on ‎2020 Dec 04 3:44 PM
Hello experts,
I am trying to calculate charges in road FO for each product and stage. For example, Stage 1 with 10 tons of Product1 and Stage 2 with 3 tons of Product2. Each ton is a separated FU. Rates are: Product1 = 5$ per ton, Product2 = 7$ per ton. So I want to get something like this:
Stage1 = 10 * 5= 50
Stage2 = 3 * 7 = 21$
How can I set rate tables and calculation sheets to do it in that way?
Request clarification before answering.
Hi all,
I think this is part of the SAP standard solution. There isn't any enhancement required at all.
Set your calculation profile to Stage level and set your calculation sheet (charge type) at Calculation Resolution Base Product and it will works. Via Calculation Rules tab in the Rate Table you can define a rule for the price per Ton as per your requirement.
You can refer to below OSS Note:
https://launchpad.support.sap.com/#/notes/2522134
BR,
Rene
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Georgiy,
when I see your requirement, Product1 = 5$/ton and product 2 = 7$/ton. I would use resolution base "item" because you need to have one charge line for each product. if you have no other criterion such as destination location, you can use a calc base ZTONS_PER_ITEM. To calculate the tons per item, you can use a helper class (coding). The coding shall read GRO_WEI_VAL (gross weight) on item level.
you must then create a rate table with two criteria: product and tons per product and also assign calc base tons_per_product as calculation rule.
Just in case you have another criterion which is stage-based, I have had a case where I had to calculate the number of pallets on the stage because the rate depended upon the destination location. To calculate the number of tons per stage, I would use an enhancement helper class assigned to a new calc base ZSTAGE_TONS. Then, I would create a rate table which would have the calc base product and the stage tons as criteria. To bring the product on stage level, you also have to use an enhancement to fill the product on stage level. what I do not like about this solution is that you could have 2 different products on the same stage and then, your solution does not work. The solution with the items would work as I can loop over all stages and sum the number of tons for each product regardless on which stage it is. In all cases, you must also assign ZSTAGE_TONS to the rate table as calc rule. This is the prerequisite that the amount is multiplied per ton. To link stage and product via coding, you can use the destination location. I repeat, stage level only works if there is just one product per destination (stage).
I have attached the place where you have to assign the calc rules and the coding of a helper class which calculates the weight per stage:
METHOD /scmtms/if_tcc_calc_base~get_calc_base_values.
DATA:
lo_context TYPE REF TO /scmtms/cl_tcc_tsps_context.
FIELD-SYMBOLS:
<ls_calc_base_key> TYPE /scmtms/if_tcc_bus_data_acc=>ty_calc_base_key,
<ls_calc_base_value> TYPE /scmtms/if_tcc_bus_data_acc=>ty_calc_base_value,
<ls_comm_root> TYPE /scmtms/s_tcc_comm_root,
<ls_request_data> TYPE /scmtms/if_tcc_engine=>ty_request_data.
READ TABLE it_requests ASSIGNING FIELD-SYMBOL(<fs_requests>) INDEX 1 .
CHECK <fs_requests> IS ASSIGNED.
LOOP AT it_calc_base_keys ASSIGNING FIELD-SYMBOL(<fs_calc_base_key>).
IF <fs_calc_base_key>-calc_base_name = 'Z_WEIGHT_STAGE'.
READ TABLE ct_calc_base_values ASSIGNING FIELD-SYMBOL(<fs_calc_base_value>)
WITH TABLE KEY calc_base_key = <fs_calc_base_key>.
IF <fs_calc_base_value> IS ASSIGNED.
DATA lt_root_key TYPE /bobf/t_frw_key.
REFRESH lt_root_key.
APPEND VALUE #( key = <fs_requests>-root_key ) TO lt_root_key.
/scmtms/cl_tor_helper_read=>get_tor_data(
EXPORTING
it_root_key = lt_root_key
IMPORTING
et_stop = DATA(lt_stops)
et_stop_succ = DATA(lt_stop_succ)
et_all_items = DATA(lt_all_items)
et_root = DATA(lt_root) ).
DATA(lv_stage_key) = CONV /bobf/conf_key( <fs_calc_base_key>-res_base_key-res_base_id ).
READ TABLE lt_stop_succ INTO DATA(ls_stop_succ) WITH KEY key = lv_stage_key.
IF sy-subrc = 0.
READ TABLE lt_stops INTO DATA(ls_stop) WITH KEY key = ls_stop_succ-succ_stop_key.
IF sy-subrc = 0.
CLEAR <fs_calc_base_value>-qty_value_num.
LOOP AT lt_all_items INTO DATA(ls_all_items) WHERE des_loc_idtrq = ls_stop-log_locid AND item_cat = 'PRD'.
<fs_calc_base_value>-qty_value_num = <fs_calc_base_value>-qty_value_num + ls_all_items-gro_wei_val.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
You can use Calculation Base for the charge type as "Stage" in your Calculation Sheet. Rate table of the charge type have rates for each product.
This will make the charge type to populate twice - one for 50$ and another for 21$
Hope it answers your query.
Thanks,
Karthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Split your FUs by the product. You can set that up in your FUBR.
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 | |
| 16 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.