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

flag

Former Member
0 Likes
658

why we use flag in if statement?

4 REPLIES 4
Read only

Former Member
0 Likes
630

Hi,

Not clear with your requirement...

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

Thanks,

Naren

Read only

Former Member
0 Likes
630

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

Read only

former_member673464
Active Contributor
0 Likes
630

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

Read only

Former Member
0 Likes
630

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