cancel
Showing results for 
Search instead for 
Did you mean: 

Calendar Month Interval to view Opening and Closing Stock

Former Member
0 Kudos

Hi,

I have a requirement as stated below.

I want to view data from From( Calendar Month) - To (Calendar Month).

I want to view data for Opening Stock and Closing Stock.

To make it clear, please find example below.

User selection screen 04.2013 - 05.2013 i.e. April to May.

Opening stock= March Closing Stock

Closing Stock= May Closing stock

kindly revert back with your views.

April to Dec

Opening stock= March Closing Stock

Closing Stock= December Closing stock

Thanks

Shyam.V

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member182470
Active Contributor
0 Kudos

Hi,

Step 1: Create a Calmonth variable and make it as interval

Step 2: Go to your Opening Stock KF definition and drag your calmonth-->right click-->restrict-->create variable by replacement path, reference char : calmonth-->Replacement path tab: replace with variable(which you created in step1)-->Replace with External Char value Key-->Offset Start FROM--> Don't keep anything in Length

Step 3: Finally put offset value as -1 for the step 2 variable

Step 4: Repeat Step 2 by changing Offset Start TO. Don't put  any off set value and assign this variable to Closing Stock KF

Note: If above steps doesn't work for you, you may go with CMOD code as per other experts

Regards,

Suman

former_member182470
Active Contributor
0 Kudos

Did you try my approach without any code?

Former Member
0 Kudos

Hi Suman,

I have tried without code but it is retrieving the following error at selection screen of Analyser when I'm supplying the parameters as 04.2008 - 04.2008.

Value '04.200' of characteristic 0CALMONTH is not a number with 000006 spaces

anshu_lilhori
Active Contributor
0 Kudos

Hi,

Did you try with my code ?

Please update.

Regards,

AL

former_member182470
Active Contributor
0 Kudos

Have you selected "External Char value Key" in your replacement path variable? Don't keep any offset length. Hope you have followed all my steps as per my earlier reply.

Try entering 04.2013 - 05.2013. It should work with my steps.

I feel that 04.200 means totally 6 characters including dot (.). Try running by 201304 - 201305.. and let me know the result

Regards,

Suman

Former Member
0 Kudos

Hi Al,

I have tried the below code for Closing stock but is retrieving higher results.

WHEN 'ZMRPFC_INTVL_CEXIT'.

DATA: lv_calmn TYPE /bi0/oicalmonth.

LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = '0I_CALMO'.

          CLEAR: l_s_range, lv_calmn.

          lv_calmn = loc_var_range-high.

l_s_range-low = 'lv_calmn'.

  l_s_range-sign = 'I'.

  l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

CLEAR : l_s_range.

ENDLOOP.

Former Member
0 Kudos

Hi Suman,

I have tried providing different options but I'm getting the same error.

Thanks

Shyam V

anshu_lilhori
Active Contributor
0 Kudos

Hi,

So is it working perfectly for opening stock ?

For closing stock i can identify some issue with the code :

WHEN 'ZMRPFC_INTVL_CEXIT'.--------Cmod variable should be of sinlge value

DATA: lv_calmn TYPE /bi0/oicalmonth.

LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = '0I_CALMO'.--- User input should be of type interval.

   CLEAR: l_s_range, lv_calmn.

  lv_calmn = loc_var_range-high.

l_s_range-high = 'lv_calmn'.

  l_s_range-sign = 'I'.

  l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

CLEAR : l_s_range.

ENDLOOP.

Regards,

AL

former_member182470
Active Contributor
0 Kudos

If you enter 201304 - 201305, how will you get same error? It is impossible.

Hope you have not understood my previous reply. Please follow it, your problem will be resolved.

Former Member
0 Kudos

Hi Suman,

I have tried all the options as stated above but I'm not getting the desired output.

Thanks

Shyam V

former_member182470
Active Contributor
0 Kudos

Please select Key in place of External Char Value Key in replacement path tab. Then, you will not get that error. I tried in my system. It's working.

You can run as usual by 04.2013 - 05.2013

Create two variables, One is with Use Interval : FROM and other with TO in the replacement path.

For your Closing Stock KF, Create a char variable  like below :

                  

For Opening Stock KF, create one more char variable by selecting FROM Value under Use Interval in replacement path tab.

Please put offset -1 for first KF and offset is not required for second one. Just restrict with the  second variable.

