Technology Blog Posts by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Kyemre
Discoverer
551

Key users can implement Alternative Calculations or Pricing Requirements with Business Add-In (BAdI) in Pricing context and connect them to routine with a unique enhancement identifier. After the all this adaptations, The routine number can be used for setting custom calculations in the pricing procedure.

 

Creating Custom Logic

 

Go to Custom Logic app

You can create a new custom logic with Create button.

pic1.png

 

In the new implementation screen, there are 3 steps to complete the creation of a custom logic. Firstly, you should complete the choosing of Extension Point. You can filter them using by Business Context as a Pricing.

 

pic2.png

 

In this blog, the alternative calculation of condition amount in document item will be used for the example scenario. Also you can apply the same steps for header level calculation or requirements.

 

After choosing extension point, click Step 2 to continue with Implementation Attributes.

 

pic3.png

       

            In the implementation attributes, you can add filter to connect routine to custom logic as below;

pic4.png

           The filter pop-up will be displayed in the screen and click add button again to add filter condition;

 

pic5.png

 

You should enter a unique value for identifier and click save button as below;

 

pic6.png

 

After the completion the scope of custom logic, you should go to step 3 to set Implementation ID.

pic7.png

Review for New Implementation.

 

Click Create button and Publish the custom logic.

pic8.png

pic9.png

You can access the code editor by clicking Open Code Editor.

pic10.png

You can use the following code to compare subtotals and raise a message;

	*   Mandatory step for all implementations:
	*   Move the importing parameters to the changing parameters.
	    MOVE-CORRESPONDING item_amounts TO item_result_amounts.
	    MOVE-CORRESPONDING item_attributes TO item_result_attributes.
	    MOVE-CORRESPONDING item_quantities TO item_result_quantities.
	    MOVE-CORRESPONDING prcg_element_attributes TO prcg_element_result_amounts.
	    MOVE-CORRESPONDING active_price_amounts TO active_price_result_amounts.
	    
	    IF item_amounts-subtotal4amount LT item_amounts-subtotal5amount.
	*   It is possible to raise a message.
	    pricing_message = 'Net amount cannot be less than calculated costs'.
	*   You can also set a pricing error if required.
	    item_result_attributes-pricinghaserror = abap_true.
	    ENDIF.
	

Setting Alternative Calculation

Go to Implementation Activities -> General Business Data -> Price Management -> Sales Pricing -> Setting for Pricing in Sales -> Set Alternative Calculation of Condition Amount (SSCUID 102430)

 

In the customizing screen, enter a routine number and description, then assign the enhancement identifier to routine number as below;

pic11.png

Assignment the enhancement Ids to Routine number

pic12.png

Finally, 3009999 numbered routine can be used in any pricing procedure.

pic13.png

 

References

https://help.sap.com/docs/SAP_S4HANA_CLOUD/a376cd9ea00d476b96f18dea1247e6a5/f90a91ef60d345b0aa49e919... 

 
Labels in this area