‎2010 Feb 05 3:13 AM
Hi ,
I need to declare a static variable in a BADI. I have implemented the BADI SD_COND_SAVE_A for VK11 transaction. In the implementing class ZCL_IM_XXXXX I have declared the static attribute. But the issue is static variable clears each time this returns to the BADI implementation.
I am doing this in order stop the code in the BADI to be executed only once. As of now this BADI is called twice which I need to stop.
Thanks in advance,
‎2010 Feb 05 4:11 AM
Hi,
If you want the Badi implemenation to be called only once then u have to use filter and pass a filter variable from the progam , so that it works only once . for any queries reply back.
regards
Edited by: gurunath pandiyarajan on Feb 5, 2010 5:11 AM
‎2010 Feb 05 3:24 PM
‎2010 Feb 05 7:21 PM
your BADI SD_COND_SAVE_A is not filter capable, so that solution cannot work in your scenario.
‎2010 Feb 05 7:42 PM
Hi
Try to use IMPORT/EXPORT MEMORY ID
Example: Set lv_code = X when use for 1st time and free lv_cde for 2nd time use
DATA: lv_code(1) TYPE c.
DO 2 TIMES.
IMPORT lv_code FROM MEMORY ID 'ZCODE'.
IF sy-subrc <> 0.
lv_code = 'X'.
EXPORT lv_code TO MEMORY ID 'ZCODE'.
ELSE.
FREE MEMORY ID 'ZCODE'.
ENDIF.
ENDDO.
Edited by: Dean Q on Feb 5, 2010 8:44 PM
‎2010 Apr 28 2:46 PM