Proplems with updating an DDIC table

Question:
Hi,
I created an customer ddic table: YLREFNUM.
I've got a program that do some updates on this table.
This is the problem:
When the program runs normally, the update is NOT done.
When I debug the program than the update is done
This is my code:
UPDATE ylrefnum SET   yysrefnum  = yysrefnum
                        yyyear     = sy-datum(4)
                  WHERE yylab_plnt = yylab_plnt.
IF sy-subrc EQ 0.
  COMMIT WORK.
ENDIF.
I already tried it with COMMIT WORK AND WAIT. but still no good result.
Any Ideas ?
Thanks
WJ.
Answer:
Hi,
this part of your coding seems ok. That it works when debugging, but not in normal processing is eventually a hint therefor that you makes further updates in your program. You can examine it, when you leave the program with a stop-statement after this update and commit or when you debug the program until the normal end. In the first case, the updated data are persist and in the second case also (like normal processing) the updated data are reverted.
Answer:
Hi Wimpie,
try to use the statement " wait up to X seconds " after your commit.
Ive De Kerf is countering the same problem in VW for the moment.
X is a numeric field .
Regards,
Yoolb @ itelligence
Answer:
HI MR. Janssen,
also have a look at " SET UPDATE TASK LOCAL".
with this statement you tell your application that database updates are supposed to be done in the program itself and not in a separate process.
Regards,
Yoolb
Answer:
Dear WJ:
Try writing out the field for the WHERE clause after the COMMIT (inside the IF) and then set a break-point. Does your program go there on a 'normal' run? Is the return code 0 during debug? Is anything else different? Do you start out with the same table contents?
I would not spend time on the 'update task' solution. If you update and commit, a change should stick. In your case, the update did not select anything/did not work, or the commit was never carried out. Since you coded it conditionally, those two may be related.
Regards,
Wolfgang
Answer:
Hi ,
@Wolfie : it works in debugging and doesn't work when running it online.
PS. My colleague bought your book ( ABAP with STYLE )
regards,
Yoolb
Answer:
Hi,
I solved the problem by using an Update Function Module.
So I created a FM with attribute: Update Module, Start Immediately.
Put the update statement in this FM and called it with option UPDATE TASK.
Thanks to you all for helping on this issue.
Regards
WJ.

More Articles:

where used list for global objects?
Function module To write number in words?
Sales Order Userexit?
Changing one value in all tables available in R/3?
Fill color into the cell in a worksheet excel?
EXIT_SAPLCOIH_009?