‎2008 May 02 3:32 PM
Hi all,
I want the Internal table
1
1
3
2
3
4
4
1
2
3
3
I want to print the data like every highest level compring with prevous level. if the Current and previous both are same< I want both the records.
output like
3
4
4
3
3
‎2008 May 02 3:44 PM
Maybe this
DATA:
BEGIN OF itab OCCURS 0,
fl1 TYPE c,
END OF itab,
curr_hi.
START-OF-SELECTION.
PERFORM build_table.
CLEAR curr_hi.
LOOP AT itab.
IF itab-fl1 GT curr_hi.
curr_hi = itab-fl1.
ELSEIF itab-fl1 LE curr_hi.
check curr_hi NE '1'.
WRITE:/ curr_hi.
curr_hi = itab-fl1.
ENDIF.
ENDLOOP.
WRITE:/ curr_hi.
*&---------------------------------------------------------------------*
*& Form build_table
*&---------------------------------------------------------------------*
FORM build_table.
itab-fl1 = '1'. APPEND itab.
itab-fl1 = '1'. APPEND itab.
itab-fl1 = '3'. APPEND itab.
itab-fl1 = '2'. APPEND itab.
itab-fl1 = '3'. APPEND itab.
itab-fl1 = '4'. APPEND itab.
itab-fl1 = '4'. APPEND itab.
itab-fl1 = '1'. APPEND itab.
itab-fl1 = '2'. APPEND itab.
itab-fl1 = '3'. APPEND itab.
itab-fl1 = '3'. APPEND itab.
ENDFORM. " build_table
and the Output
3
4
4
3
3
‎2008 May 02 3:48 PM
hi do it like this:
data: tmp type i, x type i value 0.
loop at itab into wa.
if tmp = wa-value.
tmp = wa-value.
write: tmp.
flag = 1.
endif.
if x = 0.
tmp = wa-value.
x = 1.
continue.
endif.
at new value.
if flag = 1.
write: tmp.
flag = 0.
endif.
endat.
tmp = wa-value.
endloop.
if flag = 1.
write: tmp.
flag = 0.
endif.
reward if useful.