Skip to Content
0
Former Member
Dec 10, 2009 at 07:35 AM

Previous data missing after appending an extra record into internal table

97 Views

Hi

In the below code Exportdata internal table contains10 fields with 4 line items 10,20,40,50 records.all the 10 fields contain data

IT_EKKO_ekpo has 8 fields with 5 line items 10,20,30,40,50.all the 8 filedls contain data.

export data is having 2 extra fields with data compared to IT_ekko_ekpo.

my intension is to add the 30th line item from IT_ekko_ekpo into exportdata with the 2 extra fields data as initial .

Ater my code though the line item 30 is sucessfully inserted into exportdata with 8 fields data , all the other line items are also having data in only 8fields. the 9th and 10th field data for line items 10, 20, 40, 50 are missing.

How can I solve this issue, I want the other line items apart from 30 to contain the 10 fields data and line item 30 to contain 8 fields data after I append the exportdata table.

LOOP AT IT_EKKO_EKPO INTO wa_ekko_ekpo.

READ TABLE exportdata

INTO wa_exportdata

WITH KEY ebeln = wa_ekko_ekpo-ebeln

ebelp = wa_ekko_ekpo-ebelP

BINARY SEARCH.

IF syst-subrc NE 0.

wa_exportdata-ebeln = wa_ekko_ekpo-ebeln.

wa_exportdata-ebelp = wa_ekko_ekpo-ebelp.

wa_exportdata-konnr = wa_ekko_ekpo-konnr.

wa_exportdata-ktpnr = wa_ekko_ekpo-ktpnr.

wa_exportdata-werks = wa_ekko_ekpo-werks.

wa_exportdata-menge = wa_ekko_ekpo-menge.

wa_exportdata-netpr = wa_ekko_ekpo-netpr.

wa_exportdata-lgort = wa_ekko_ekpo-lgort.

APPEND wa_exportdata TO exportdata.

CLEAR: wa_exportdata.

ENDIF.

ENDLOOP.

  • SORT exportdata BY ebeln ebelp.