2014 Dec 12 11:51 AM
Hi,
We have situation where we would like a rate to be executed twice within the same billing period, but in two time slices.
Example:
The rate ZPRCCALC is used to calculate the commodity price for an installation, for the billing period
This rate is executed at the installation level.
Rate type ZPRICE_DYN, is maintained in the installation fact
Rate category Z_DYN_CUST is used in the installation header time slice
Rate determination has been defined for the rate type and rate category, and has the rate ZPRCCALC inside
We are in a situation where, for the month of October, there are two different prices applicable
01.10.2014-15.10.2014 Price1
16.10.2014-31.10.2014 Price2
I have tried the below methods to see whether the correct prices are returned
Method 1:
Updated the code in ZPRCCALC to create two time slices in the output operand
Result:
Billing terminates as soon as I update the first time slice to the output operand. (Macro used:mac_output_ioper)
Error log has the following details "The time slice of the outbound step does not cover the time slice of
the target step."
Method 2:
Time sliced the rate type installation fact.
Instead of having 01.10.2014-31.10.2014 ZPRICE_DYN
I changed it to
01.10.2014-15.10.2014 ZPRICE_DYN
16.10.2014-31.10.2014 ZPRICE_DYN
But the rate is getting executed just once! For 01.10-31.10! It is as if SAP merges the time slices.
Result:
Billing works fine but ZPRCCALC is executed just once, for the whole time slice instead of twice.
So, the output operand has just once price, for the whole period
Method 3:
Time slice the rate type installation fact, just as in method 2
Updated ZPRCCALC code to create two time slices in the output operand
Result:
Same error as method 1.
Can someone please let me know what I am missing here.
Should I add period control to the variant? Is there any other configuration that needs to be maintained?
Regards,
Joshua.
2014 Dec 12 1:56 PM
Hi Joshua,
Can you please tell the input and output operand categories.
And if possible the source code, probably as an attachment. Would help in analysis.
Cheers,
Rakesh. .
sapisurdg.wordpress.com
2014 Dec 12 2:16 PM
Hi Rakesh,
There are no input operands. The single output operand has category FACTOR.
Also there is no variant or period control.
I can see that inside the macro there is a check performed whether the "From timeslice contains the into-timeslice"(Copied the text from the comment in the source code. Source code in a standard subroutine), for FACTORs. But is this fixable by a note or a configuration or may be a different macro?
Also the code is very simple, so adding it right here.
Everything till the macro execution works fine. Inside the macro billing terminates with the error from my first post.
*Logic to fill in the prices into table i_prices
*i_prices has the below structure
* ab TYPE isu2a_out_oper-ab
* bis TYPE isu2a_out_oper-bis
* qnt_new TYPE isu2a_out_oper-qnt_new
loop at i_prices.
out_oper-ab = i_prices-ab.
out_oper-bis = i_prices-bis.
out_oper-qnt_new = i_prices-qnt_new.
out_oper-qnt_old = i_prices-qnt_new.
mac_output_ioper x_op-o1.
endloop.
i_price is a table with header line and has the below data inside
01.10.2014 15.10.2014 0.5 0.5
16.10.2014 31.10.2014 0.23 0.23
Thanks.
2014 Dec 12 3:21 PM
Hi Joshua,
Thanks for the information.
Can you try having an input parameter in the variant for the price to be maintained in the facts.
so your time slice cause of price change would come in directly in the table with 2 line items.
That should work for you.
Hope this helps.
Cheers,
Rakesh. .
sapisurdg.wordpress.com
2014 Dec 12 3:57 PM
Thank you very much Rakesh.
Let me try that. Seems like it will work. But will update you after my attempt.