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: 

Validate a screen entry through message

Former Member
0 Kudos
92

Moderator message: do NOT offer points

Dear experts,

I have designed one screen containing 10 entries of 10 different fields.

One entry is for amount . I want that amount to be less than 1000.00 and if it is not so it should give message.

My logic is working fine..but the only problem is that when I make a wrong entry , it should allow me to corrrect it there and there only..

now with message type E , it disables all the fields and other entries are also to be entered again...

and with message type W and I , it is taking that as a right entry.

So which message type should I use ? Or any other alternative ?

<<text removed>>

Edited by: Matt on Nov 24, 2008 11:21 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos
65

Hi,

You can use field checks in the PAI of the screen.

The syntax is Field <fieldname> Module <check module name>. In the module you write the code to check the field and give the message with Type 'E' ie., type error then you can modify the individual field.

If that is an internal table field you can use it within LOOP and ENDLOOP.

Regards

Thabitha.

7 REPLIES 7

kesavadas_thekkillath
Active Contributor
0 Kudos
65

at selection-screen on <screen field>.

do your validation here.

Former Member
0 Kudos
66

Hi,

You can use field checks in the PAI of the screen.

The syntax is Field <fieldname> Module <check module name>. In the module you write the code to check the field and give the message with Type 'E' ie., type error then you can modify the individual field.

If that is an internal table field you can use it within LOOP and ENDLOOP.

Regards

Thabitha.

former_member1245113
Active Contributor
0 Kudos
65

If you want all the fields to be input enabled use

CHAIN

field fnam module mname on input/request

when you use FIELD key word the system delays the transfer of the values from screen to program until the checks have been validated.

ENDCHAIN.

for further help go through the KEY word documentaion.

regards

Ramchander Rao.K

Edited by: ramchander krishnamraju on Nov 24, 2008 6:23 AM

Former Member
0 Kudos
65

Use Message Type W or S and then write a STOP statement after it.

The control will remain on your Selection Screen and you will be able to make the required changes.

Former Member
0 Kudos
65

Hi,

My suggestion is you can go with message type 'E'. Check the following code:

tables: vbak, vbap.

parameters: vbeln like vbak-vbeln,

netwr like vbak-netwr. " Currency field

at selection-screen on netwr.

if netwr > 1000.

message e000(00) with 'Enter less than or equal 1000.'.

endif.

start-of-selection.

write: vbeln, netwr.

Regards,

Bhaskar

Former Member
0 Kudos
65

Hi,

In the PAI of that screen you can use CHAIN...ENDCHAIN or simply in the Module USER_COMMAND of that screen once user presses ENTER or whatever you can validate it there so once 1st field is validated it will validate 2nd and so on and in order to make the fields Editable when some Invalidation happens in that case use FM

CALL FUNCTION 'MESSAGE_TEXT_BUILD'

EXPORTING

msgid = g_msgid

msgnr = g_msgno

msgv1 = g_msgv1

IMPORTING

message_text_output = g_message.

which will extract the message text based on the message class and message no,and since you validating in the manner i mentioned above it will behave like an ERROR message but will allow you to edit.

Former Member
0 Kudos
65

For validating single field:

In PAI

field <field1> module check_field1.

" if in module u thro message of type E or W after validating. The field field1 will remain available for input.

For validating multiple fields:

In PAI

chain.

field <field1>.

field <field2>.

field <field3>.

module check_fields.

endchain.

" if in module u thro message of type E or W after validating. The all the fields mentioned within chain endchain will remain available for input.

For validating fields in Table control:

In PAI

loop at itab.

Use any of above two methods

endloop.