‎2009 Jun 25 6:39 AM
Hi,
I want to check some values inside the loop to avoid those values...
Loop at itab.
if itab-name = 'BSA-RETRIVE'.
Return.
elseif itab-name = 'FSI-RETRIVE'.
Retrun.
else.
Append itab to lt_itab.
endloop.
For this,
I have list of values maintained as constants...
Constants:
Begin of gc_tab,
Bsa(20) type c value 'BSA-RETRIVE',
fsi(20) type c value 'FSI-RETRIVE',
......
end of gc_tab.
In my program,
I want to check as like
Loop at itab.
if itab-mname is in any of the constants, then Return.else.
append.
endloop.
How to achive this...any ideas...
‎2009 Jun 25 6:43 AM
hi,
Use and in the if condition
if itab-name = 'BSA-RETRIVE' and itab-name = 'FSI-RETRIVE'
return
else
endif.Regards
Sarves
‎2009 Jun 25 6:45 AM
Hi,
thanks for the reply...
The problem is not with the operator...
I want to maintain as constant array...
cos later if we want to add , we can just add in the constant array...
‎2009 Jun 25 6:49 AM
Hi,
Then you can achieve this using ranges. keep all the constant values hardcoded in the range and in the loop give an if condition, saying
loop at itab-name.
if itab-name in range.
return
else.
endif.Regards
Sarves
‎2009 Jun 25 6:53 AM
How to get the data in Range??
I am having the values in the constants which is in the Private section of the class.
Whenever I get a new value, I will just include that in the Array of constants...I dont want to touch the method again and again...This is the purpose I am doing this...
I have the data in the constants..
in the method How to refer the constants or hopw to get it in the range tab....
‎2009 Jun 25 7:18 AM
Hello
loop at itab.
search gc_tab for itab-mname.
if sy-subrc = 0.
return.
else.
* do anything here
endif.
endloop.
‎2009 Jun 25 6:47 AM
Hi,
Take RANGES ..r_names and fill all your constants.
Loop at itab where not name in r_names
append lt_itab.
endloop.
Regards,
Kumar Bandanadham
‎2009 Jun 25 6:48 AM
USE BELOW CODE :
REPORT ZZZZZTEST .
CONSTANTS: BEGIN OF GC_TAB,
CON1 TYPE CHAR10 VALUE 'NARESH',
CON2 TYPE CHAR10 VALUE 'PATEL',
CON3 TYPE CHAR10 VALUE 'VINIT',
END OF GC_TAB.
DATA: BEGIN OF IT OCCURS 0,
NAME TYPE CHAR10,
END OF IT.
IT-NAME = 'NARESH'.
APPEND IT.
IT-NAME = 'PATEL'.
APPEND IT.
IT-NAME = 'VINIT'.
APPEND IT.
IT-NAME = 'PATEL1'.
APPEND IT.
IT-NAME = 'NARESH'.
APPEND IT.
IT-NAME = 'VINIT1'.
APPEND IT.
IT-NAME = 'PATEL'.
APPEND IT.
LOOP AT IT.
CASE IT-NAME.
WHEN GC_TAB-CON1.
WRITE:/ IT-NAME.
WHEN GC_TAB-CON2.
WRITE:/ IT-NAME.
WHEN GC_TAB-CON3.
WRITE:/ IT-NAME.
ENDCASE.
ENDLOOP.
‎2009 Jun 25 7:32 AM
Hi,
I hope this will solve your problem.
DATA: typ1 TYPE c LENGTH 1,
comp1 TYPE i,
v_flag.
DATA: BEGIN OF itab OCCURS 0,
name(20),
END OF itab.
CONSTANTS: BEGIN OF lc_cons,
con1(20) VALUE 'Hello',
con2(20) VALUE 'Hai',
con3(20) VALUE 'Hi',
END OF lc_cons.
FIELD-SYMBOLS: <temp> TYPE ANY.
START-OF-SELECTION.
itab-name = 'hook'.
APPEND itab.
itab-name = 'Hai'.
APPEND itab.
DESCRIBE FIELD lc_cons TYPE typ1 COMPONENTS comp1.
LOOP AT itab.
CLEAR v_flag.
DO comp1 TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE lc_cons TO <temp>.
IF <temp> EQ itab-name.
v_flag = 'X'.
EXIT.
ENDIF.
ENDDO.
IF v_flag NE 'X'.
append itab to lt_itab.
ENDIF.
ENDLOOP.
Regards,
Kumar Bandanadham