Skip to Content
Product Information
Author's profile photo Prateek Agarwal

Output Management – Adding Taxes to Purchase Order Output

Business Case

While working with various customers implementing S/4HANA Cloud, I have noticed that non-availability of tax details on Purchase Order output has always been a concern. Most of our customers are spread across various geographies have taxation rules which mandate an input tax to all purchase being made by the customers.

This means that any purchase order document generated from the S/4HANA Cloud should have the tax details added to them. While the taxation works perfectly fine when using the public cloud, the same tax details are not added to the purchase order output generated from the system. This means the Purchase order document sent across to the vendors does not have complete details and some vendors might challenge the applicable taxes at a later stage.

What is, currently, provided by S/4HANA Cloud

S/4HANA Cloud by default gives us an option to generate the purchase order output (either to send manually or electronically). By design, the Purchase Order output only gives the Net Prices for each item. Even the Purchase Order total price is a sum of all the Item Net prices put together which considers only the basic price set for the corresponding product.

However, the customers want the ability to send across the input tax along with the purchase order output. This is needed because they want to send the correct Purchase order gross amount to their vendors.

Solution

We implemented a small solution for one of our customers to address this situation using In-app Extensibility.

I can summarize the below steps by which you can produced the tax amount in the Purchase Order output.

 

EDIT : Please refer to the updated steps highlighted in Blue to understand the logic to get Tax Rates.

Steps to generate the Tax Amount on the Purchase Order Output

Extend Purchase Order Item to include fields for Tax Amount & item gross amount.

We need to add two custom fields to calculate Item Tax Amount and Item gross amount.

To create custom field, use the app ‘Custom Fields and Logic’.

  • Business Context: Procurement: Purchasing Document Item

For a detailed understanding on how to create a custom field refer to the scope item In-App Extensibility (1N9).

Image 1.png

 

 

 

Enable the usage of these custom fields on the Form Template for Purchase Orders in the associated tab ‘Form Templates’. This is done to ensure that the custom fields are available in the Data Source for the Purchase Order Forms.

Extend Purchase Order header to include fields for Tax Amount & Gross Purchase Order Amount.

We need to add two custom fields to calculate Item Tax Amount and Item gross amount.

To create custom field, use the app ‘Custom Fields and Logic’.

  • Business Context: Procurement: Purchasing Document

Image 2.png

Enable to usage of these custom fields on the Form Template for Purchase Orders in the associated tab ‘Form Templates’. This is done to ensure that the custom fields are available in the Data Source for the Purchase Order Forms.

 

EDIT

Create a Custom Business Object to Maintain Tax Rates

Create a custom business object with Tax Code, Country & Tax Rates. You can later use this Custom Business object in the BADI to identify the TAX Rates.

Tip: Please remember to create a UI for the CBO, so that we can give the business user an ability to maintain the correct tax rates, whenever there is a change.

 

Calculate the tax values at the purchase order item

To calculate the tax values, we need to implement a small custom logic in the related BADI.

Open the add ‘Custom Field and logic’ and go the tab for Custom logic.

Create new implementation for the BADI to modify Purchase Order Items data.

  • Business Context: Procurement: Purchasing Document Item.
  • BADI Description: Modification of Purchase Order Items.

Image 3.png

Implement a piece of custom code based on below logic to calculate the tax amount to the custom fields created above.

The incoming parameter purchaseorderitem & purchaseorder will contain the custom fields created above.

Image 4.png

  • Pick up the tax code from the purchase order line item. This will be available in the field purchaseorderitem-taxcode.
  • With this tax code read the tax rate (maintained in the CBO for Tax Rates). Read the applicable Tax Rate using the custom Business object created above.
  • Do a calculation for item tax value with the tax rate and the item net value i.e. purchaseorderitem-netvalue.

 

  • Remember to move the values from purchasorderitem to purchaseorderitemchange. This is to ensure that the new calculated values are recorded in the the changed item details.

 

 

  • Calculate the tax values at the purchase order header

 

To calculate the tax values at header, we need to implement a small custom logic in the related BADI.

Open the app ‘Custom Field and logic’ and go the tab for Custom logic.

Create new implementation for the BADI to modify Purchase Order header data.

  • Business Context: Procurement: Purchasing Document.
  • BADI Description: Modification of Purchase Order Header.

Image 5.png

The incoming parameter purchaseorder contain the custom fields created on the Purchase order header initially. The parameter table purchaseorderitem_table will have the calculated values for tax amounts at item level from previous step.

  • Loop across the purchaseorderitem_table to read tax amount at individual line items.
  • Header total tax value will be an aggregate of the item tax values.
  • Header gross value will be an aggregate of the total header tax value and header net value i.e. purchaseorder-netvalue.

Modify standard Purchase order template to include tax values.

SAP provides a standard template for purchase orders which is used for generating output. The standard template built in the system is MM_PUR_PURCHASE_ORDER. We need to customize this template and build a custom form to add the tax values as per the business requirement. Follow the steps below the customize the template. You will need the software Adobe Livecycle designer to modify adobe forms. The software is available in the app ‘Install Additional Software’.

  • Open the app ‘Maintain form templates’ under the tile Output Management.
  • Go to the tab ‘Predelivered Templates’.

 

  • Download the form template MM_PUR_PURCHASE_ORDER.

 

