Ansicht
Dokumentation

MMPUR_ORDREQOUT_ENHA - BAdI: Determine VAT Number for Purchase Order Items

MMPUR_ORDREQOUT_ENHA - BAdI: Determine VAT Number for Purchase Order Items

BAL Application Log Documentation   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

With this BAdI, you can add VAT number to the purchase order items. This BAdI is applicable only for the API Purchase Order – Send, Update, and Cancel (OrderRequest_Out).

Parameters:

Importing Parameters:

  • PURCHASINGDOCUMENT: This parameter carries the purchase order number.
  • COMPANY_VATREGISTRATION: This parameter carries the VAT details of the purchase order. This parameter can be used when the buying company and the ship to company are in the same country.
  • COMP_EC_VATREGISTRATION: This parameter carries the VAT details of the purchase order. This can be used when the buying company and the ship to company are in different countries.
  • ITEM_ADDRESS_DETAIL: This parameter carries the purchase order item number and the ship to country of the purchase order item. This parameter helps to identify which purchase order item is sent to which country.

Changing Parameters:

  • ITEM_VATREGISTRATION: A VAT value by default is assigned to a purchase order item based on the VAT value maintained in the purchase order. Use this parameter to assign a VAT value to a specific purchase order item.
  • MESSAGES: Use this parameter to raise information (errors and warnings) messages.

Sample Implementation

*"  IMPORTING
*"     PURCHASINGDOCUMENT  TYPE PURCHASEDOCUMENTID ( Purchase document no)
*"     COMPANY_VATREGISTRATION  TYPE TY_COMPANYVATREGISTRATION (Vat no)
*"     COMP_EC_VATREGISTRATION  TYPE TT_COMPANYVATREGISTRATION (VAT no wrt foreign country)
*"     ITEM_ADDRESS_DETAIL  TYPE TT_ITEM_ADDRESS (Item address)
*"  CHANGING
*"     ITEM_VATREGISTRATION  TYPE TY_ITEMVATREGISTRATION ( VAT no details)
*"     MESSAGES  TYPE BAPIRETTAB (Return messages)
*"  EXCEPTIONS
*"     CX_BLE_RUNTIME_ERROR (Exceptions)


* Read the purchase order data
      SELECT  * FROM i_purchaseorderitemapi01 WITH PRIVILEGED ACCESS WHERE         purchaseorder = @purchasingdocument INTO TABLE @mt_poitem.
    ENDIF.
* Loop at the item data
    LOOP AT mt_poitem ASSIGNING FIELD-SYMBOL().
* Read the address data for Ship-to country
      READ TABLE item_address_detail ASSIGNING FIELD-SYMBOL() WITH KEY purchasingdocumentitem  = -purchaseorderitem.
      IF sy-subrc = 0.
* Calculate the VAT number based on the material group
        IF -materialgroup = 'P001'.
          item_vatregistration-vatregistration = company_vatregistration-vatregistration.
        ELSE.
* Calculate the VAT number based on Ship-To Country
          READ TABLE comp_ec_vatregistration ASSIGNING FIELD-SYMBOL() WITH KEY country = -shiptocountry.
          IF sy-subrc = 0.
            item_vatregistration-vatregistration = -vatregistration.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDLOOP.






ABAP Short Reference   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 4154 Date: 20240606 Time: 194624     sap01-206 ( 42 ms )