Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Static variable in BADI

Former Member
0 Likes
1,430

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,

5 REPLIES 5
Read only

Former Member
0 Likes
966

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

Read only

0 Likes
966

Thanks. Can you let me know how to use Filter.

Read only

0 Likes
966

your BADI SD_COND_SAVE_A is not filter capable, so that solution cannot work in your scenario.

Read only

Former Member
0 Likes
966

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

Read only

Former Member
0 Likes
966

10 questions limit