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 statement in internal table

Former Member
0 Likes
2,925

Hi Gurus,

LOOP AT gi_coas.

READ TABLE gi_ekkn WITH KEY aufnr = gi_coas-aufnr

BINARY SEARCH.

IF sy-subrc EQ 0.

gi_ekkn-kostl = gi_coas-kostv.

MODIFY gi_ekkn TRANSPORTING kostl.

ENDIF.

ENDLOOP.

Will this code work or not let me know.

its giving short dump for me.

is there anything wrong in it.

10 REPLIES 10
Read only

Former Member
0 Likes
999

Hi

Hi which table you have to modify?

gi_ekkn or gi_coas?

Only you can modify gi_coas with the value read from gi_ekkn.

LOOP AT gi_coas.

READ TABLE gi_ekkn WITH KEY aufnr = gi_coas-aufnr

BINARY SEARCH.

IF sy-subrc EQ 0.

gi_ekkn-kostl = gi_coas-kostv.

MODIFY <b>gi_coas</b> <b> index sy-tabix</b> TRANSPORTING kostl.

ENDIF.

ENDLOOP.

Reward points if useful

Regards

Anji

Message was edited by:

Anji Reddy Vangala

Read only

dani_mn
Active Contributor
0 Likes
999

HI

try this.

LOOP AT gi_coas.

READ TABLE gi_ekkn WITH KEY aufnr = gi_coas-aufnr

BINARY SEARCH.

IF sy-subrc EQ 0.

gi_ekkn-kostl = gi_coas-kostv.

<b>MODIFY gi_ekkn index sy-tabix TRANSPORTING kostl .</b>

ENDIF.

ENDLOOP.

Read only

Former Member
0 Likes
999

Best way is to use Workareas

LOOP AT gi_coas into wa_coas.

READ TABLE gi_ekkn into wa_ekkn WITH KEY aufnr = wa_coas-aufnr
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_ekkn-kostl = wa_coas-kostv.
MODIFY gi_ekkn from wa_ekkn.
ENDIF.

ENDLOOP.

Read only

Former Member
0 Likes
999

hi Mac.

you can only modify the table which you are looping in... the statement that you have written is wrong...

Please replace the table name... according to your requiremnt and rest all on the coding and syntax sid looks good,.

regards,

jayant

Read only

Former Member
0 Likes
999

Hi,

In ECC6.0 latest we want to use Workarea before entering the values in internal table or retrieving from db table to internal table...

So use work aeas it ill be very useful

reward if useful

Read only

Former Member
0 Likes
999

hi,

the code looks fine it should work.

Read only

Former Member
0 Likes
999

Hi,

try this:

1. give where condition

2. use INDEX claause

Jogdand M B

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
999

Hi,

The best solution with good performance and with out modify is the one below.

FIELD-SYMBOLS: <gi_ekkn> like line of gi_ekkn.

LOOP AT gi_coas.

READ TABLE gi_ekkn ASSIGNING <gi_ekkn>WITH KEY aufnr = gi_coas-aufnr

IF sy-subrc EQ 0.

<gi_ekkn>-kostl = gi_coas-kostv.

ENDIF.

ENDLOOP.

Best Regards,

Sesh

Read only

Bema
Active Participant
0 Likes
999

<b>sort gi_ekkn by aufnr.</b>

LOOP AT gi_coas.

READ TABLE gi_ekkn WITH KEY aufnr = gi_coas-aufnr

BINARY SEARCH.

IF sy-subrc EQ 0.

v_kostl = gi_coas-kostv.

MODIFY gi_ekkn FROM gi_coas TRANSPORTING kostl.

ENDIF.

ENDLOOP.

Give KOSTL in both tables.

Read only

Former Member
0 Likes
999

hi frnd.

try this one,,

LOOP AT gi_coas into wa_coas.

READ TABLE gi_ekkn into wa_ekkn WITH KEY aufnr = wa_coas-aufnr

BINARY SEARCH.

IF sy-subrc EQ 0.

wa_ekkn-kostl = wa_coas-kostv.

MODIFY gi_coas index sy-tabix TRANSPORTING kostl.

ENDIF.

ENDLOOP.

regards

vijay