Custom IP Planning Function Types

Read c_th_data record

you can still use read table with key. The trick is to copy the values from the block characteristics I_S_BLOCK_LINE into a structure your ls_data and change and adapt the structure according to your needs. Then you can use  the read table into ls_data2 from ls_data. This way it will work.  < add example>

You can find an example e.g. in CL_RSPLFC_DISTR_KEY method IF_RSPLFA_SRVTYPE_IMP_EXEC~EXECUTE. Add the end of the code p_r_distribution->distribute is called. In this method you can find an example:

READ TABLE c_th_data ASSIGNING <s_data2> FROM <s_distr_data>.

So you are using the hashed key and fill the values you are looking for into  <s_distr_data>.

Reference data

http://scn.sap.com/thread/1756926

Messages in Planning Function Type methods
See note 1815440 – Planning funtion relevant information messages are suppressed in BW 7.3x and not suppressed in BW 7.0x

See SCN forum post on the subject http://scn.sap.com/message/14064844

Just create a Message and use the method i_r_msg->add_msg( ) to return it.

E,A,X messages are always displayed on the Web or BEx Analyzer. Other messages are suppressed by default as of BW 7.3 , unless you flag them as problem class “Very High”. This works as of SP7 or via Note 1653610.

To flag a message as “Very High” pass ‘1’ as parameter in the add_msg method

Error message:

MESSAGE E001(rsplf) WITH l_msg INTO l_msg.
i_r_msg->add_msg( ).  " No need to mention problem class

Warning or info message

MESSAGE W001(rsplf) WITH l_msg INTO l_msg.
i_r_msg->add_msg( '1'  ).  " Mention '1' as problem class
MESSAGE I001(rsplf) WITH l_msg INTO l_msg.
i_r_msg->add_msg( '1'  ).  " Mention '1' as problem class

Passing parameters

Elementary Types:

Example: Passing a 0VERSION value via a BEx variable.

1) In RSPLF1 / Parameter: create a parameter: parameter = VERSION, description = Version, parameter type = Elementary
Structure Parameters = leave empty, Parameter is Tabluar = unchecked, InfoObject = 0VERSION, Copy InfoObject Text = unchecked
Internal Default Val = leave empty, Variables allowed = checked

2) Create a PF using the planning function type. Assign a version value or a variable

3) In the code of the Planning Function Type class  ( in execute method for example)

DATA:
l_r_version type ref to if_rsplfa_param_elem,
l_version type /bi0/oiversion.

" Get version from parameter elementary "VERSION"
l_r_version = i_r_param_set->get_param_elem( 'VERSION' ).
l_r_version->get_value( importing e_value = l_version ).

Objects in INIT_EXECUTION

  1. Use i_r_infoprov object. Get the list of objects with  methods get_infoprov , get_t_charnm and get_t_keyfnm of i_r_infoprov_desc.  See CL_INM_FUNC_TYPE_CALC_PRODCOST->INIT_EXECUTION as example.
  2. Use i_r_msg. Returns  error messages in object i_r_msg.  See CL_INM_FUNC_TYPE_CALC_PRODCOST->INIT_EXECUTION as example.
  3. Use i_r_srv object. Provides info on the calling planning function via methods below. Check CL_INM_FUNC_TYPE_DEL_LCKD_VERS as example.
  • i_r_srv->get_name()
  • i_r_srv->GET_TEXT()
  • i_r_srv->GET_SRVTYPENM()
  • i_r_srv->GET_INFOPROV()
  • i_r_srv->GET_TAB_CHAR_USAGE()
  • i_r_srv->GET_PARAM_SET_RULES()
  • i_r_srv->GET_ADMIN_INFO()
  • lt_param_set_rules = i_r_srv->get_param_set_rules( ).
    Ex:
    lr_param_set = ls_param_set_rule-r_param_set.
    lt_param_keyfigures = lr_param_set->get_tab_param_struc( ‘KEYFIGURES’ ).
    lr_param_target_data_sel = lr_param_set->get_param_data_sel(‘CHA_VALUES’).

Use i_r_infoprov.

METHOD if_rsplfa_srvtype_imp_exec~init_execution.
mv_execute_pf = abap_true.
mv_infoprovider = i_r_infoprov_desc->get_infoprov( ).
mt_charnm = i_r_infoprov_desc->get_t_charnm( ).
mt_keyfnm = i_r_infoprov_desc->get_t_keyfnm( ).

* Make sure all necessary Characteristics are provided by the InfoProvider:
is_cha_included( iv_cha = '0MATERIAL' ir_msg = i_r_msg ).
is_cha_included( iv_cha = '0INM_PQUNIT' ir_msg = i_r_msg ).
is_cha_included( iv_cha = '0UNIT' ir_msg = i_r_msg ).

* Make sure all necessary Keyfigures are provided by the InfoProvider:
is_kyf_included( iv_kyf = '0AMOUNTFX' ir_msg = i_r_msg ).
is_kyf_included( iv_kyf = '0AMOUNTVR' ir_msg = i_r_msg ).
is_kyf_included( iv_kyf = '0INM_PDQTY' ir_msg = i_r_msg ).
is_kyf_included( iv_kyf = '0INM_PDCOST' ir_msg = i_r_msg ).
is_kyf_included( iv_kyf = '0INM_LOTSIZ' ir_msg = i_r_msg ).

ENDMETHOD.

Use i_r_msg.

data: lv_dummy type char100.
MESSAGE ID 'INM_PPA' TYPE 'E' NUMBER 001
WITH iv_cha mv_infoprovider
INTO lv_dummy.
ir_msg->add_msg( ).

Leave a Reply