‎2010 Aug 20 10:57 PM
Hi All,
I have a method that calls a program via a job and I am having issues passing data between the two.
Note that two different users process the method and program (via job) resp. This is how I am calling the second prog-
SUBMIT ZPROGRAM
VIA JOB l_jobname
NUMBER l_jobcount
USER i_user
AND RETURN.
I need to pass data from method to the second program and vice versa and then the method continues its processing with the data acquired from the second program.
I have tried using Import/Export using database and also shared buffer. What I have found is that most of the times I am able to pass data from method to program. However the job takes a couple of min to execute and I think that the data is not making back to the method in time.
I have looked at some useful forum links-
but havent been able to find an answer yet. Any solution? Thanks in advance for your help!
Liz
‎2010 Aug 23 4:04 AM
Hello,
When you IMPORT FROM / EXPORT TO DATABASE, the data gets physically stored in a DB table whose structure should be similar to INDX table. Further details can be found from SAP documentation.
Just to let you know this is not session specific & SUBMIT'ting the program VIA JOB shouldn't impact this.
However the job takes a couple of min to execute and I think that the data is not making back to the method in time.
It is difficult to analyse the problem w/o seeing your IMPORT / EXPORT construct. Post the IMPORT / EXPORT for better response.
BR,
Suhas
‎2010 Aug 22 2:33 AM
Hi All,
Can you please advise if using export/import via database is better for my scenario or should I go with using the shared buffer ? Which is better in terms of performace, memory etc. I am planning to delete the data from both the d/b & shared buffer before exiting the main method.
Thanks, Liz
‎2010 Aug 22 8:01 PM
Hello,
I don't think when you submit anothe program bia job the control back to the previous program. Again here export / import will not work. This is session specific.
SUBMIT ZPROGRAM
VIA JOB l_jobname
NUMBER l_jobcount
USER i_userAND RETURN.
One think you can try, just submit the program (with out any job) with screen fields and here you can pass data from/to another program via export and import.
Thanks
Subhanar
‎2010 Aug 23 4:04 AM
Hello,
When you IMPORT FROM / EXPORT TO DATABASE, the data gets physically stored in a DB table whose structure should be similar to INDX table. Further details can be found from SAP documentation.
Just to let you know this is not session specific & SUBMIT'ting the program VIA JOB shouldn't impact this.
However the job takes a couple of min to execute and I think that the data is not making back to the method in time.
It is difficult to analyse the problem w/o seeing your IMPORT / EXPORT construct. Post the IMPORT / EXPORT for better response.
BR,
Suhas
‎2010 Aug 23 3:00 PM
Hi Suhas, Subhankar
I have tested the scenario without the job previously itself and it works. Thats the reason, i am trying with the job now as my requirement is that I need to change the user while executing the second report.
Here is an example of my import/export - I am passing the return value from the second report to the first.
Code in second report-
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'RET1'.
INDX-AEDAT = SY-DATUM.
INDX-USERA = SY-UNAME.
EXPORT RETURN1 TO SHARED BUFFER INDX(ST) ID INDXKEY.
Code in first report -
SUBMIT ZPROGRAM
VIA JOB l_jobname
NUMBER l_jobcount
USER i_user
AND RETURN.
Once Job close FM is executed successfully, I import the values as follows
IMPORT RETURN1 TO RETURN1 FROM SHARED BUFFER INDX(ST) ID INDXKEY3.
INDXKEY is having value RET1.
However Return1 is not having any values in first report. It has some value in executed without the job
Please note that I have tried Export/import with Database too and I am getting the same results.
Thanks for your suggestions.
Regards, Liz
‎2010 Aug 23 3:09 PM
Hi ,
You need to create INDXKEY3 with the user name you had given inside the job. Also you need to wait until the job is finished.
You can the job status using the FM /SDF/SM_GET_JOB_STATUS or from table tbtco .
Thanks
Subhanakr
‎2010 Aug 23 3:18 PM
Hi,
Sorry, there was a typo if my prev code. The import statement goes as this -
IMPORT RETURN1 TO RETURN1 FROM SHARED BUFFER INDX(ST) ID INDXKEY.
I think I have tried giving the same username too. But let me try that option again.
Also let me follow your advise.. and check if the job is finished. Only if the job is finished, it should go the next steps..
another thought - how can I make the current process to wait until the jobs over? I
Thanks for your help.
Cheers, Liz
‎2010 Aug 23 3:43 PM
>
> Also let me follow your advise.. and check if the job is finished. Only if the job is finished, it should go the next steps..
> another thought - how can I make the current process to wait until the jobs over? I
Similar requirement discussed in the forum:
The FMs to check the status of the BG job are: BP_JOB_STATUS_GET & SHOW_JOBSTATE.
BR,
Suhas
‎2010 Aug 23 8:02 PM
Brilliant !! Issue is resolved.
Only change is I tweaked your code to use While loop (I get a little tensed with Do-Endo
For my scenario where program 1 is run by user 1 and program 2 by another user, would you advise import/export with database or with shared buffer ? Or it doesnt matter ? Let me know what you think about it..
Thanks for your help !! I'm ready to close this topic
Cheers, Liz
‎2010 Aug 23 8:28 PM
SHARED BUFFER is not user-specific but app server specific.
Read the SAP documentation for details [http://help.sap.com/abapdocu_70/en/ABAPEXPORT_DATA_CLUSTER_MEDIUM.htm#&ABAP_ALTERNATIVE_6@6@].
I personally prefer using DB clusters (IMPORT FROM / EXPORT TO DATABASE) over other techniques when multi-session, multi-user options are there.
Cheers,
Suhas