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

problem with update

Former Member
0 Likes
675

Hi,

I have problem with update, why this simple part of program doesn't work?

UPDATE zvratka_prijemky

SET spz = 'test'

WHERE mblnr_101 = '5000084938'

AND zeile_101 = '0001'.

write SY-SUBRC.

sy-subrc returns 4.

thanks.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
660

Hello,

Always use MODFY statement.

Do like this.

data: wa like zvratka_prijemky.

select single * from zvratka_prijemky into wa where mblnr_101 = '5000084938' 
AND zeile_101 = '0001'.
if sy-subrc = 0.
wa-spz = 'test'.
modify zvratka_prijemky  from wa.
endif.

Hope this solve ur issue.

Vasanth

4 REPLIES 4
Read only

Former Member
0 Likes
660

Hello,

Are u passing values to all the key feields of the Z table . Check this.


UPDATE zvratka_prijemky
SET spz = 'test'
WHERE mblnr_101 = '5000084938' 
AND zeile_101 = '0001'. 
commit work and wait.  " Check here

Vasanth

Read only

0 Likes
660

Hi

sy-subrc returns 0 but the value still doesn't appear in table.

Read only

Former Member
0 Likes
661

Hello,

Always use MODFY statement.

Do like this.

data: wa like zvratka_prijemky.

select single * from zvratka_prijemky into wa where mblnr_101 = '5000084938' 
AND zeile_101 = '0001'.
if sy-subrc = 0.
wa-spz = 'test'.
modify zvratka_prijemky  from wa.
endif.

Hope this solve ur issue.

Vasanth

Read only

0 Likes
660

Thaks so much, it solves my problem.