SAP-BI: Starting Process-Chain via Programm RSPC_API_CHAIN_START and wait for result

Sometimes you want to start a Processchain via programm and wait for it to end. This is a bit tricky as a Processchain starts normaly in Background and doesn’t give you a result if it is ended correctly.
SAP provides for !!!small!!! Processchain the Function

RSPC_API_CHAIN_START

This can be called synchonous with the following example:

call function 'RSPC_API_CHAIN_START'
exporting
i_chain = 'ZMYPROCCESSCHAIN
* I_T_VARIABLES =
i_synchronous = '
X'
* I_SIMULATE =
* I_NOPLAN =
* I_DONT_WAIT =
* IMPORTING
* E_LOGID =
exceptions
failed = 1
others = 2
.

What you have to know is – the result of this function is given on the !!!first!!! finished step – and !!!not!!! for the whole chain. To wait you have to use a little trick:

While using a one-step-chain with a Sub-Processchain this little problem is solved.

Be honest – if we had encountered in the pub – I would get at least a beer sponsored for this, right?


Ein Kommentar zu “SAP-BI: Starting Process-Chain via Programm RSPC_API_CHAIN_START and wait for result”

  1. Klaus sagt:

    Another option is to use wait and RSPC_API_CHAIN_GET_STATUS in a while loop. This works witht every chain.

Hinterlasse eine Antwort