CL_EHSW_MN_MNTRC_IN_EXAMPLE1 - Sample Implementation BADI_EHSW_MN_MNTRC_IN
rdisp/max_wprun_time - Maximum work process run time Fill RESBD Structure from EBP Component StructureThis documentation is copyright by SAP AG.
Functionality
This is an example implementation for the BAdI BADI_EHSW_MN_MNTRC_IN.
The implementation determines a disposal document and checks as well as completes the received disposal document data. This document, for example, can be used for the disposal document type BGS (German Begleitschein).
Prerequisite
To use the example implementation CL_EHSW_MN_MNTRC_IN_EXAMPLE1, a disposal document type with the settingsof the example document type EBGS (such as number of waste codes, status profile, and function assignment) is a prerequisite.
Disposal Document Determination
A disposal document is searched for using the disposal document type and the authority-assigned number.If a disposal document matches the search criteria, the parameter E_MN_RECN_OLD contains the technicalkey of the disposal document’s header record. If a disposal document could be determined using the search criteria, the parameter E_MN_RECN_OLD is empty.
Check and Complete Disposal Document
The example implementation checks the entered disposal document data.
The header data is checked as follows:
- Is the field in the inbound message that contains the internal disposal document number (DisposalNote -> InternalID) not filled?
- Does the existing disposal document not have the status CAN, CHK, COMPL or ARCH?
- Is the field for setting the disposal document status (DisposalNote -> LifeCycleStatusCode) filled? And if so, does the field contain either the status IEERR or ISENT?
Item data is checked as follows:
- Is a maximum of one item (DisposalNote -> Item) available in the inbound message?
- Is there no waste material (DisposalNote -> Item -> Material) in the inbound message?
- Does the field to indicate the relevance to the balance sheet (DisposalNote -> Item -> AccountingRelevanceIndicator) contain the value FALSE?
Waste code data is checked as follows:
- Does the inbound message contain a waste code (DisposalNote -> Item -> WasteClassification)?
If a check fails, a error message is output. The disposal document receives an error status ICERR Error During Creation or IRERR Change Error.
The example implementation completes the disposal document data as follows:
- All technical keys are determined using the logical key.
- The waste code of the document is used as the general waste code.
- Either the waste material is determined from the disposal channel of the waste approval or the material is determined using the waste code.
- The indicator for the balance sheet relevance of a disposal partner is set.
- The DG Regulation for Preliminary Leg, DGRegulation for Main Leg, and DG Reg. for Subsequent Leg fields are copied from the existing disposal document.
- Only texts of the type "Remark" (TextCollectionTypeCode = 10006) are copied. All other text types are copied from the existing disposal document.
The completed disposal document data is checked for consistency and against the Customizing settings.
Finally, the status of the disposal document is set as follows:
- If the document is new and all checks were successful, the status ITMPL draft is set. All changes are accepted.
- If the document is new and a check produced an error, the status is set to ICERR Creation Error - Error Log. Only the status is changed in the disposal document.
- If the document is changed and all checks were successful, the status is set to IRET Received from Service Provider.
- If the document is changed and the inbound message contains the status ISENT Sent,this status is set in the disposal document. Only the status is changed in the disposal document.
- If the document is changed and the inbound message contains the status IEERR ExternalError - Check with Service Provider, this status is set in the disposal document. Only the status is changed in the disposal document.
- If the document is changed and a check produced an error, the status is set to IRERR Change Error - Error Log. Only the status is changed in the disposal document.
If an internal error occurs, the parameter E_FLG_ERROR contains the value X in order to cancel further processing.
If a check results in an error, the parameter e_flg_set_msglog_rpc_failed contains the value X.Further processing continues further so that the field BusinessDocumentProcessingResultCode contains the value 5 in the outbound message.
Relationships
Example
Notes
Further information
TXBHW - Original Tax Base Amount in Local Currency BAL Application Log Documentation
This documentation is copyright by SAP AG.
Length: 5548 Date: 20120526 Time: 115933 triton ( 208 ms )






