cancel
Showing results for 
Search instead for 
Did you mean: 

Query Exit

former_member205400
Active Participant
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

former_member205400
Active Participant
0 Kudos

That is an awesome answer and it solved my problem.

Do you happen to know where I can get information about the Local Interfaces and the importing objects?

""Local Interface:

*" IMPORTING

Former Member
0 Kudos

Some help on Customer Exit Variables from the documantation

<a href="http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a56f5e09411d2acb90000e829fbfe/frameset.htm">Customer Exit Variables</a>

Additionally set an external Breakpoint in the code and look at the values passed to the parameters.

Rishi

Answers (0)