‎2011 Mar 31 11:12 AM
Hello everyone,
I am writing a BDC batch program to upload details via the PO13 (Maintain Position) screen. Everything appears to work
ok. A BDC session is created and I can see this in SM35.
If I run the session in the foreground everyting works ok and the new records are entered.
However, If I run the session in the background then errors appear and no records are committed.
I get the error 'Runtime error RAISE_EXCEPTION has occurred'.
Would anyone know looking at my code below what I need to do in order to get things working.
I would really appreciate any help on this.
Thanks
Andy
LOOP AT excel_tab INTO excel_wa WHERE error IS INITIAL.
PERFORM bdc_dynpro USING 'SAPMH5A0' '5100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PM0D1-SEARK'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'PPHDR-PLVAR' '01'.
PERFORM bdc_field USING 'PM0D1-SEARK' excel_wa-position.
PERFORM bdc_field USING 'PM0D1-TIMR6' 'X'.
PERFORM bdc_field USING 'PPHDR-BEGDA' '01.03.2011'.
PERFORM bdc_field USING 'PPHDR-ENDDA' '31.12.9999'.
PERFORM bdc_dynpro USING 'SAPMH5A0' '5100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=INSE'.
PERFORM bdc_field USING 'PPHDR-PLVAR' '01'.
PERFORM bdc_field USING 'BDC_CURSOR' 'TT_T777T-ITEXT(08)'.
PERFORM bdc_field USING 'PM0D1-SEARK' excel_wa-position.
PERFORM bdc_field USING 'BDC_CURSOR' 'PPHDR-BEGDA'.
PERFORM bdc_field USING 'PM0D1-TIMR6' 'X'.
PERFORM bdc_field USING 'PPHDR-BEGDA' '01.03.2011'.
PERFORM bdc_field USING 'PPHDR-ENDDA' '31.12.9999'.
PERFORM bdc_field USING 'MARKFELD(08)' 'X'.
PERFORM bdc_dynpro USING 'MP101000' '2000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=UPD'.
PERFORM bdc_field USING 'P1010-SUBTY' '0011'.
PERFORM bdc_field USING 'PX010-HILFM(01)' excel_wa-hilfm.
PERFORM bdc_dynpro USING 'SAPMH5A0' '5100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM bdc_field USING 'PPHDR-PLVAR' '01'.
PERFORM bdc_field USING 'PM0D1-SEARK' excel_wa-position.
PERFORM session_insert USING 'PO13'.
ENDLOOP.
‎2011 Mar 31 11:15 AM
Hi Andy,
Could you post details from the runtime error?
Regards,
Chen
‎2011 Mar 31 11:25 AM
Hi Chen, thanks for replying. I get the error:
A RAISE statement in the program "CL_GUI_SPLITTER_CONTAINER=====CP" raised the
exception
condition "CNTL_SYSTEM_ERROR".
Since the exception was not intercepted by a superior
program, processing was terminated.
Short description of exception condition:
For detailed documentation of the exception condition, use
Transaction SE37 (Function Library). You can take the called
function module from the display of active calls.
‎2011 Mar 31 11:42 AM
Hi,
please have a look at
Note 721791 - Dump when running a batch input session in OM
It says, that batch-input may not work for PO13 an some cases!
And it contains some hints!
Regards,
Klaus
Edited by: Klaus Babl on Mar 31, 2011 1:34 PM
‎2011 Mar 31 11:24 AM
Hi Andy!
Do you clear your BDCTAB in FORM SESSION_INSERT?
Last screen looks strange! You pass some values (PLVAR, SEARK) but leave with code 'BACK'. Are you sure that is right? Maybe you should record it anew to compare your program with recorder data!
Regards,
Klaus
‎2011 Mar 31 11:31 AM
Hi Klaus,
Thanks for replying. I have just entered the following two lines of code to
clear the BDC data but I am still getting the error when I run the job in background.
PERFORM clear_bdc_data.
PERFORM end_transaction.
Thanks
Andy
‎2011 Mar 31 11:47 AM
Hi Andy,
The error implies that in the flow of the Tcode: PO13, it goes into a screen which has a GUI SPLIT Container. Since there is no access to GUI components in background mode the session throws an exception, while it works fine in foreground mode, as it has access to the GUI Components.
Soln: Generate a new recording in SHDB, and while creating the recording choose "Simulate Background Mode" and try, if this doesn't work then possible workarounds are as given below.
Workaround: Check if there is a way to alter the screen flow, so that it can avoid this screen where it needs GUI interaction. Alternatively a better solution would be to look for a BAPI/FM which could replicate the "PO13" functionality.
If neither of the above are possible, then the only option left would be to run this in foreground always.
Regards,
Chen
‎2011 Mar 31 12:45 PM
Many thanks for replying chen and Klaus. It is much appreciated.
I'll look at the note you suggested.
Again many thanks
Andy