Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

selection option help

Former Member
0 Likes
730

hello friends,

my declaration for input of company code is like below:

s_bukrs FOR t001-bukrs OBLIGATORY.

now its allowing me to enter manually the company code or

i can choose from the F4 help.

but my requirement is that, user shopuld not be allowed to

manually enter the compcode,

but he should be allowed to choose from the F4 help.

had any oe face this situation earlier.

plz help.

thank you.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
708

Hi,

Do Validation on the Select options.. I dont think you can get this way.

select-options : s_matnr for mara-matnr.

at selection-screen.

select single * from mara where matnr in s_matnr.

if sy-subrc ne 0.

message

endif.

6 REPLIES 6
Read only

Former Member
0 Likes
709

Hi,

Do Validation on the Select options.. I dont think you can get this way.

select-options : s_matnr for mara-matnr.

at selection-screen.

select single * from mara where matnr in s_matnr.

if sy-subrc ne 0.

message

endif.

Read only

Former Member
0 Likes
708

Do validation for the company code

Read only

Former Member
0 Likes
708

Hi Sanjana,

The requirement needs to be slightly changed and you need to check if the value entered exists in database. What I mean to say is that if the user manually enters the value, it needs to be checked for existence in the corresponding table.

You can do this validation (check) in the even AT SELECTION-SCREEN.

Here at this event the value is checked for the existence in dB and then is allowed to go further else an error can be thrown back.

Here goes the code to help you.

*data declaration.

v_bukrslow type knvv-bukrs.

v_bukrshigh type knvv-bukrs.

at selection-screen.

IF s_bukrs-low IS NOT INITIAL.

SELECT SINGLE bukrs

FROM knvv

INTO v_bukrslow

WHERE bukrs = s_bukrs-low.

IF v_bukrslow IS INITIAL.

MESSAGE 'Low Value doesnot exist' TYPE 'E'.

ENDIF.

ENDIF.

IF s_bukrs-high IS NOT INITIAL.

SELECT SINGLE bukrs

FROM knvv

INTO v_bukrshigh

WHERE bukrs = s_bukrs-high.

IF v_bukrshigh IS INITIAL.

MESSAGE 'High Value doesnot exist' TYPE 'E'.

ENDIF.

ENDIF.

ENDIF.

This should solve your query and set you sail.

Reward points if useful.

Thanks,

Tej..

Read only

Former Member
0 Likes
708

hi sanjana,

try with Fm's like F4IF_INT_TABLE_VALUE_REQUEST, F4IF_FIELD_VALUE_REQUEST

F4IF_FIELD_VALUE_REQUEST

This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three

parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.

CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'

EXPORTING

TABNAME = table/structure

FIELDNAME = 'field name'

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNR

F4IF_INT_TABLE_VALUE_REQUEST

This FM is used to dsiplay values stored in an internal table as input

help.This FM is used to program our own custom help if no such input help

exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD

is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.

If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = field from int table whose value will be returned

DYNPPROG = SY-CPROG

DYNPNR = SY-DYNNR

DYNPROFIELD = 'screen field'

VALUE_ORG = 'S'

TABLES

VALUE_TAB = internal table whose values will be shown.

RETURN_TAB = internal table of type DDSHRETVAL

EXCEPTIONS

parameter_error = 1

no_values_found = 2

others = 3.

with regards,

Suresh Babu Aluri.

DYNPROFIELD = 'screen field'

IMPORTING

RETURN_TAB = table of type DYNPREAD

Read only

Former Member
0 Likes
708

hi sanjana,

SELECT-OPTIONS s_burkst001-bukrs

FOR <f> MATCHCODE OBJECT <search_help>.

I hope thhe following code would help your problem.

Have a check with this code.

Reply Back.

Regards,

Praveen.

Read only

Former Member
0 Likes
708

Hi

I don't think what you require is possible. There are two options which you can implement:

1. You can let the user enter any value and then run a validation code whether the company code exists or not.

2. Use F4 help for the field. This will save you of validation codes also.