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

Please validate my update stmt. - Urgent.

Former Member
0 Likes
561

Hi,

Please validate my below UPDATE statement.

I have given values ( in debugger ) for the parameter in WHERE condition. Still the below UPDATE stmt is not updating the data base table zbmta0016ref_bep.

IF p_test IS INITIAL.

UPDATE zbmta0016ref_bep

SET bepo_haupt = lw_mainbepo-nhb

aenam = sy-uname

laeda = sy-datum

utime = sy-uzeit

WHERE matnr = pc_main-matnr

AND abt = lw_mainbepo-abt

AND wg = lw_mainbepo-wg

AND ag = lw_mainbepo-ag

AND bepo_k = lw_mainbepo-bepo_k

AND betr_s = l_betr_s

.

ENDIF.

Please help me.

Hi,

Please validate my below UPDATE statement.

I have given values ( in debugger ) for the parameter in WHERE condition. Still the below UPDATE stmt is not updating the data base table zbmta0016ref_bep.

IF p_test IS INITIAL.

UPDATE zbmta0016ref_bep

SET bepo_haupt = lw_mainbepo-nhb

aenam = sy-uname

laeda = sy-datum

utime = sy-uzeit

WHERE matnr = pc_main-matnr

AND abt = lw_mainbepo-abt

AND wg = lw_mainbepo-wg

AND ag = lw_mainbepo-ag

AND bepo_k = lw_mainbepo-bepo_k

AND betr_s = l_betr_s

.

ENDIF.

Please help me.

3 REPLIES 3
Read only

Former Member
0 Likes
545

Use Commit work statement ...

IF p_test IS INITIAL.

UPDATE zbmta0016ref_bep

SET bepo_haupt = lw_mainbepo-nhb

aenam = sy-uname

laeda = sy-datum

utime = sy-uzeit

WHERE matnr = pc_main-matnr

AND abt = lw_mainbepo-abt

AND wg = lw_mainbepo-wg

AND ag = lw_mainbepo-ag

AND bepo_k = lw_mainbepo-bepo_k

AND betr_s = l_betr_s

.

commit work

ENDIF.

Regards,

Santosh

Read only

Former Member
0 Likes
545

Hi Kumar,

first check the where condition is working properly means whether is there any record with the specified criteria.check the statement.

select * from zbmta0016ref_bep

WHERE matnr = pc_main-matnr

AND abt = lw_mainbepo-abt

AND wg = lw_mainbepo-wg

AND ag = lw_mainbepo-ag

AND bepo_k = lw_mainbepo-bepo_k

AND betr_s = l_betr_s.

if sy-subrc = 0.

write:/ 'the code is executing properly'.

else.

write: / 'please check the code'.

endif.

if the above code is working means if sy-subrc = 0 then check whether p_test has any data or not.

the problem must be in either of these two.if these two are working properly let me know.

please reward points if useful.

Read only

Former Member
0 Likes
545

If any of the variables that used in the where condition is a select-option then use in instead of =

Eg:

Where

betr_s in l_betr_s