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

Field validation

Former Member
0 Likes
1,229

Hi all,

I need to validate a field which has got F4 help. The field is accepting values which are in the f4 help value list.It is also accepting values other than the f4 help values(values typed by the user), which it should not. How do i make it not to accept values which are not f4 help values.

Thanks.

1 ACCEPTED SOLUTION
Read only

former_member787646
Contributor
0 Likes
1,163

Hi

If it is a selection screen then you can add the "VALUE CHECK" addition to the PARAMETER:

Eg.. Parameters: VBELN TYPE VBAK-VBELN VALUE CHECK.

Hope it helps.

Murthy

8 REPLIES 8
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,163

Hello,

Can you tell which field you are trying to validate in the selection-screen?

BR,

Suhas

Read only

0 Likes
1,163

Hello

Try this.


*----------------------------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR selection_screen_field_name.
*-----------------------------------------------------------------------
*----------------------------------------------
  CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
    EXPORTING
      object_type           = 'type'
      object_name           = selection_screen_field_name
      suppress_selection    = 'X'
      use_alv_grid          = ''
      without_personal_list = ''
    IMPORTING
      object_name_selected  = selection_screen_field_name
    EXCEPTIONS
      cancel                = 1.

Thanks

Anirudh Saini

Read only

Former Member
0 Likes
1,163

Activity code(COBL-VORNR)

Read only

Former Member
0 Likes
1,163

Hi,

You will be selecting list of values to be populated in F4 help. populate that in to temporary internal table and validate the value selected in the screen with that of the temp internal table.

Thanks & Regards,

Madhu

Read only

Former Member
0 Likes
1,163

One way is you can create dropdown but if values are many then it will be very lenthy.

Other way you can set validation in that field but of course only after entering value, I think there is no way to accept only those values from the user which are there in f4 help.

Regards

Bikas

Read only

former_member787646
Contributor
0 Likes
1,164

Hi

If it is a selection screen then you can add the "VALUE CHECK" addition to the PARAMETER:

Eg.. Parameters: VBELN TYPE VBAK-VBELN VALUE CHECK.

Hope it helps.

Murthy

Read only

Former Member
0 Likes
1,163

I would recommend you to use below method to validate screen fields.

AT-SELECTION SCREEN.

Select * From <table> where <field_name> IN <s_screen_field>.

IF sy-subrc <> 0.

message e000(ZRAM) with 'Please enter correct input'.

ENDIF.

rgds

rajesh

Read only

Former Member
0 Likes
1,163

Hi,'

In such cases best to use drop down list, but if the list is too big then no point in using it.

In such case we can write a query and validate :

AT-SELECTION SCREEN.

Select *

From mara

where matnr IN s_matnr.

into table i_itab.

IF sy-subrc 0.

message e001(zz1) with 'Please enter correct input'.

ENDIF.

hope this helps you.

thanx,

dhanashri.