cancel
Showing results for 
Search instead for 
Did you mean: 

IP: activate/deactivate dataslice at runtime

Former Member
0 Kudos

Hi all,

I would like activate/deactivate data slices at run time of a query in order to show users data and update them with planning functions but not with user input.

In detail I would like to create a planning sequence containing the following function:

- FOX1 to call the dataslice exit to DEACTIVATE the specific dataslice

- FOX2 modifying the data

- FOX3 to call the dataslice exit to ACTIVATE the specific dataslice

In sdn I've found threads BPS --> IP Dataslice question... ( ) in wich Gregor Dieckmann suggests of customizing class CL_RSPLS_DS_EXIT_BASE and callback his method on planning function.

Unfortunaly there isn't an example, can anyone give me some example?

Best Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Ricardo,

here is a first set of ABAP code. It is not final yet, but almost (for example exporting parameter of Z-function is not needed) ... We tested the function indiviually with SE37 and that works fine. In combination with the FOX formula we still encounter a problem (which deals with the automatic code generation of the FOX itself -> OSS in process). Additionally some coding for checking the dataslice itself

please keep in touch on your progress regarding this issue

regards

D

FUNCTION z_ip_activate_dataslice.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(I_ACTIVE) TYPE STRING OPTIONAL

*" EXPORTING

*" REFERENCE(I_RESULT) TYPE STRING

*" RAISING

*" CX_SY_STRUCT_ATTRIBUTES

*"----


TABLES: rspls_ds,rspls_ds_field.

DATA: l_s_ds TYPE rspls_s_ds.

DATA: l_dsnr TYPE if_rspls_ds_types=>tn_dsnr.

DATA: l_ts_iobj TYPE if_rspls_ds_types=>tn_ts_iobj.

DATA: r_r_instance TYPE REF TO if_rspls_dataslice.

DATA: lv_noinput TYPE rs_bool.

DATA: if_rspls_ds_exit TYPE REF TO zip_cl_rspls_ds_exit_base.

DATA: l_r_data_slice TYPE REF TO zip_cl_rspls_ds_exit_base.

DATA: i_clsname TYPE seoclsname.

DATA: l_r_ex TYPE REF TO cx_rspls_failed.

DATA: l_t_dsfield TYPE rspls_t_ds_field.

DATA: l_s_iobj TYPE if_rspls_ds_types=>tn_s_iobj.

DATA: ls_data TYPE c.

DATA: lt_rspls_ds_field TYPE TABLE OF rspls_ds_field.

DATA: ls_rspls_ds_field TYPE rspls_ds_field.

DATA: ls_rspls_ds TYPE rspls_ds.

SELECT SINGLE * FROM rspls_ds

INTO ls_rspls_ds

WHERE infoprov = 'ZPCA_C01P'

AND dstype = 'E'.

IF NOT ls_rspls_ds IS INITIAL.

SELECT * FROM rspls_ds_field

INTO TABLE lt_rspls_ds_field

WHERE infoprov = 'ZPCA_C01P'.

ENDIF.

LOOP AT lt_rspls_ds_field INTO ls_rspls_ds_field.

MOVE ls_rspls_ds_field-iobjnm TO l_s_iobj-iobjnm.

INSERT l_s_iobj INTO TABLE l_ts_iobj.

ENDLOOP.

CALL METHOD zip_cl_rspls_ds_exit_base=>if_rspls_ds_exit~get_instance

EXPORTING

i_basic_prov = 'ZPCA_C01P'

i_dsnr = ls_rspls_ds-dsnr

i_ts_iobj = l_ts_iobj

i_clsname = 'ZIP_CL_RSPLS_DS_EXIT_BASE'

RECEIVING

r_r_instance = r_r_instance.

l_r_data_slice ?= r_r_instance.

  • export meldingen

CALL METHOD l_r_data_slice->if_rspls_ds_methods~is_protected

EXPORTING

i_s_data = i_active

IMPORTING

