08-19-2008 3:33 PM
Hello there, I´m trying to update a z-table , but I´m not sure if the way i´m working is the best , First I do a Select in order to check if the register exists ant then I make an update , but where I can catch any exception.???
SELECT * FROM zpx_ci_docs_proc
INTO TABLE ti_zpx_ci_docs
WHERE nume_docu = num_doc.
If sy-subrc = 0.
update zpx_ci_docs_proc set DATA_ENVI = dat_envi WHERE nume_docu = num_doc.
.
if sy-subrc = 0.
MESSAGE s000(zpb) WITH
" register update''
endif.
Thanks again.
08-19-2008 4:52 PM
Hi,
When you are updating /modifying a table..
Remember you need to enqueue and Dequeue the table before and after updation for data integrity.
A Enqueue and Dequeue FM's would be provided for you for the purpose once you create a custom table.
Thank you
08-19-2008 3:39 PM
You are already using sy-subrc, if it's 0 it means no errors, if you add an ELSE you are already into error handling area, because not 0 means error.
08-19-2008 4:52 PM
Hi,
When you are updating /modifying a table..
Remember you need to enqueue and Dequeue the table before and after updation for data integrity.
A Enqueue and Dequeue FM's would be provided for you for the purpose once you create a custom table.
Thank you
08-19-2008 9:56 PM
Hi,
Use enqueue FM before updating the table and After updation use dequeue FM.
DO.
Use ENQUEUE_E_TABLE FM
IF sy-subrc = 0.
EXIT.
ENDIF.
ENDDO.
UPDATE statement.
IF sy-subrc = 0.
Use DEQUEUE_E_TABLE FM
ELSE.
Error Handling.
ENDIF.
Do enddo is used to ensure that there are no locks apart from yours on the table before you update it.
Thanks,
Kartavya
08-19-2008 10:22 PM
Also please dequeue even if update is failed. i mean even if sy-subrc <> 0, then also dequeue the table.
Thanks,
Kartavya