How To Make A Mandatory Fields Using ABAP

When you create a field in ABAP whether it’s using SELECT-OPTIONS or PARAMETERS and want to make the field to be mandatory, then you can use the keywords WITH OBLIGATORY.
Here’s the ABAP sample code to implement this keyword.
Z_REPORT_MANDATORY_FIELD.
tables:
kna1.
data:
t_kna1 type TABLE OF kna1 WITH HEADER LINE.
SELECT-OPTIONS:
p_kunnr for kna1-kunnr OBLIGATORY.

START-OF-SELECTION.
select * into table t_kna1 from kna1 where
kunnr in p_kunnr.
LOOP AT t_kna1.
WRITE :/ t_kna1-name1, t_kna1-land1.
ENDLOOP.
When you run the program and execute it without selecting the KUNNR field then it will prompt you the message to “Fill in all required entry fields”
sap mandatory field
sap mandatory field

Subscribe in a reader

Comments

0 Responses to "How To Make A Mandatory Fields Using ABAP"

Post a Comment

Stay Updated