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 get data from the called program using SUBMIT in a background job?

Former Member
0 Kudos

Hi Experts,

I've a program which creates a background job using JOB_OPEN and JOB_CLOSE function modules.

Between the above function modules I need to call a program using SUBMIT VIA JOB statement.

My problem is, How do I fetch some data in an internal table in the called program to the calling program after the SUBMIT statement?

I tried to EXPORT and IMPORT the data, but they are giving a failed sy-subrc when using this background job.

Kindly let me know your inputs and valuable suggestions.

12 REPLIES 12

Former Member
0 Kudos

when you use EXPORT and IMPORT statement use the same name and type of variable.

0 Kudos

Hi Swati,

I'm using the same variables and of same type.

But still I'm getting this error.

When I remove the job creation, it is working properly.

I'm able to export and import data.

But when i place this submit statement as a job step i'm unable to get the data from the memory.

0 Kudos

Kumar,

If I am not wrong when a program X is submitted in a program Y,then Program X will be executed in BACKGROUND provided it is supplied with all the parameters needed and hence there is no need of job step.

Correct me if I am wrong.

K.Kiran.

0 Kudos

Hi Kiran,

Yes, you are right. But the problem here is the user needs a back ground job to be scheduled to submit the program since the called program processes enormous records and thus may affect performance.

So we were suggested to use a SUBMIT.... VIA JOB between the job_open and job_close function modules.

And now the problem is we need to display the log or list of this called program from the calling program.

0 Kudos

Kumar,

If the problem is w.r.t to getting the data using EXPORT/IMPORT then see the below example

Program X is submitted in Program Y

itab is the final internal table in program X, which is having all the needed data.

Export itab to memory id 'kk_itab' ........in program X.

Now declare an internal table in program Y whose structure is similar to the final internal table in program X. here it is itab.

Import itab from memory id 'kk_itab .........in program Y.

K.Kiran.

0 Kudos

Hi Kiran,

I agree with you,but problem here is if i submit program via job it is not working.With out job it is working fine.

0 Kudos

Kumar,

When we execute a program as a background job then the output will be sent to Spool which needs to be fetched again.I guess we need to use Submit via spool as mentioned by Rajat.

Check these threads to get some idea

K.Kiran.

Former Member
0 Kudos

when you use EXPORT and IMPORT statement use the same name and type of variable.

Former Member
0 Kudos

Hi,

If the purpose of the list is to serve as an log only, then you can use the to SAP-SPOOL option for submit...via job statement. The log / list generated in the called program will get stored in the spool.

Hope this helps you.

Kind Regards,

Raj

Former Member
0 Kudos

Hi,

try 'EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key'

Regards,

Andrej.

Former Member
0 Kudos

Hi,

Use the SUBMIT statement as shown below...

SUBMIT <Prg_Name>

TO SAP-SPOOL

USING SELECTION-SCREEN '1000'

WITH SELECTION-TABLE it_rsparams

DESTINATION 'LOCL'

KEEP IN SPOOL ' '

IMMEDIATELY ' '

WITHOUT SPOOL DYNPRO

AND RETURN.

IMPORT t_table TO t_std_data FROM MEMORY ID <id>.

This will work in back ground also.

Rgds,

Bujji

0 Kudos

Can you tell how you solve this problem? I have the same problem.