2008 Jan 19 8:08 PM
Dear friends please help me in this.
We are having a z report. This report works fine in foreground and wont work( means it will be in active state for more than 5 days but no result will come)when we schedule it in background as a job.
In this report we are using bdc code also for uploading data. the sample code is
FORM bdc_transaction USING tcode.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = webdcdata.
WRITE: / 'BDC_INSERT'(i03),
tcode,
(12) 'returncode:'(i05),
sy-subrc.
ENDFORM. "BDC_TRANSACTION
-
and i am populating the data in bdc
PERFORM bdc_dynpro USING 'SAPLMR1M' '6000'.
PERFORM bdc_field USING 'BDC_OKCODE' 'ENTR'.
PERFORM bdc_field USING 'BDC_CURSOR' 'INVFO-BLDAT'.
---
-
-
PERFORM bdc_dynpro USING 'SAPLMR1M' '6000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
PERFORM bdc_field USING 'BDC_CURSOR' 'DRSEG-RBLGP(01)'.
CALL TRANSACTION 'MIRO' USING webdcdata MODE p_mode UPDATE 'S'
MESSAGES INTO itab_msg.
etc.
First i am populating data into an internal table and then displaying it in the output screen. Here i hava placed a menu items like select all , deselect all , upload etc . So that user can select as many records as he want and then can select the upload button
so that the report will call bdc to upload the data.
-
when i am directly executing the report it displays the data and then
i will select the records that are displayed and
then i press the button upload then the data will be uploaded into
the screens. here i am not getting any problem everything is fine.
when i am scheduling this job in Background it will be keep on
running but no result will be displayed. Atleast output screen
is also not displayed. Later on i came to know that we
cannot schedule the reports which are using bdcs in background.
So please tell me how far it is true. Please give me a clear explaniation for this .
Thank you so much for all the replies.
2008 Jan 20 1:05 AM
Hi Shiva,
When we try to run a report or program that involves a screen interaction (dialog) in the background, it is handled by the background work process which errors out on dialog requests. One such example is when we try to use ALV in background using GRID DISPLAY. The error says that the GUI is not supported. It works fine if we use ALV LIST DISPLAY that creates a list that can be sent to spool. Gric display is online display and cannot be sent to spool as thats the only ouput mode in the background (apart from a file output).
I am sure that your output screen is being sent to spool. Did you check the spool list for your program? You cannot interact in the spool list.
When you schedule this job in the background how will a user interact on the output screen when there is no output screen for data selection that you want to use for BDC? Your program waits for the data from the output screen with a press of button (UPLOAD) and in the background, that button is never pressed.
What you can do to run it in the background is to do a pre-selection of data (instead of user doing it) and use the same in the BDC table. This will eliminate the need for usr interaction. Create two blocks of code in your report in an IF...ELSE...ENDIF to handle foreground and background request. In the IF statement check the system variable sy-batch, it will be set for the programs running in background.
See below:
IF sy-batch EQ 'X'. "for background run
...
ELSE. "for foreground run
...
ENDIF.
Hope this helps.
Thanks
Sanjeev
2008 Jan 20 1:05 AM
Hi Shiva,
When we try to run a report or program that involves a screen interaction (dialog) in the background, it is handled by the background work process which errors out on dialog requests. One such example is when we try to use ALV in background using GRID DISPLAY. The error says that the GUI is not supported. It works fine if we use ALV LIST DISPLAY that creates a list that can be sent to spool. Gric display is online display and cannot be sent to spool as thats the only ouput mode in the background (apart from a file output).
I am sure that your output screen is being sent to spool. Did you check the spool list for your program? You cannot interact in the spool list.
When you schedule this job in the background how will a user interact on the output screen when there is no output screen for data selection that you want to use for BDC? Your program waits for the data from the output screen with a press of button (UPLOAD) and in the background, that button is never pressed.
What you can do to run it in the background is to do a pre-selection of data (instead of user doing it) and use the same in the BDC table. This will eliminate the need for usr interaction. Create two blocks of code in your report in an IF...ELSE...ENDIF to handle foreground and background request. In the IF statement check the system variable sy-batch, it will be set for the programs running in background.
See below:
IF sy-batch EQ 'X'. "for background run
...
ELSE. "for foreground run
...
ENDIF.
Hope this helps.
Thanks
Sanjeev