Ansicht
Dokumentation

MMPUR_ORDRQOUT_PROCE - BAdI: Prepare Custom Mapping for Order Data (Called Before Std Mapping)

MMPUR_ORDRQOUT_PROCE - BAdI: Prepare Custom Mapping for Order Data (Called Before Std Mapping)

Addresses (Business Address Services)   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

The API Purchase Order - Send, Update, Cancel (API OrderRequest_OUT) enables you to transfer purchase order messages between your SAP S/4HANA buyer system and an external supplier system. A purchase order is created in the SAP S/4HANA buyer system which is relevant for XML message exchange processing with a supplier system. Whenever such a purchase order is saved in the system, a corresponding XML message is created and is transferred to the corresponding buyer system.

By default, the values for the parameters (supported by this API) are assigned through a fixed mapping, this is called as the standard mapping. You can use this BAdI to define custom mapping for the API OrderRequest_OUT. With this custom mapping you can fill data as required in the xml message structure of the API. This BAdI can also be used to raise information messages, for example, suppose you want to raise an error message when the value of purchasing organization is ‘001’, then using this BAdI you can create an implementation that raises such messages. Also, you can stop the XML message before it is sent to the external supplier system. This can be used for testing purposes.

Note:

  • Using this BAdI, you can only fill data for the fields that are supported in the API OrderRequest_OUT. Refer to the API documentation to know the list of the supported fields.
  • This BAdI is an on-premise BAdI, it cannot be implemented using the app Custom Fields and Logic.

To create a BAdI implementation, use the transaction SE18 or SE19.

Parameters

Importing Parameters

IV_OBJECT_KEY: Contains the purchase order number. Use this parameter to read the purchase order data.

Changing Parameters

CS_OUTBOUND_MESSAGE: Contains ABAP structure of the generated XML message. Use this parameter to fill values of the attributes in the XML message.

CT_MESSAGES: Use this parameter to raise information messages, see sample implementation below.

CV_PROCEED_WITH_APPL_PROC: Use this flag to execute the custom mapping. Set value of this flag as abap_false to skip the standard mapping and execute the custom mapping. If this flag is set as abap_true, then standard mapping is executed. By default, this value is abap_true.

Notes:

If you set value for this flag as abap_false in order to stop the execution of standard mapping, then ensure to map all the fields that are in the standard message structure.

If you want to map data for the fields that are not supported by this API, then use the BAdI: Modify Standard Mapping for Order Data (Called After Standard Mapping). This BAdI allows you to map data for the fields that are not supported by this API. Refer to the documentation of BAdI: Modify Standard Mapping for more details.

CV_SKIP_SENDING: Use this parameter to stop sending the XML message. This parameter can be used to test the implementation and the API. Set value of this parameter to abap_true (by default this value is abap_false) to skip sending the XML message, see sample implementation below.

method IF_MMPUR_ORDRQOUT_PROCESS_MAP~CUSTOM_MAPPING.

* Read the purchase order data.
SELECT SINGLE * FROM i_purchaseorderapi01 WITH PRIVILEGED ACCESS WHERE purchaseorder = @iv_object_key INTO @DATA(lt_po).

**Custom Mapping
cs_outbound_message-purchase_order_request-order-purchase_order_id = lt_po-purchaseorder.
cs_outbound_message-purchase_order_request-order-purchasing_document_type = lt_po-purchaseordertype.
cs_outbound_message-purchase_order_request-order-purchasing_organization = lt_po-purchasingorganization.
cs_outbound_message-purchase_order_request-order-purchasing_group = '002'.

*Custom Validations or checks
**For example, if the purchasing group of a purchase order is 001, Stop sending the message.
IF lt_po-purchasinggroup = '001'.
APPEND VALUE #( type = 'E' message = 'Failed because Purchasing Group is 001') to ct_messages.
    ENDIF.
cv_proceed_with_appl_proc = abap_true.
cv_skip_sending = abap_false.
  endmethod.






RFUMSV00 - Advance Return for Tax on Sales/Purchases   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 4515 Date: 20240523 Time: 195329     sap01-206 ( 91 ms )