Application Development and Automation 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: 
Read only

validate data while entering on the screen in module pool

Former Member
0 Likes
3,330

Sir,

I wish to validate the entries done on screen.How to do so plz guide.

Thanks & Regards

Vibhuti

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,704

hi vibhuti

if it is dialog program put all the filelds in the chain endchain like this

chain

fileds :

module validatefields

endchain.

module validatefilelds

select .....................

command

endmodule

if it is selection-screen

at selection secreen

perform validation

form validation

select commands......................

endform

it may the answer

5 REPLIES 5
Read only

Former Member
0 Likes
1,704

u can do field validations using chain--endchain.

ex: CHAIN.

FIELD KNA1-KUNNR.

MODULE USER_VAL.

ENDCHAIN.

Read only

Former Member
0 Likes
1,704

in PAI.

CHAIN.

FIELD V_MATNR.

FIELD QTY.

Module validate_data.

ENDCHAIN.

Module validate_data.

if qty > 10.

message 'Enter qty less than 10 !' type 'E'.

endif.

endmodule.

Read only

Former Member
0 Likes
1,704

You can do validation 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

Regards

vasu

Read only

Former Member
0 Likes
1,704

hi,

1. consider ur screen has 3 input's , if the user enters and he presses any button.

2. now u can validate that one...

so in <b>PAI module, u have to code this first.</b>

ex :

<b> PROCESS AFTER INPUT.

MODULE USER_COMMAND_1000.</b>

in module user_command...

write code..

if field1 GT '10'..

......... like this....

reply back...

With Rgds,

S.Barani

Read only

Former Member
0 Likes
1,705

hi vibhuti

if it is dialog program put all the filelds in the chain endchain like this

chain

fileds :

module validatefields

endchain.

module validatefilelds

select .....................

command

endmodule

if it is selection-screen

at selection secreen

perform validation

form validation

select commands......................

endform

it may the answer