07-21-2007 6:25 PM
07-22-2007 7:13 AM
Hi
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
<b>Reward points for useful Answers</b>
Regards
Anji
07-21-2007 6:30 PM
07-22-2007 7:13 AM
Hi
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
<b>Reward points for useful Answers</b>
Regards
Anji