Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to provide validation for a particular field of screen

Hi Experts,

For my project, I have created a screen. In the screen, we have one field. For this field we have provided F4 help. When the user clicks on the F4 list of values is displayed.

I have to provide following condition for this field.

User should only select values from this F4 list only. If the user tries to enter any data which is not contained in the list, system should throw message that 'Invalid data. Select valid values".

Can you please let me know how I can do so?

The relevant portion of code is

CASE save_ok_code.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN 'BACK'.

PERFORM exit.

WHEN 'CANCEL'.

LEAVE PROGRAM.

WHEN 'SAVE'.

CALL FUNCTION 'MESSAGES_INITIALIZE'.

PERFORM check_batch CHANGING fl_error.

IF fl_error IS INITIAL.

PERFORM save.

IF sy-subrc EQ 0.

CLEAR gv_deleted.

PERFORM update_alv_grid_display.

***for message display

CALL FUNCTION 'MESSAGES_SHOW'.

ENDIF.

ELSE.

CALL FUNCTION 'MESSAGE_STORE'

EXPORTING

arbgb = 'ZEX_MYPROJECT'

msgty = 'S'

txtnr = '053'

msgv1 = text-008

EXCEPTIONS

OTHERS = 3.

CHECK sy-subrc = 0.

CALL FUNCTION 'MESSAGES_SHOW'.

ENDIF.

WHEN OTHERS.

CALL METHOD cl_gui_cfw=>dispatch.

I am totally new for ABAP. So, please help me out.

Thanks

Smith

Former Member
replied

then in that case you have to use Field <screenfield> module <module_name>.

in the module you check the value using the checktable/value table and accordinly give the message.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question