‎2007 Feb 26 6:53 PM
Hello friends,
Below is the code I am using.
IMPORT flag_linked FROM MEMORY ID 'ZLINKED_FLAG'.
IF flag_linked NE 'X'.
flag_linked = 'X'.
EXPORT flag_linked TO MEMORY ID 'ZLINKED_FLAG'.
.........code.....
endif.
When I am execuing the program for the first time everything works fine and the Import statement fails. However when I am executing the program the second time the Import statement is successful in the first attempt.
Its a exit so will trigger couple iof times. So how would i clear the memory when the program is executed completely.
Madhu..
‎2007 Feb 26 6:55 PM
Hi,
WHen the program is completed the memory values will automatically be erased..as these values are stored in the ABAP memory...And not in SAP memory..
Also please check the documentation for detailed explanation of IMPORT and EXPORT statement..
Thanks,
Naren
‎2007 Feb 26 6:54 PM
‎2007 Feb 26 6:55 PM
Hi,
WHen the program is completed the memory values will automatically be erased..as these values are stored in the ABAP memory...And not in SAP memory..
Also please check the documentation for detailed explanation of IMPORT and EXPORT statement..
Thanks,
Naren
‎2007 Feb 26 6:59 PM
Thanks,
So Naren you mean to say once the program is completely executed the value in the field flag_linked will be blank.
I also assumed so but i dont know why I see the value after the Import statement is triggered.
The exits trigger when a PO is created. However when i close the window and execute it it looks fine.
Any suggestions.
Madhu.
‎2007 Feb 26 6:58 PM
Hi Madhu,
Please see link
http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/content.htm
To delete data clusters, you can use the following statements:
· FREE MEMORY deletes all data cluster from the ABAP memory
· DELETE FROM ... ID id deletes a data cluster with the identification id, which was stored in the ABAP memory of a database table, or in an application buffer of an application server.
regards,Nishant
Please reward points if this helps
‎2007 Feb 26 6:59 PM
Hi Madhu,
Please use FREE MEMORY statement to clear memory.
or
move space to flag_linked.
EXPORT flag_linked TO MEMORY ID 'ZLINKED_FLAG'.
Regards,
Ferry Lianto
‎2007 Feb 26 7:13 PM
Hi,
Yes..Once the program is completed..The value in the memory will be blank..But to make to sure..you can give FREE MEMORY ID 'xxxx'.
Try this simple report...Execute the report more than once...It will show no memory...But you have to completely go out of the transaction SE38...To make it work..
DATA: v_value(2) VALUE '99'.
DATA: v_value_get(2).
IMPORT v_value = v_value_get FROM MEMORY ID 'ZTEST'.
IF sy-subrc = 0.
WRITE: / v_value_get.
ELSE.
WRITE: / 'No memory'.
ENDIF.
v_value_get = '89'.
EXPORT v_value = v_value_get TO MEMORY ID 'ZTEST'.
WRITE: / sy-subrc.
Also to be on the safer side...You can use FREE MEMORY ID 'ZTEST' to clear it immediately...
Thanks,
Naren
‎2007 Feb 26 7:19 PM
Thanks Naren.
I cant use free memory in my case because the exit is triggered many times and i cant free memory in between. If i need to i should free only when the exit would be triggered for the last time, but i dont know when would it trigger the last time.
Madhu...
‎2007 Feb 26 7:23 PM
Hi,
If we don't when exactly to free the memory...Then leave it as is..
As I mentioned earlier..the memory will automatically get refreshed for new transactions..
BTW...are you using IMPORT and EXPORT in the same user exit..
Instead you can use STATICS..
Example
-
STATICS: V_FLAG TYPE C.
IF V_FLAG IS INITIAL. " First time..
V_FLAG = 'X'.
ENDIF.
IF V_FLAG = 'X'. " Subsequent times.
..
ENDIF.
Thanks,
Naren
‎2007 Feb 26 7:27 PM
Hi Madhu,
if v_flag ne 'X'.
IMPORT flag_linked FROM MEMORY ID 'ZLINKED_FLAG'.
v_flag = 'X'.
endif.
if v_flag = 'X' .
IF flag_linked NE 'X'.
flag_linked = 'X'.
EXPORT flag_linked TO MEMORY ID 'ZLINKED_FLAG'.
.........code.....
endif.
endif.I guess this works
Regards
Naresh