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 (report)

Former Member
0 Likes
1,109

hi experts,

what is mean by flag? how we know the using method? pl explain breifly & clearly.

for good answer points reward.

thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
922

Hi ,

Flags are generally used to check the status of something.

For example :

Data : p_repr(1)  type c ,    "Representative 
         p_supr(1)  type c ,    " Supervisor
         p_depl(1)  type c ,    " Demand Planner
         g_flag_role TYPE c.  " Flag

  IF g_ok_code = 'EXEC'.
* This part gets the records from z09_user_roles and sets g_flag_role as either R or S or D.

    CASE 'X'.
      WHEN p_repr .
        g_flag_role = 'R'.
      WHEN p_supr .
        g_flag_role = 'S'.
      WHEN p_depl .
        g_flag_role = 'D'.
    ENDCASE.

    CASE g_flag_role .

      WHEN 'R'.
...........................

     WHEN 'S'.
.............................

     WHEN 'D'.
 .........................

.
.
.
.
ENDCASE.

Hope this will clarify your doubt.

plz reward if useful.

thanks,

dhanashri.

Edited by: Dhanashri Pawar on Jun 25, 2008 8:22 AM

5 REPLIES 5
Read only

Former Member
0 Likes
922

Generally a flag is used to know whether a particular thing is validated or not.I mean

if a = b

c_flag = x.

Then depending on whether the flag is set or not you can write what action needs to be taken.

Reward Points..

Read only

Former Member
0 Likes
923

Hi ,

Flags are generally used to check the status of something.

For example :

Data : p_repr(1)  type c ,    "Representative 
         p_supr(1)  type c ,    " Supervisor
         p_depl(1)  type c ,    " Demand Planner
         g_flag_role TYPE c.  " Flag

  IF g_ok_code = 'EXEC'.
* This part gets the records from z09_user_roles and sets g_flag_role as either R or S or D.

    CASE 'X'.
      WHEN p_repr .
        g_flag_role = 'R'.
      WHEN p_supr .
        g_flag_role = 'S'.
      WHEN p_depl .
        g_flag_role = 'D'.
    ENDCASE.

    CASE g_flag_role .

      WHEN 'R'.
...........................

     WHEN 'S'.
.............................

     WHEN 'D'.
 .........................

.
.
.
.
ENDCASE.

Hope this will clarify your doubt.

plz reward if useful.

thanks,

dhanashri.

Edited by: Dhanashri Pawar on Jun 25, 2008 8:22 AM

Read only

Former Member
0 Likes
922

Hi Shirish,

Flag is used as a tag by which you can handle your program.

Suppose if you want to display 7 after 5 then what you need to do is like this.


data: count type i value 1
data: flag type i value 0.
do 7 times.
  if count >= 5.
    flag = 1.
  endif.
  write:/ count.
count = count + 1.

enddo.
if flag = 1.
   count = count + 1.
   write:/ count.
endif.

&***********Reward Point if helpful**********&

Read only

Former Member
0 Likes
922

Flags can be used for validation.Also used for checking the conditions.It is declared as a variable of lenght 1(char/int) type.

Read only

Former Member
0 Likes
922

Hi,

Generally flags are used to check the status of some variables in a program and according to the status we proceed our working like if flag is equal to this value do this else do this,

For Eg.

Intialize the flag with 0.

then at some point in program

if x=y

flag = 1.

.........

........

If flag = 1

do

......

......

else

do

......

......