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

update problem

Former Member
0 Likes
374

hi gurus....

as i use below code for update fields in sales order which the user enter in selection screen.. for that i update VBAK table...

instead of update that particular sales order it update all sales order by shipment value....

my requirement is the shipment number which is associated with particular sales order i want to update that sales order...

please suggest me the solution...

SELECT TKNUM

ZZARLINENM1

ZZARLINENO1

ZZARLINENM2

ZZARLINENO2

ZZARLINENM3

ZZARLINENO3

ZZARLINENM4

ZZARLINENO4

FROM VTTK INTO CORRESPONDING FIELDS OF TABLE IT_VTTK

WHERE TKNUM IN S_DOC.

SELECT TKNUM

VBELN

FROM VTTP INTO CORRESPONDING FIELDS OF TABLE IT_VTTP

WHERE TKNUM IN S_DOC.

IF IT_VTTP[] IS NOT INITIAL.

SELECT VBELN

VGBEL

FROM LIPS INTO CORRESPONDING FIELDS OF TABLE IT_LIPS

FOR ALL ENTRIES IN IT_VTTP

WHERE VBELN = IT_VTTP-VBELN.

ENDIF.

IF IT_LIPS[] IS NOT INITIAL.

SELECT VBELN

FROM VBAK INTO CORRESPONDING FIELDS OF TABLE IT_VBAK

FOR ALL ENTRIES IN IT_LIPS

WHERE VBELN = IT_LIPS-VGBEL.

ENDIF.

LOOP AT IT_LIPS.

READ TABLE IT_VTTP WITH KEY TKNUM = IT_VTTK-TKNUM.

IF SY-SUBRC = 0.

READ TABLE IT_LIPS WITH KEY VBELN = IT_VTTP-VBELN.

IF SY-SUBRC = 0.

READ TABLE IT_VBAK WITH KEY VBELN = IT_LIPS-VGBEL.

IF SY-SUBRC = 0.

UPDATE VBAK SET

ZZAIRLINENAME1 = IT_VTTK-ZZARLINENM1

ZZAIRLINENO1 = IT_VTTK-ZZARLINENO1

ZZAIRLINENAME2 = IT_VTTK-ZZARLINENM2

ZZAIRLINENO2 = IT_VTTK-ZZARLINENO2

ZZAIRLINENAME3 = IT_VTTK-ZZARLINENM3

ZZAIRLINENO3 = IT_VTTK-ZZARLINENO3

ZZAIRLINENAME4 = IT_VTTK-ZZARLINENM4

ZZAIRLINENO4 = IT_VTTK-ZZARLINENO4

WHERE VBELN = IT_LIPS-VGBEL.

COMMIT WORK.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

kind regards

rahul

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
338

Hi ,

You are looping at LIPS which is an delivery item list . Im not sure if this is the best solution to have a table update in this manner.

//instead of update that particular sales order it update all sales order by shipment value....

This is problem of duplicates i suppose in ur case.

Try to build the relation with delivery header table LIKP and check to have one sales order update .

Br,

Vijay.

1 REPLY 1
Read only

Former Member
0 Likes
339

Hi ,

You are looping at LIPS which is an delivery item list . Im not sure if this is the best solution to have a table update in this manner.

//instead of update that particular sales order it update all sales order by shipment value....

This is problem of duplicates i suppose in ur case.

Try to build the relation with delivery header table LIKP and check to have one sales order update .

Br,

Vijay.