Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Query Exit

I'm trying to implement a customer exit in a query.

For example I have an exit that uses hard coded values like:

*" IMPORTING

*" REFERENCE(I_VNAM) TYPE RSZGLOBV-VNAM OPTIONAL

*" REFERENCE(I_T_VAR_RANGE) TYPE RRS0_T_VAR_RANGE OPTIONAL

*" REFERENCE(I_VARTYP) TYPE RSZGLOBV-VARTYP OPTIONAL

*" REFERENCE(I_IOBJNM) TYPE RSZGLOBV-IOBJNM OPTIONAL

*" REFERENCE(I_S_COB_PRO) TYPE RSD_S_COB_PRO OPTIONAL

*" REFERENCE(I_S_RKB1D) TYPE RSR_S_RKB1D OPTIONAL

*" REFERENCE(I_S_RKB1F) TYPE RRO01_S_RKB1F OPTIONAL

*" REFERENCE(I_THX_VAR) TYPE RRO01_THX_VAR OPTIONAL

*" EXPORTING

*" VALUE(E_T_RANGE) TYPE RSR_T_RANGESID

*" EXCEPTIONS

*" UNKNOWN_VARIABLE

*" UNEXPECTED_VARTYPE

*" INVALID_PERIV

*" VARIABLE_INITIAL

*" NO_REPLACEMENT

*" NO_PROCESSING

*"----


"note1: the variable mwhtest1 must be n the query and set as follows:

" General: processing by: customer exit

" Details: not ready for input

"note2: information about table RSZGLOBV

" vnam is the variable included in the query, e.g. MWHTEST1

" iobjnm is the characteristic the variable is attached to, e.g. ZDEPT_NO

" vartyp is the type of variable, i.e. characteristic, text, formula

DATA: L_S_RANGE TYPE RSR_S_RANGESID,

mydept(4) TYPE c.

case i_vnam.

when 'MWHTEST1'.

mydept = '0010'.

l_s_range-low = mydept.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

mydept = '0014'.

l_s_range-low = mydept.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

mydept = '0016'.

l_s_range-low = mydept.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

endcase.

You can see from this example that the values for the query restrictions are being hardcoded here 10,14,16.

What I'd like to do is put in some code that gets all the values from a infocube or dso that pulls values dynamically between a range.

So something like:

" need some kind of iport statement i think

*" REFERENCE(I_INFO_PROV) TYPE RSINFOCUBE OPTIONAL

"--- select from master data table .. in this case from a DSO

select DISTINCT /BIC/ZDEPT_NO from /BIC/AZEDWDEPT00

into table l_th_zcdept

where /BIC/ZDEPT_NO > '0009'

and /BIC/ZDEPT_NO < '0017'.

"read the table and append the values

LOOP AT l_th_zcdept.

l_s_range-low = ZDEPT_NO.

l_s_range-sign = 'I'.

l_s_range-opt = 'EQ'.

APPEND l_s_range TO e_t_range.

ENDLOOP.

Does this make any sence?

Any help is appreciated, points awarded.

Former Member
Former Member replied

Use this if you want to include dept nos only from the table

l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.

select DISTINCT /BIC/ZDEPT_NO from /BIC/AZEDWDEPT00
  into l_s_range-low
  where /BIC/ZDEPT_NO > '0009'
  and /BIC/ZDEPT_NO < '0017'.
    APPEND l_s_range TO e_t_range.
endselect.

Use this if you want only the range

l_s_range-sign = 'I'.
l_s_range-opt = 'BT'.
l_s_range-low = '0010'.
l_s_range-high = '0016'.
APPEND l_s_range TO e_t_range.

Rishi

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question