Image 6.png

 

  • Open the template in Adobe live cycle designer. You can begin by saving the template as a custom form starting YY1*.
  • The custom fields calculated above will be available in the Data source FDP_EF_PURCHASE_ORDER_SRV.
  • The Header level tax value & gross fields will be available on the node PurchaseOrderNode.
  • The item level tax value a& gross value will be available on the node PurchaseOrderNode->PurchaseOrderItems->PurchaseOrderItemNode.
  • You can choose to display these details on the form based on the business requirements.

Once the form is ready, upload the customized form back using the app ‘Manage Form Template’.

Do the necessary output parameter configuration to use the new custom form for output type (PURCHASE_ORDER).

Refer to the scope item Output Management (1LQ) which provides best practice information to implement an end-to-end scenario for output management in the SAP S/4HANA Cloud edition. Additionally, some very good blogs are already available which explain how to customize an adobe form using Adobe LiveCycle Designer.

Since all the necessary customization are now completed, verify the new purchase order output with the available apps. Below is a sample output of how the purchase order looks like based on our business requirements.

Image 7.png

Conclusion

Tax details can be added on Purchase Order output by using the In-App Extensibility capabilities of S/4HANA Cloud. The customization will need a minimum technical skill. By adopting this design, you can add the tax values on the purchase order output. This will ensure that the purchase order document sent across to the vendors have the correct Order amount.

Assigned tags

      19 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Prateek Agarwal
      Prateek Agarwal
      Blog Post Author

      Kamal Jain Thanks a lot for your expert technical help in achieving this solution.

      Author's profile photo Prateek Agarwal
      Prateek Agarwal
      Blog Post Author

      Kamal Jain Many thanks for your expert technical guidance in achieving this solution.

      Author's profile photo Sohaib Rahman
      Sohaib Rahman

      Appreciate your efforts, Would you please share the source code?

      Author's profile photo nese Lakshmi
      nese Lakshmi

      Hi, Can you share some sample BADI code please..

      Author's profile photo Ryan Muller
      Ryan Muller

      Good info thanks for adding this!

      Author's profile photo Devin Good
      Devin Good

      Was looking for info on how this could be done.Thanks for sharing!

      Author's profile photo Paul Taylor
      Paul Taylor

      Another great example, thanks.

      Author's profile photo Grecia Cuellar
      Grecia Cuellar

      Very informative, always good to understand how to add these fields. Thank you for sharing!

      Author's profile photo Sai Giridhar Kasturi
      Sai Giridhar Kasturi

      A very valid business case for most of the cloud customers. Thanks for sharing the details.

      Author's profile photo Divya Vemulapati
      Divya Vemulapati

      Hi Prateek

      Can I add the field HSN/SAC in Purchase order form where I can see the field in Purchase Order but not in the form?

      Even I can see the field in the form but not data in the field which I was seen in Purchase Order

      Best Regards,

      Divya

      Author's profile photo Raghavendra S
      Raghavendra S

      I am also facing same issue with field SAC in Purchase order form where I can see the field in Purchase Order but not in the form. Even I can see the field in the form but there is no data in the field which I was seen in Purchase Order.

      please help me to resolve this issue.....

      Regards

      Raghu

       

      Author's profile photo José Bernardino Ruiz
      José Bernardino Ruiz

      Hi, can you tell me the Badi logic? I need a custom field in PO with the total amount and I don't know get the tax rate.

      Thanks.

      Author's profile photo Scarlett Wang
      Scarlett Wang

      It does meet the real business needs of customers. Thanks.

      Author's profile photo Shobna Devchand
      Shobna Devchand

      Hi,

      With regard to the following statement "With this tax code read the tax rate (maintained in the tax tables)"

      Please can you advise what the tax tables/CDS Views are that need to be read to obtain the rate as I cannot seem to find any.

      Many thanks

      Author's profile photo Simadri Sekhar Sutar
      Simadri Sekhar Sutar

      Hello Prateek Agarwal ,

      I have similar requirement . As you know we can not use tables in cloud platform , can you suggest a CDS which can provide "Tax Rate" for further calculations. i searched a bit but found only "I_TaxCode" which is not usefull in this requirement.

      Waiting for your valuable suggestion.

      Best regards,

      Simadri

      Author's profile photo nese Lakshmi
      nese Lakshmi

      Prateek, do you see any issue with the below login in the BADI to calculate the Total Qty on the PO lines:

      * purchaseorderchange- = 'Your field content'.

      * purchaseorderchange-yy1_totalpoqty_pdh = 15.

      data: ls_purchaseorderitem_table like LINE OF purchaseorderitem_table.

      LOOP AT purchaseorderitem_table INTO ls_purchaseorderitem_table.

      purchaseorderchange-yy1_totalpoqty_pdh = purchaseorderchange-yy1_totalpoqty_pdh

      + ls_purchaseorderitem_table-orderquantity.

      endloop.

      * purchaseorderchange-yy1_totalpoqty_pdh = 12.

      Author's profile photo nese Lakshmi
      nese Lakshmi

      For some reason, value is not coming on the the output form.. All the binding is correct..

      /Users/lakshmin/Downloads/Total PO Qty.jpg

      Author's profile photo Kapil Jain
      Kapil Jain

      Which CDS View to be use to find the tax rate. I am not able to figure out the tax rate.

      Author's profile photo Prateek Agarwal
      Prateek Agarwal
      Blog Post Author

      Hi Kapil,

      Tax Rates are currently not available in any of the Released CDS Views.

      We need to create a custom Business Object with Tax Code/ Country & Tax Rates. We can then use this CBO in the BADI to recognize the Tax Rates.

      This means, we have an additional maintenance of the Custom Business Object, whenever necessary.

      I am in process of updating the blog with this suggestion.

      Thanks,
      Prateek