Selection Screens Selection Screens Parameters PARAMETERS <parm>[(<length>)] <type> [<decimals>]. Creates a parameter <parm>. The additions length, type, and decimals are the same as for DATA. Cannot have type F. Comments on the left side of the input fields can be changed using Selection Texts. Other additions: DEFAULT <f> - can be either a literal or a field name. Default values transported before INITIALIZATION. Therefore, default can be only fields which are already filled when the user starts the program (e.g. SY-...); NO-DISPLAY - hides parameter. To hide a parameter only under certain conditions declare it without NO-DISPLAY suppress its display by using MODIFY SCREEN. LOWER CASE - allows accept lower case. Cannot be used if a parameter references a dictionary fields which has its own attributes; OBLIGATORY AS CHECKBOX - creates a checkbox (type C(1)). Cannot have TYPE|LIKE addition. Valid values are ' ' and 'X'. Note. Using LIKE to refer to an ABAP/4 Dictionary field of type CHAR of length 1 and valid values 'X' and ' ' (defined in the field's domain) automatically creates a checkbox on the selection screen; RADIOBUTTON GROUP <radi> - creates a radiobutton and assigns it to the group <radi> (length of the <radi> cannot be > 4). Can have LIKE refering to C(1). Valid values are ' ' and 'X'. If no DEFAULT addition exists then first radiobutton in group will be 'X'; MEMORY ID <pid> - uses a default value from the global SAP memory (SPA/GPA parameters). <pid> can be up to 3 characters long and must not be enclosed in quotation marks. You use the global SAP memory to pass values retained beyond transaction limits between programs. This memory is available to a user for the entire duration of a terminal session and any parallel sessions use the same memory. The SAP memory is thus more comprehensive than the transaction-bound Data Clusters in ABAP/4 memory. See the TPARA table ("Directory of Memory IDs") for all system Memory IDs. Parameters can be set user specific in the user's master records with the name <pid>. See also SET/GET PARAMETER. MATCHCODE OBJECT <mobj> - assigns matchcode object from Data Dictionary to the parameter. <mobj> should be 4 characters long and must not be enclosed in quotation marks. If you use this option, the possible entries pushbutton appears after the input field of the parameter (? not always). When the user presses this button, the effect is to perform a matchcode selection for the input field MODIF ID <key> - assigns the parameter to a modification group. <key> should be 3 characters long and must not be enclosed in quotation marks. The MODIF ID option ABAP Training Page 1 of 7 Selection Screens always assigns <key> to the column SCREEN-GROUP1 of the internal table SCREEN. Parameters assigned to a modification group can be processed as an entire group with the LOOP AT SCREEN/MODIFY SCREEN statements during the AT SELECTIONSCREEN OUTPUT event; logical database specific additions. ABAP Training Page 2 of 7 Selection Screens RANGES RANGES <range> FOR <f>. This is a short form of DATA: BEGIN OF <range> OCCURS 10, SIGN(1), OPTION(2), LOW LIKE <f>, HIGH LIKE <f>, END OF <range>. Creates a selection table <range> which refers to the column of database field <f> or to an internal field <f>. The <range> has the same structure as Selection Options internal table, but the are not part of the selection screen and are not linked to a database table. SIGN OPTION LOW HIGH Iinclusion; E exclusion. ABAP Training Logical operators: EQ, NE, GT, GE, LE, Single value LT, CP, NP - if HIGH is if HIGH is empty; Upper limit empty; Lower limit - or empty BT (between), NB (not if HIGH is not empty. between) - if HIGH is not empty. Page 3 of 7 Selection Screens Selection Options o o SELECT-OPTIONS <selopt> FOR <fgt;. Creates a selection table <selopt> for the column <f> of a database table or for an internal field <seltab>. The database table must be declared with TABLES. The <selopt> name can be up to 8 characters. Cannot have type F. Comments on the left side of the input fields can be changed using Selection Texts. The <selopt> has the same format as RANGE tables. Additions the same as for PARAMETERS: NO-DISPLAY LOWER CASE OBLIGATORY MEMORY ID <pid> MATCHCODE OBJECT <mobj> MODIF ID <key> Specific additions: DEFAULT <f1> [TO <f2>] [OPTION <option>] [SIGN <sign>] - fills 1st line of <selopt> with default value or interval (if both <f1> and <f2>). <f1> and <f2> can be either a literal or a field name. Default values transported before INITIALIZATION. Therefore, default can be only fields which are already filled when the user starts the program (e.g. SY-...). <option>: single values - EQ, NE, GE, GT, LE, LT, CP, or NP. The default value is EQ; intervals - BT or NB. The default value is BT. <sign> = I|E (Incllude|Exclude). The default value is I; NO-EXTENSION - forbids multiple selection( ); NO INTERVALS - hides TO-field (but an interval is still can be selected using the button. Use the function module SELECT_OPTIONS_RESTRICT to completely forbid intervals); NO DATABASE SELECTION - if a logical database is attached to the report program and a selection criterion is connected to a database table, which is also part of the logical database, and if that database table is designated for a dynamic selection, the system transfers the corresponding selection criteria to the logical database. The logical database does not read lines from the database table that do not meet these selection criteria. If you want the logical database to read these lines anyway, for example, when you use the selection criteria for other purposes than limiting database accesses, use the NO DATABASE SELECTION. . ABAP Training Page 4 of 7 Selection Screens Selection Screen Formatting SELECTION-SCREEN SKIP [<n>]. Generates <n> blank lines, where <n> = 1..9, 1 is default. SELECTION-SCREEN ULINE [<format>] [MODIF ID <key>]. Generates an underline. <format> is [[/]<pos>](<len>): "/" generates a new line and therefore is not allowed inside BEGIN OF LINE...END OF LINE. (<len>) without <pos> uses current position and only allowed inside BEGIN OF LINE...END OF LINE. <pos> can be a number (in this case it is relative to the frame if inside BEGIN OF BLOCK WITH FRAME...END OF BLOCK) or POS_LOW|POS_HIGH. SELECTION-SCREEN COMMENT <format> <text> [FOR FIELD <f>|<selopt>] [MODIF ID <key>]. Writes <text>: text symbol text-<nnn>; a field name with a maximum length of 8 characters. This character field must not be declared with (for example) the DATA statement, but is generated with length <len> automatically and must be filled dynamically during the INITIALIZATION. FOR FIELD option has as a result, if the user requests help on the comment on the selection screen, the help text for the assigned field is displayed. SELECTION-SCREEN BEGIN OF LINE. ... SELECTION-SCREEN END OF LINE. Places several elements on a single line. Note that the selection text (name of the parameter or text element) is not displayed when this option used. To display a selection text COMMENT option must be used. SELECTION-SCREEN POSITION <pos>. <pos> can be a number (in this case it is relative to the frame if inside BEGIN OF BLOCK WITH FRAME...END OF BLOCK) or POS_LOW|POS_HIGH. SELECTION-SCREEN BEGIN OF BLOCK <block> [WITH FRAME [TITLE <text>]] [NO INTERVALS]. ... SELECTION-SCREEN END OF BLOCK <block>. Creates a logical block. Blocks can be nested. Only 5 blocks with frames can be nested. NO INTERVALS displays all SELECT-OPTIONS within the block as with NO INTERVALS addition; inherited by subordinate blocks with frames and does not by subordinates blocks without frames. ABAP Training Page 5 of 7 Selection Screens Selection Screen Events INITIALIZATION. Executes a processing block before the selection screen is processed. In this block you initialize the selection screen. This is also the only possibility to change the default values of parameters or selection criteria defined in logical databases. You can find out the names of the internal fields you want to change either by examining the logical database SAPDB<ldb> itself (with the transaction SLDB or by choosing Tools->ABAP/4 Development Workbench->Development->Programming environ.->Logical databases), or by retrieving the technical information of that field. AT SELECTION-SCREEN. Executes a processing block after the system has finished processing the selection screen. If an error|warning message is sent from this processing block, the system displays the selection screen again and all input fields can be changed. AT SELECTION-SCREEN ON <parm>|<selopt>. Executes a processing block after the system has finished processing the <parm>|<selopt>. If an error|warning message is sent from this processing block, the system displays the selection screen again and only this input field can be changed. AT SELECTION-SCREEN ON END OF <selopt>. Executes a processing block at the end of processing Multiple Selection Window of the <selopt>. Can be used to check the entries in the internal table <selopt>. Both the E and W messages are sent in dialog window. AT SELECTION-SCREEN ON BLOCK <block>. Executes a processing block after the system has finished processing the <block>. If an error|warning message is sent from this processing block, the system displays the selection screen again and only the input fields in the <block> can be changed. AT SELECTION-SCREEN ON RADIOBUTTON GROUP <radi>. Executes a processing block after the system has finished processing the <radi>. If an error|warning message is sent from this processing block, the system displays the selection screen again and only the radiobutton group <radi> can be changed. AT SELECTION-SCREEN ON VALUE-REQUEST FOR <parm>|<selopt>. The possible entries button automatically appears next to the input field for <parm>|<selopt> when it is selected on the selection screen. Executes a processing block which allows user to choice a value from a list when user presses the button or F4. Can be used only in report programs, not in a logical database program. AT SELECTION-SCREEN ON HELP-REQUEST FOR <parm>|<selopt>. Executes a processing block which displays a help text when user presses F1 or the button on the selected <parm>|<selopt>. Can be used only in report programs, not in a logical database program. AT SELECTION-SCREEN OUTPUT. Executes a processing block during the PBO of a selection screen for each ENTER. For example, here can be applied a modifications to the screen: ABAP Training Page 6 of 7 Selection Screens LOOP AT SCREEN. .... MODIFY SCREEN. ENDLOOP. To change at runtime attributes of screen fields. SCREEN is memory table which automatically created and maintained by system (with header line). The structure of the SCREEN: Name Length Description NAME 30 Name of the screen field GROUP1 3 Modification group 1 GROUP2 3 Modification group 2 GROUP3 3 Modification group 3 GROUP4 3 Modification group 4 ACTIVE 1 Visible and ready for input REQUIRED 1 Mandatory INPUT 1 Ready for input OUTPUT 1 For display only INTENSIFIED 1 Highlighted INVISIBLE 1 Supressed LENGTH 1 Output length is reduced DISPLAY_3D 1 Displayed with 3D frames Displayed with value help VALUE_HELP 1 To activate a field attribute, set its value to 1. To deactivate it, set it to 0. If ACTIVE = 0, then system sets INVISIBLE = 1 and INPUT = 0, and user can neither see the field nor enter values into it. ABAP Training Page 7 of 7