10-08-2008 11:59 AM
Hello friends,
I have one internal table i_tab like
MATNR RUN
3000101
3000101 X
3000102
3000102 X
3000103
3000103 X
3000104 X
3000105
I want to check first if RUN = balnk, then take this record.
If it is not blank then take 'X' record.
How to do it with the same internal table?
Regards,
RH
10-08-2008 12:02 PM
Did you try to program something yourself and what does that piece of program look like?
10-08-2008 12:04 PM
Hello,
Try this:
loop at i_tab.
at new matnr.
wa_aux = i_tab-run.
endat.
endloop.
Regards.
10-08-2008 12:05 PM
Loop the itab into wa.
if wa-run = space.
then take wa_run-matnr.
else
take 'X'.
endif.
endloop.
hope this is wht u r looking for..
10-08-2008 12:15 PM
the above replies shd suffice your issue.
Edited by: Poornima Madhusudhan on Oct 8, 2008 1:15 PM
10-08-2008 12:36 PM
Hi Ronny
Just check the below code.
TYPES : BEGIN OF TY_ITAB,
N(10) TYPE C,
F TYPE C,
END OF TY_ITAB.
DATA : ITAB TYPE TABLE OF TY_ITAB WITH HEADER LINE,
ITAB1 TYPE TABLE OF TY_ITAB WITH HEADER LINE,
W_ITAB TYPE TY_ITAB.
ITAB-N = '3000101'.
ITAB-F = 'X'.
APPEND ITAB.
ITAB-N = '3000101'.
ITAB-F = ' '.
APPEND ITAB.
ITAB-N = '3000101'.
ITAB-F = ' '.
APPEND ITAB.
ITAB-N = '3000101'.
ITAB-F = 'X'.
APPEND ITAB.
ITAB-N = '3000102'.
ITAB-F = 'X'.
APPEND ITAB.
ITAB-N = '3000103'.
ITAB-F = 'X'.
APPEND ITAB.
ITAB-N = '3000103'.
ITAB-F = ' '.
APPEND ITAB.
ITAB-N = '3000104'.
ITAB-F = ' '.
APPEND ITAB.
SORT ITAB BY N F.
LOOP AT ITAB.
W_ITAB = ITAB.
AT NEW N.
ITAB1-N = W_ITAB-N.
ITAB1-F = W_ITAB-F.
APPEND ITAB1.
CLEAR : ITAB, ITAB1.
ENDAT.
ENDLOOP.
LOOP AT ITAB1.
WRITE 😕 ITAB1-N,
ITAB1-F.
ENDLOOP.
Comment on it.
Regards
M kumar
10-08-2008 12:52 PM
hi,
Try this out
data : matnr like mara-matnr.
sort i_itab.
loop at i_itab.
if i_itab-matnr eq matnr and i_itab-run eq 'X'.
i_itab-run = 'X'.
elseif i_itab-matnr ne matnr and i_itab-run eq ' '.
i_itab-run = ' '.
elseif i_itab-matnr ne matnr and i_itab-run eq 'X'.
i_itab-run = ' '.
endif.
matnr = i_itab-matnr.
endloop.
10-08-2008 3:40 PM
Hello Ronny,
Can you say what the expected output would be for your example itab?
Should it be getting the ones in red?
MATNR RUN
3000101
3000101 X
3000102
3000102 X
3000103
3000103 X
3000104 X
3000105
If yes
* make sure run = blank is comes first
sort itab by matnr run.
loop at itab into wa.
at new matnr.
* do whatever you're trying to do
endat.
endloop.
12-02-2008 1:53 PM