cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member1013626
Participant
0 Kudos

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.

Could you please help where I have gone wrong?

Regards,
Draksh

Accepted Solutions (1)

Accepted Solutions (1)

bishwajit_das
Active Contributor
0 Kudos

Hi,

Try using the UPPERCASE as it is in BPC

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.

I wish the values that you have hard coded either doesn't match with BPC ( due to case problem or mis-spell ).

Check this out as its something very minor.

Regards,

Bishwajit


former_member1013626
Participant
0 Kudos

Hi Das,

  You are right. When I test the function at SE37, the system is converting lower to higher case but when I pass lowercase in the program at SE38, it does not. So, passing in CAPS as parameters has returned the result correctly.

Thanks all,

Regards,
Draksh

Answers (1)

Answers (1)

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

What is the error/dump info ?

Regards.

former_member1013626
Participant
0 Kudos

Hi Roseberg,

  It returns an empty table as output displayed int the ALV report. When I run the function, the input parameters are passing through, the error is at

       er_data = lr_data.

     ASSIGN lr_data->* TO <lt_dim_mbr>.

of the function.



I have added the below code to see the result in an ALV report.

" Show transaction data via ALV

DATA: lo_table TYPE REF TO cl_salv_table.

DATA: lo_functions TYPE REF TO cl_salv_functions.

TRY.

  cl_salv_table=>factory( IMPORTING r_salv_table = lo_table

* CHANGING t_table = <lt_query_result> ).

CHANGING t_table = ltt_result ).

  lo_functions = lo_table->get_functions( ).

  lo_functions->set_all( abap_true ).

  lo_table->display( ).

  CATCH cx_salv_msg.

ENDTRY.


Regards,

Draksh

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

I do not have the required data elements so I cannot duplicate your error.

Things to try:

Use constants as parameters for example:

Constants: c_DIM_NAME TYPE  UJ_DIM_NAME value 'acct_pl' .

  call function 'ZBPC_GETDIM_MASTER'

  EXPORTING

    DIM_NAME = c_DIM_NAME

           

regards.    

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Is it OK to pass lower case ?

How the data is stored in the tables ?

Regards.