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: 

Validations on the screen.

Former Member
0 Kudos

Hi,

I have one field in the screen that screen I have designed using screen painter. If I enter some thing in that filed first I am checking one condition like whether that is exists in table or not if not I am giving error message. It is displaying error message but it is not allowing to enter any thing on that field I mean it is showing in grey color but I want in input allow mode. Please help me where I need to put the logic and what logic I need to put for that. And one more doubt is in the another screen I am entering value in the net weight (vekp-ntgew) field but I need to validate that field in the following way

If any body enters value like 100.532 system should display error message and it can allow to enter another value in the same screen. Please help me how to resolve above problems.

Thanks a lot.

7 REPLIES 7

former_member194152
Contributor
0 Kudos

Hi,

put that field between chain and endchain and then call module according to requirement.

Regards

Gagan

Former Member
0 Kudos

Hi Babji,

Give Information or worning message so that it is allow u to enter.

Sunil.

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Former Member
0 Kudos

The module that you use for the validation should be defined as follows

FIELD screenfield ON INPUT / Request Module validation_module.

Input / Request depends on when you want the validation.

Input .... If a value is entered.

Request ... if the value is last changed .

raymond_giuseppi
Active Contributor
0 Kudos

You should execute the control in a module linked to the field on which control is executed (or group of fields), the code is in the PAI logic of the dynpro.

Sample:

   CHAIN.
    FIELD field1.
    FIELD field2.
    MODULE check_field1_2 ON CHAIN-REQUEST.
   ENDCHAIN.
   FIELD field3 MODULE check_field3 

If an error message is sent in check_field1_2, both fields (and only those) are ready for input, if an error message is sent in check_field3, only field field3 is ready for input.

Regards

Former Member
0 Kudos

Hi

You can do validation for taht field in the PAI for the fields

For multiple fields validation you can use CHAIN..ENDCHAIN

see the sample code in PAI

PROCESS AFTER INPUT.

  • Forced Exit from the transaction

MODULE exit AT EXIT-COMMAND.

  • Checking for the input fields

CHAIN.

  • Ship to Party

FIELD: t_103_tc-kunnr.

MODULE check_ship3 ON CHAIN-INPUT.

ENDCHAIN.

&----


*& Module check_ship3 INPUT

&----


  • Validation of Ship to Party on Screen 103

----


MODULE check_ship3 INPUT.

IF NOT t_103_tc-kunnr IS INITIAL.

  • Check Ship to Party in table KNA1 and KNVP

PERFORM check_ship_to_auth USING t_103_tc-kunnr

x_100-vkorg

x_100-vtweg

x_100-spart

c_ship.

ENDIF.

ENDMODULE. " check_ship3 INPUT

&----


*& Form check_ship_to

&----


  • Validation of Ship to Party/Issuing/Notification Authorities

  • in KNA1 and KNVP tables

----


FORM check_ship_to_auth USING p_kunnr TYPE kunnr

p_so TYPE vkorg

p_dc TYPE vtweg

p_div TYPE spart

p_ship TYPE parvw.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = p_kunnr

IMPORTING

output = p_kunnr.

CLEAR v_kunnr.

  • Check Ship to/Sold to/Lic Auth person Party in table KNA1

SELECT SINGLE kunnr

INTO v_kunnr

FROM kna1

WHERE kunnr = p_kunnr.

IF sy-subrc <> 0.

IF p_ship = c_ship.

MESSAGE e051 WITH 'Invalid Ship to Entered'(008).

ENDIF.

ENDFORM.

Also you can see the below examples...

Go to se38 and give demodynpro and press F4.

YOu will get a list of demo module pool programs.

One more T-Code is ABAPDOCU.

YOu can find more examples there.

See the prgrams:

DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement

DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB

http://www.geocities.com/ZSAPcHAT

http://www.allsaplinks.com/files/using_table_in_screen.pdf

To ensure that one or more PAI modules are only called when several screen fields meet a particular condition, you must combine the calls in the flow logic to form a processing chain. You define processing chains as follows:

CHAIN....ENDCHAIN.

All flow logic statements between CHAIN and ENDCHAIN belong to a processing chain. The fields in the various FIELD statements are combined, and can be used in shared conditions.

CHAIN.

FIELD: <f1>, <f 2>,...

MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST.

FIELD: <g1>, <g 2>,...

MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.

...

ENDCHAIN.

When this command is used, all of the fields on the screen that belong to the processing chain (all of the fields listed in the field statements) are made ready for input again. Other fields are not ready for input. Whenever the MODULE statement appears within a processing chain, even if there is only one FIELD attached to it, all of the fields in the chain (not only the affected field) are made ready for input again, allowing the user to enter new values. If the fields in the processing chain are only checked once, the PAI processing continues directly after the FIELD statement, and the preceding modules are not called again.

CHAIN.

FIELD: <f1>, <f 2>,...

MODULE <mod1> ON CHAIN-INPUT|CHAIN-REQUEST.

FIELD: <g1>, <g 2>,...

MODULE <mod2> ON CHAIN-INPUT|CHAIN-REQUEST.

...

ENDCHAIN.

Check this out

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabbd35c111d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_47x200/helpdata/en/d1/801ca2454211d189710000e8322d00/frameset.htm

Refer to this thread

Regards

Vasu

Former Member
0 Kudos

Hi,

1. goto layout in screen painter and double click on required field which u want to enter input, enable input field and out field in field attributes->program..

2. give information message or warning message and continue.

Former Member
0 Kudos

Hi Babji,

If your program is calling a screen, let say is CALL SCREEN 9000. Double click on the 9000, then select Flow Logic.

In the flow logic define the field inside the CHAIN statement. like this:

Code Sample:

==============================================================

Flow Logic

==============================================================

PROCESS BEFORE OUTPUT.

MODULE STATUS_9000.

PROCESS AFTER INPUT.

CHAIN.

FIELD:

Field1,

Field2,

Field3.

MODULE USER_COMMAND_9000.

ENDCHAIN.

==============================================================

Try it, it should work.

Regards,

Rayden