Query 결과 출력 함수 “RRW3_GET_QUERY_VIEW_DATA”

BW Query 결과를 받을 수 있는 RFC Function

 

1. 함수 설명 : http://benxbrain.com/en/sap/functiongroup/RRW3/RRW3_GET_QUERY_VIEW_DATA.htm

 

2. 파라미터 설명 : http://help.sap.com/saphelp_nw04/helpdata/en/07/ff413a3ace7022e10000000a11402f/frameset.htm

 

3. I_T_PARAMETER 설정위한 코드

[#M_더보기|접기|

 

1. 단일 변수

  cond-name   =  ‘VAR_NAME_1’ 
  cond-value  = ‘ZVAR1’.    “변수ID
  APPEND cond TO parameters.

 

  cond-name   =  ‘VAR_VALUE_EXT_1’ 
  cond-value  = zlar.    “변수값
  APPEND cond TO parameters.

 

 

2. 복수 단일  변수

단일변수를 인덱스로 구성해서 사용 가능.

 

<——— 확인필요 ——>

LOOP AT t_prctrgrp.
lv_index = sy-tabix.
CONCATENATE ‘VAR_NAME_3’          lv_index  INTO  lv_var.
CONCATENATE ‘VAR_OPERATOR_3’      lv_index  INTO  lv_op.
CONCATENATE ‘VAR_VALUE_LOW_EXT_3’ lv_index  INTO  lv_value.
CONCATENATE ‘VAR_SIGN_3’          lv_index  INTO  lv_sign.

 

  gs_input-cond-name   = lv_var.
  gs_input-cond-value  = ‘ZVAR1’.
  APPEND cond TO parameters.

 

  gs_input-cond-name   = lv_op.
  gs_input-cond-value  = ‘EQ’.
  APPEND cond TO parameters.

 

  gs_input-cond-name   = lv_value.
  gs_input-cond-value  = zvalue.
  APPEND cond TO parameters.

 

  gs_input-cond-name   = lv_sign
  gs_input-cond-value  = ‘I’.
  APPEND cond TO parameters.
ENDLOOP.

<———————>

 

3. 간격 단일 변수

  cond-name   =  ‘VAR_NAME_4’ 
  cond-value  = ‘ZVAR1’.    “변수ID
  APPEND cond TO parameters.

 

  cond-name   =  ‘VAR_VALUE_LOW_EXT_4’ 
  cond-value  = zlar_low.    “변수값
  APPEND cond TO parameters.

 

  cond-name   =  ‘VAR_VALUE_HIGH_EXT_4’ 
  cond-value  = zlar_high.    “변수값
  APPEND cond TO parameters.

 

_M#]

 

4. Sample Code : http://support.neptune-software.com/support/articles/126059-read-sap-bw-queries-for-use-in-neptune

5. 관련 함수 : RRX_VARIABLES_FLUSH –> RRX_GRID_CMD_PROCESS


5. 참고(Class를 통해 Query 결과 출력)

[#M_더보기|접기|

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: wa_var type RRX1_s_VAR.

data: i_var TYPE RRX1_T_VAR.

 

 

create object r_request

exporting i_genuniid = ‘0S50SHFPJAOR2F9MZC9FGMUFE’

Get your genuniid from table rsrrepdir

 

*Now set your variables if nessecary:

*wa_var-vnam = ‘MYVARIABLE’.

*wa_var-sign = ‘I’.

*wa_var-OPT = ‘EQ’.

*wa_var-LOW = ‘ABC’.

*append wa_var to i_var.

 

try.

r_request->VARIABLES_SET( i_t_var = i_var ).

*r_request->variables_submit( ).

r_request->read_data( ).

 

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

 

r_dataset->refresh( i_version = 1 ).

 

catch cx_rsr_x_message into zcx_message.

catch cx_root into zcx_root.

 

endtry.

출처 : http://scn.sap.com/thread/15164

_M#]