* 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.
* General remark:
* The enhancement ID that you assign to a routine number must correspond to the BAdI filter of the current implementation.
* In the configuratin of a pricing procedure, you assign the routine number to a condition type or to a subtotal line.
* In the following, an example implementation of a condition amount routine for the condition item is presented.
* Such type of routine can be used to change the value for a pricing element.
* The example implementation below sets the condition amount equal to the net amount plus the tax amount.
* When the routine number is assigned to a subtotal line at the end of the pricing procedure, it shows the final value of the line item.
TRY.
prcg_element_result_amounts-CONDITIONAMOUNT = prcg_element_result_amounts-CONDITIONBASEVALUE – prcg_element_result_amounts-CONDITIONBASEVALUE / ( 1 + ABS( prcg_element_result_amounts-CONDITIONRATEVALUE / 100 ) ).
prcg_element_result_amounts-CONDITIONAMOUNT = – prcg_element_result_amounts-CONDITIONAMOUNT.
IF prcg_element_result_amounts-conditionamount = 0.
* it is possible to raise a message if an issue is identified
pricing_message = ‘Check the condition amount of the condition XY01’.
* indicate a pricing error if required
item_result_attributes-pricinghaserror = abap_true.
ENDIF.
CATCH cx_sy_conversion_error cx_sy_arithmetic_error INTO DATA(lx_conversion).
prcg_element_result_amounts-conditioninactivereason = ‘X’.
prcg_element_result_amounts-conditionamount = 0.
* You should use the statement “RAISE EXCEPTION” only for critical business errors or programming runtime errors.
RAISE EXCEPTION TYPE cx_ble_runtime_error
EXPORTING
previous = lx_conversion.
* Remark: Alternative exception handling
* TRY.
* RAISE EXCEPTION TYPE cx_pricing_formula EXPORTING error_message = ‘Conversion Error’ ##NO_TEXT .
* CATCH cx_pricing_formula INTO DATA(lx_pricing_formula).
* RAISE EXCEPTION TYPE cx_ble_runtime_error
* EXPORTING
* previous = lx_pricing_formula.
* ENDTRY.
ENDTRY.
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.
prcg_element_result_amounts-CONDITIONAMOUNT = prcg_element_result_amounts-CONDITIONBASEVALUE * prcg_element_result_amounts-CONDITIONRATEVALUE / 100 / ( 1 + prcg_element_result_amounts-CONDITIONRATEVALUE / 100 ).
prcg_element_result_amounts-CONDITIONAMOUNT = - prcg_element_result_amounts-CONDITIONAMOUNT.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
17 | |
5 | |
5 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |