Application Development 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: 

Update issue

Former Member
0 Kudos

Hi all ,

I need to make an update statement for a table PA2006.

for which I have picked the records which r required to be updated .

Then in the loop I am trying to update the table ,

but it changes the records except the last one .

Am not able to find the error .

I am enclosing my piece of code ,

just varify if anyting seems to be missing..

code

LOOP AT it_2006_upd INTO wa_2006_upd.

IF wa_2006_upd-ktart = '35'

CONCATENATE sy-datum+6(2) '.'

sy-datum+4(2) '.'

sy-datum+0(4)

INTO g_tdlangu.

UPDATE pa2006 SET sprps = 'X' flag4 = 'F' tdlangu = sy-datum

WHERE pernr = wa_2006_upd-pernr and

subty = wa_2006_upd-subty and

seqnr = wa_2006_upd-seqnr and

begda = wa_2006_upd-begda and

endda = wa_2006_upd-endda and

quonr = wa_2006_upd-quonr

ENDIF.

clear wa_2006_upd.

ENDLOOP.

2 REPLIES 2

Former Member
0 Kudos

Check the return code also put a commit work and wait in. If you are running it in debug mode, this will trigger the commits for you.

Former Member
0 Kudos

U can also do as

LOOP AT it_2006_upd INTO wa_2006_upd.

IF wa_2006_upd-ktart = '35'

CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum+0(4)
INTO wa_2006_upd-tdlangu.
wa_2006_upd-sprps = 'X'.
wa_2006_upd-flag4  = 'F'.

UPDATE pa2006 FROM wa_2006_upd.
ENDIF.
clear wa_2006_upd.
ENDLOOP.