Application Development 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: 

flag

Former Member
0 Kudos

why we use flag in if statement?

4 REPLIES 4

Former Member
0 Kudos

Hi,

Not clear with your requirement...

not only flag...We can compare any variables / work areas / internal tables using IF statement..

Thanks,

Naren

Former Member
0 Kudos

flag is used as a mediator,

In the below example records of itab are appended to itab1 except the first record on every change of MATNR , chk how the flag is used

loop at itab.

 at new matnr.
    v_flag = 'X'.
 endat.
 if v_flag eq 'X'.    
  clear flag.
 else.
   append itab to itab1.   
 endif.

endloop.

Message was edited by:

Chandrasekhar Jagarlamudi

Message was edited by:

Chandrasekhar Jagarlamudi

former_member673464
Active Contributor
0 Kudos

hi,,

You can use flag for different purposes.Suppose we need to check any of the records being checked for a table you can use flag for that thing .If ther is any changes we can also use flag for that thing also.It depends on different situations.

regards,

veeresh

Former Member
0 Kudos

Hi Silla,

LOOP AT TAB.

IF TAB-FLAG IS INITIAL.

TAB-FLAG = 'X'.

ENDIF.

MODIFY TAB.

ENDLOOP.

TAB-FLAG = 'X'.

MODIFY TAB TRANSPORTING FLAG

WHERE FLAG IS INITIAL.

Rewords if it is helpful.

Rgds,

P.Nag