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

modify internel table

Former Member
0 Likes
985

Dear Experts,

My code is Below. my requirement is all the work area fields are modify comparing ebeln.

but i am use append duplicates entris allowed.only possible to modify.

All the work area is filled.but when debugger is execute modify statement should be short dump error.

loop at it_ekko into wa_ekko.

read table it_ekpo into wa_ekpo with key ebeln = wa_ekko-ebeln.

if sy-subrc = 0.

wa_ekpo-ebeln = wa_ekko-ebeln.

wa_ekpo-bedat = wa_ekko-bedat.

wa_ekpo-reswk = wa_ekko-reswk.

modify it_ekpo from wa_ekpo.

endif.

endloop.

Plz solved it.how to use modify statement is my code.

regards,

raj.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
939

Hi

If you want to update it_ekpo u need to use the INDEX option, because the statament MODIFY is not in a LOOP of IT_EKPO table, so the system can't know which record has to be modified.

loop at it_ekko into wa_ekko.
  read table it_ekpo into wa_ekpo with key ebeln = wa_ekko-ebeln.
  if sy-subrc = 0.
*   wa_ekpo-ebeln = wa_ekko-ebeln.
   wa_ekpo-bedat = wa_ekko-bedat.
   wa_ekpo-reswk = wa_ekko-reswk. 
*   modify it_ekpo from wa_ekpo.
   modify it_ekpo from wa_ekpo index sy-tabix. <-----------------------------
  endif.
endloop.

Max

6 REPLIES 6
Read only

Former Member
0 Likes
940

Hi

If you want to update it_ekpo u need to use the INDEX option, because the statament MODIFY is not in a LOOP of IT_EKPO table, so the system can't know which record has to be modified.

loop at it_ekko into wa_ekko.
  read table it_ekpo into wa_ekpo with key ebeln = wa_ekko-ebeln.
  if sy-subrc = 0.
*   wa_ekpo-ebeln = wa_ekko-ebeln.
   wa_ekpo-bedat = wa_ekko-bedat.
   wa_ekpo-reswk = wa_ekko-reswk. 
*   modify it_ekpo from wa_ekpo.
   modify it_ekpo from wa_ekpo index sy-tabix. <-----------------------------
  endif.
endloop.

Max

Read only

0 Likes
939

This message was moderated.

Read only

Former Member
0 Likes
939

Hi,

PARAMETERS p_carrid TYPE scarr-carrid.

DATA scarr_tab TYPE SORTED TABLE OF scarr

WITH UNIQUE KEY carrid.

DATA: idx TYPE sy-tabix,

scarr_wa TYPE scarr.

SELECT *

FROM scarr

INTO TABLE scarr_tab.

READ TABLE scarr_tab

WITH TABLE KEY carrid = p_carrid

TRANSPORTING NO FIELDS.

idx = sy-tabix.

scarr_wa-currcode = 'EUR'.

MODIFY scarr_tab INDEX idx FROM scarr_wa

TRANSPORTING currcode.

Thanks

P.S.Rajesh

Read only

tarangini_katta
Active Contributor
0 Likes
939

Hi,

data : it_ekko type sorted table of Unique-KEY ebeln.

loop at it_ekko into wa_ekko.

read table it_ekpo into wa_ekpo with key ebeln = wa_ekko-ebeln.

if sy-subrc = 0.

wa_ekpo-ebeln = wa_ekko-ebeln.

wa_ekpo-bedat = wa_ekko-bedat.

wa_ekpo-reswk = wa_ekko-reswk.

modify it_ekpo from wa_ekpo.

endif.

endloop.

Then it will solve u r pbm.

Thanks,

Read only

Former Member
0 Likes
939

EKPO is item level data.

There could be duplicate entries being created for the same ekko-ebeln. Hence the short dump.

Keep POSNR too in ekpo if you dont have it.

Read only

Former Member
0 Likes
939

>

> Dear Experts,

> My code is Below. my requirement is all the work area fields are modify comparing ebeln.

> but i am use append duplicates entris allowed.only possible to modify.

> All the work area is filled.but when debugger is execute modify statement should be short dump error.

>

> loop at it_ekko into wa_ekko.

> read table it_ekpo into wa_ekpo with key ebeln = wa_ekko-ebeln.

> if sy-subrc = 0.

> wa_ekpo-ebeln = wa_ekko-ebeln.

> wa_ekpo-bedat = wa_ekko-bedat.

> wa_ekpo-reswk = wa_ekko-reswk.

> modify it_ekpo from wa_ekpo.

> endif.

> endloop.

> Plz solved it.how to use modify statement is my code.

> regards,

> raj.

Hi Raj,

Use Modify it_ekpo from wa_ekpo index and transporting the fileds which you require .