Вы находитесь на странице: 1из 9

3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

Community

Ask a Question Write a Blog Post Login

Former Member
April 12, 2010 7 minute read

Integrated Planning – how to activate/deactivate data slice at


RUNTIME
Follow RSS feed Like

8 Likes 12,980 Views 5 Comments

Introduction
In one of my blogs (Integrated Planning – how to activate/deactivate data slice) I described how to
activate/deactivate data slice in Integrated Planning using customers Z function module called within FOX
formula. This technique usefull only for key user and requres restart of planning application, which not always
possible or suitable for planning process.
Goal
This blog describes how to activate/deactivate data slice at RUNTIME of planning function/sequence.
Scenario
Let us consider a scenario where we have records marked as LOCKED or UNLOCKED (with any infoobject) and
data slice activated on locked records. At the beginning of planning process user updates data (this data
marked as unlocked) and at the end he should lock this data by copying records to locked. The challenge is to
make possible copying to locked, because data sclice activated on locked data and planning application will give
an error. In this blog I’ll describe a solution that makes possible to deactivate data slice for speci c steps in
planning sequence.
General schema of implementation
1. Creating class which reads LOCK/UNLOCK command and according to this command our code will activate
or deactivate data slice.
2. Creating custom function type in IP based on class.
3. Creating planning function based on our custom type. This function type will send command LOCK/UNLOCK
to data slice.
4. Creating planning sequence with the next structure: Execute planning function for manipulation of locked
records. -> Activate data slice.
5. Creating data slice based on class in IP Modeler. 
Detailed implementation  
Use TCode  SE24 to de ne a custom exit class. Set superclass to CL_RSPLS_DS_EXIT_BASE class.
https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 1/9
3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

    

Create your own


method for
implementing locking
logic.

De ne parameters to the MY_DATASLICE method.


1. I_S_DATA : input data
2. E_T_MESG: messages

https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 2/9
3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

3. E_NOINPUT: A Boolean ag. If you want to protect the cell, the set this parameter to X, otherwise leave the
parameter blank.

  
Example of custom logic: You want to lock all lines that have marked “Locked” by MD of InfoObject
Z_LOCK_IND.

In method MY_DATASLICE apply following code:  


DATA: l_msg TYPE if_rspls_cr_types=>tn_s_mesg .  
IF i_s_data = ‘00001’.    
l_msg-msgid = ‘RSPLS_CR’.     l
_msg-msgty = ‘E’.    
l_msg-msgno = ‘019’.    
l_msg-msgv2 = ‘0001’.   
APPEND l_msg TO e_t_mesg.  
e_noinput = rs_c_true.  
i_s_data contains line value of IO Z_LOCK_IND. If line locked (value = 1) message appears and no input allowed
(e_noinput = true). Rede ne the standard method IF_RSPLS_DS_METHODS~IS_PROTECTED to include
bu ering and the data slice switch.

Add to this rede ned method code in appendix A.Save the class and activate it.   For writing command
LOCL/UNLOCK de ne class ZCL_MAINTAIN_DATASLICE for the switching function. Add the interface

https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 3/9
3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

IF_RSPLFA_SRVTYPE_IMP_EXEC_REF to this class.

Rede ne next methods without adding any code (just rede ne and save):
IF_RSPLFA_SRVTYPE_IMP_EXEC_REF~INIT_EXECUTION IF_RSPLFA_SRVTYPE_IMP_EXEC_REF~EXECUTE
Rede ne method IF_RSPLFA_SRVTYPE_IMP_EXEC_REF~GET_REF_DATA_SEL and add code in appendix B. In
this method you get the command from planning function (LOCK or UNLOCK) and store ti to SAP memory. This
command will be read by IS_PROTECTED method as described above. Save the class and activate it.   Create
InfoObject with master data LOCK and UNLOCK values:

Create function type for switching data slice. Use transaction RSPLF.Set the next properties in function type:

Go to the Parameter tab. Right-click the Parameter eld to add an elementary parameter called COMMAND
passed by InfoObject early created (with LOCK/UNLOCK master data).

https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 4/9
3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

Save and activate the function type.   Create planning function of type early created type for unlocking data
slice.

In parameter COMMAND select UNLOCK.

This function will deactivate data slice. Planning sequence should have next structure:
1. Deactivate the data slice.
2. Execute your function for manipulating locked records.
3. Activate the data slice (build this function similarly to deactivation function but with LOCK parameter).
Create data slice based on you own class.  Open modeler and navigate to InfoProvider – > Data Slice. Press
Cerate and choose in “Data Slice Based On” “for an exit class” parameter.
  

At “Exit Class” choose your early created custom class.

