09-22-2008 10:21 AM
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.
09-22-2008 10:25 AM
when you use EXPORT and IMPORT statement use the same name and type of variable.
09-22-2008 10:30 AM
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.
09-22-2008 10:41 AM
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.
09-22-2008 11:03 AM
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.
09-22-2008 11:13 AM
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.
09-22-2008 11:20 AM
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.
09-22-2008 11:27 AM
09-22-2008 10:25 AM
when you use EXPORT and IMPORT statement use the same name and type of variable.
09-22-2008 11:17 AM
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
09-22-2008 11:41 AM
Hi,
try 'EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key'
Regards,
Andrej.
09-22-2008 11:43 AM
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
02-19-2009 1:16 PM
Can you tell how you solve this problem? I have the same problem.