Purushoth_Natarajan
New Member
I'm trying to create PO receipts using the standard API `porcapi.p`, which is being called from a DB trigger on the `ih_hist` table. The code is successfully creating the receipts as expected.
However, it's causing a pause in the Invoice Post and Print menu i.e. When a PO has 5 lines, I need to manually click 'Next' 5 times to proceed with the invoice posting. Ideally, this should run in API mode without requiring manual interaction.
I’ve tried changing the `c-application-mode`, but the issue still persists.
Can someone help me figure out how to run this in proper API mode or suppress the interactive behaviour?
I've attached the code snippet below for reference.
/* ihrw.t - REPLICATION-WRITE TRIGGER FOR ih_hist TABLE */
TRIGGER PROCEDURE FOR REPLICATION-WRITE OF ih_hist
OLD BUFFER OLD_ih_hist.
{qxotrig.i
&TABLE-NAME = 'ih_hist'
&ROW-ID = string(rowid(ih_hist))
&OID = string(ih_hist.oid_ih_hist)
&TRIGGER-TYPE = 'WRITE'}
{us/px/pxpgmmgr.i}
{us/px/pxphdef.i xxihsopo}
if NEW ih_hist then do:
{us/px/pxrun.i &PROC = 'createIhDataset'
&HANDLE=ph_xxihsopo
&PROGRAM = 'xxihsopo.p'
&PARAM = "(buffer OLD_ih_hist,
buffer ih_hist)"
&NOAPPERROR = true
&CATCHERROR = true}
end. /* IF new ih */
API call:
{us/px/pxrun.i &PROC = 'receivePurchaseOrder'
&HANDLE=ph_porcapi
&PROGRAM = 'porcapi.p'
&PARAM = "(input dataset dsPOTrans,
output dataset dsPOTransResp)"
&NOAPPERROR = true
&CATCHERROR = true}
However, it's causing a pause in the Invoice Post and Print menu i.e. When a PO has 5 lines, I need to manually click 'Next' 5 times to proceed with the invoice posting. Ideally, this should run in API mode without requiring manual interaction.
I’ve tried changing the `c-application-mode`, but the issue still persists.
Can someone help me figure out how to run this in proper API mode or suppress the interactive behaviour?
I've attached the code snippet below for reference.
/* ihrw.t - REPLICATION-WRITE TRIGGER FOR ih_hist TABLE */
TRIGGER PROCEDURE FOR REPLICATION-WRITE OF ih_hist
OLD BUFFER OLD_ih_hist.
{qxotrig.i
&TABLE-NAME = 'ih_hist'
&ROW-ID = string(rowid(ih_hist))
&OID = string(ih_hist.oid_ih_hist)
&TRIGGER-TYPE = 'WRITE'}
{us/px/pxpgmmgr.i}
{us/px/pxphdef.i xxihsopo}
if NEW ih_hist then do:
{us/px/pxrun.i &PROC = 'createIhDataset'
&HANDLE=ph_xxihsopo
&PROGRAM = 'xxihsopo.p'
&PARAM = "(buffer OLD_ih_hist,
buffer ih_hist)"
&NOAPPERROR = true
&CATCHERROR = true}
end. /* IF new ih */
API call:
{us/px/pxrun.i &PROC = 'receivePurchaseOrder'
&HANDLE=ph_porcapi
&PROGRAM = 'porcapi.p'
&PARAM = "(input dataset dsPOTrans,
output dataset dsPOTransResp)"
&NOAPPERROR = true
&CATCHERROR = true}