e_noinput = lv_noinput.

I_RESULT = 'X'.

METHOD if_rspls_ds_methods~is_protected.

----


  • --> i_s_data data record, the values for infoobjects from

  • n_ts_fields are set, the rest is initial

  • <-- e_t_mesg messages

  • <-- e_noinput flag, records is protected or not

----


DATA:

dref TYPE REF TO data,

ls_bi_param TYPE zbi_param.

DATA: l_s_mesg TYPE if_rspls_cr_types=>tn_s_mesg.

FIELD-SYMBOLS:

<lv_period> TYPE /bi0/oifiscper3,

<lv_version> TYPE /bi0/oiversion,

<lv_year> TYPE /bi0/oifiscyear,

<ls_s_data> TYPE ANY.

CLEAR e_t_mesg.

      • create required data objects ************************************

CREATE DATA dref LIKE i_s_data.

ASSIGN dref->* TO <ls_s_data>.

CHECK sy-subrc = 0.

      • assign values ***************************************************

ASSIGN COMPONENT:

'FISCPER3' OF STRUCTURE <ls_s_data> TO <lv_period>,

'VERSION' OF STRUCTURE <ls_s_data> TO <lv_version>,

'FISCYEAR' OF STRUCTURE <ls_s_data> TO <lv_year>.

CHECK sy-subrc = 0.

MOVE-CORRESPONDING i_s_data TO <ls_s_data>.

CASE i_active.

WHEN ' '.

IF <lv_year> < sy-datum(4).

e_noinput = rs_c_true.

ELSEIF <lv_year> = sy-datum(4).

e_noinput = rs_c_false.

SELECT SINGLE * FROM zbi_param

INTO ls_bi_param

WHERE zkey1 = 'DATA_SLICE'

AND zkey2 = 'VERSION'

AND zkey3 = <lv_version>.

CASE ls_bi_param-zdata1.

WHEN 'FQ1'.

CHECK <lv_period> BETWEEN 1 AND 3.

e_noinput = rs_c_true.

WHEN 'FQ2'.

CHECK <lv_period> BETWEEN 1 AND 6.

e_noinput = rs_c_true.

WHEN 'FQ3'.

CHECK <lv_period> BETWEEN 1 AND 9.

e_noinput = rs_c_true.

WHEN 'BUD'.

e_noinput = rs_c_true.

ENDCASE.

ENDIF.

WHEN 'D'.

e_noinput = rs_c_true.

WHEN 'A'.

e_noinput = rs_c_false.

ENDCASE.

IF e_noinput = rs_c_true AND e_t_mesg IS SUPPLIED.

l_s_mesg-msgid = 'ZBW'.

l_s_mesg-msgno = '002'.

l_s_mesg-msgty = 'S'.

APPEND l_s_mesg TO e_t_mesg.

ENDIF.

ENDMETHOD.

Former Member
0 Kudos

Hi Dries,

thanks for your helpfull example.

I've developed abap class and function modules.

I execute function module (from SE37) but it fails for a wrong value of importing parameter I_ACTIVATE. Can you give me an example of I_ACTIVATE value?

Thanks a lot

Former Member
0 Kudos

we use 'D' to deactivate, and 'A' to activate. This is mentioned in the FOX formula

You can also see this in the code of the exit of the dataslice itself (_protected). If the method protected is called standard (without the FOX) the IACTIVE paramter will be initial, if it is called from FOX it will either have D or A.

D

Former Member
0 Kudos

Hi Dries,

In method code you use follow parameters:

- I_ACTIVE to define action (to activate/deactivate dataslice);

- I_S_DATA to store data record;

In FM code you call method is_protected and assign I_ACTIVATE at parameter I_S_DATA.

For this reason when I execute FM the system generate an error.

Regards

Former Member
0 Kudos

Hi,

did you add I_ACTIVE TYPE STRING as import parameter in your Z-function?

