‎2013 Aug 22 5:20 PM
Hello.
My Abap program, has a loop with the update command:
DO.
UPDATE zcaixa_loja SET seqp2k = t_header-numseq
WHERE vkbur = t_loja-vkbur.
IF sy-subrc EQ 0.
EXIT.
ELSE.
WAIT UP TO 2 SECONDS.
ENDIF.
IF sy-index > 10.
EXIT.
ENDIF.
ENDDO.
This command does not work sometimes.
The key is correct in "where condition."
Moving this code to a call function "in update Task" resolves ?
A typical R/3 installation contains dialog work processes and at least one update work process. The update work processes are responsible for updating the database. When an ABAP program reaches a COMMIT WORK statement, any function modules from CALL FUNCTION... IN UPDATE TASK statements are released for processing in an update work process. The dialog process does not wait for the update to finish. This kind of update is called asynchronous update.
Thanks !!!
‎2013 Aug 22 8:39 PM
You're using that inside an User-exit? If it's not inside a user-exit/badi/etc and it's a simple "report", I see no reason why you should use call function.. in update task.
Also, that "DO..ENDO" construction is very ugly. "Update" command when used correctly does works. You're probably having a program error somewhere else, and are trying to correct the program at the wrong place (dbaccess).
Finally, if you're trying to update multiple values in a database table from your internal tables "T_HEADER" and "T_LOJA", use MODIFY..FROM TABLE instead. Less dbaccess for updates = better performance.
Best Regards,
Mauricio
‎2013 Aug 22 5:53 PM
Hi Ronaldo,
It is going to make no difference if you put the code in "Update task" . Update tasks are mainly used to mainatin database consistency if one is working with a transaction with many dialog steps (screens) . In your case , I feel the record you are trying to update is most probably locked by another process which does not allow you to update . PLease let me know if it helps.
BR,
Shankar..
‎2013 Aug 22 6:22 PM
Hi Ronaldo,
what exactly you are trying to do can u plz explain?
Regards,
Narayan
‎2013 Aug 22 7:25 PM
‎2013 Aug 22 8:39 PM
You're using that inside an User-exit? If it's not inside a user-exit/badi/etc and it's a simple "report", I see no reason why you should use call function.. in update task.
Also, that "DO..ENDO" construction is very ugly. "Update" command when used correctly does works. You're probably having a program error somewhere else, and are trying to correct the program at the wrong place (dbaccess).
Finally, if you're trying to update multiple values in a database table from your internal tables "T_HEADER" and "T_LOJA", use MODIFY..FROM TABLE instead. Less dbaccess for updates = better performance.
Best Regards,
Mauricio
‎2013 Aug 23 4:48 AM
If i m not getting it wrong you want to update your database completely on COMMIT WORK or ROLLBACK if the condition failed. For this it will be better to use the CALL FUNCTION...IN UPDATE TASK. It will do work and won't show errors either.
Create a Function Module and write the Modify query in that and use it in your report/program.
Best Regards,
D Amarnath
‎2013 Aug 23 7:29 AM
i didn't understand y u have used the do loop and y u r waiting for 2 second and y u r exiting from the the loop when index is > 10, if you want to update the values back in the database.
you can loop the table and use Modify stmt to update table based on the work area or you can use MODIFY dbtable FROM TABLE itab <b>transporting <fields> if both the structures are matching..
Regards,
Narayan