Implement Pricing Routine in S/4HC

We know that routine sometimes needed especially when we talk about pricing. To have different calculation or certain modification and logic, it is common to have a routine in used in ECC.

But how it can be done in S4HC, sounds possible, yeah! Your next question must be, is it the same method as if when we work in ECC?

After I did my exploration, the concept is the same, though it needs small adaptation, as S4HC using BADi to work for its customs modification.

Well, just because this S4HC is something new, thus not so much resources I can get that make the development of routine seem challenging to achieve, but eventually it works and you can try.

In this example, I use simple scenario whereby for discount condition type I need to have 2 decimal rounding calculated for each quantity before multiple by the total quantity.

For example, if I have 10 PC and the unit price @135.50 GBP.

Without routine, the system will calculate discount as follow:

Price @135.50 GBP 1.355,00 GBP
Discount 9% 121.95 GBP

But instead to have standard calculation as example above, business request to have calculation as follow:

Price @135.50 GBP 1.355,00 GBP
Discount 9% 122.00 GBP

Which actually the  different is because the rounding apply in the discount of each unit price before it is multiplied with the total quantity.

To achieve this calculation, I need to develop my own routine and assigned it in the pricing procedure.

Pricing routine in pricing procedure in S4HC

I hope you quite familiar how to do customizing or ‘SPRO’ in S4HC because it will be too long if I put in the detail that portion.

Ok, let’s get started.

If you notice, the allowed namespace that provided by SAP now is not started from 900 but 3000000 to 3009999.

Create Routine

For my case, I need to create routine for Alternative Calculation of Condition Amount, so I need to configure in this section (Configuration ID: 102430).

Click on Configure button.

To register your routine number, click on New Entries.

Choose any number from the allowed namespace, mine is 3000000 and fill-in also the description.

Continue to configure the assignment of routine to Enhancement ID, click on the entry 

Until this step, you are only able to fill in Process Enhancement Option Task.

Save this entry and set aside for we will complete it with Enhancement Identifier later.

Create Customs Logic

Use FioriApp Custom Fields and Logic.

Find button + to create new custom logic. If you are not familiar to write code, could ask help from your ABAPER to write the code for you, they know the drill!

A pop up will be displayed, you can create your own naming, just make sure the Business Context and Badi Description is correct:

Add filter to your customs logic, this basically to fill in later the Enhancement Identifier.

You can start writing your code and save as Draft to publish later or directly to Publish to test in your transaction.

BAdi Documentation

In the top section, you also can find the BAdi Documentation that you can read to know from which structure the price will be called or initiated.

Available Fields



3 thoughts on “Implement Pricing Routine in S/4HC

  1. Hi Monica – this was great. I am early in my adventures with S4HC. Was wondering if you have created a custom data transfer or Copying routine yet. I am trying to figure out how I can create a new one, but in a way I alter the old routine – where I would have copied and changed the standard before – I can not see the default routine used.

    1. Hi also,
      Either myself was also just recently exploring S4HC and so far only managed to build this only pricing routine.
      This just also because of my senior was asking for help so I brought myself to the exploration.
      Yes, I agree with you that you can’t find the standard routine inside the custom code. Because the method to built routine in S4HC is slightly difference, it uses BAdi to do so.
      But in overall I guess the approach either for Data Transfer or Copying Routine is the same with the steps I did for pricing.
      Moreover, the next challenging part was, I cannot do debugging like normal ABAP can do in ECC. Dunno, this part I am also still clueless.
      So during development, I only can compile and then publish my code and go straight to test in the transaction, and do trial and error, check the result there.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s