https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 5/9
3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

In “Characteristics that are restricted by the exit class” choose your characteristic(s).

Data slice should be active by default.

Save your data slice.

y_ _ _ _ _ __ g
= l_s_mesg e_noinput = o_r_protected->*. INSERT <l_s_buf> INTO TABLE
<l_th_buf>. ENDIF. e_noinput = o_r_protected->*.”fix pointer to <l_s_buf>-protected IF
e_noinput = rs_c_true AND e_t_mesg IS SUPPLIED. * o_r_s_mesg is a pointer to
‘_S_MESG’ in the buffer workarea e_t_mesg[] = l_s_mesg[]. ENDIF. ELSE. * no, do
not use the buffer, call a method that returns the * fields e_noinput and e_s_mesg CALL
METHOD my_dataslice EXPORTING i_s_data = i_s_data IMPORTING
e_t_mesg = l_s_mesg e_noinput = e_noinput. e_t_mesg[] = l_s_mesg[]. ENDIF.
ENDMETHOD. Appendix B
IF_RSPLFA_SRVTYPE_IMP_EXEC_REF~GET_REF_DATA_SEL code method
IF_RSPLFA_SRVTYPE_IMP_EXEC_REF~GET_REF_DATA_SEL. Data : l_r_param_elem
type ref to if_rsplfa_param_elem, l_unlock(10) type c. CALL METHOD i_r_param_set-
>get_param_elem EXPORTING i_param_name = ‘COMMAND’
RECEIVING r_r_param_elem = l_r_param_elem. CALL METHOD l_r_param_elem-
>GET_VALUE IMPORTING E_VALUE = l_unlock. Export COMMAND from l_unlock to
memory id ‘DATA_SLICE_LOCK’. endmethod. </body></body>

Alert Moderator

Assigned tags

Retagging required | andrey uryukin |

Related Blog Posts

We are sorry but we are currently unable to retrieve related content.

Related Questions

https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 6/9
3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

We are sorry but we are currently unable to retrieve related content.

5 Comments

You must be Logged on to comment or reply to a post.

Former Member

March 2, 2011 at 4:40 am

Hi,
I never thought about a solution like this.
This is just what I need now.
Thanks,
Matthieu

Like (0)

Former Member

March 18, 2011 at 1:36 pm

Hi,
your solution works ne, my requirement is to pass Data slice Characteristics values dynamically. Can I de ne
Variables (for data slice Chars..) if so how..?
Thanks,
Madhu

Like (0)

Former Member

September 8, 2011 at 4:13 pm

We have around 10 reports built into a web template. The selections for the web template is Region and Fiscal
Period
Each report is restricted to a particular Business Division ( lets say 1 to 10 )
Each report in the web template has a button “POST”. The requirement is when the user clicks this button, the
data in the current report should be locked. Say for example Business Divison = 5, scal Period ( selected by
User ) = 10/2011, and Region ( selected by User ) = Texas.

https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 7/9
3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

We wouldn’t know what region the user will use as a selection. We have around 40 to 50 regions and its not a
good idea to create n number of dataslices considering Region, Fiscal Period, Business Division combinations.

Hence we want a dynamic solution.


The dynamic solution should have custom data slice ( as per your web log in link 2 ) and it should operate based
on what the user has selected.

I have created 10 Filters in the modeler with single hardcoded values for Business Divison and two variable for
Region and Fiscal Period.

Intention is to use these lters and a planning function ( lock/unlock ) and use buttons to lock the data.

Is it possible to achieve above using the custom dataslice?

DV

Like (0)

Former Member

October 13, 2011 at 5:54 pm

I have the Same senario. did you able to do it. If so let me know hoe

Like (0)

Former Member

April 6, 2015 at 7:15 am

Hi,

Very Informative blog. Thanks for sharing.

Currently we are facing Authorization issues while activating and deactivating data slice for users.

The data slice gets needs to get activated and deactivated for certain planning sequences which are called in
SAP Analysis O ce 1.4 SP9 version.

The planning sequence is called by the particular user. The issue faced is that users do not have 0BI_ALL
authorizations.

Is there any particular authorization to activate and deactivate data slice? We have tried with S_RS_ICUBE auth.
But yet the issue remains.

Regards,
https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 8/9
3/25/2020 Integrated Planning – how to activate/deactivate data slice at RUNTIME | SAP Blogs

Priyanka

Find us on

Privacy Terms of Use

Legal Disclosure Copyright

Trademark Cookie Preferences

Newsletter Support

https://blogs.sap.com/2010/04/12/integrated-planning-how-to-activatedeactivate-data-slice-at-runtime/ 9/9

Вам также может понравиться