Former Member

# deleting a column from an internal table

Hai friends,

The following is my requirement

i have 3 materials with quantity in an internal table it_tab1.

MATNR Qty

a 10

b 20

b 30

c 5

d 10

i want as below

a 10

b 50

c 5

d 10

when i click a radio button the result should move to an excel sheet. i have done the calculation and moved to local variable.

now i want the local variable to be deleted from the internal table. how can i delete a column from an internal table.

10|10000 characters needed characters exceeded

Former Member
Sep 01, 2008 at 11:54 AM

Hi,

Collect <wa> into <Itab>

Regards,

Naresh.

10|10000 characters needed characters exceeded
• Former Member
Sep 01, 2008 at 11:18 AM

Hi Vennila,

Did you try COLLECT statement ?

Do F1 on this key - Collect in se38 and read more.

Hope it helps.

Manish

10|10000 characters needed characters exceeded
• Former Member
Sep 01, 2008 at 11:20 AM

Hi,

your problem can easily be solve by COLLECT statement

10|10000 characters needed characters exceeded
• Former Member
Sep 02, 2008 at 05:46 AM

hai naresh,

when i remove the append statement and use collect statement i got the answer. thank you for your timely help.

10|10000 characters needed characters exceeded
• Former Member
Sep 10, 2008 at 05:45 AM

TWO WAYS:

1. COLLECT

2. TYPES: BEGIN OF TY_MATRIAL,

MATNR TYPE MARA.,

SUBTOTAL TYPE I,

END OF TY_MATRIAL.

DATA: IT_MATNR TYPE TABLE OF TY_MATRIAL,

IW_MATNR TYPE TY_MATRIAL,

IT_SUBTOTAL TYPE TABLE OF TY_MATRIAL,

IW_SUBTOTAL TYPE TABLE OF TY_MATRIAL.

SORT IT_MATNR BY MATNR.

LOOP AT IT_MATNR INTO IW_MATNR.

IW_SUBTOTAL-MATNR = IW_MATNR-MATNR.

IW_SUBTOTAL-SUBTOTAL = IW_SUBTOTAL-SUBTOTAL + IW_MATNR-SUBTOTAL.

AT END OF MATNR.

APPEND IW_SUBTOTAL TO IT_SUBTOAL.

CLEAR IW_SUBTOTAL.

ENDAT.ENDLOOP.