<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Modlue programming guide! in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517206#M845928</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;Module Pool Programming&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This component though is not attached to the screen painter, plays important role in transaction. Normally, for reports, on line executable programs are written but for transaction, Module Pool Programs are written. The module pool program contains only modules to handle various events associated with screen and data declaration statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System divides the module pool program into several include program. These are global field, PBO modules, and PAI modules. It is entirely user&amp;#146;s decision whether to use these modules or write directly into main program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creation of Module Pool Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create module pool program either through &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Object browser&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System automatically creates the module pool program and for these program which are created through object browser, system creates the include modules.&lt;/P&gt;&lt;P&gt;Or&lt;/P&gt;&lt;P&gt;ABAP/4 editor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is similar to normal program creation. Type of program should be given &amp;#145;M&amp;#146; and is not created by system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Communication between Dynpro and Module Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each screen, the system executes the flow logic, which contains corresponding events. The control is passed to Module Pool Program. Module Pool Program handles the code for these events and again passes back control to the flow logic and finally to screen. Unlike on line program, in this case, the control remains with flow logic. The switching of control between flow logic and module pool program and back is common process when user executes transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creation of a Complete Transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps involved to create a complete transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Create module pool program.&lt;/P&gt;&lt;P&gt;&amp;#149;	From screen painter create screens.&lt;/P&gt;&lt;P&gt;&amp;#149;	Write flow logic for each screen.&lt;/P&gt;&lt;P&gt;&amp;#149;	Write code for all the events in module pool program.&lt;/P&gt;&lt;P&gt;&amp;#149;	Check for any error in screen and flow logic.&lt;/P&gt;&lt;P&gt;&amp;#149;	Generate each and every component of screen i.e. flow logic and screen.&lt;/P&gt;&lt;P&gt;&amp;#149;	Single screen can be tested using Screen Painter.&lt;/P&gt;&lt;P&gt;&amp;#149;	Create transaction code through object browser.&lt;/P&gt;&lt;P&gt;&amp;#149;	Generate the transaction code.&lt;/P&gt;&lt;P&gt;&amp;#149;	User can execute the transaction by entering the transaction code in the command field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Handling Function Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function code or OKCODE is the last field of Field list. Function code can be handled as follows:&lt;/P&gt;&lt;P&gt;During the Designing of the screen, a function code is assigned to pushbutton.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	In field list, developer needs to specify OKCODE as last field.&lt;/P&gt;&lt;P&gt;&amp;#149;	In module program it is a global field and can be evaluated in the PAI event.&lt;/P&gt;&lt;P&gt;&amp;#149;	A function code is treated in the same way, regardless it comes from pushbutton, menu item or any other GUI element.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A complete example for transaction is shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a screen like the one below:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;When the user clicks on the Display button, you want to display details of sflight, with corresponding carrid and connid (which is entered by the user).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module pool program to handle this particular screen is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program YVTEST7.&lt;/P&gt;&lt;P&gt;TABLES: SFLIGHT.&lt;/P&gt;&lt;P&gt;DATA: OKCODE (4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE INPUT1 INPUT,&lt;/P&gt;&lt;P&gt; CASE OKCODE.&lt;/P&gt;&lt;P&gt;   WHEN &amp;#145;DISP&amp;#146;.&lt;/P&gt;&lt;P&gt;     SELECT * FROM SFLIGHT &lt;/P&gt;&lt;P&gt;            WHERE CARRID =  SFLIGHT &amp;#150; CARRID AND &lt;/P&gt;&lt;P&gt;                           CONNID = SFLIGHT &amp;#150; CONNID.&lt;/P&gt;&lt;P&gt;     ENDSELECT.&lt;/P&gt;&lt;P&gt;     LEAVE TO SCREEN 200.&lt;/P&gt;&lt;P&gt;   WHEN &amp;#145;EXIT&amp;#146;.  LEAVE TO SCREEN 0.&lt;/P&gt;&lt;P&gt;  ENDCASE.&lt;/P&gt;&lt;P&gt; ENDMODULE.			&amp;#147;INPUT1 INPUT&lt;/P&gt;&lt;P&gt; MODULE USER_COMMAND_0200 INPUT.&lt;/P&gt;&lt;P&gt; CASE OKCODE.&lt;/P&gt;&lt;P&gt;WHEN &amp;#145;BACK&amp;#146;. LEAVE TO SCREEN 100.&lt;/P&gt;&lt;P&gt; ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMODULE.				&amp;#147;USER_COMMAND_0200 INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the user clicks on display, control is transferred to screen no. 200 on which you display sflight details &amp;amp; on the same screen, when user clicks on BACK button, he comes back to main screen. &lt;/P&gt;&lt;P&gt;Flow logic for screen 100 is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt; MODULE INPUT.&lt;/P&gt;&lt;P&gt;Flow logic for screen 200&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt; USER_COMMAND_0200.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULES: Modules are handled in module pool program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to write flow logic for screen 200 and design screen 200.&lt;/P&gt;&lt;P&gt;In case of transaction transfer of data from program to screen is automatic i.e. you need not transfer the data from program to screen explicitly. The fields, which you define in the screen receives the data from program and displays the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Field Checks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As already mentioned Transaction is the only method, which SAP recommends to update the database tables. Data entered in the database table should be valid and correct. Data entered is validated at each and every point. ABAP/4 offers various methods to validate data and those are as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Automatic field checks&lt;/P&gt;&lt;P&gt;&amp;#149;	Checks performed in the flow logic&lt;/P&gt;&lt;P&gt;&amp;#149;	Checks performed in the ABAP/4 module pool program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Automatic Field Checks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These checks are based on the field information stored in the dictionary. These checks are performed by the system automatically when the user enters the data for the screen field. System performs these checks before PAI event is triggered. Types of field checks performed by system are as follows:&lt;/P&gt;&lt;P&gt;&amp;#149;	Required input&lt;/P&gt;&lt;P&gt;While designing the screen, for particular screen field if you click the Req. Entry checkbox, the field becomes mandatory. When the transaction is executed if user leaves this particular field blank, the system displays error message. User cannot proceed until the user enters some data.&lt;/P&gt;&lt;P&gt;&amp;#149;	Proper Data Format&lt;/P&gt;&lt;P&gt;Each field has its own data format whether it is table field or screen field. Whenever data is entered, system checks for the proper format of the data. For example date. Each user has its own format for date, which is defined in the user master record. If the date defined in the user master record is in the format DD/MM/YYYY, if the user enters the date, say, in YY/DD/MM, the user displays the error message. System also checks for the value of month or days. For example if month entered is greater than twelve then the error message is displayed.&lt;/P&gt;&lt;P&gt;&amp;#149;	Valid Value for the Field&lt;/P&gt;&lt;P&gt;In data dictionary two tables are related by Primary key-Foreign key relationship.  Whenever the user enters the data, the system checks for the check table values.   Also in Domain, if you have fixed values, then the system checks for these values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Automatic field checks are repeated each time the user enters the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About at Exit &amp;#150; Command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Automatic field checks can be avoided by AT EXIT-COMMAND, which works exactly the same way as Cancel works on application tools bar. In the R/3 screen, if you want to quit the processing of that particular screen without entering the mandatory fields, user can click the Cancel button. Same functionality can be incorporated in the user-defined transaction by using AT EXIT-COMMAND. This module can be called before the system executes the automatic field checks and it goes without saying that before PAI event. Code for AT EXIT-COMMAND in flow logic and in module pool program can be written as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Flow Logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Process After Input.&lt;/P&gt;&lt;P&gt;Module exit AT EXIT-COMMAND.&lt;/P&gt;&lt;P&gt;         In module pool program.&lt;/P&gt;&lt;P&gt;Module exit.&lt;/P&gt;&lt;P&gt;Case okcode.&lt;/P&gt;&lt;P&gt;When &amp;#145;Exit&amp;#146;.&lt;/P&gt;&lt;P&gt;Leave to screen 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To achieve this kind of functionality a pushbutton or menu item should be assigned a function type &amp;#145;E&amp;#146;. It tells the system to process this particular module before carrying out any field checks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Flow Logic Validations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the case where you want user to enter only &amp;#145;LH&amp;#146; and &amp;#145;SQ&amp;#146; for sflight-carrid. In this case, you are restricting value of a screen field. This cannot be achieved by automatic field check. Hence there is a need of additional validation. It can be done in flow logic by using following statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field -&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt; Values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Field sflight-carrid values (&amp;#145;LH&amp;#146;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For multiple values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Field sflight-carrid values (&amp;#145;LH&amp;#146; &amp;#145;SQ&amp;#146;).&lt;/P&gt;&lt;P&gt;Field sflight-price values (between 1000 and 2000).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case when the user enters the value, PAI is triggered  and field is checked for  that particular value. If the value entered happens to be wrong, that field is enabled for user to enter. If you have multiple Field statements in your flow logic, it is sequential execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the following case:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Module  assign.&lt;/P&gt;&lt;P&gt;Field sflight-carrid values (&amp;#145;LH&amp;#146; &amp;#145;SQ&amp;#146;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ABAP/4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module  assign.&lt;/P&gt;&lt;P&gt;Data: carrid1 like sflight-carrid.&lt;/P&gt;&lt;P&gt;Carrid1 = sflight-carrid.&lt;/P&gt;&lt;P&gt;Endmodule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, Sflight-carrid is used in the flow logic before the field statement. The system will give invalid value or some previous value as the field sflight-carrid is used in module before it is checked i.e., field statement is after the module in which sflight-carrid is being used. The field is not available to the system unless it executes the field statement. Field statement transfers the values to the program and is done only once. If you don&amp;#146;t have Field statement in your flow logic, transfer of values takes place in PAI event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider one more case where you have multiple field statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Field Sflight-carrid values (&amp;#145;LH&amp;#146;).&lt;/P&gt;&lt;P&gt;Field Sflight-connid values (&amp;#145;0400&amp;#146; &amp;#145;0500&amp;#146;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case if the user enters only carrid wrong, then this particular field is enabled and rest of the fields are disabled for user to input. Many times if the user enters wrong value for one field, then you might want to give option to user to enter all the fields, which is not possible by using Field statement only. This functionality can be achieved by CHAIN &amp;#150; ENDCHAIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chain.&lt;/P&gt;&lt;P&gt;Field sflight-carrid value (&amp;#145;LH&amp;#146;).&lt;/P&gt;&lt;P&gt;	Field sflight-connid values (between &amp;#145;200&amp;#146; and &amp;#145;500&amp;#146;).&lt;/P&gt;&lt;P&gt;Endchain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field sflight-price values (&amp;#145;100&amp;#146; &amp;#145;1000&amp;#146;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, if the user enters wrong value only for carrid, both the fields i.e. carrid and connid are enabled as they are grouped together in the Chain statement. The field price will be disabled for input. Usually, logically related fields are grouped together with Chain-Endchain statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module Pool Program Validations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Checking fields ABAP/4 program includes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Field statement in flow logic.&lt;/P&gt;&lt;P&gt;&amp;#149;	Module statement in ABAP/4 module pool Program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Field sflight-carrid module &amp;lt;name&amp;gt;.&lt;/P&gt;&lt;P&gt;This module can be handled in the main program i.e. module pool program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ABAP/4 program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module Check.&lt;/P&gt;&lt;P&gt;Select single * from sflight where carrid = sflight-carrid.&lt;/P&gt;&lt;P&gt;If sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;	Message e001.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, field sflight-carrid is checked in the table for its existence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynamically Calling the Screens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About Displaying Next Screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transaction is a sequence of screens, which are displayed one after the other. The next screen displayed depends upon the attributes of first screen. In attributes you need to give Next Screen number i.e. if next screen displayed should be 200 screen, then this number should be given in next Screen attributes. These are static attributes of the screen. By default, if nothing is specified in the program, the system branches out to the screen number, which is specified in the attribute screen.&lt;/P&gt;&lt;P&gt;In this case, if user selects MARA pushbutton, then fields from Mara table are displayed. When the user clicks on the MARD, then the fields from MARD table are displayed. Depending upon users selection, the screen is branched out and this has to be done during runtime. This functionality can be achieved by dynamically calling the screen in module pool program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The screen can branch out to new screen depending upon user selection. Following command in module pool program can do this:&lt;/P&gt;&lt;P&gt;&amp;#149;	SET SCREEM&lt;/P&gt;&lt;P&gt;&amp;#149;	CALL SCREEN&lt;/P&gt;&lt;P&gt;&amp;#149;	LEAVE TO SCREEN &amp;lt;NUMBER&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All these commands override the specifications given in the attributes. This overriding is temporary. The values stored in the attribute are not changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set Screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set screen &amp;lt;number&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In module pool program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case okcode.&lt;/P&gt;&lt;P&gt;	When  &amp;#145;DISP&amp;#146;.&lt;/P&gt;&lt;P&gt;		Set screen 200.&lt;/P&gt;&lt;P&gt;	When &amp;#145;LIST&amp;#146;.&lt;/P&gt;&lt;P&gt;		Set screen 300.&lt;/P&gt;&lt;P&gt;Endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, the entire processing of current screen takes place and then the system branches out to next screen. If you want to branch out to the next screen without processing the current screen, LEAVE SCREEN should be used along with the SET SCREEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case okcode..&lt;/P&gt;&lt;P&gt;	When  &amp;#145;DISP&amp;#146;.&lt;/P&gt;&lt;P&gt;		Set screen 200.&lt;/P&gt;&lt;P&gt;		Leave Screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	When &amp;#145;LIST&amp;#146;.&lt;/P&gt;&lt;P&gt;		Set screen 300.&lt;/P&gt;&lt;P&gt;		Leave Screen.&lt;/P&gt;&lt;P&gt;Endcase.&lt;/P&gt;&lt;P&gt;When SET SCREEN is used, control cannot be transferred to the main screen or previous screen, unless you write code for the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call Screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usually used for pop up screens. Many times, there is a need for user to enter additional information or secondary information on another screen or pop up screen. Once the user enters the data, he should be able to go back to main screen or to the screen where he started. This is not possible by using SET SCREEN. CALL SCREEN achieves this functionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;Call Screen 200.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will simply call a screen number 200 from a main screen. Once the screen is displayed the user can enter all the data and return to the main screen by clicking BACK button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To call screen as pop up screen the syntax is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call screen starting at &amp;lt;col.no.&amp;gt; &amp;lt;line no&amp;gt;&lt;/P&gt;&lt;P&gt;				 Ending at &amp;lt;col no&amp;gt; &amp;lt;line no&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case window will be popped as window and user can close it by using BACK button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leave to screen &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To SET a new screen without processing current screen, you need to use the following two statements together:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET SCREEN 200.&lt;/P&gt;&lt;P&gt;LEAVE SCREEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or a Single statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEAVE TO SCREEN 200.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Mar 2008 10:07:00 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-04T10:07:00Z</dc:date>
    <item>
      <title>Modlue programming guide!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517202#M845924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Need some help in module pool programming guide !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 09:59:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517202#M845924</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-04T09:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Modlue programming guide!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517203#M845925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;MODULE POOL PROGRAMMING (MPP):&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;These are type M programs in SAP.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;These programs cannot be executed directly.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Transaction Codes (Tcodes) are used to execute MPP programs.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Graphical Screen PAinter is the tool used to create GUI in MPP (SE51).&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MPP programs are created using the transaction code SE80.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MPP programs should start with the naming convention SAPMZ or SAPMY.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EVENTS ASSOCIATED WITH SELECTION-SCREEN:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INITIALIZATION&lt;/P&gt;&lt;P&gt;AT SELECTION-SCREEN&lt;/P&gt;&lt;P&gt;START-OF-SELECTION&lt;/P&gt;&lt;P&gt;TOP-OF-PAGE&lt;/P&gt;&lt;P&gt;END-OF-PAGE&lt;/P&gt;&lt;P&gt;END-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EVENTS ASSOCIATED WITH MPP:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;1. PROCESS BEFORE OUTPUT (PBO) - Used to specify initial attributes for the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. PROCESS AFTER INPUT (PAI) - Used to specify &lt;/P&gt;&lt;P&gt;event functionalities for the components of the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMPONENTS OF MPP PROGRAM:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. ATTRIBUTES - It holds description about the screen.&lt;/P&gt;&lt;P&gt;2. FLOW LOGIC - This is an editor for MPP programs to specify event functionality for the screen components.&lt;/P&gt;&lt;P&gt;3. ELEMENT LIST - This provides description about the components created in the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES OF SCREEN IN MPP:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. NORMAL SCREEN - A screen which has maximizing, minimizing and closing options &lt;/P&gt;&lt;P&gt;is referred to as normal screen.&lt;/P&gt;&lt;P&gt;2. SUBSCREEN - A screen within a normal screen with either of above three options &lt;/P&gt;&lt;P&gt;is referred to as subscreen.&lt;/P&gt;&lt;P&gt;3. MODAL DIALOG BOX - A screen with only closing option which is used to provide &lt;/P&gt;&lt;P&gt;information to the end user is referred to as modal dialog box.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NAVIGATIONS TO CREATE A SIMPLE MPP PROGRAM:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SE80 -&amp;gt; Select Program from the dropdown list -&amp;gt; SPecify program name starting with SAPMZ or SAPMY (eg. SAPMYFIRSTMPP) -&amp;gt; Press Enter -&amp;gt; Click on Yes to Create object -&amp;gt; Opens another dialog box -&amp;gt; Click on Continue to create Top Include File for the program -&amp;gt; Opens another dialog box specifying TOP INCLUDE FILE name (MYFIRSTMPPTOP) -&amp;gt; Click on Continue -&amp;gt; Opens Program Attributes screen -&amp;gt; Enter short description -&amp;gt; The default program type is M -&amp;gt; Save under a package -&amp;gt; Assign Request number -&amp;gt; A folder with specified program name(SAPMYFIRSTMPP) is created with Top Include File.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To create a screen, right click on program name -&amp;gt; Create -&amp;gt; SCreen -&amp;gt; Opens dialog box &lt;/P&gt;&lt;P&gt;-&amp;gt; Specify Screen number (100) -&amp;gt; Continue -&amp;gt; Opens an interface -&amp;gt; Enter short description &lt;/P&gt;&lt;P&gt;-&amp;gt; Select Screen type as Normal -&amp;gt; Click on LAYOUT pushbutton from appn. toolbar &lt;/P&gt;&lt;P&gt;-&amp;gt; Opens Graphical Screen painter -&amp;gt; Drag and drop two input fields, two pushbuttons and &lt;/P&gt;&lt;P&gt;two text fields -&amp;gt; Double click on each component to specify attributes as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INPUT FIELDS: IO1, IO2&lt;/P&gt;&lt;P&gt;FIRST PUSHBUTTON : PB1, PRINT, PRINT&lt;/P&gt;&lt;P&gt;SECOND PUSHBUTTON : PB2, EXIT, EXIT&lt;/P&gt;&lt;P&gt;TEXT FIELDS : LB1 (ENTER NAME), LB2 (ENTER CITY)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; Save -&amp;gt; Click on Flowlogic Pushbutton from appn. toolbar -&amp;gt; Opens Flow Logic editor &lt;/P&gt;&lt;P&gt;with two events (PA1 and PBO).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To specify event functionalities for screen components, &lt;/P&gt;&lt;P&gt;decomment PAI Module name (USER_COMMAND_0100) &lt;/P&gt;&lt;P&gt;-&amp;gt; Double click on module name -&amp;gt; Click on Yes to create object -&amp;gt; Opens an interface &lt;/P&gt;&lt;P&gt;-&amp;gt; Select Program name from the list -&amp;gt; Continue -&amp;gt; Click on Yes to save the editor &lt;/P&gt;&lt;P&gt;-&amp;gt; Opens PAI module and specify following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-UCOMM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'PRINT'.&lt;/P&gt;&lt;P&gt;LEAVE TO LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; IO1, IO2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In TOP INCLUDE FILE, declare input fields as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : IO1(20), IO2(20).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save -&amp;gt; Activate -&amp;gt; Right click on Program name -&amp;gt; Activate (to activate all inactive objects).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To execute MPP program, right click on program name -&amp;gt; Create -&amp;gt; Transaction &lt;/P&gt;&lt;P&gt;-&amp;gt; Opens an interface -&amp;gt; Specify Tcode starting with Z or Y (zfirstmpp) -&amp;gt; Enter short description -&amp;gt; Continue -&amp;gt; Specify Main program name (SAPMYFIRSTMPP) and initial Screen number (100) -&amp;gt; Save under a package -&amp;gt; Assign a request number -&amp;gt; Execute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TOP INCLUDE FILE is an area to declare variables for the program, and the variables declared here becomes globally accessed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SCREEN VALIDATION USING MPP:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------" /&gt;&lt;P&gt;SCREEN is a predefined structure used to make MPP screen validations dynamically. SCREEN has following components:&lt;/P&gt;&lt;P&gt;GROUP1&lt;/P&gt;&lt;P&gt;INVISIBLE&lt;/P&gt;&lt;P&gt;REQUIRED&lt;/P&gt;&lt;P&gt;INPUT&lt;/P&gt;&lt;P&gt;OUTPUT&lt;/P&gt;&lt;P&gt;INTENSIFIED&lt;/P&gt;&lt;P&gt;IF SCREEN-INVISIBLE = 0 - Sets the input field values as visible.&lt;/P&gt;&lt;P&gt;   SCREEN-INVISIBLE = 1 - Sets the input field as password field.&lt;/P&gt;&lt;P&gt;   SCREEN-REQUIRED = 0 - Not a mandatory field.&lt;/P&gt;&lt;P&gt;   SCREEN-REQUIRED = 1 - Sets input field as mandatory one.&lt;/P&gt;&lt;P&gt;Eg. code to perform validation dynamically for a login screen:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------" /&gt;&lt;P&gt;1. Create an MPP program.&lt;/P&gt;&lt;P&gt;2. Create a Normal Screen like initial login screen.&lt;/P&gt;&lt;P&gt;3. Assign IO1, IO2 to group GR1, IO3 to GR2.&lt;/P&gt;&lt;P&gt;4. In Top Include file, declare variables.&lt;/P&gt;&lt;P&gt;5. In PBO, specify following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;IF SCREEN-GROUP1 = 'GR1'.&lt;/P&gt;&lt;P&gt;SCREEN-REQUIRED = '1'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SCREEN-GROUP1 = 'GR2'.&lt;/P&gt;&lt;P&gt;SCREEN-INVISIBLE = '1'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODIFY SCREEN.  * to update the changes made to the predefined 		  structure.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. In PAI, specify following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-UCOMM.&lt;/P&gt;&lt;P&gt;WHEN 'LOGIN'.&lt;/P&gt;&lt;P&gt;CALL TRANSACTION 'SE38'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. Create a Tcode -&amp;gt; Activate all -&amp;gt; Execute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;INSERTING RECORDS FROM MPP SCREEN INTO DATABASE TABLE:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Create an MPP program.&lt;/P&gt;&lt;P&gt;2. In Top Include File, declare an internal table as follows:&lt;/P&gt;&lt;P&gt;	&lt;/P&gt;&lt;P&gt;	DATA IT_KNA1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; -&amp;gt; Save -&amp;gt; Activate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Create a screen -&amp;gt; In Screen Painter, click DICTIONARY/PROGRAM FIELDS (F6) &lt;/P&gt;&lt;P&gt;pushbutton from appn. toolbar -&amp;gt; Opens an interface &lt;/P&gt;&lt;P&gt;-&amp;gt; Specify internal table name -&amp;gt; Click on GET FROM PROGRAM pushbutton &lt;/P&gt;&lt;P&gt;-&amp;gt; Select required fields -&amp;gt; Continue -&amp;gt; Paste on Screen Painter &lt;/P&gt;&lt;P&gt;-&amp;gt; Create two pushbuttons (INSERT, EXIT) -&amp;gt; Save -&amp;gt; Flow logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. In PAI, specify following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-UCOMM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'INSERT'.&lt;/P&gt;&lt;P&gt;INSERT INTO KNA1 VALUES IT_KNA1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;MESSAGE S000(ZMSG).&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;MESSAGE W001(ZMSG).&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;*LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;SET SCREEN 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. Create a Tcode -&amp;gt; Activate all -&amp;gt; Execute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIST OF VALUES:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt;Adding dropdown facility to the input fields is called as LIST OF VALUES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VRM is a predefined type group which has the following structure and internal table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VRM_VALUE is a structure with the components KEY and TEXT.&lt;/P&gt;&lt;P&gt;VRM_VALUES is an internal table declared for the above structure without header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above type group is used to fetch values from the internal table declared with user-defined records and insert into the input field in the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'VRM_SET_VALUES' is a function module used to carry the records from the internal table and populate in the input field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NAVIGATIONS TO CREATE DROPDOWN FACILITY FOR INPUT BOX:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------" /&gt;&lt;P&gt;1. Create MPP program.&lt;/P&gt;&lt;P&gt;2. Create a screen.&lt;/P&gt;&lt;P&gt;3. Add a input box -&amp;gt; Double click -&amp;gt; Specify name (IO1) -&amp;gt; Select LISTBOX from the dropdown list -&amp;gt; A dropdown facility is added for the input field in the screen.&lt;/P&gt;&lt;P&gt;4. Create two pushbuttons (PRINT, EXIT).&lt;/P&gt;&lt;P&gt;5. In Top Include File, specify following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS VRM.&lt;/P&gt;&lt;P&gt;DATA IO1(20).&lt;/P&gt;&lt;P&gt;DATA A TYPE I.&lt;/P&gt;&lt;P&gt;DATA ITAB TYPE VRM_VALUES. * To create an internal table of an existing type&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA WA LIKE LINE OF ITAB. * To create a temporary structure of sameline type of internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. In PBO, specify following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF A = 0.&lt;/P&gt;&lt;P&gt;WA-KEY = 'ABAP'.&lt;/P&gt;&lt;P&gt;WA-TEXT = 'ADVANCED PROGRAMMING'.&lt;/P&gt;&lt;P&gt;APPEND WA TO ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WA-KEY = 'BW'.&lt;/P&gt;&lt;P&gt;WA-TEXT = 'BUSINESS WAREHOUSING'.&lt;/P&gt;&lt;P&gt;APPEND WA TO ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WA-KEY = 'EP'.&lt;/P&gt;&lt;P&gt;WA-TEXT = 'ENTERPRISE PORTAL'.&lt;/P&gt;&lt;P&gt;APPEND WA TO ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'VRM_SET_VALUES'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    ID                    =  'IO1'&lt;/P&gt;&lt;P&gt;    VALUES                =   ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A = 1.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. In PAI, specify following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-UCOMM.&lt;/P&gt;&lt;P&gt;WHEN 'PRINT'.&lt;/P&gt;&lt;P&gt;LEAVE TO LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; IO1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;8. Create a Tcode -&amp;gt; Activate all -&amp;gt; Execute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATING TABSTRIPS IN MPP:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------" /&gt;&lt;P&gt;In a normal screen, we can add only maximum of 40 components.&lt;/P&gt;&lt;P&gt;To make a screen hold more than 40 components, we can use tabstrip controls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NAVIGATIONS TO CREATE TABSTRIP CONTROL:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------------------" /&gt;&lt;P&gt;1. Create an MPP program.&lt;/P&gt;&lt;P&gt;2. Create a normal screen (100) &lt;/P&gt;&lt;P&gt;-&amp;gt; Add Tabstrip Control component from toolbar &lt;/P&gt;&lt;P&gt;-&amp;gt; By default, a tabstrip control is created with 2 tab buttons &lt;/P&gt;&lt;P&gt;-&amp;gt; Double click on tabstrip control &lt;/P&gt;&lt;P&gt;-&amp;gt; Specify name (TBSTR) in Attributes box &lt;/P&gt;&lt;P&gt;-&amp;gt; Click on First tab button &lt;/P&gt;&lt;P&gt;-&amp;gt; Add Subscreen Area from toolbar to first tab button &lt;/P&gt;&lt;P&gt;-&amp;gt; Double click on subscreen area &lt;/P&gt;&lt;P&gt;-&amp;gt; Specify name (SUB1) &lt;/P&gt;&lt;P&gt;-&amp;gt; Click on Second tab button &lt;/P&gt;&lt;P&gt;-&amp;gt; Repeat same process for adding subscreen area (SUB2) &lt;/P&gt;&lt;P&gt;-&amp;gt; Double click on First tab button &lt;/P&gt;&lt;P&gt;-&amp;gt; Specify attributes (TAB1,FIRST,TAB1) &lt;/P&gt;&lt;P&gt;-&amp;gt; Double click on Second tab button &lt;/P&gt;&lt;P&gt;-&amp;gt; Specify attributes (TAB2, SECOND, TAB2) &lt;/P&gt;&lt;P&gt;-&amp;gt; SAve &lt;/P&gt;&lt;P&gt;-&amp;gt; Flowlogic. &lt;/P&gt;&lt;P&gt;3. Create two subscreens (10, 20) -&amp;gt; Add required components in each subscreen.&lt;/P&gt;&lt;P&gt;4. In Top Include File, specify following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : IO1(10), IO2(10), IO3(10), IO4(10).&lt;/P&gt;&lt;P&gt;CONTROLS TBSTR TYPE TABSTRIP.&lt;/P&gt;&lt;P&gt;DATA A LIKE SY-DYNNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'CONTROLS' statement is used to allocate a memory area for the tabstrip created in the normal screen. 'TABSTRIP' itself is a data type for the tabstrip control. Whenever a tabstrip is created, SAP creates an object called 'ACTIVETAB' which is used to call the corresponding subscreens for each tab button in PAI.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. In Flowlogic editor, write following code to initiate the subscreens to the corresponding subscreen areas of each tab button when the main screen is called:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS BEFORE OUTPUT.&lt;/P&gt;&lt;P&gt;MODULE STATUS_0100.&lt;/P&gt;&lt;P&gt;CALL SUBSCREEN SUB1 INCLUDING 'SAPMZTABSTRIP' '10'.&lt;/P&gt;&lt;P&gt;CALL SUBSCREEN SUB2 INCLUDING 'SAPMZTABSTRIP' '20'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt; MODULE USER_COMMAND_0100.&lt;/P&gt;&lt;P&gt; CALL SUBSCREEN SUB1.&lt;/P&gt;&lt;P&gt; CALL SUBSCREEN SUB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. In PAI, specify following code for click events on each tab button:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-UCOMM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'TAB1'.&lt;/P&gt;&lt;P&gt;A = '10'.		   * calls specified subscreen during PAI	&lt;/P&gt;&lt;P&gt;TBSTR-ACTIVETAB = 'TAB1'.  * makes entire tab button in active status&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'TAB2'.&lt;/P&gt;&lt;P&gt;A = '20'.&lt;/P&gt;&lt;P&gt;TBSTR-ACTIVETAB = 'TAB2'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'DISPLAY'.&lt;/P&gt;&lt;P&gt;LEAVE TO LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; IO1, IO2, IO3, IO4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. Create a Tcode -&amp;gt; Activate all -&amp;gt; Execute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLE CONTROLS:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt;Table Control component is used to view the internal table contents in the screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Navigations to create Table control component:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;1. Create an MPP program.&lt;/P&gt;&lt;P&gt;2. In Top include File, declare variables as follows:&lt;/P&gt;&lt;P&gt;	&lt;/P&gt;&lt;P&gt;DATA ITAB LIKE KNA1 OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA ITAB1 LIKE KNA1 OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;CONTROLS TBCL TYPE TABLEVIEW USING SCREEN 100.&lt;/P&gt;&lt;P&gt;DATA CUR TYPE I VALUE 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; Save -&amp;gt; Activate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Create a Screen (100) -&amp;gt; Select Table control component from toolbar -&amp;gt; Double Click and specify name (TBCL) -&amp;gt; Press F6 and specify internal table name (ITAB) -&amp;gt; Select required fields -&amp;gt; Paste on the Table control -&amp;gt; To separate the fields, use Separators option in Table control Attributes -&amp;gt; Specify labels if necessary -&amp;gt; Create pushbuttons (FETCH, MODIFY, PRINT, EXIT) -&amp;gt; Save -&amp;gt; Flowlogic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. In PAI module, specify following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-UCOMM.&lt;/P&gt;&lt;P&gt;WHEN 'FETCH'.&lt;/P&gt;&lt;P&gt;SELECT * FROM KNA1 INTO TABLE ITAB.&lt;/P&gt;&lt;P&gt;TBCL-LINES = SY-DBCNT.  * To create Vertical Scrollbar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'PRINT'.&lt;/P&gt;&lt;P&gt;GET CURSOR LINE CUR.&lt;/P&gt;&lt;P&gt;READ TABLE ITAB INDEX CUR.&lt;/P&gt;&lt;P&gt;LEAVE TO LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; ITAB-KUNNR, ITAB-NAME1, ITAB-ORT01, ITAB-LAND1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'MODIFY'.&lt;/P&gt;&lt;P&gt;LOOP AT ITAB1.&lt;/P&gt;&lt;P&gt;MODIFY KNA1 FROM ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;MESSAGE S002(ZMSG).&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;MESSAGE E003(ZMSG).&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM KNA1 INTO TABLE ITAB.&lt;/P&gt;&lt;P&gt;TBCL-LINES = SY-DBCNT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. In FlowLogic editor, specify following step loops:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS BEFORE OUTPUT.&lt;/P&gt;&lt;P&gt; MODULE STATUS_0100.&lt;/P&gt;&lt;P&gt; LOOP AT ITAB CURSOR CUR WITH CONTROL TBCL.&lt;/P&gt;&lt;P&gt; ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt; MODULE USER_COMMAND_0100.&lt;/P&gt;&lt;P&gt; LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;    MODULE NEW.     * New module to move records from ITAB to 		      ITAB1. Double click on Module Name (New) 		      to create a new one.&lt;/P&gt;&lt;P&gt; ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. Specify following code in the NEW module:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   MODULE NEW INPUT.&lt;/P&gt;&lt;P&gt;	APPEND ITAB TO ITAB1.&lt;/P&gt;&lt;P&gt;   ENDMODULE.                 &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;7. Create a Tcode -&amp;gt; Activate all -&amp;gt; Execute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;USING TABLE CONTROL WIZARD:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="--------------------------" /&gt;&lt;P&gt;This is a predefined SAP-specific component to create table control using predefined navigations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Create an executable program (Z_TABLEWIZARD) in SE38 editor. Write the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL SCREEN 200.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; Save -&amp;gt; Activate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Goto SE51 -&amp;gt; Specify program name created earlier (Z_TABLEWIZARD) -&amp;gt; Specify Screen number (200) -&amp;gt; Layout -&amp;gt; Select Table Control (Wizard) component from toolbar -&amp;gt; Opens Table control Wizard -&amp;gt; Follow the navigations -&amp;gt; Save and Activate the table control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Execute the program (Z_TABLEWIZARD).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Priya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 10:01:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517203#M845925</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-04T10:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: Modlue programming guide!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517204#M845926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;simple and easy way to understand Module pool...with step by step procedure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE POOL PROGRAMMING:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;These are type M programs in SAP.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MPP programs should start with the naming convention SAPMZ or SAPMY.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MPP programs are used to create and assign a user-defined screen to the Transaction Code.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Each screen created in MPP is assigned a screen number. This screen number is assigned to a Tcode.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MPP programs cannot be executed directly. Tcodes are used to execute these programs.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EVENTS IN MPP:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------" /&gt;&lt;P&gt;PROCESS BEFORE OUTPUT (PBO)&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT (PAI)&lt;/P&gt;&lt;P&gt;PROCESS ON VALUE REQUEST  - To provide F4 functionality to MPP program screen i/p fields.&lt;/P&gt;&lt;P&gt;PROCESS ON HELP REQUEST - To provide F1 functionality to MPP program screen components.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Navigations to create a simple MPP program:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SE80 -&amp;gt; Select Program from drop-down list -&amp;gt; Specify program name starting with SAPMZ or SAPMY -&amp;gt; Press Enter -&amp;gt; Click on Yes to create object -&amp;gt; Create Top Include File by clicking on Continue icon in pop-up screens -&amp;gt; Save under a package -&amp;gt; Assign a request number -&amp;gt; MPP program with specified name is created with Top include File.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To create screen, Right click on program name -&amp;gt; Select Create -&amp;gt; Screen -&amp;gt; Opens Screen Description page -&amp;gt; Enter short description for screen -&amp;gt; Select screen type as NORMAL -&amp;gt; Click on LAYOUT pushbutton from application toolbar -&amp;gt; Opens Screen Painter -&amp;gt; Drag and drop two input fields from toolbar -&amp;gt; Likewise, create two pushbuttons -&amp;gt; Double click on each component -&amp;gt; Opens Attributes box -&amp;gt; Specify attributes for each screen component -&amp;gt; For pushbutton, specify FCT code -&amp;gt; Save the screen -&amp;gt; Click on Flowlogic pushbutton from application toolbar -&amp;gt; Opens Flow logic editor to create event functionalities for screen components -&amp;gt; Decomment PAI module -&amp;gt; Double click on PAI module name -&amp;gt; Click on Yes to create PAI module object -&amp;gt; Opens PAI module -&amp;gt; Specify the following code within module-endmodule statements:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CASE SY-UCOMM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'DISPLAY'.&lt;/P&gt;&lt;P&gt;LEAVE TO LIST-PROCESSING.&lt;/P&gt;&lt;P&gt;WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; IO1, IO2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&amp;gt; Save.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now double click on 'Includes' Folder (TOP INCLUDE FILE) -&amp;gt; Declare variables for input fields as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA : IO1(10), IO2(10).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save -&amp;gt; Activate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now To create Transaction Code, right click on Main Program Name -&amp;gt; Create -&amp;gt; Transaction -&amp;gt; Opens an interface -&amp;gt; Enter Tcode name starting with Z or Y -&amp;gt; Enter short description -&amp;gt; Continue -&amp;gt; Opens interface -&amp;gt; Enter Main program name and Screen number to be called first -&amp;gt; Save under a package -&amp;gt; Assign a request number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Activate all the objects of MPP program by right clicking on Main program Name -&amp;gt; Click on Activate -&amp;gt; Raises 'Objects Activated' message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To execute the MPP program, specify Tcode name in the Command Prompt area -&amp;gt; Press Enter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MPP SCREEN VALIDATIONS:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eg. code to make field validations in MPP program:&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Using screen painter, design a screen consisting of four input fields for client, username, password and language as we have in login screen of SAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assign the first two input fields to one group called GR1, the third input field to a group GR2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create two pushbuttons and assign FCT codes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the TOP INCLUDE FILE, declare following variables:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROGRAM  SAPMYSCREENVALID.&lt;/P&gt;&lt;P&gt;DATA : IO1(3), IO2(8), IO3(8), IO4(2).&lt;/P&gt;&lt;P&gt;DATA A TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save -&amp;gt; Activate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Flow logic editor, decomment PAI MODULE, double click on module name, and inside the module, write the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;module USER_COMMAND_0200 input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;case sy-ucomm.&lt;/P&gt;&lt;P&gt;WHEN 'LOGIN'.&lt;/P&gt;&lt;P&gt;CALL TRANSACTION 'SE38'.&lt;/P&gt;&lt;P&gt;WHEN 'EXIT'.&lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endmodule.                 " USER_COMMAND_0200  INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save -&amp;gt; Activate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In PBO module, write the following code to assign default input field attributes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;module STATUS_0200 output.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; SET PF-STATUS 'xxxxxxxx'.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; SET TITLEBAR 'xxx'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF A = 0.&lt;/P&gt;&lt;P&gt;MESSAGE S010(ZMSG).&lt;/P&gt;&lt;P&gt;LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;IF SCREEN-GROUP1 = 'GR1'.&lt;/P&gt;&lt;P&gt;SCREEN-REQUIRED = '1'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF SCREEN-GROUP1 = 'GR2'.&lt;/P&gt;&lt;P&gt;SCREEN-INVISIBLE = '1'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;MODIFY SCREEN.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;A = 1.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;endmodule.                 " STATUS_0200  OUTPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Save -&amp;gt; Activate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create a Transaction Code -&amp;gt; Execute the program.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arunsri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 10:01:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517204#M845926</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-04T10:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: Modlue programming guide!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517205#M845927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unlike report, interface, and conversion development which generally entails the creation of one autonomous program which can be executed independently of other objects, dialog program development entails development of multiple objects, none of which can be executed on its own. Instead, all objects are linked hierarchically to the main program and are executed in a sequence dictated by the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dialog programs are composed of the following main components:&lt;/P&gt;&lt;P&gt;Screens&lt;/P&gt;&lt;P&gt;Module pool&lt;/P&gt;&lt;P&gt;Subroutines&lt;/P&gt;&lt;P&gt;Menus/GUI statuses&lt;/P&gt;&lt;P&gt;Transaction codes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Screens are made up of the following components:&lt;/P&gt;&lt;P&gt;Screen attributes&lt;/P&gt;&lt;P&gt;Screen layout/screen elements&lt;/P&gt;&lt;P&gt;Fields&lt;/P&gt;&lt;P&gt;Flow logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Flow logic is comprised of two events:&lt;/P&gt;&lt;P&gt;The process before output (PBO) event invokes any processing which is to occur before the screen is displayed to the user.&lt;/P&gt;&lt;P&gt;The process after input (PAI) event invokes any processing which is to occur after the user has completed interaction with the screen by invoking any one of the possible functions (I.E. Save, back, enter, etc.).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and pls check following links&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="2432311"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.geocities.com/ZSAPcHAT" target="test_blank"&gt;http://www.geocities.com/ZSAPcHAT&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4546835"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4785224"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="4818772"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 10:02:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517205#M845927</guid>
      <dc:creator>arpit_shah</dc:creator>
      <dc:date>2008-03-04T10:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Modlue programming guide!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517206#M845928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;Module Pool Programming&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This component though is not attached to the screen painter, plays important role in transaction. Normally, for reports, on line executable programs are written but for transaction, Module Pool Programs are written. The module pool program contains only modules to handle various events associated with screen and data declaration statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System divides the module pool program into several include program. These are global field, PBO modules, and PAI modules. It is entirely user&amp;#146;s decision whether to use these modules or write directly into main program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creation of Module Pool Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can create module pool program either through &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Object browser&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;System automatically creates the module pool program and for these program which are created through object browser, system creates the include modules.&lt;/P&gt;&lt;P&gt;Or&lt;/P&gt;&lt;P&gt;ABAP/4 editor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is similar to normal program creation. Type of program should be given &amp;#145;M&amp;#146; and is not created by system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Communication between Dynpro and Module Program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For each screen, the system executes the flow logic, which contains corresponding events. The control is passed to Module Pool Program. Module Pool Program handles the code for these events and again passes back control to the flow logic and finally to screen. Unlike on line program, in this case, the control remains with flow logic. The switching of control between flow logic and module pool program and back is common process when user executes transaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creation of a Complete Transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steps involved to create a complete transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Create module pool program.&lt;/P&gt;&lt;P&gt;&amp;#149;	From screen painter create screens.&lt;/P&gt;&lt;P&gt;&amp;#149;	Write flow logic for each screen.&lt;/P&gt;&lt;P&gt;&amp;#149;	Write code for all the events in module pool program.&lt;/P&gt;&lt;P&gt;&amp;#149;	Check for any error in screen and flow logic.&lt;/P&gt;&lt;P&gt;&amp;#149;	Generate each and every component of screen i.e. flow logic and screen.&lt;/P&gt;&lt;P&gt;&amp;#149;	Single screen can be tested using Screen Painter.&lt;/P&gt;&lt;P&gt;&amp;#149;	Create transaction code through object browser.&lt;/P&gt;&lt;P&gt;&amp;#149;	Generate the transaction code.&lt;/P&gt;&lt;P&gt;&amp;#149;	User can execute the transaction by entering the transaction code in the command field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Handling Function Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function code or OKCODE is the last field of Field list. Function code can be handled as follows:&lt;/P&gt;&lt;P&gt;During the Designing of the screen, a function code is assigned to pushbutton.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	In field list, developer needs to specify OKCODE as last field.&lt;/P&gt;&lt;P&gt;&amp;#149;	In module program it is a global field and can be evaluated in the PAI event.&lt;/P&gt;&lt;P&gt;&amp;#149;	A function code is treated in the same way, regardless it comes from pushbutton, menu item or any other GUI element.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A complete example for transaction is shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have a screen like the one below:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;When the user clicks on the Display button, you want to display details of sflight, with corresponding carrid and connid (which is entered by the user).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module pool program to handle this particular screen is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Program YVTEST7.&lt;/P&gt;&lt;P&gt;TABLES: SFLIGHT.&lt;/P&gt;&lt;P&gt;DATA: OKCODE (4).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULE INPUT1 INPUT,&lt;/P&gt;&lt;P&gt; CASE OKCODE.&lt;/P&gt;&lt;P&gt;   WHEN &amp;#145;DISP&amp;#146;.&lt;/P&gt;&lt;P&gt;     SELECT * FROM SFLIGHT &lt;/P&gt;&lt;P&gt;            WHERE CARRID =  SFLIGHT &amp;#150; CARRID AND &lt;/P&gt;&lt;P&gt;                           CONNID = SFLIGHT &amp;#150; CONNID.&lt;/P&gt;&lt;P&gt;     ENDSELECT.&lt;/P&gt;&lt;P&gt;     LEAVE TO SCREEN 200.&lt;/P&gt;&lt;P&gt;   WHEN &amp;#145;EXIT&amp;#146;.  LEAVE TO SCREEN 0.&lt;/P&gt;&lt;P&gt;  ENDCASE.&lt;/P&gt;&lt;P&gt; ENDMODULE.			&amp;#147;INPUT1 INPUT&lt;/P&gt;&lt;P&gt; MODULE USER_COMMAND_0200 INPUT.&lt;/P&gt;&lt;P&gt; CASE OKCODE.&lt;/P&gt;&lt;P&gt;WHEN &amp;#145;BACK&amp;#146;. LEAVE TO SCREEN 100.&lt;/P&gt;&lt;P&gt; ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMODULE.				&amp;#147;USER_COMMAND_0200 INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the user clicks on display, control is transferred to screen no. 200 on which you display sflight details &amp;amp; on the same screen, when user clicks on BACK button, he comes back to main screen. &lt;/P&gt;&lt;P&gt;Flow logic for screen 100 is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt; MODULE INPUT.&lt;/P&gt;&lt;P&gt;Flow logic for screen 200&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt; USER_COMMAND_0200.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MODULES: Modules are handled in module pool program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to write flow logic for screen 200 and design screen 200.&lt;/P&gt;&lt;P&gt;In case of transaction transfer of data from program to screen is automatic i.e. you need not transfer the data from program to screen explicitly. The fields, which you define in the screen receives the data from program and displays the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Field Checks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As already mentioned Transaction is the only method, which SAP recommends to update the database tables. Data entered in the database table should be valid and correct. Data entered is validated at each and every point. ABAP/4 offers various methods to validate data and those are as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Automatic field checks&lt;/P&gt;&lt;P&gt;&amp;#149;	Checks performed in the flow logic&lt;/P&gt;&lt;P&gt;&amp;#149;	Checks performed in the ABAP/4 module pool program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Automatic Field Checks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These checks are based on the field information stored in the dictionary. These checks are performed by the system automatically when the user enters the data for the screen field. System performs these checks before PAI event is triggered. Types of field checks performed by system are as follows:&lt;/P&gt;&lt;P&gt;&amp;#149;	Required input&lt;/P&gt;&lt;P&gt;While designing the screen, for particular screen field if you click the Req. Entry checkbox, the field becomes mandatory. When the transaction is executed if user leaves this particular field blank, the system displays error message. User cannot proceed until the user enters some data.&lt;/P&gt;&lt;P&gt;&amp;#149;	Proper Data Format&lt;/P&gt;&lt;P&gt;Each field has its own data format whether it is table field or screen field. Whenever data is entered, system checks for the proper format of the data. For example date. Each user has its own format for date, which is defined in the user master record. If the date defined in the user master record is in the format DD/MM/YYYY, if the user enters the date, say, in YY/DD/MM, the user displays the error message. System also checks for the value of month or days. For example if month entered is greater than twelve then the error message is displayed.&lt;/P&gt;&lt;P&gt;&amp;#149;	Valid Value for the Field&lt;/P&gt;&lt;P&gt;In data dictionary two tables are related by Primary key-Foreign key relationship.  Whenever the user enters the data, the system checks for the check table values.   Also in Domain, if you have fixed values, then the system checks for these values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Automatic field checks are repeated each time the user enters the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About at Exit &amp;#150; Command&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Automatic field checks can be avoided by AT EXIT-COMMAND, which works exactly the same way as Cancel works on application tools bar. In the R/3 screen, if you want to quit the processing of that particular screen without entering the mandatory fields, user can click the Cancel button. Same functionality can be incorporated in the user-defined transaction by using AT EXIT-COMMAND. This module can be called before the system executes the automatic field checks and it goes without saying that before PAI event. Code for AT EXIT-COMMAND in flow logic and in module pool program can be written as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Flow Logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Process After Input.&lt;/P&gt;&lt;P&gt;Module exit AT EXIT-COMMAND.&lt;/P&gt;&lt;P&gt;         In module pool program.&lt;/P&gt;&lt;P&gt;Module exit.&lt;/P&gt;&lt;P&gt;Case okcode.&lt;/P&gt;&lt;P&gt;When &amp;#145;Exit&amp;#146;.&lt;/P&gt;&lt;P&gt;Leave to screen 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To achieve this kind of functionality a pushbutton or menu item should be assigned a function type &amp;#145;E&amp;#146;. It tells the system to process this particular module before carrying out any field checks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Flow Logic Validations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the case where you want user to enter only &amp;#145;LH&amp;#146; and &amp;#145;SQ&amp;#146; for sflight-carrid. In this case, you are restricting value of a screen field. This cannot be achieved by automatic field check. Hence there is a need of additional validation. It can be done in flow logic by using following statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field -&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt; Values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Field sflight-carrid values (&amp;#145;LH&amp;#146;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For multiple values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Field sflight-carrid values (&amp;#145;LH&amp;#146; &amp;#145;SQ&amp;#146;).&lt;/P&gt;&lt;P&gt;Field sflight-price values (between 1000 and 2000).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case when the user enters the value, PAI is triggered  and field is checked for  that particular value. If the value entered happens to be wrong, that field is enabled for user to enter. If you have multiple Field statements in your flow logic, it is sequential execution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider the following case:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Module  assign.&lt;/P&gt;&lt;P&gt;Field sflight-carrid values (&amp;#145;LH&amp;#146; &amp;#145;SQ&amp;#146;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ABAP/4&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module  assign.&lt;/P&gt;&lt;P&gt;Data: carrid1 like sflight-carrid.&lt;/P&gt;&lt;P&gt;Carrid1 = sflight-carrid.&lt;/P&gt;&lt;P&gt;Endmodule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, Sflight-carrid is used in the flow logic before the field statement. The system will give invalid value or some previous value as the field sflight-carrid is used in module before it is checked i.e., field statement is after the module in which sflight-carrid is being used. The field is not available to the system unless it executes the field statement. Field statement transfers the values to the program and is done only once. If you don&amp;#146;t have Field statement in your flow logic, transfer of values takes place in PAI event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Consider one more case where you have multiple field statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Field Sflight-carrid values (&amp;#145;LH&amp;#146;).&lt;/P&gt;&lt;P&gt;Field Sflight-connid values (&amp;#145;0400&amp;#146; &amp;#145;0500&amp;#146;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case if the user enters only carrid wrong, then this particular field is enabled and rest of the fields are disabled for user to input. Many times if the user enters wrong value for one field, then you might want to give option to user to enter all the fields, which is not possible by using Field statement only. This functionality can be achieved by CHAIN &amp;#150; ENDCHAIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Chain.&lt;/P&gt;&lt;P&gt;Field sflight-carrid value (&amp;#145;LH&amp;#146;).&lt;/P&gt;&lt;P&gt;	Field sflight-connid values (between &amp;#145;200&amp;#146; and &amp;#145;500&amp;#146;).&lt;/P&gt;&lt;P&gt;Endchain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Field sflight-price values (&amp;#145;100&amp;#146; &amp;#145;1000&amp;#146;).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, if the user enters wrong value only for carrid, both the fields i.e. carrid and connid are enabled as they are grouped together in the Chain statement. The field price will be disabled for input. Usually, logically related fields are grouped together with Chain-Endchain statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module Pool Program Validations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Checking fields ABAP/4 program includes&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;#149;	Field statement in flow logic.&lt;/P&gt;&lt;P&gt;&amp;#149;	Module statement in ABAP/4 module pool Program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAI.&lt;/P&gt;&lt;P&gt;Field sflight-carrid module &amp;lt;name&amp;gt;.&lt;/P&gt;&lt;P&gt;This module can be handled in the main program i.e. module pool program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ABAP/4 program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Module Check.&lt;/P&gt;&lt;P&gt;Select single * from sflight where carrid = sflight-carrid.&lt;/P&gt;&lt;P&gt;If sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;	Message e001.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, field sflight-carrid is checked in the table for its existence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynamically Calling the Screens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About Displaying Next Screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transaction is a sequence of screens, which are displayed one after the other. The next screen displayed depends upon the attributes of first screen. In attributes you need to give Next Screen number i.e. if next screen displayed should be 200 screen, then this number should be given in next Screen attributes. These are static attributes of the screen. By default, if nothing is specified in the program, the system branches out to the screen number, which is specified in the attribute screen.&lt;/P&gt;&lt;P&gt;In this case, if user selects MARA pushbutton, then fields from Mara table are displayed. When the user clicks on the MARD, then the fields from MARD table are displayed. Depending upon users selection, the screen is branched out and this has to be done during runtime. This functionality can be achieved by dynamically calling the screen in module pool program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The screen can branch out to new screen depending upon user selection. Following command in module pool program can do this:&lt;/P&gt;&lt;P&gt;&amp;#149;	SET SCREEM&lt;/P&gt;&lt;P&gt;&amp;#149;	CALL SCREEN&lt;/P&gt;&lt;P&gt;&amp;#149;	LEAVE TO SCREEN &amp;lt;NUMBER&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All these commands override the specifications given in the attributes. This overriding is temporary. The values stored in the attribute are not changed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set Screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set screen &amp;lt;number&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In module pool program&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case okcode.&lt;/P&gt;&lt;P&gt;	When  &amp;#145;DISP&amp;#146;.&lt;/P&gt;&lt;P&gt;		Set screen 200.&lt;/P&gt;&lt;P&gt;	When &amp;#145;LIST&amp;#146;.&lt;/P&gt;&lt;P&gt;		Set screen 300.&lt;/P&gt;&lt;P&gt;Endcase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case, the entire processing of current screen takes place and then the system branches out to next screen. If you want to branch out to the next screen without processing the current screen, LEAVE SCREEN should be used along with the SET SCREEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Case okcode..&lt;/P&gt;&lt;P&gt;	When  &amp;#145;DISP&amp;#146;.&lt;/P&gt;&lt;P&gt;		Set screen 200.&lt;/P&gt;&lt;P&gt;		Leave Screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	When &amp;#145;LIST&amp;#146;.&lt;/P&gt;&lt;P&gt;		Set screen 300.&lt;/P&gt;&lt;P&gt;		Leave Screen.&lt;/P&gt;&lt;P&gt;Endcase.&lt;/P&gt;&lt;P&gt;When SET SCREEN is used, control cannot be transferred to the main screen or previous screen, unless you write code for the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call Screen&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Usually used for pop up screens. Many times, there is a need for user to enter additional information or secondary information on another screen or pop up screen. Once the user enters the data, he should be able to go back to main screen or to the screen where he started. This is not possible by using SET SCREEN. CALL SCREEN achieves this functionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Syntax&lt;/P&gt;&lt;P&gt;Call Screen 200.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Will simply call a screen number 200 from a main screen. Once the screen is displayed the user can enter all the data and return to the main screen by clicking BACK button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To call screen as pop up screen the syntax is &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call screen starting at &amp;lt;col.no.&amp;gt; &amp;lt;line no&amp;gt;&lt;/P&gt;&lt;P&gt;				 Ending at &amp;lt;col no&amp;gt; &amp;lt;line no&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case window will be popped as window and user can close it by using BACK button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leave to screen &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To SET a new screen without processing current screen, you need to use the following two statements together:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET SCREEN 200.&lt;/P&gt;&lt;P&gt;LEAVE SCREEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or a Single statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEAVE TO SCREEN 200.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Mar 2008 10:07:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/modlue-programming-guide/m-p/3517206#M845928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-04T10:07:00Z</dc:date>
    </item>
  </channel>
</rss>

