on 11-09-2015 10:51 AM
Hi,
is there any solution for changing the Documentstatus in BADI?
I try this:
METHOD if_ex_document_main01~after_save.
BREAK-POINT.
DATA: dokexistiert TYPE bapi_doc_aux-flag.
CALL FUNCTION 'BAPI_DOCUMENT_EXISTENCECHECK'
EXPORTING
documenttype = draw-dokar
documentnumber = draw-doknr
documentpart = draw-doktl
documentversion = draw-dokvr
IMPORTING
* DOCUMENTISDELETED =
documentexists = dokexistiert
* RETURN =
.
IF dokexistiert = 'X'.
DATA: ls_return_commit TYPE bapiret2.
IF draw-dokst = 'IA'.
DATA: lf_doctype TYPE bapi_doc_draw-documenttype,
lf_docnumber TYPE bapi_doc_draw-documentnumber,
lf_docpart TYPE bapi_doc_draw-documentpart,
lf_docversion TYPE bapi_doc_draw-documentversion,
lf_statusextern TYPE bapi_doc_draw-statusextern,
lf_statusintern TYPE bapi_doc_draw-statusintern,
lf_statuslog TYPE bapi_doc_draw-statuslog,
ls_return TYPE bapiret2.
lf_docnumber = draw-doknr. "'Documentnumber'.
lf_doctype = draw-dokar." 'DRW'.
lf_docversion = draw-dokvr." '00'.
lf_docpart = draw-doktl." '000'.
lf_statusintern = 'FR'.
CALL FUNCTION 'BAPI_DOCUMENT_SETSTATUS'
EXPORTING:
documenttype = lf_doctype
documentnumber = lf_docnumber
documentpart = lf_docpart
documentversion = lf_docversion
statusextern = lf_statusextern
statusintern = lf_statusintern
statuslog = lf_statuslog
IMPORTING:
return = ls_return.
* Errors occurred ??
*** IF ls_return-TYPE CA 'EA'.
*** ROLLBACK WORK.
*** MESSAGE ID '26' TYPE 'I' NUMBER '000'
*** WITH ls_return-MESSAGE.
*** ELSE.
*** COMMIT WORK.
*** ENDIF.
ENDIF.
ENDIF. "dokument existiert
ENDMETHOD.
When i activate the badi, i get a dump... (file attached).
Thankfull for every solution.
Regards
Sebastian
Hi Sebastian,
BAdI AFTER_SAVE is executed in update task. So if you call the BAPI_DOCUMENT_SETSTATUS directly within the BAdI you get the shortdump because you will start another update in the update task.
So you have to start the status-processing asynchronously. The execution must happen after the original update task has finished.
There are following possible solutions
Hope this helps.
Regards,
Benedikt
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
12 | |
10 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.