Validations in Module Pool
Validations in Module Pool
How to do the validation for this paramater in screen . And if Im taking a set of parameter - how to do the validation .. Regards, Narender Subbu P
Posts: 1,709 Registered: 4/29/05 Forum Points: 2,792
Reply
Reply
hi Subramanian , Chain Endchain is used for a set of parameter , Just I want to validate a single parameter ... Regards, Narender muralikrishna k...
Posts: 2,431 Registered: 9/11/06 Forum Points: 3,684
Reply
Naren, Use FIELD field name MODULE MODULE_3. Pls. Mark if useful.
Lindsay Hoare
Posts: 16 Registered: 5/26/05 Forum Points: 36
Reply
Hi, you just need to put a validation module in the PAI in the screen flow logic. eg if your field is zzz-field1, use a statement in the PAI like this: FIELD ZZZ-FIELD1 MODULE VALIDATE_FIELD1. or, to only process conditionally, use FIELD ZZZ-FIELD1 MODULE VALIDATE_FIELD1 ON INPUT or FIELD ZZZ-FIELD1 MODULE VALIDATE_FIELD1 ON REQUEST. if your module then generates an error message this field will be highlighted for action. if you have several fields you need to chain them eg ZZZ-FIELD1 and ZZZ-FIELD2: CHAIN. FIELD: ZZZ-FIELD1, ZZZ-FIELD2. MODULE VALIDATE_FIELDS ON CHAIN-INPUT " (or ON CHAIN-REQUEST) ENDCHAIN. Satya Priya Vep...
Posts: 307 Registered: 5/13/06 Forum Points: 412
Reply
Hi Narender, U need to do the validation in PAI event of the screen as below : PROCESS AFTER INPUT. MODULE user_command_0100. *** input check for field cvp number
FIELD : cvp_no. "Screen Field needs to be validated MODULE show_cv_desc. And the module definition is as follows : MODULE show_cv_desc INPUT. ws_repid = sy-cprog. ws_num = '1000'. i_dynfields-fieldname = 'CVP_NO'. APPEND i_dynfields. CALL FUNCTION 'DYNP_VALUES_READ' EXPORTING dyname = ws_repid dynumb = ws_num TABLES dynpfields = i_dynfields EXCEPTIONS invalid_abapworkarea = 1 invalid_dynprofield = 2 invalid_dynproname = 3 invalid_dynpronummer = 4 invalid_request = 5 no_fielddescription = 6 invalid_parameter = 7 undefind_error = 8 double_conversion = 9 stepl_not_found = 10 OTHERS = 11. IF sy-subrc EQ 0. READ TABLE i_dynfields WITH KEY fieldname = 'CVP_NO'. IF sy-subrc EQ 0. cvp_no = i_dynfields-fieldvalue. ENDIF. ENDIF. ***********Validation if cvp_no = '0013'. message e000(zocm) with 'Wrong Entry'. " If the user enters 0013 for cvp_no endif. ENDMODULE. " show_cv_desc INPUT Please do reward helpful answers. Gopi Narendra Re: validation in Module pool Program
Reply
in the PAI.. module check_data. select single * from <table> where <tablefield> = <screenfield-value>. if sy-subrc = 0. else. message E000(00) with '<ScreenField-Value> does not exit'. endif. endmodule. in the flow logic for the screen. write as chain. field : <screenfield>. module check_data. endchain. Regards Gopi Jayanthi Jayara...
Posts: 3,763 Registered: 2/24/05 Forum Points: 5,420
Reply
Hi, In PAI, FIELD fieldname MODULE validate. MODULE validate INPUT. ..do the validation here.... ENDMODULE. "Validate INPUT Shiba Prasad Du...
Posts: 2,911 Registered: 11/25/06
Reply
in PAI you have to validate the field. FIELD f1 MODULE m1 ON REQUEST. things in sqare bracket are optional []. in abap editor it will show MODULE m1 input. <do validation code>. ENDMODULE. regards shiba dutta
y y y y y
The element attribute PARAMETER-ID (SPA/GPA parameters). The element attribute HOLD DATA CALL TRANSACTION ... USING Automatic settings of particular global fields ON *-INPUT The ABAP module is called if the user has entered a "*" in the first character of the field, and the field has the attribute *-entry in the Screen Painter. When the input field is passed to the program, the * is removed. * behaves like an initial field in the ON INPUT condition.
The functions of the FIELD statement for controlling data transport also apply when you use MODULE.
In cases where you apply conditions to various combinations of screen fields, it is worth setting up a separate processing chain for each combination and calling different modules from within it. The functions of the FIELD statement for controlling data transport also apply when you use processing chains. Within a processing chain, screen fields are not transported until the FIELD statement. Processing chains also have another function for the FIELDS statements that they contain. This is described in the section on validity checks.
It is irrelevant whether the statements occur within a CHAIN ... ENDCHAIN block or not.
DATA: OK_CODE LIKE SY-UCOMM, INPUT1(20), INPUT2(20), INPUT3(20), FLD(20). CALL SCREEN 100. MODULE INIT_SCREEN_100 OUTPUT. SET PF-STATUS 'STATUS_100'. ENDMODULE. MODULE CANCEL INPUT. LEAVE PROGRAM. ENDMODULE. MODULE CURSOR INPUT. GET CURSOR FIELD FLD. MESSAGE I888(BCTRAIN) WITH TEXT-001 FLD. ENDMODULE. MODULE MODULE_1 INPUT. MESSAGE I888(BCTRAIN) WITH TEXT-002. ENDMODULE. MODULE MODULE_2 INPUT. MESSAGE I888(BCTRAIN) WITH TEXT-003. ENDMODULE. MODULE MODULE_* INPUT. MESSAGE I888(BCTRAIN) WITH TEXT-004 INPUT3. ENDMODULE. MODULE C1 INPUT. MESSAGE I888(BCTRAIN) WITH TEXT-005 '1'. ENDMODULE. MODULE C2 INPUT. MESSAGE I888(BCTRAIN) WITH TEXT-005 '2' TEXT-006 '3'. ENDMODULE. The next screen (statically defined) for screen 100 is itself. It has the following layout:
The screen fields INPUT1, INPUT2, and INPUT3 are assigned to the input fields. The function code of the pushbutton is EXECUTE. In the GUI status STATUS_100, the icon (F12) is active with function code CANCEL and function type E. The function key F2 is also active with function code CS and function type S. The F8 key is active with the function code EXECUTE and no special function type. The screen flow logic is as follows: PROCESS BEFORE OUTPUT. MODULE INIT_SCREEN_100. PROCESS AFTER INPUT. MODULE CANCEL AT EXIT-COMMAND. CHAIN. FIELD: INPUT1, INPUT2. MODULE MODULE_1 ON CHAIN-INPUT. FIELD INPUT3 MODULE MODULE_* ON *-INPUT. MODULE MODULE_2 ON CHAIN-REQUEST. ENDCHAIN. FIELD INPUT1 MODULE C1 AT CURSOR-SELECTION. CHAIN. FIELD: INPUT2, INPUT3. MODULE C2 AT CURSOR-SELECTION. ENDCHAIN. MODULE CURSOR AT CURSOR-SELECTION. The program uses information messages to show which modules are called following user interaction and which data is transported. y y y Whenever one of the input fields 1 or 2 is not initial, the system calls the module MODULE_1 for any user interaction. Whenever one of the three input fields is changed, the system calls the module MODULE_2 for any user interaction. Whenever input field 3 contains a * entry, the system calls module MODULE_* for any user interaction.
y y y
If the user chooses F2 or double-clicks a text field on the screen, the system calls the module CURSOR. If the user chooses F2 or double-clicks input field 1, the system calls the module C1. If the user chooses F2 or double-clicks input field 2 or 3, the system calls the module CURSOR. Module C2 is never executed, since the MODULE ... AT CURSOR SELECTION statement occurs twice, and only the last is processed.
http://help.sap.com/saphelp_47x200/helpdata/en/d1/801ca2454211d189710000e8322d00/frameset.h tm
Flow Logic Keywords You define the flow logic in the flow logic editor of the Screen Painter, using the following keywords: Keyword CALL CHAIN ENDCHAIN ENDLOOP FIELD LOOP MODIFY MODULE ON PROCESS SELECT VALUES Description Calls a subscreen. Starts a processing chain. Ends a processing chain. Ends loop processing. Refers to a field. You can combine this with the MODULE and SELECT keywords. Starts loop processing. Modifies a table. Identifies a processing module. Used with FIELD assignments. Defines a processing event. Checks an entry against a table. Defines allowed input values.
For more information about transaction programming, see the Example of Flow Logic Example The following example shows some use of screen flow logic: *-----------------------------------------------* Sample Code *--------------------------------------------------*Processing Before Screen Output PROCESS BEFORE OUTPUT. MODULE INIT_FIELDS.
* Self-programmed F1 Help PROCESS ON HELP-REQUEST. FIELD GSSG-BUKRG MODULE V-BUKRG. * Processing after user input PROCESS AFTER INPUT. * Lock customer master record CHAIN. FIELD GSSG-KTNRG MODULE ENQUEUE_CUSTOMER_MASTER. * Read customer master record MODULE READ_CUSTOMER_MASTER. * Read business area MODULE READ_GSSG. ENDCHAIN. * Process function code FIELD OK-CODE MODULE OKCODE ON INPUT.