on 12-20-2014 7:38 AM
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:
ID | Types | CHAR32 | |
PROP | Types | CHAR32 |
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What is the error/dump info ?
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
13 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.