Skip to Content
0
Former Member
Sep 05, 2007 at 09:52 AM

Data from BI query

43 Views

Hi ,

I'm stuck on an Abap program

I have to execute a Bex Query then store the retreived data, the old logic uses classe cl_RSR_Query_variables, this doesn't exist any more.

I want to keep my logic and substitute only the type of my query variable

here it is the part of logic to modify

DATA: wf_query_var TYPE REF TO cl_rsr_query_variables .

DATA: r_request TYPE REF TO cl_rsr_request.

DATA: r_dataset TYPE REF TO cl_rsr_data_set.

MOVE: query_name TO cube_name .

  • Convert the query name to technical id

CLEAR p_genuniid .

CALL FUNCTION 'CONVERSION_EXIT_GENID_INPUT'

EXPORTING

input = query_name

IMPORTING

output = p_genuniid.

IF p_genuniid IS INITIAL .

RAISE query_not_found .

ENDIF.

  • Create instance of cl_rsr_request

CREATE OBJECT r_request

EXPORTING i_genuniid = p_genuniid .

  • Create instance of cl_rsr_variables

i_var[] = query_variables[] .

CREATE OBJECT wf_query_var

EXPORTING

i_r_request = r_request

i_t_nvar = i_var

EXCEPTIONS

user_not_authorized = 1

no_processing = 2

bad_value_combination = 3

x_message = 4

OTHERS = 5.

IF sy-subrc <> 0.

CASE sy-subrc .

WHEN 1 .

RAISE user_not_authorized .

WHEN 3 .

RAISE bad_value_combination .

WHEN OTHERS .

RAISE unknown_error .

ENDCASE .

ENDIF.

  • Set the variable and execute the query

TRY.

r_request->variables_set( i_t_var = i_var ).

r_request->variables_start( ).

r_request->read_data( ).

r_dataset = cl_rsr_data_set=>get( i_r_request = r_request ).

.....

Thanks for any suggestion