Skip to Content
0
Apr 17, 2012 at 04:13 AM

Calling BW query in ABAP function module

768 Views

Hi Experts,

My requirement is to retrieve data from BW query. The selection screen of BW query contains sold-to party (select-option) and fiscal year (parameter).

The query returns gross sales figures for sold-to party in specified fiscal year.

When tried executing query using the function module 'RRW3_GET_QUERY_VIEW_DATA', the sy-subrc is returned 5 (Invalid input).

The parameters are filled as follows:

gs_parameters-name = 'VAR_NAME_2'.

gs_parameters-value = '0P_CALYE'.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_SIGN_2'.

gs_parameters-value = 'I'.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_OPERATOR_2'.

gs_parameters-value = 'EQ'.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_VALUE_LOW_EXT_2'.

gs_parameters-value = '2011'.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_VALUE_LOW_2'.

gs_parameters-value = '2011'.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_VALUE_HIGH_EXT_1'.

gs_parameters-value = iv_year.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

* Sold to party

gs_parameters-name = 'VAR_NAME_1'.

gs_parameters-value = 'VSDVD_0SOLD_TO_MS'.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_SIGN_1'.

gs_parameters-value = 'I'.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_OPERATOR_1'.

gs_parameters-value = 'BT'.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_VALUE_LOW_EXT_1'.

gs_parameters-value = iv_kunnr.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_VALUE_LOW_1'.

gs_parameters-value = iv_kunnr.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_VALUE_HIGH_EXT_1'.

gs_parameters-value = iv_kunnr.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

gs_parameters-name = 'VAR_VALUE_HIGH_1'.

gs_parameters-value = iv_kunnr.

APPEND gs_parameters TO gt_parameters.

CLEAR gs_parameters.

When used the function module 'RRX_GRID_CMD_PROCESS', the selection screen parameters of BW query are not populated as specified.

l_s_var-vnam = '0P_CALYE'.

l_s_var-vartyp = '1'.

l_s_var-vparsel = 'P'.

l_s_var-sign = 'I'.

l_s_var-opt = 'EQ'.

l_s_var-low = iv_year.

l_s_var-low_ext = iv_year.

APPEND l_s_var TO l_t_var.

l_s_var-vnam = 'VSDVD_0SOLD_TO_MS'.

l_s_var-vartyp = '1'.

l_s_var-vparsel = 'S'.

l_s_var-sign = 'I'.

l_s_var-opt = 'EQ'.

l_s_var-low = iv_kunnr.

l_s_var-low_ext = iv_kunnr.

APPEND l_s_var TO l_t_var.

Please help me resolve the issue with either of specified function modules.