‎2009 Oct 22 4:39 AM
Dear All experts,
i have problem to reverse multiple posting no. in one time. Eg i have 3 posting no need to revese, when first n second posting no are reversed but third got error , so this will cosinder fail. so i need recover back the first and second posting no.
i tried to use BAPI to reverse it eg :
CALL FUNCTION 'BAPI_GOODSMVT_CANCEL'
EXPORTING
materialdocument = materialdocument
matdocumentyear = matdocumentyear
goodsmvt_pstng_date = matdocumentdate
TABLES
return = return_o.
when finish reverse all three posting no. without error , then i only go throw "Commit Work" . CAN I ? the way i doing is correct ? or any idea to solve this problem?
THanks
‎2009 Oct 22 8:52 AM
How can i do BAPI more than 1 times witout "commint work" ? only do the commit work for the last record.
THanks
‎2009 Oct 22 5:10 AM
‎2009 Oct 22 6:00 AM
Try like this.
Make changes wherever needed
loop at itab into wa.
CALL FUNCTION 'BAPI_GOODSMVT_CANCEL'
EXPORTING
materialdocument = wa-mblnr
matdocumentyear = wa-mjahr
goodsmvt_pstng_date = wa-budat
TABLES
return = lt_return.
if lt_return[] is not initial.
append lines of lt_return to lt_messages.
endif.
clear lt_return[].
endloop.
read table lt_messages into wa1 with key type = 'E'.
if sy-subrc = 0.
"Error Found
else.
"Commit work
endif.
‎2009 Oct 22 8:52 AM
How can i do BAPI more than 1 times witout "commint work" ? only do the commit work for the last record.
THanks
‎2009 Oct 22 9:46 AM
hi,
just a change in code
put the read statement inside the loop.
read table lt_return into wa1 with key type = 'E'.
if sy-subrc = 0.
"Error Found
else.
"Commit work
endif.
They way for what your are asking is impossible because bapi accepts only one material document at a time.
‎2009 Oct 22 9:56 AM
Yeah , thank for your reply . how i going to recover back those reversed data ? do i need to repost it again and get the new migo no. ? Bc i need to reverse more than 1 migo no. in one time , and cnt 100% all migo can reverse successfully without. how i going to prevent this happen ?
‎2009 Oct 22 7:07 PM
hi,
Once there is no error record found and commit has happened successfully, then there is no need to repost the successfull records,
but when you get error in return table collect all the error records and repost again.