Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically end batch session?

Former Member
0 Kudos

While the BDC is running, I'd like to from within the transaction that is being called (determine if the transaction was called from a BDC and then) conditionally break out of the BDC. Is this possible? I know in foreground you can type /BEND, but no variation of this works from within the ABAP coding. I also tried the many different formats of the LEAVE command, but none of them work for exiting the BDC either. If you have a possible workaround, also this will be pretty useful. Thank you.

5 REPLIES 5

kesavadas_thekkillath
Active Contributor
0 Kudos

This will work



perform bdc_dynpro      using 'SAPMF02K' '0107'.
perform bdc_field       using 'BDC_OKCODE' '/00'.
perform bdc_field       using 'RF02K-LIFNR' '519076'.
perform bdc_field       using 'RF02K-EKORG' 'TL01'.
perform bdc_dynpro      using 'SAPMF02K' '0310'.
perform bdc_field       using 'BDC_OKCODE' '/NBEND'. "<---
perform bdc_transaction using 'MK01'.

ThomasZloch
Active Contributor
0 Kudos

Did you try issuing messages of type A or X, are they just skipping to the next transaction as well? Type X is supposed to throw a short dump, so this might be too harsh for your purposes.

Thomas

Former Member
0 Kudos

Look for a userexit where you can program your check and throw the E or A message when needed.

Former Member
0 Kudos

Hello Adrian,

You may want to consider using memory variables (export to memory) or parameters (set / get parameter). From the BDC driver program set / export a memory variable/parameter and read it from your transaction which is being run by BDC. You can do so in your transaction through a user exit/enhancement spot (assuming it is a Std SAP program) or directly. Make sure that this parameter/memory variable is set only through your BDC driver program. On identifying the BDC call, as others mentioned, you can raise a message (say type E) to break out of the BDC call. You can capture this message in the message table of the BDC call.

Hope this helps.

Regards,

Jinesh

Edited by: Jinesh Parakulangara on Oct 22, 2010 6:51 PM

0 Kudos

We changed the approach from trying to manipulated the BDC to running validations from Function Group BTCH e.g. BP_JOBLOG_READ, BP_JOBLOG, BP_JOB_ABORT, BP_JOB_DELETE etc.