Application Development and Automation 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: 
Read only

Differences between background an online when executing a program that generates an excel file

Former Member
0 Likes
1,548

Hello experts,

I have create a Z program that calls transaction CK86_99 and generates an excel file with the info of the report. I have created it via SHDB.

These are the sentences:

PERFORM bdc_dynpro      USING 'SAPMKKB0' '0300'.
PERFORM bdc_field       USING 'BDC_CURSOR'
'KKB0-MATNR'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'=OSNY'.
PERFORM bdc_field       USING 'KKB0-MATNR'
imat
-matnr.
PERFORM bdc_field       USING 'KKB0-WERKS'
'E000'.
PERFORM bdc_field       USING 'KKB0-KLVAR'
'PPC1'.
PERFORM bdc_field       USING 'KKB0-TVERS'
'1'.
PERFORM bdc_field       USING 'KKB0-KADKY'
gd_date
.
PERFORM bdc_field       USING 'TCKH9-SICHT'
'1'.
PERFORM bdc_dynpro      USING 'SAPLKKRSOO' '0100'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'=MATE'.
PERFORM bdc_dynpro      USING 'SAPLKKRSOO' '0100'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'=PRE_BACK_A'.
PERFORM bdc_dynpro      USING 'SAPMSSY0' '0120'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'=%PC'.
PERFORM bdc_dynpro      USING 'SAPLSPO5' '0110'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'=OK'.
PERFORM bdc_field       USING 'BDC_CURSOR'
'SPOPLI-SELFLAG(02)'.
PERFORM bdc_field       USING 'SPOPLI-SELFLAG(01)'
''.
PERFORM bdc_field       USING 'SPOPLI-SELFLAG(02)'
'X'.
PERFORM bdc_dynpro      USING 'SAPLSFES' '0200'.
PERFORM bdc_field       USING 'BDC_CURSOR'
'DY_FILENAME'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'=REPL'.
PERFORM bdc_field       USING 'DY_PATH'
path
.
PERFORM bdc_field       USING 'DY_FILENAME'
file_ck13n
.
PERFORM bdc_dynpro      USING 'SAPMSSY0' '0120'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_dynpro      USING 'SAPLKKRSOO' '0100'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'=CANC'.
PERFORM bdc_dynpro      USING 'SAPMKKB0' '0300'.
PERFORM bdc_field       USING 'BDC_OKCODE'
'/EBACK'.
PERFORM bdc_field       USING 'BDC_CURSOR'
'KKB0-MATNR'.
PERFORM bdc_transaction USING 'CK86_99'.

If I execute the program on-line, the file is generate without problems, but if I execute it as a background job, the excel file is not generated.

What do I need to have the excel in a background job??

Thanks in advance.

Laura.

4 REPLIES 4
Read only

PeterJonker
Active Contributor
0 Likes
1,169

If you do this online the excel is either downloaded to your pc or shown in the screen ( I don't know the transaction).

In the background the program is running on the server and is not connected to your or any PC.

What should the program do ? Download to a random PC (or take over a PC and show on the screen ) ?

That is basically the problem you are facing.

can you run transaction 'CK86_99' in the background ? I don't think so. There is no option in the menu.

Therefore I think you cannot use a bdc for this program. Because it is also not possible to run transaction 'CK86_99' in the  background

Read only

0 Likes
1,169

Hello Peter,

Thanks for your answer.

The excel file is downloaded to my PC when I execute it on-line.

It is not possible to do the same in the server? Files does not need to be in my PC, they could be in any other placem I just want to generate them.

Regards.

Laura.

Read only

0 Likes
1,169

Hi Laura ,

Yes technically it is possible, but not by using this transaction. You will need to program it yourself.

Most transactions can be executed both online and in the background. Unfortunately this report is an exception.

I don't no this report/transaction so I don't know what it does and what your requirement is. I tried to execute this transaction in our system, but it has not been configured so I failed to do so.

It is a module pool program so copying it and modifying it to your needs is not really a good option.

You could do some debugging when you start the transaction online to see which parts of the code are used. When you are lucky it will soon call a function module which you might be able to re-use in your program.

I am sorry I can't be of any more help.

Read only

former_member209120
Active Contributor
0 Likes
1,169

Hi Laura Calvel ,

Differences between background an online

The basic difference between foreground and background is, foreground means, the process execution is shared between your SAP GUI session on your local PC and the application server. Whereas background process uses the resources of application server, i.e., runs on application server.

In foreground jobs are only allowed a certain amount of runtime. Long running jobs usually times out in foreground, and have to be run background. Some customers has day-end jobs to fill custom tables, and these only run late at night, so they are scheduled as background jobs as well.

For failing background job

See this thread http://scn.sap.com/thread/3239489