How to use EXPORT / IMPORT to Memory

12,786

Apparently you are trying to transfer data from a user session to a background/update session. This won't work using the ABAP memory. Check the documentation on the ABAP Memory Organization: An RFC call or an update module is run in a different user session which has a different ABAP Memory.

Share:
12,786
Beto
Author by

Beto

I'm a software dev in SAP-ABAP, but constantly develop in Android or web too.

Updated on June 04, 2022

Comments

  • Beto
    Beto almost 2 years

    I'm trying to export a value for an enhancement inside a BAPI call, that is executed in a background update task. But the value is not being read inside the enhancement, however if I do a local test the value is read correctly from memory.

    Any ideas as to why this doesn't work?

    This is my code:

    Export program:

    DATA: lv_id TYPE char30.
    
    CONCATENATE 'ZTCODE' sy-uname
      INTO lv_id.
    
    EXPORT ztcode FROM iv_tcode TO MEMORY ID lv_id.
    

    Import program(inside enhancement):

    DATA: lv_tcode  TYPE sy-tcode,
          lv_id     TYPE char30.
    
    CONCATENATE 'ZTCODE' sy-uname
      INTO lv_id.
    
    IMPORT ztcode TO lv_tcode FROM MEMORY ID lv_id.