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: 

How to Return control from Background processing?

Former Member
0 Kudos
187

Hello Experts,

I have got one requirement to automatically save the Spool request generated in sp01 as a local file.

Actually i have generated one report, a few days back. In that report, if the user clicks on the button ( Execute in Background) in the Menu bar, my program needs to be navigated to the transaction SP01 and the recently generated spool request should be saved as a local file automatically....I need to use BDC on the transaction SP01.

But i don't know where to write the necessary code. Because i have debugged the program by clicking 'Execute in Background'. After 'AT SELECTION SCREEN' event, the control is transferred to Background processing and finally it is giving a message that 'Background job was scheduled for the program' and returning to the selection screen.

After the job was scheduled, i need to write the BDC code for saving the spool request as a local file. Please suggest me the the place where i have to write the code.

Any helpful answer will surely be rewarded.

Thanks in advance.

Pavan.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
99

Hi,

If you RUN the program in Background mode you can not

generate the file to presantation sever. It possiable to generate

the file to application sever.

Use this FM DX_FILE_WRITE to create file to application server.

Thanks,

Durai.V

4 REPLIES 4

Former Member
0 Kudos
100

Hi,

If you RUN the program in Background mode you can not

generate the file to presantation sever. It possiable to generate

the file to application sever.

Use this FM DX_FILE_WRITE to create file to application server.

Thanks,

Durai.V

0 Kudos
99

Hi Durai,

Thanks for ur prompt response.

U r saying that in B/G processsing, we cannot write to the presentation server....ok...But they want me to do the same...

I need to go to SP01 and get the recent spool request number and then i need to use the option 'Save as a Local file'. So i need to use BDC on SP01.

I know how to get the spool request number, how to do BDC and all....But i m not getting where to write the code....

After i clicked on 'Execute in B/G' it is directly giving a msg that 'B/G job was scheduled'. After that, i need to the do the BDC. But the control is not coming back to my program, even in debugging mode.

I don't even know when the Performs for retrieving data are getting executed. I tried by placing Break points in STRT-OF-SELECTION. But the control is not coming there....

I want the exact location to write the code.....I hope u got my requirement.

Please help me.

Pavan.

0 Kudos
99

Hi,

DATA : lt_rdiresult LIKE rdiresult.

CALL FUNCTION 'CLOSE_FORM'

IMPORTING

RESULT = st_result1.

After Closing form U get Spool number from

st_result1-tdspoolid

U write the code after colsing form. But it will work in Forground only.

IF u want to Exctue in Background only u can gownload file to application sever only.

If u schedule to background the program goes to out of the GUI contol ( Only excute in application server) so u cant debug & file create in presensation server.

If download file from application server Use t-code CG3Y.

Thanks,

Durai.V

0 Kudos
99

Execute your program with SUBMIT xxxxx exporting List to memory.

You can then import the list in another program (or from the calling program) --the list is stored in a table of type abaplist.

You can then manipulate this table -- note it's in RAW format so you'll need the function modules to convert it to a list.

This approach works both in Foreground and as a background process as well.

Can't remember the function modules off hand but there's enough of them to handle this.

Just press the HELP / F1 key in the abap editor on the SUBMIT command and look for the exporting list to memory option.

Cheers

jimbo

Edited by: james hawthorne on Jul 18, 2008 5:49 PM