Some pricing logic can be shared across multiple price plan. A simple example is the logic to derive the Country Name from the Number Dialed. This logic can be encapsulated and used by many Charges. Here in SAP CC we can use the Pricing Macro object to provide re-usable function.

Pricing Macro:

  • Similar to a sub-routine (ABAP)
  • Can be used across multiple Charges
  • Accepts specified input parameters
  • Returns specified output parameters
  • Can be used in two ways:
    1. Macros Rating Function – Macro generates final rated amount directly
    2. Macro Operator – Macro performs some logic and results are returned to calling price plan for further computation.

Let’s create a Pricing Macro that will take a phone number, look at it’s prefix and return the name of the country associated to the prefix. Prefix +61 for Australia, +33 for France and +1 for US of A.

Create a new Pricing Macro. Select File ->New Pricing Macro
Capture

Set up the input and output parameters of the pricing macro

  • Rating context properties: Phone Number (string) <- similar to your import parameter in your sub-routine
  • Generated properties: County Name <-similar to your export parameter in your sub-routine

Capture

Add a Prefix Switching component into the macro to check prefixes +33, +61 and +1

Capture

At the Prefix Switching Definition, Change the Property Name to ‘Phone Number’. The property ‘Phone Number’ is inherited from the Pricing Macro’s Rating Context Properties.
Capture

Capture

Add the Output Property Updates to each branch in your logic. Set the value to the appropriate country.

Capture

We have earlier defined the exporting parameter ‘Country Name’ at the ‘Generated properties’ view of the Pricing Macro’s definition. In the Output Property Component, when the prefix is +33, we assign the value of this parameter to France.

Capture

Add a ‘Free’ rating component to each branch.

Capture

Repeat the steps with the rest of the prefixes.

Capture

Let’s go ahead and execute the Trial Run Price Plan.

Capture

Capture

Enter +61 as the value of the input property Phone Number. Then click the Start button that looks like a play symbol on the top left of the Rating Trial Run application. The output should be ‘Australia’. Aussie! Aussie! Aussie! Oi! Oi! Oi!

Capture

Now try it with other values and verify that the output value is correct.

Capture

Save the Pricing Macro. File->Save->In the Database

Capture

Select the Catalog T01 then Click Save.

Capture

Capture

Finally, let’s use the Pricing Macro in one of the Charge that have been created in the previous chapter.
Select File->Open->Charge

Capture

Select the [T01]Mobile Usage Charge and click Open.

Capture

Click on the node just before the fee is calculated. Insert a Pricing Macro Operator under this branch.

Capture

Capture

Give the name of the Macro Operator as ‘Look up country name’. Choose the ‘Get country name from phone number’ Pricing Macro. Select the ‘Number Dialed’ property as the Mapping Property of the importing parameter of the Pricing Macro’s Phone Number (that’s a mouthful). Note that the property ‘Number Dialed’ comes from the CIC which is linked with the Charge.

Capture

Test the Price Plan to see the output of the Pricing Macro utilization.

Capture

Capture

Capture

Capture

Capture

Save the modified Charge in the Database.

And it’s Done…!

pricingmacro

Average Rating
0 out of 5 stars. 0 votes.
My Rating:
Categories:

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *