2008 Apr 23 8:41 AM
Hello gurus,
I have an internal table with following fields.
matnr werks lgort lvorm
-
A--
X
A--
X
A--
A--
X
B--
B--
X
my requirement is if ihave
Material numbers(matnr) with one plant(werks) and one-storage locations(lgort) attached to it ..
EG:A P M X record.....
I have to delete these type of records.
and for these records which have multiple lgorts for same matnr and same plant(werks) i have 2 manipulate like this ...total count for those records which doesnt have X
and deletion count for records which have lvorm = X
A--
X
A--
A--
X
in this example ,
total count = 1 A--
deletion count =2 A--
X
A--
X
i have 2 find this total count n deletion count for all other matnrs in the internal table.
how can i do manipulations for each individual matnr.....
Hello gurus,
I have an internal table with following fields.
matnr werks lgort lvorm
-
A--
X
A--
X
A--
A--
X
B--
B--
X
my requirement is if ihave
Material numbers(matnr) with one plant(werks) and one-storage locations(lgort) attached to it ..
EG:A P M X record.....
I have to delete these type of records.
and for these records which have multiple lgorts for same matnr and same plant(werks) i have 2 manipulate like this ...total count for those records which doesnt have X
and deletion count for records which have lvorm = X
A--
X
A--
A--
X
in this example ,
total count = 1 A--
deletion count =2 A--
X
A--
X
i have 2 find this total count n deletion count for all other matnrs in the internal table.
how can i do manipulations for each individual matnr.....
2008 Apr 23 10:06 AM
Hi Madan,
Use the below logic.
data: v_total type i,
v_deleted type i.
data: begin of itab_result occurs 0,
matnr like mara-matnr,
total type i,
deleted type i,
end of itab_result.
sort itab by matnr.
loop at itab.
if itab-lvorm = 'X'.
v_deleted = v_deleted + 1.
else.
v_total = v_total + 1.
endif.
at end of matnr.
itab_result-matnr = itab-matnr.
itab_result-total = v_total.
itab_result-deleted = v_deleted.
append itab_result.
clear itab_result.
clear: v_total, v_deleted.
endat.
endloop.
Edited by: Velangini Showry Maria Kumar Bandanadham on Apr 23, 2008 11:06 AM
2008 Apr 23 10:10 AM
ya its ok...
But my first condition shud also satisfy...
delete the records which i have one matnr one plant and one storage location
look at my first point....
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |