‎2009 Jan 22 12:52 PM
hi,
I have done an append structure in the database EBAN
and i am doing an update in the table EBAN
UPDATE EBAN SET ZFLAG = 'X'
WHERE using all the primary condition
The row that i am trying to update exist in the table Eban. The problem that i am having is that sometimes the update is done sometimes not.
I check in debug for the data that is done updating properly and in debug the update is done. But not when executing the program without debug. I've tried COMMIT statement after UPDATE but it didn't work. how can i solve this?
‎2009 Jan 22 12:58 PM
Hi Deniz,
try like this...
SELECT *
FROM EBAN
INTO WA_EBAN
WHERE <primary conditions which you are giving in UPDATE>.
if sy-subrc eq 0.
wa_eban-zfalg = 'X'.
update eban from wa_eban.
endif.
it should work.
-- Jyothi
‎2009 Jan 22 1:29 PM
hi Jyothi,
thanks for the quick answer. i've tried your suggestion but it didn't work.
‎2009 Jan 22 1:40 PM
Hi
My intention there is whether the record is existing in the system or not. What is the sy-subrc value. Did you check?
if that is zero then it must work.
Ensure that it is zero and then remove the select. It is just for checking.
- Jyothi
‎2009 Jan 22 1:45 PM
>
> the select. It is just for checking.
its more then superfluous
‎2009 Jan 22 1:31 PM
check sy-subrc after your update. its not necessary to do a select before update as suggested before.
‎2009 Jan 22 1:39 PM
‎2009 Jan 22 1:44 PM
if you added field in standard strcture in EABN , for this you can find any exit you have to appned the strcture in exit level that will update the standard table automatically...
‎2009 Jan 22 1:50 PM
Hi,
Lock the record before you update and unlock it after the update is done.
Use the lock object EMEBANE
CALL FUNCTION 'ENQUEUE_EMEBANE' " for locking, pass the necessary parameters
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
UPDATE EBAN SET ZFLAG = 'X'
WHERE using all the primary condition.
if sy-subrc = 0.
" Update successfull !
else.
" Update unsuccessfull !
endif.
call function DEQUEUE_EMEBANE " For unlocking. Pass the necessary parameters
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards,
Advait
‎2009 Jan 22 3:08 PM
hi Advait,
i've tried your suggestion but it didn't work. like before when i check in debug mode the field is updated but when i execute the program without debug it doesn't work (i got error message: "Object requested is currently locked by user "). i want to know the differance between running program with debug mode and without debug mode.
‎2009 Jan 22 3:15 PM
Ideally it should work.
Have you written this code in a user exit or it is a stand alone program ?
regards,
Advait
Edited by: Advait Gode on Jan 22, 2009 4:15 PM
‎2009 Jan 22 3:22 PM