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

Sharing data between two background jobs

itabhishek9
Participant
0 Likes
1,519

Hi SDNites,

I am using export and import to transfer tables between programs. Now I wanted to schedule 2 instances of the same pgm in background.

Can you please tell me in this case will there be overlapping of the same ABAP memory used or not. My call on this is that yes this will happen. If this is the case then what would be the resolution for the same i.e. how can I share data between two programs and also can schedule the 2 instances without any problem.

Regards,

Abhi

Edited by: Thomas Zloch on Nov 2, 2010 5:22 PM - somewhat misleading subject corrected

Hi SDNites,

I am using export and import to transfer tables between programs. Now I wanted to schedule 2 instances of the same pgm in background.

Can you please tell me in this case will there be overlapping of the same ABAP memory used or not. My call on this is that yes this will happen. If this is the case then what would be the resolution for the same i.e. how can I share data between two programs and also can schedule the 2 instances without any problem.

Regards,

Abhi

Edited by: Thomas Zloch on Nov 2, 2010 5:22 PM - somewhat misleading subject corrected

5 REPLIES 5
Read only

Former Member
0 Likes
1,054

Hi Abhishek,

Yes you are correct there will be overlap of the Memory may be it is ok in Development but not in all the system. In this kind of scenario please save the data in 2 different Memory ID'S (Locations).

Please create the memory id dynamically like 2 different instances then 2 diiferent memory ID's like (JOBNAME)

Make the Jobname to PROGRAM_1 (1ST instance) PROGRAM_2 (2ND instance).

Your statement should be

EXPORT ITAB TO MEMORY ID JOBNAME.

EXPORT ITAB TO MEMORY ID JOBNAME.

And the Program using the SY-BATCH value and FM "GET_JOB_RUNTIME_INFO" get the jobname and use the IMPORT Statement using the MEMORY ID as your jobname and make sure that you will free this MEMORY ID.


  IF NOT sy-batch IS INITIAL.

*--Function Module to get the Runtime Job details
    CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
      IMPORTING
        jobcount        = v_jobcount
        jobname         = v_jobname
      EXCEPTIONS
        no_runtime_info = 1
        OTHERS          = 2.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
IMPORT ITAB FROM MEMORY ID V_JOBNAME.
FREE MEMORY ID V_JOBNAME.
ENDIF.

Let me know if you need anything else on this.

Regards,

Srinivas

Read only

roberto_vacca2
Active Contributor
0 Likes
1,054

Hi..

You can use instead a CALL FUNCTION 'ZFUNC_CUSTOM' WITH DESTINATION 'NONE' .. Pay attention to "Update Module" option in the attributes. This should be "Start Delayed" if you are calling in the background process.

Hope to be useful...

Read only

Former Member
0 Likes
1,054

Hi

Abap memory works on session level, so if you schedule your program twice, those jobs will run in two different session, that means they can't see the same ABAP memory

Max

Read only

Former Member
0 Likes
1,054

Hi Abishek,

There will be no overlapping as export and import memories scope is limited to the session lever only.

Hope this answer your query.

Regards

Bikas

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,054

Use Shared Memory.

link:[EXPORT TO MEMORY/DATABASE/SHARED BUFFER|http://help.sap.com/saphelp_45b/helpdata/en/34/8e73a36df74873e10000009b38f9b8/frameset.htm]