03-03-2008 9:50 PM
I have an internal table with fields..
begin of it occurs 0,
ebeln
matkl
werks
end of it.
its filled with values..
ebeln | matkl | werks |
12111 | A123 | LK
12111 | A123 | LK
12111 | A123 | LK
12111 | A123 | LK
12111 | A123 | LK
12111 | A123 | LN
12121 | A124 | LK
12121 | A124 | LK
12121 | A124 | LK
12122 | A125 | LK
12122 | A125 | LK
12122 | A125 | LK
12123 | A126 | LN
12123 | A126 | LN
Now I want to eliminate the values from the internal table where all ebeln and werks are different..for example..all 12111's should be eliminated from the internal table as the it has different werks assighned to one of the ebeln's..and I need only ebeln's with 12121 and 12123.
Any suggention would be helpful..
Thanks,
M/
03-03-2008 11:55 PM
Hi ,
Take a copy of your internal say IT1 .
IT1[] = IT[].
Loop at it .
loop at it1 with key ebeln = it_ebeln and werks <> it_werks.
flag = 'X'.
EXIT.
ENDloop.
if flag = ' X' .
clear .
delete table it where ebeln = it_ebeln .
ENDIF.
Endloop.
In this way your problem is solved
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Mar 4, 2008 11:03 AM
03-04-2008 1:50 AM
If I am correct in understanding,, you are trying to eliminate all the EBELN with werks = LN.
All the ebelns should be assigned to werks LK
Please confirm..
03-04-2008 2:26 PM
Rahul,
I want to eliminate all EBLELN'S if all WERKS are not same..
03-04-2008 2:44 PM
Write as :
sort it by ebeln werks.
Loop at it.
At new ebeln.
v_werks = it-werks. <--- get the first werks ...
endat.
if v_werks <> it-werks.
flag = 'X'.
endif.
at end of ebeln.
if flag = 'X'.
delete internal table it where ebeln = it-ebeln.
endif.
clear : flag , v_werks.
endat.
endloop.
03-04-2008 3:17 AM
Hi,
DATA : v_ebeln LIKE table name-ebeln,
v_werks LIKE table name--werks.
SORT itab BY ebeln werks .
LOOP AT ITAB.
ON CHANGE OF itab-ebeln.
Move : itab-ebeln TO v_ebeln,
itab-werks TO v_werks.
ENDON.
IF ITAB-ebeln NE v_ebeln OR
ITAB-werks NE v_werks.
DELETE ITAB WHERE ebeln EQ ITAB-ebeln .
clear : v_ebeln , v_werks.
ENDIF.
ENDLOOP.