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

Executing a report program in background from another program

Former Member
0 Likes
1,772

Hi Experts,

I developed a report to display material change history based on change date range. Report is taking much time (around 15-20 mins) as I'm hitting CDPOS and CDHDR tables. User wants to execute the report in foreground because he/she can give selection criteria that is required everytime.

So, my requirment is now to create another program with same selection screen elements which will execute the original program in background. In the new program, we will be just capturing the selection elements and will pass them to original program to run in background and display a message to user without wait for the background job to complete. Original program should send an email to an fixed email id with the report output as attachment (for example excel file).

Please suggest.

Thanks in Advance,

Siva Sankar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,328

Hi Siva,

You can try calling standard FMs CHANGEDOCUMENT_READ_HEADERS and CHANGEDOCUMENT_READ_POSITIONS to get the history for material change instead of hitting tables CDHDR and CDPOS.

- Saba

8 REPLIES 8
Read only

Former Member
0 Likes
1,329

Hi Siva,

You can try calling standard FMs CHANGEDOCUMENT_READ_HEADERS and CHANGEDOCUMENT_READ_POSITIONS to get the history for material change instead of hitting tables CDHDR and CDPOS.

- Saba

Read only

0 Likes
1,328

Hi Saba,

User will be executing the report based on material group and plant, which will lead to huge number of materials to hit CDHDR and CDPOS. Can we use those func modules for such a big number?

Thanks for your quick response.

Siva Sankar

Read only

former_member195421
Participant
0 Likes
1,328

Hi ,

Could you please check if we can implement blockwise reading of data from change tables using function modules , it will make the program more faster .

Regards,

Ratheesh BS

Read only

0 Likes
1,328

Hi Ratheesh,

I'm already using parallel processing to hit CDHDR and CDPOS tables. But report is taking lot of time because of huge number of materials.

Regards,

Siva Sankar

Read only

0 Likes
1,328

Hi Siva,

Please see the link

http://help.sap.com/saphelp_nw04/helpdata/EN/2a/fa01dd493111d182b70000e829fbfe/content.htm

When using function modules , I dont think you can directly get data based on material and plant . these function modules usualy works with object class and creation date .

Once you retrieve the data using the function modules you have to filter out the unncecessary data based on your selection screen conditions .

Regards,

Ratheesh BS

Edited by: Ratheesh Bhaskarapillai Suseeladev on Mar 8, 2012 5:19 AM

Read only

0 Likes
1,328

Hi Ratheesh,

I tried CHANGEDOCUMENT_* func modules. But execution time is almost same as hitting the tables in parallel processing. I feel executing the report in background (as mentioned in my original message above) is better option. Please suggest.

Thanks,

Siva Sankar

Read only

0 Likes
1,328

Hi Siva,

In that case go ahead with your plan , but still user wont get the immedaite results . Mean time we will check if any other options are available .

Regards,

Ratheesh BS

Read only

Former Member
0 Likes
1,328

Hi Siva,

You can use the FM : OPEN_JOB and get the job number from this FM and use the submit statement with JOB number and pass the selection screen parameter values. Use the FM: CLOSE_JOB with start immediatly. So your orginal program will run in background.

You can handle the logic to sent a mail to user in the orginal program, like check the program is running in background mode sy-batch = 'X' then send the output to users.

Regards

Rajesh V