Skip to Content
avatar image
Former Member

Set a variable in SAP/ABAP memory

Hi,

We run a transaction in asynchronous mode or synchronous mode. When we set a variable in the SAP memory when running in synchronous mode, it is getting stored and we are able to get it back.

But when we run the transaction in default asynchronous mode, it is not setting the variable in the SAP memory and not getting it back.

Note: By default it runs in asynchronous mode, we set it to synchronous mode only through debugging.

Can someone please tell me how we can store the variable in the SAP memory when it runs in asynchronous mode ?

Thanks

Priya.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Sep 04, 2008 at 07:10 PM

    Use

    import and export statement.

    Import var1 to shared memory Id id1.

    or

    Import var1 to database

    Similarly export statment.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 08:14 PM

    Hi Priya,

    Import and Export parameters cannot be used directly to implement in asynchronous transactions.

    You program an asynchronous method in the implementation program between the macro instructions BEGIN_METHOD <Method> and END_METHOD .

    The system generates an implementation from the specifications you made when defining the method. The unique ID of the object is available in the structure of the key fields under the variable OBJECT-KEY .

    An asynchronous method can be implemented with a transaction. The transaction is called in the program with the ABAP command CALL TRANSACTION . The input fields in the first screen of the transaction are assigned values from the key fields of the object and possibly from the import parameters of the method via processing parameters ("SET/GET parameters"). This first screen is then skipped when the transaction is called (... AND SKIP FIRST SCREEN ).

    Example

    Implementing the method EditAsynchron ( Change quality notification asynchronously ).

    The method operates on an object of the type BUS2078 ( quality notification). This object type has the key field Number ( notification number ). This method has no import parameters.

    You implement this method by calling transaction QM02 .

    When called, the transaction requires the sales document that is available as key of the object from the variable OBJECT-KEY-NUMBER .

    • Method Edit (simplified)

    ************************************************************

    BEGIN_METHOD EditAsynchron CHANGING CONTAINER.

    SET PARAMETER ID 'IQM' FIELD OBJECT-KEY-NUMBER.

    CALL TRANSACTION 'QM02' AND SKIP FIRST SCREEN.

    END_METHOD.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 04, 2008 at 08:22 PM

    As in synchronous processing, database is updated before the next transaction takes place.

    While debugging, just check where are you missing on the values.

    Probably you are not getting updated value in asynchronous mode and hence you are losing on the value.

    You can paste the code where you are losing the value. Probably that can help me to find out, what exact problem is.

    You can use EXPORT and IMPORT or SET/GET PARAMETER for storing the temporary value.

    Thanks,

    Kartavya

    Add comment
    10|10000 characters needed characters exceeded