cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

execute query using RFC

former_member182510
Participant
0 Likes
3,006

Hello Experts,

I have a scenario where I have to execute 1 query with 1 user entry variable using an RFC, for that I used RFC - RS_VC_GET_QUERY_VIEW_DATA_FLAT, I have created the required report which should get executed through this rfc. I have SAP BW 3.5 SP 17.

I assigned all the required parameters like cube name, report name and in i_t_parameter gave values like, user entry variable name and value to be passed.

I tried executing using following option

user entry variable optional with single value - rfc returned all values from the cube instead of giving only 1 record pertaining to the input given.

E_T_TEXT_SYMBOLS table in the output is saying input entry variable in empty.

user entry variable mandatory with single value - rfc shown an error - enter appropriate value for user entry variable.

when I executed bex query with both the above mentioned types of variables, I received result for only the given output.

input value is restricted in the query designer and then query executed using rfc, output was correct with only 1 row.

Please guide me if anyone has encountered the similar scenario or tell me which all values i should give in I_T_PARAMETER table to get the desired output.

Thanks & Regards,

Priyanka Joshi

Edited by: Priyanka J Joshi on Mar 23, 2011 9:38 AM

View Entire Topic
Former Member
0 Likes

Hi

Try using FM RRW3_GET_QUERY_VIEW_DATA

Here is link explaining how to use it.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0865602-9f77-2d10-759c-fe1e0b1ac...

Hope this helps.

Regards

Sudeep

former_member182510
Participant
0 Likes

Hello Sudeep,

I tried as per the pdf u shared but my problem is, when am passing value for particular field, result is coming out for the complete data set. Value given for the field is not considered in FILTER value. How do I make it work?

Regards,

Priyanka Joshi

Former Member
0 Likes

Hi

check by running query manuaaly if query itself works ok.

if query run ok then try using debuggin if you encounter any error during execution.

But i would suggest check query first.

Regards

Sudeep

former_member182510
Participant
0 Likes

Hello Sudeep,

query when executed in BEx works fine, gives output only for the given input value.

Regards,

Priyanka Joshi

Former Member
0 Likes

Hi

have you tried debugging code you have written?

can you share your code here ?

Regards

Sudeep

former_member182510
Participant
0 Likes

Hello Sudeep,

I tried debugging my code, i_t_parameter table shows the passed parameter but when fm gets called again same thing happens, as complete data set comes.

here is my code.

data: t_i_parameter type RRXW3TQUERY,

t_axis_info type RRWS_THX_AXIS_INFO,

t_cell_data type RRWS_T_CELL,

t_axis_data type RRWS_THX_AXIS_DATA,

t_final_output type table of ZPROJECTCARD_OUTPUT,

t_input type table of ZPROJECTCARDNO.

data: w_i_infoprovider type RSINFOPROV,

w_i_query type RSZCOMPID,

w_i_parameter like line of t_i_parameter,

w_axis_info like line of t_axis_info,

w_cell_data like line of t_cell_data,

w_axis_data like line of t_axis_data,

w_final_output like line of t_final_output,

w_input like line of t_input.

w_i_infoprovider = 'ZINRA'.

w_i_query = 'ZINRA_RATI_REPORT1'.

    • Fill the internal table of parameters to pass 1 project card no.

w_i_parameter-name = 'VAR_NAME_1'.

w_i_parameter-value = 'ZPS_SITE'.

append w_i_parameter to t_i_parameter.

clear w_i_parameter.

w_i_parameter-name = 'VAR_SIGN_1'.

w_i_parameter-value = 'I'.

append w_i_parameter to t_i_parameter.

clear w_i_parameter.

w_i_parameter-name = 'VAR_OPERATOR_1'.

w_i_parameter-value = 'EQ'.

append w_i_parameter to t_i_parameter.

clear w_i_parameter.

w_i_parameter-name = 'VAR_VALUE'.

w_i_parameter-value = ZPROJECT_CARD.

append w_i_parameter to t_i_parameter.

clear w_i_parameter.

    • FM to fetch the query data

CALL FUNCTION 'RRW3_GET_QUERY_VIEW_DATA'

EXPORTING

I_INFOPROVIDER = w_i_infoprovider

I_QUERY = w_i_query

  • I_VIEW_ID =

I_T_PARAMETER = t_i_parameter

IMPORTING

E_AXIS_INFO = t_axis_info

E_CELL_DATA = t_cell_data

E_AXIS_DATA = t_axis_data

  • E_TXT_SYMBOLS =

EXCEPTIONS

NO_APPLICABLE_DATA = 1

INVALID_VARIABLE_VALUES = 2

NO_AUTHORITY = 3

ABORT = 4

INVALID_INPUT = 5

INVALID_VIEW = 6

OTHERS = 7

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.