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

plz chk the code wats wrong in it

Former Member
0 Likes
884

hi

i m having itab with vbeln

and ztable with objnr and ordsent.

where objnr and vbeln are equal

so now when i find objnr EQ vbeln i have to modify the ztable-ordsent = ' '.

i have writen the followin code

LOOP AT lt_ztsd2marc INTO ls_ztsd2marc.

READ TABLE ct_success INTO ls_success WITH KEY ordnr =

ls_ztsd2marc-ordnr.

IF sy-subrc EQ 0.

ls_ztsd2marc-ordsent = ' '.

MODIFY TABLE lt_ztsd2marc FROM ls_ztsd2marc TRANSPORTING ordsent .

MODIFY ztsd2marc FROM TABLE lt_ztsd2marc.

IF sy-subrc EQ 0.

MESSAGE s112(z2).

ENDIF.

ENDIF.

ENDLOOP.

its updating it in work area but the changes are not gettin reflected in the internal table and not even in my ztable ztsd2marc.

plz tell me wat is wrong in this code?

7 REPLIES 7
Read only

Former Member
0 Likes
840

Hi Neha ,

What is the value of SY-SUBRC when you modify the internal table and table.

Regards

Arun

Read only

Manohar2u
Active Contributor
0 Likes
840

You should not use

<b>MODIFY table</b> with in the loop

try with

<b>modity</b> itab.

and after endloop then update your z table

Message was edited by:

Manohar Reddy K

Read only

Former Member
0 Likes
840

Hello,

Try using stmt like below :

MODIFY TABLE lt_ztsd2marc FROM ls_ztsd2marc

& use commit work after z table updation.

Thanks.

Read only

Former Member
0 Likes
840

Hi

Give

<b> Modify itab -> Modifying internal table

Modify ztable -> Modifying Table</b>

Regards

Haritha.

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
840

Hi,

Replace

MODIFY TABLE lt_ztsd2marc FROM ls_ztsd2marc TRANSPORTING ordsent .

MODIFY ztsd2marc FROM TABLE lt_ztsd2marc.

by this single statement

MOdify lt_ztsd2marc from ls_ztsd2marc transporting ordsent where ordnr = ls_ztsd2marc-ordnr.

Read only

Former Member
0 Likes
840

LOOP AT lt_ztsd2marc INTO ls_ztsd2marc.

READ TABLE ct_success INTO ls_success WITH KEY ordnr =

ls_ztsd2marc-ordnr.

IF sy-subrc EQ 0.

ls_ztsd2marc-ordsent = ' '.

MODIFY TABLE lt_ztsd2marc FROM ls_ztsd2marc TRANSPORTING ordsent

where ordnr = ls_ztsd2marc-ordnr .

**MODIFY ztsd2marc FROM TABLE lt_ztsd2marc.

update ztsd2marc set ordsent = it_ztsd2marc-orsent

where ordnr = it_ztsd2marc-ordnr.

IF sy-subrc EQ 0.

MESSAGE s112(z2).

ENDIF.

ENDIF.

ENDLOOP.

Read only

Former Member
0 Likes
840

hi..

jus try the code below.. it'll def give the solution to ur question.

i've jus modified little of ur code that u posted.

LOOP AT lt_ztsd2marc INTO ls_ztsd2marc.

READ TABLE ct_success INTO ls_success WITH KEY ordnr =

ls_ztsd2marc-ordnr.

IF sy-subrc EQ 0.

ls_ztsd2marc-ordsent = ' '.

MODIFY TABLE lt_ztsd2marc FROM ls_ztsd2marc TRANSPORTING ordsent

where ordnr = ls_ztsd2marc-ordnr .

**MODIFY ztsd2marc FROM TABLE lt_ztsd2marc.

update ztsd2marc set ordsent = it_ztsd2marc-orsent

where ordnr = it_ztsd2marc-ordnr.

IF sy-subrc EQ 0.

MESSAGE s112(z2).

ENDIF.

ENDIF.

ENDLOOP.

all the best