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: 

display error message and hold the transaction ??

Former Member
0 Kudos
131

Hi,

I am checking if user has entered value in a required field !! If he has not, I want to hold the transaction, display an error message until he enters a value in that field.

How to achieve this ??

can i have the steps and statements , please ??

thanks

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
84

If you are using a selection-screen....

at selection-screen.

if p_field is initial.
message e001(00) with 'Hey, fill in this field'.
endif.

Regards,

Rich Heilman

0 Kudos
84

If you are using a dynpro, then its pretty much the same. Add a MODULE in your flow logic.

FIELD P_FIELD MODULE_CHECK_PFIELD.

In you ABAP program, do something like this.

MODULE_CHECK_PFIELD.

if p_field is initial.
message e001(00) with 'Hey, fill in this field'.
endif.

ENDMODULE.

Regards,

RIch Heilman

0 Kudos
84

Hi,

A little more:

You can also use this so that the cursor stays on p_field field on the scree.

at selection-screen on p_field.

if p_field is initial.

message e001(00) with 'Hey, fill in this field'.

endif.

Cheers,

Bhanu

former_member181962
Active Contributor
0 Kudos
84

Hi Rad,

If it is already a required field, then why do we need to handle this separately. Required fields have this property already embedded in SAP.

If the user doesn't enter a value, then SAP throws an error.

However, whatver fellow sdn members suggested is equally valid for all the fields(mandatory or otherwise).

Regards,

Ravi