This website is not affiliated with, sponsored by, or approved by SAP AG.

Modify selection made in BEX query variable.

Business Warehouse

Moderators: Snowy, thx4allthefish

Modify selection made in BEX query variable.

Postby Quentin Cook » Thu Sep 23, 2010 9:42 am


Could anyone tell me if the following is possible and if it is how do I do it?

I would like to create customer exit BEX variable which allows the user to enter some text. The customer exit would then use the text to produce a list of employees whose name contains the input text. The variable should then use this list to filter the query to just those employees in the list.

I know I could create a variable with "Variable Represents" option set to "Selection option" which would allow me to do pattern matching but doing matching in this way is case sensitive. If I could do the code myself I could make it non case specific.

I can produce the list but the variable ignores any changes you make to the table which holds the selection the user made.


Quentin Cook
Posts: 8
Joined: Fri Nov 24, 2006 6:07 am
Location: England

Re: Modify selection made in BEX query variable.

Postby 2bwornot2bw » Thu Dec 09, 2010 4:49 pm

Its been a while since i have done anything that involved but basically you need 2 varaibles. a text variable with user entry (emp_name) and an exit variable against your employee characteristic (emp_list) that allows multiple values.
when the query is run you would enter the character string into the emp_name; then the exit vaiable will read the entered text string from memory ( LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'EMP_NAME' [I_STEP = 2 should catch it] ). Then you would open up the text table for your employee characteristic (maybe /BI0/TEMPLOYEE); loop through the entire table comparing the user entered EMP_NAME string as a substring of the text field in /BI0/TEMPLOYEE. (You will probably want to shift both to upper case - and you will have to decide whether you will search all text lengths or just one). As you find matches you will need to append the associated employee number into the L_S_RANGE-LOW field of the EMP_LIST variable. then you say "ta-daa".
there are a few watch-outs, that i can think of; mostly associated with someone entering a bad string: clean out bad characters, decide what a null text string means (either no employees or all employees), there may be an upper limit to how many employee numbers can be moved into the variable L_S_RANGE, do you accept wild card entries (i'd suggest "no")
when in danger or in doubt, run in circles, scream and shout.
Posts: 127
Joined: Mon Aug 09, 2004 10:56 am
Location: you ess eh

Return to Business Warehouse

Who is online

Users browsing this forum: No registered users and 7 guests


This website is not affiliated with, sponsored by, or approved by SAP AG.