In the mean time, we implemented note 1230042 and the error when generating the FOX formula has been solved ... My code now is ok and the FOX function did not generate any errors anymore.

here my code of the function:

function z_ip_activate_dataslice.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(I_ACTIVE) TYPE STRING OPTIONAL

*" VALUE(I_INFOPROV) TYPE RSINFOPROV OPTIONAL

*" RAISING

*" CX_SY_STRUCT_ATTRIBUTES

*" CX_RSPLS_FAILED

*"----


tables: rspls_ds,rspls_ds_field.

data: l_s_ds type rspls_s_ds.

data: l_dsnr type if_rspls_ds_types=>tn_dsnr.

data: l_ts_iobj type if_rspls_ds_types=>tn_ts_iobj.

data: r_r_instance type ref to if_rspls_dataslice.

data: lv_noinput type rs_bool.

data: if_rspls_ds_exit type ref to zip_cl_rspls_ds_exit_base.

data: l_r_data_slice type ref to zip_cl_rspls_ds_exit_base.

data: i_clsname type seoclsname.

data: l_r_ex type ref to cx_rspls_failed.

data: l_t_dsfield type rspls_t_ds_field.

data: l_s_iobj type if_rspls_ds_types=>tn_s_iobj.

data: ls_data type c.

data: lt_rspls_ds_field type table of rspls_ds_field.

data: ls_rspls_ds_field type rspls_ds_field.

data: ls_rspls_ds type rspls_ds.

select single * from rspls_ds

into ls_rspls_ds

where infoprov = i_infoprov

and dstype = 'E'.

if not ls_rspls_ds is initial.

select * from rspls_ds_field

into table lt_rspls_ds_field

where infoprov = i_infoprov.

endif.

loop at lt_rspls_ds_field into ls_rspls_ds_field.

move ls_rspls_ds_field-iobjnm to l_s_iobj-iobjnm.

insert l_s_iobj into table l_ts_iobj.

endloop.

try.

call method zip_cl_rspls_ds_exit_base=>if_rspls_ds_exit~get_instance

exporting

i_basic_prov = i_infoprov

i_dsnr = ls_rspls_ds-dsnr

i_ts_iobj = l_ts_iobj

i_clsname = 'ZIP_CL_RSPLS_DS_EXIT_BASE'

receiving

r_r_instance = r_r_instance.

catch cx_rspls_failed into l_r_ex.

raise exception l_r_ex.

endtry.

l_r_data_slice ?= r_r_instance.

  • export meldingen

call method l_r_data_slice->if_rspls_ds_methods~is_protected

exporting

i_s_data = i_active

importing

e_noinput = lv_noinput.

endfunction.

IMPORT parameters of function:

I_ACTIVE TYPE STRING

I_INFOPROV TYPE RSINFOPROV

EXCEPTIONS:

CX_SY_STRUCT_ATTRIBUTES

CX_RSPLS_FAILED

D

0 Kudos

Hi,

just a little remark: Don't 'pollute' the interface method 'is_protected'.

1. Create a public attribute n_active in your implementation of the dataslice. Or if you like set/get methods better, create a private attribute p_active and create set/get methods for this attribute in your implementation of the data slice.

2. To set the attribute simply call

...

l_r_data_slice->n_active = i_active.

...

3. In your implementation check the current value of your attribute, e.g. n_active, e.g. like this

...

check n_active is not initial.

or use a 'case' statement if you need a more fine granular logic as Dries' example.

Regards,

Gregor

Former Member
0 Kudos

Do you really need to do this though dataslices? You could simply say a certain key figure can be changed through planning functions but not through user input. That can be configured in the query at the key figure's properties.

Good luck anyway.

Former Member
0 Kudos

Hallo Dries,

I am faced the same problem here and want to simply set my data slice to active or inactive in productiv system directly instead of doing it in dev.system and transport it to productiv.

There is a table you are using in your code provided here it is called zbi_param. Could you please give me some information about how this table should look like with which structure?

Thanks and regards,

Alians