Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

internal table

Former Member
0 Likes
345

Hello gurus,

I have an internal table with following fields.

matnr werks lgort lvorm

-


A--


P
M
--


X

A--


Q
M
--


X

A--


Q
N
--


A--


Q
O
--


X

B--


P
M
--


B--


P
N
--


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--


Q
M
--


X

A--


Q
N
--


A--


Q
O
--


X

in this example ,

total count = 1 A--


Q
N
--


deletion count =2 A--


Q
M
--


X

A--


Q
O
--


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--


P
M
--


X

A--


Q
M
--


X

A--


Q
N
--


A--


Q
O
--


X

B--


P
M
--


B--


P
N
--


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--


Q
M
--


X

A--


Q
N
--


A--


Q
O
--


X

in this example ,

total count = 1 A--


Q
N
--


deletion count =2 A--


Q
M
--


X

A--


Q
O
--


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.....

2 REPLIES 2
Read only

Former Member
0 Likes
322

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

Read only

0 Likes
322

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....