Quantcast
Channel: SCN : Discussion List - SAP Planning and Consolidation, version for SAP NetWeaver
Viewing all articles
Browse latest Browse all 5414

Z-Function to read BPC master data does not return when called from a program

$
0
0

Hi Experts,

  I have created a function and it is returning correct values when tested at se37. But when I call the function from a SE38 Executable program, it throws into error.

Below is the function module:

FUNCTION ZBPC_GETDIM_MASTER.

*"----------------------------------------------------------------------

*"*"Local Interface:

*"  IMPORTING

*"     REFERENCE(DIM_NAME) TYPE  UJ_DIM_NAME

*"     REFERENCE(APPSET_ID) TYPE  UJ_APPSET_ID

*"     REFERENCE(H_NAME) TYPE  UJA_S_HIER-HIER_NAME OPTIONAL

*"     REFERENCE(ATTR_NAME) TYPE  UJ_ATTR_NAME

*"  TABLES

*"      E_LT_RESULT STRUCTURE  ZDIMMBR

*"  RAISING

*"      CX_UJA_ADMIN_ERROR

*"      CX_SY_REF_IS_INITIAL

*"----------------------------------------------------------------------

 

 

DATA:

       lv_appset_id TYPE uj_appset_id VALUE 'CATHAY', "appset reference

       lo_dim TYPE REF TO if_uja_dim_data, "object reference

       ls_hier_info TYPE uja_s_hier,

       lt_hier_name TYPE uja_t_hier_name,

       ls_attr_list TYPE uja_s_attr,

       lt_attr_name_dim TYPE uja_t_attr_name,

       lr_data TYPE REF TO data,

       o_exception TYPE REF TO cx_uja_admin_error,

       lt_result TYPE TABLE OF ZDIMMBR.

 

 

FIELD-SYMBOLS: <lt_dim_mbr> TYPE HASHED TABLE.

 

"object creation

TRY.

lo_dim = cl_uja_admin_mgr=>create_dim_ref( i_appset_id = lv_appset_id

                                            i_dim_name = DIM_NAME ).

*Choosing attributes of the dimension to be read.

*If we want to read only two Attributes “Country” and “Area” & Hierarchy from GEOGRAPHY Dimension, then

*take out those attributes and put them in table lt_attr_name_geo and lt_hire_name.

if not h_name is INITIAL.

ls_hier_info-hier_name =

H_NAME.

APPEND: ls_hier_info-hier_name TO lt_hier_name.

ENDIF.

 

ls_attr_list-ATTRIBUTE_NAME =

ATTR_NAME.

APPEND: ls_attr_list-attribute_name TO lt_attr_name_dim.

 

*Retrieving dimension member

 

   CALL METHOD lo_dim->read_mbr_data

   EXPORTING

     if_ret_hashtab = abap_true

     it_attr_list = lt_attr_name_dim "columns:attributes name list

     it_hier_list = lt_hier_name    "columns:hierarchies name list

     IMPORTING

 

       er_data = lr_data.

     ASSIGN lr_data->* TO <lt_dim_mbr>.

 

 

  E_LT_RESULT[] = <lt_dim_mbr>.

 

 

CATCH cx_uja_admin_error INTO o_exception.

ENDTRY.

 

ENDFUNCTION.



Below is the structure of ZDIMMBR:

IDTypesCHAR32
PROPTypesCHAR32

 

Below is the calling SE38 Executable program

 

REPORT ZTEST.

data:

       "Output(import) parameters

      ltt_result TYPE STANDARD TABLE OF ZDIMMBR,

       ls_result TYPE ZDIMMBR.

 

 

"initialization of the function.

  call function 'ZBPC_GETDIM_MASTER'

  EXPORTING

    DIM_NAME = 'acct_pl'

    APPSET_ID = 'cathay'

    H_NAME = 'parenth1'

    ATTR_NAME = 'qty'

  TABLES

   E_LT_RESULT = ltt_result.

 

When I test the function at SE37 as below I get the result.

Function_test.png

 

Could you please help where I have gone wrong?

 

Regards,
Draksh


Viewing all articles
Browse latest Browse all 5414

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>