Execute BW Query Using Abap Part I
Execute BW Query Using Abap Part I
FUNCTION y_execute_query.
*"---""Local Interface:
*" IMPORTING
*" VALUE(QUERY_NAME) TYPE CHAR50
*" EXPORTING
*" VALUE(XML_OUT) TYPE STRING
*" TABLES
*"
QUERY_VARIABLES STRUCTURE RRX_VAR
*"
RETURN STRUCTURE BAPIRET2 OPTIONAL
*"
META STRUCTURE ZBW_QUERY_OUTPUT_METADATA OPTIONAL
*" EXCEPTIONS
*"
BAD_VALUE_COMBINATION
*"
USER_NOT_AUTHORIZED
*"
UNKNOWN_ERROR
*"
QUERY_NOT_FOUND
*"----
data
TYPE-POOLS: rrx1 .
DATA: r_request TYPE REF TO cl_rsr_request.
DATA: r_dataset TYPE REF TO cl_rsr_data_set.
DATA: zcx_message TYPE REF TO cx_rsr_x_message.
DATA: zcx_root TYPE REF TO cx_root.
DATA: lcount TYPE i .
DATA: xcount TYPE i .
DATA: wa_var TYPE rrx1_s_var.
DATA: i_var TYPE rrx1_t_var.
DATA: wa_axis LIKE LINE OF r_dataset->n_sx_version_20a_1-axis_data .
DATA: wa_axis_info LIKE LINE OF r_dataset->n_sx_version_20a_1-axis_info .
DATA: wa_chars LIKE LINE OF wa_axis_info-chars .
DATA: wa_cell LIKE LINE OF r_dataset->n_sx_version_20a_1-cell_data .
TRY.
r_request->variables_set( i_t_var = i_var ).
r_request->variables_start( ).
r_request->read_data( ).
wa_chars-chanm
MATCH OFFSET moff
MATCH LENGTH mlen.
IF sy-subrc EQ 0 .
off = moff + mlen .
SHIFT wa_chars-chanm LEFT BY off PLACES .
ENDIF .
CLEAR: iobj_return .
REFRESH : iobj_return .
this BAPI(Z_BAPI_IOBJ_GETDETAIL) is a copy of BAPI_IOBJ_GETDETAIL without the authority
check
with the following code commented out
CALL METHOD cl_rsd_iobj=>authority_check
EXPORTING
i_iobjnm
= infoobject
i_activity
= rssb_c_auth_actvt-display
EXCEPTIONS
user_not_authorized = 1.
IF sy-subrc <> 0.
bapi_syserror.
EXIT.
ENDIF.
LOOP AT iobj_details .
is_fieldcat-fieldname = iobj_details-infoobject .
IF is_fieldcat-fieldname+0(1) EQ '0' .
SHIFT is_fieldcat-fieldname LEFT BY 1 PLACES .
ENDIF .
is_fieldcat-datatype = iobj_details-datatp.
is_fieldcat-outputlen = iobj_details-outputlen .
is_fieldcat-scrtext_l = iobj_details-textlong.
APPEND is_fieldcat TO it_fieldcat.
CLEAR : is_fieldcat .
ENDLOOP .
IMPORTING
e_axis_data = wa_axis_data
e_cell_data = wa_CELL_DATA.
Can you also tell me how to pass to i_t_parameter , if i want to use a date range.
Thanks in advance.
Regards,
Sumanth
Rithesh Vijayakrishnan in response to Rithesh Vijayakrishnan on page 11
6 Aug, 2007 3:26 AM
Hi,
Rithesh Vijayakrishnan
5 Aug, 2007 11:56 PM
Hi,
I am using your method to execute queries from ABAP. But I have a query where i need to filter the
characteristics in the 'Rows' using variables. When i put these cahracteristics in 'Filter' section I am able to
pass the variables from ABAP. But when the restriction is applied in Rows am not able to pass the variables. is
there any way to do this ?
Thanks,
Durairaj Athavan Raja in response to Rajeev Kapur on page 11
9 Jul, 2007 11:57 PM
if you want all data you can leave the input value blank.
however i am not sure about patterns like
value = abc* as VAR_OPERATOR_I doesnt support CP (contains pattern)
Rajeev Kapur in response to Tony Cromwell on page 11
9 Jul, 2007 7:27 PM
Hi,
Function Module (RRW3_GET_QUERY_VIEW_DATA) is working for us as well, however when i use an
asterisk it does bring the data. Please can you post the resolution for the same.
Regards and Thanks
Rajeev
Tony Cromwell
27 Jun, 2007 8:34 AM
Hi Athavan,
I think your FM is great...
But I'm facing a problem with this TABLES parameter
QUERY_VARIABLES
LIKE
RRX_VAR