Skip to Content
0
Former Member
Feb 06, 2016 at 03:25 PM

Generic Datasource using RUN_RSDRI_QUERY

295 Views

I want to write a function module to extract data from BPC to BW using a generic datasource. I want to data package the records for when there are large volumes of data. The first time the code executes, 100 records are returned. The second call fails with a runtime error in method RUN_RSDRI_QUERY on the statement "assert lo_query_engine is not initial." I am not an ABAP expert so I am stuck on why my code is failing. If I comment out the "i_packagesize = l_pack", all the BPC data is returned but I am nervous that this code will not work with large volumes of data. Can anyone provide help on how I can package the data?

Thanks.

field-symbols: <lt_data> type standard table

* First data package
IF s_counter_datapakid = 0.


*populating selection table
LOOP AT s_s_if-t_select INTO l_s_select WHERE fieldnm = 'VERSION'.
wa_sel-dimension = l_s_select-fieldnm.
wa_sel-attribute = 'VERSION'.
wa_sel-sign = l_s_select-sign.
wa_sel-option = l_s_select-option.
wa_sel-low = l_s_select-low.
APPEND wa_sel TO it_sel.
ENDLOOP.

*populating dimension table
LOOP AT i_t_fields.
IF i_t_fields-fieldnm <> 'SIGNDATA'.
ls_dim_name = i_t_fields-fieldnm.
APPEND ls_dim_name TO lt_dim_name.
ENDIF.
ENDLOOP.
l_pack = i_maxsize.
l_start = 'X'.
ENDIF.

IF l_end NE 'X'.

try.
lo_appl_mgr = cl_uja_bpc_admin_factory=>get_application_manager( i_appset_id = lv_appset_id
i_application_id = lv_application_id ).

call method lo_appl_mgr->create_data_ref
exporting
i_data_type = 'T'
it_dim_name = lt_dim_name
if_tech_name = space
importing
er_data = lo_dataref.
catch cx_uja_admin_error
cx_uj_no_auth
cx_uj_static_check. "#EC NO_HANDLER
endtry.

assign lo_dataref->* to <lt_data>.
lo_query = cl_ujo_query_factory=>get_query_adapter( i_appset_id = lv_appset_id
i_appl_id = lv_application_id ).


try.

lo_query = cl_ujo_query_factory=>get_query_adapter( i_appset_id = lv_appset_id
i_appl_id = lv_application_id ).
call method lo_query->run_rsdri_query
exporting
it_dim_name = lt_dim_name
it_range = it_sel
if_check_security = abap_false
i_packagesize = l_pack "all data is returned if I comment out this line
importing
et_data = <lt_data>
e_end_of_data = l_end
changing
c_first_call = l_start.


catch cx_ujo_read.
message text-011 type 'I'.
return.
endtry.
APPEND LINES OF <lt_data> TO e_t_data.
s_counter_datapakid = s_counter_datapakid + 1.

ELSE.
RAISE no_more_data.

ENDIF.

ENDIF.