Application Development 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: 

Restricting input to a field

Former Member
0 Kudos

Hello Gurus,

I have created a transaction code which is linked to a view. In this view i have a character field, i want the user to enter only data in the date format or a '' in this field. Can you please tell me how will i restrict the user from entering any other data other than '' or data in the date format for this field whenever the transaction is executed. Kindly help.

Regards,

Aditya.

4 REPLIES 4

Former Member
0 Kudos

well restrict input is not possible, but you can check(validate) what the user has inputted and bring a message (e.G. type I) if he made something that your didnt wish, and return to selection screen.

Former Member
0 Kudos

hi,

by using obligatory key word u can do this.

0 Kudos

sry samba, but thats wrong.

keyword obligatory will not do any restrictions on a input parameter.

All it will do is to make the input for this field mandatory.

Former Member
0 Kudos

HI,

As Florian suggested, validation as below might help you:

PARAMETERS: p_text TYPE char8 DEFAULT '20080916'.

DATA: date TYPE datum.

AT SELECTION-SCREEN.
  IF p_text NE '*'.
    date = p_text.
    CALL FUNCTION 'RP_CHECK_DATE'
      EXPORTING
        date         = date
      EXCEPTIONS
        date_invalid = 1
        OTHERS       = 2.
    IF sy-subrc <> 0.
      MESSAGE e001(00) WITH 'Invalid Date'.
    ENDIF.
  ENDIF.

Regards

Eswar