11-07-2005 5:21 PM
Hi
I need to save a value in memory in a BADI (Abap Objects), for example to save a flag variable; but it sends a sintax error.
For example:
Data: flag(1) type c.
flag = '1' or '0'.
EXPORT flag TO MEMORY ID 'ZTEST'.
Wich is the sintax to set a value in memory in Abap Objects ??
Regards
Frank
11-07-2005 5:25 PM
The addition ID must be specified with the statements IMPORT/EXPORT/FREE ... MEMORY in ABAP Objects.
Error message in ABAP Objects if the following syntax is used:
EXPORT f TO MEMORY.
IMPORT f FROM MEMORY.
FREE MEMORY.
Correct syntax:
EXPORT f TO MEMORY ID key.
IMPORT f FROM MEMORY ID key.
FREE MEMORY ID key.
Reason:
If no identification is specified, all programs in a call chain use the same memory area. This may lead to unpredictable results especially with complex transactions.
Regards,
Rich Heilman
11-07-2005 5:23 PM
11-07-2005 5:24 PM
Hi Frank,
Is this the exact statement you used?
<b>flag = '1' or '0'.</b>
There is no such statment with the use or 'or'.
If this is not the statement, then I apologize and I request the syntax error text.
Srinivas
11-07-2005 5:25 PM
The addition ID must be specified with the statements IMPORT/EXPORT/FREE ... MEMORY in ABAP Objects.
Error message in ABAP Objects if the following syntax is used:
EXPORT f TO MEMORY.
IMPORT f FROM MEMORY.
FREE MEMORY.
Correct syntax:
EXPORT f TO MEMORY ID key.
IMPORT f FROM MEMORY ID key.
FREE MEMORY ID key.
Reason:
If no identification is specified, all programs in a call chain use the same memory area. This may lead to unpredictable results especially with complex transactions.
Regards,
Rich Heilman
11-07-2005 5:27 PM
Here is a example, this is passing the syntax checker.
report zrich_0001
no standard page heading.
*---------------------------------------------------------------------*
* CLASS lcl_test DEFINITION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
class lcl_test definition.
public section.
methods: constructor.
data: flag type c.
endclass.
*---------------------------------------------------------------------*
* CLASS lcl_test IMPLEMENTATION
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
class lcl_test implementation.
method constructor.
EXPORT <b>flag = flag</b> TO MEMORY ID 'ZTEST'.
endmethod.
endclass.
REgards,
Rich Heilman
Message was edited by: Rich Heilman
11-07-2005 5:25 PM
Hi Frank,
here is an example code.
TABLES INDX.
TYPES: BEGIN OF ITAB3_TYPE,
CONT(4),
END OF ITAB3_TYPE.
DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',
F1(4), F2 TYPE P,
ITAB3 TYPE STANDARD TABLE OF ITAB3_TYPE WITH NON-UNIQUE
DEFAULT KEY INITIAL SIZE 2,
WA_INDX TYPE INDX.
Fill the data fields before CLUSTR
before the actual export
INDX-AEDAT = SY-DATUM.
INDX-USERA = SY-UNAME.
Export der Daten.
EXPORT F1 FROM F1
F2 FROM F2
ITAB3 FROM ITAB3
TO DATABASE INDX(ST) FROM WA_INDX ID INDXKEY.
Regards,
Ravi
11-07-2005 5:35 PM
Thanks for your responses.
I tried the Rich syntax and it works.
Thanks
Frank