|
The IDoc processing function module has a required parameter "IDOC_STATUS". Here you can enter as many status items as required. They all will appear in the WE05 listing, when an IDoc is displayed. The last entry in the table will become the final status of the IDoc. So if you add a status entry with STATUS-"51" (general error) or "52"= (Application error) you can set the IDoc to failure.
See this nice little function below, that fills the IDOC_STATUS table appropriately from values that are compatible with the SY-MSGV1 …..
function Z_LOGOS_IDOC_STATUS_FILL.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(DOCNUM) TYPE EDIDC-DOCNUM OPTIONAL
*" VALUE(STATUS) OPTIONAL
*" VALUE(STATUS_ERROR) OPTIONAL
*" VALUE(MSGID) OPTIONAL
*" VALUE(MSGTY) OPTIONAL
*" VALUE(MSGNO) OPTIONAL
*" VALUE(MSGV1) OPTIONAL
*" VALUE(MSGV2) OPTIONAL
*" VALUE(MSGV3) OPTIONAL
*" VALUE(MSGV4) OPTIONAL
*" VALUE(APPL_LOG) TYPE BALOGNR OPTIONAL
*" TABLES
*" IDOC_STATUS STRUCTURE BDIDOCSTAT OPTIONAL
*"----------------------------------------------------------------------
*
clear IDOC_STATUS.
IDOC_STATUS-DOCNUM = DOCNUM.
IDOC_STATUS-STATUS = STATUS.
IDOC_STATUS-MSGTY = MSGTY.
if MSGTY ca 'EAX' and not STATUS_ERROR is initial.
IDOC_STATUS-STATUS = STATUS_ERROR.
endif.
IDOC_STATUS-MSGID = MSGID.
IDOC_STATUS-MSGNO = MSGNO.
IDOC_STATUS-MSGV1 = MSGV1.
IDOC_STATUS-MSGV2 = MSGV2.
IDOC_STATUS-MSGV3 = MSGV3.
IDOC_STATUS-MSGV4 = MSGV4.
IDOC_STATUS-APPL_LOG = APPL_LOG.
append IDOC_STATUS.
*
endfunction.
|