cancel
Showing results for 
Search instead for 
Did you mean: 

Validating User-typed Input Against the Associated TextEdit's SearchHelp

mike_mcinerney
Participant
0 Kudos

I have a textEdit element which is tied to a searchHelp.

The user can select a valid value from the searchHelp.

They can also just type in a value rather than selecting one.

Is there a single method/fm that will tell me if the value selected could have been returned by the SH.

(I'm not worried about what inputs the user may have entered on the SH, just could the value have been returned?)

Simple Example.

Custom SearchHelp : ZSHCURR1  returns a list of selectable currencies

The user can select one from the searchhelp. 

Let's say USD is in the list and GBP is not.

I'm looking for a fm/method. like is_value_allowable below,  that will  return a boolean

is_value_allowable( 'ZSHCURR1' ,  'USD' ) returns TRUE

is_value_allowable( 'ZSHCURR1' ,  'GNP' ) returns FALSE

Does anyone know of a simple, existing, piece of wrapped functionality for doing this?

Thanks...

...Mike

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Mike,

Search helps can pull their values from a database table or view and may also have an exit which alters the records returned by the search help. So I don't know of any function module or method that performs a check as cleanly as you've described.

You could write your own procedure to do this though using something like function module F4_FIELD_ON_VALUE_REQUEST. It is possible to call this function module and receive a table of all possible results. You could then read the table for the proposed value to see if it is a legal value.

CALL FUNCTION 'F4_FIELD_ON_VALUE_REQUEST'
     EXPORTING
       tabname                   = space
       fieldname                 = space
       searchhelp                = '
ZSHCURR1'
       suppress_recordlist = abap_true
     TABLES
       return_tab                 = return_tab
     EXCEPTIONS
       OTHERS                    = 5.

Cheers,

Amy

mike_mcinerney
Participant
0 Kudos

Hi Amy,

Thanks.  And yes, you've summarized exactly our need.  We have many exit'd  searchHelps that we want to validate - some simple, some more complex.  Hence the question, is_value_allowable( ).  Still looking for some magic but I may just have to build some...

...Mike

Answers (1)

Answers (1)

Former Member
0 Kudos

i don't know any FM but you can achieve using search help import and export parameter

go through below link

http://scn.sap.com/docs/DOC-32686

create one more attribute and set it when you choose from search help. you can use this attribute in your logic