No coding is required to achieve your report.

anshu_lilhori
Active Contributor
0 Kudos

Did you try my code?

Former Member
0 Kudos

Hi Suman,

Thank for your quick response.

I have tried the same steps as stated above.

I'm not getting any error at user entry but I'm not getting desired output.

Thanks

Shyam V

former_member182470
Active Contributor
0 Kudos

No chance. I tried in my system and i got the result as you expected. My screen shot is for Closing stock kf. Similarly you need to create with FROM VALUE for opening stock.

I am 100% confident that my approach will give you accurate result.

Note : Hope you know How to say THANKS in scn when any reply helps you..

Former Member
0 Kudos

Hi Suman,

Thanks for your reply.

PFA screenshots for the same.

I have followed all the steps mentioned by you.

I'm getting negative values for both opening and closing stock.

Screen shot 1

Screenshot 2

Screenshot 3

Thanks

Shyam V

former_member182470
Active Contributor
0 Kudos

Why are you restricting your KF with calmonth range variable? This is absolutely wrong. Range variable has to be in filter.

You have to restrict your Opening Stock KF with the 1st replacement variable what you created for it by FROM.

Sijmilarly restrict your closing stock KF with 2nd replacement variable what you created by TO values.

So you have not understood what i explained clearly in my previous replies.

You need to create two variable s for open stock( with FROM Values) and closing stock( TO values).

Restrict your 2 KFs with the above variables respectively.

I can't explain you any more. You are not understanding the SCN culture. WHen any contributor is spending lot of time on your issue, you should have minimum courtesy to encourage us by the way to say thanks in scn. It is not just english word thanks.

Former Member
0 Kudos

I have restricted with replacement variable only.

Ignore the naming convention as specified in the restricted column. Calendar Month ( Interval,To,)

For my understanding , I have kept Interval as description.

I know the pain in answering to my question.

As I could not resolve my problem, I'm repeatedly providing you some hints to resolve the problem.

former_member182470
Active Contributor
0 Kudos

I have patiently explained last night also the same. How I am able to achieve in my system? I am not a magician. I just did as per my latest reply. I got it...You say you didn't get it.

You don't confirm whether you created 2 variables for KF1 and KF2?

Former Member
0 Kudos

Hi,

Kindly provide me code for the same.

Thanks

Shyam V

anshu_lilhori
Active Contributor
0 Kudos

Hi,

The codes as follows:

DATA: lv_calmn TYPE /bi0/oicalmonth,

For Opening Stock:


WHEN 'Z_calmn'.  ---cmod variable

LOOP AT i_t_var_range INTO loc_var_range_s WHERE vnam = 'zcalmonth'.----User input variable

          CLEAR: l_s_range, lv_calmn.

          lv_calmn = loc_var_range_s-low - 1.

l_s_range_s-low = 'lv_calmn'.

            l_s_range_s-sign = 'I'.

            l_s_range_s-opt = 'EQ'.

            APPEND l_s_range_s TO e_t_range.

            CLEAR : l_s_range_s .

For closing stock:

WHEN 'Z_calmn1'.  ---cmod variable

LOOP AT i_t_var_range INTO loc_var_range_s WHERE vnam = 'zcalmonth'.----User input variable

          CLEAR: l_s_range, lv_calmn.

          lv_calmn = loc_var_range_s-high.

l_s_range_s-low = 'lv_calmn'.

  l_s_range_s-sign = 'I'.

  l_s_range_s-opt = 'EQ'.

  APPEND l_s_range_s TO e_t_range.

  CLEAR : l_s_range_s .

Hope this helps.

Regards,
AL

ravi_chandra3
Active Contributor
0 Kudos

Hi

Try to create  2 variables,

1) variable is ready for input.

     variables represents interval.

     manual input.

2) variable is not ready for input.

     variables represents interval.

     customer exit.

and then populate the data as per the requirement in e_t_range table.

anshu_lilhori
Active Contributor
0 Kudos

Hi,

Make two RKfs restrict the both with 0calmonth --variable customer exit ---single value.

Take any keyfigure and restrict with 0calmonth with the user input variable.---interval.

This will act as dummy keyfigure for user to enter the selections.

For opening stock we will capture the from value entered by the user and will do offfset of -1 in cmod.

For closing stock we will capture the to value entered by the user and pass in our second variable in cmod.

If you need help regarding the code then let me know,

Regards,

AL