0% found this document useful (0 votes)
111 views21 pages

Parameters: (Length)

The document discusses various parameters and additions that can be used with the PARAMETERS and SELECT-OPTIONS statements in ABAP to customize selection screens. It describes how parameters define input fields, additions like LENGTH and VISIBLE LENGTH control field attributes, and SELECT-OPTIONS defines selection criteria for database tables. The document also covers events like AT SELECTION-SCREEN that validate user input and START-OF-SELECTION that processes selection criteria.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views21 pages

Parameters: (Length)

The document discusses various parameters and additions that can be used with the PARAMETERS and SELECT-OPTIONS statements in ABAP to customize selection screens. It describes how parameters define input fields, additions like LENGTH and VISIBLE LENGTH control field attributes, and SELECT-OPTIONS defines selection criteria for database tables. The document also covers events like AT SELECTION-SCREEN that validate user input and START-OF-SELECTION that processes selection criteria.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 21

Length denotes how much space is required for input field in the selection screen.

If no length is is taken then, system automatically takes single space for input.

PARAMETERS

<parameter_name> (Length) OR LIKE <obj_name>

TYPE <type_name or table_name with field_name> DECIMALS <d>.

The input field is filled with Default value.User can accept or change that value. DEFAULT <f>. If we use Lower Case then all the input values will be in lower case and if we dont use Lower case then all the input values will be converted to Upper case. LOWER CASE or UPPER CASE. * For Type addition there is some exception. With this addition we can reduce the visible length of the input field on the selection screen. We have to use this addition if we want to reduce the visible length of the input field. VISIBLE LENGTH (Len). The user cannot continue with the program without entering a value in this input field. When we use this option, a question mark appears in the input field of the selection screen. OBLIGATORY . Search help name must be defined in the ABAP dictionary. MATCHCODE OBJECT <search help name> . To check a user entry against a check table or against fixed values in the ABAP dictionary VALUE CHECK . * This addition defines the input field of a parameter as a checkbox.Here the parameter type is always Char with length 1. AS CHECKBOX . This addition defines the input field of a parameter as a radiobutton. The maximum length of the string <rad> is 4. We must assign at least 2 parameters to each <rad> group. Only 1 parameter per group must have a default value assigned using DEFAULT addition. The default value must be X.If we do not use the default addition,the 1st parameter of each group is set to X.

RADIOBUTTON GROUP <radiobutton group name(rad)> .

PARAMETERS

<parameter_name> (Length) To suppress the display of the input field NO-DISPLAY .*

on the selection screen we use this. In a Report 3 stages are there, 1) Data input (Selection Screen) , 2) Data processing (Select statement) & 3) Data output (Write,Skip,Uline,Vline etc). Mainly reports are of two Types : a) Classical Reports :Displays the whole data in One List. b) lnteractive Reports:- Display the summarized information as the First List and the detailed information in the secondary Lists. SELECT-OPTIONS : This statement creates a selection criteria on the selection screen for a particular database field. The select-options statement also creates a selection table with the same name given in the select-options statement. This selection table is nothing but an internal table that holds the selection criteria for that field. PARAMETERS statement accepts only single inputs, whereas SELECT-OPTIONS statement accepts range of inputs on the selection-screen. SELECT-OPTIONS <selection table name> FOR <database table name-field name> Structure of the Selection Tables : The row type structure of Selection Table consists of the following four components, SIGN, OPTION, LOW & HIGH. I stands for inclusive EQ E stands for exclusive LE NE GT LT CP

NP BT NB

Selection Table Low High Multiple selection button(Pushbutton) Using a multiple selection means to append several rows to the selection table. When the Multiple selection button is green that means several rows are appended to the selection table. Different use of SELECT-OPTIONS :Report Demo. Data Wa_Carrid TYPE SPFLI-CARRID. SELECT-OPTIONS AIRLINE for Wa_Carrid. Here as per the syntax of SELECT-OPTIONS we did not use database table name with field name (i.e. Wa_Carrid), so we have to declare a data type Wa_Carrid which actually denotes same data type like SPFLI-CARRID.

These symbols are green to show that the SIGN field has value I. If the SIGN field has value E , the symbols are red. 5th Sep Some additions comes with SELECT-OPTIONS statement :-

1. Default addition :- We assign some Default values to the selection criteria. SELECT-OPTIONS <SELCT. TABLE> FOR <DATABASE TABLE NAME-FIELD NAME> DEFAULT <g> [to <h>] [OPTION <op>] [ SIGN <s>] This means that you can fill only the first row of selection table <seltab> with default values. To fill more rows with default values, the selection table must be processed before the selection screen is called, for example, during the AT SELECTION-SCREEN -OUTPUT event. 2. No-Extension addition :- With the addition of NO-EXTENSION we can restrict the selection table to take more than one row . Here the multiple selection button will not be available for the user.

No multiple selection button. SELECT-OPTIONS <SELEC. TABLE> FOR <DB TABLE NAME -FIELD NAME> .. NO-EXTENSION. 3. No Intervals addition :- When we use this addition only the LOWER INPUT FIELD is visible on the selection screen. Here the user can enter only a single field comparison for the first row of the selection table and use multiple selection button for range selection for more rows.

No Higher Input Field is available. SELECT-OPTIONS <SELEC. TABLE> FOR <DB TABLE NAME- FIELD NAME> . NO INTERVALS.

Now we can also add NO-EXTENSION addition with NO INTERVALS addition. The result will be as follows.

SELECT-OPTIONS <SELEC. TABLE> FOR <DB TABLE NAME -FIELD NAME> NO INTERVALS NO-EXTENSION. 2 types of selection screen is there, i) STANDARD SELECTION SCREEN & ii) USER DEFINED SELECTION SCREEN. Standard Selection Screen User Defined Selection Screen Standard selection screen can be called if they contain User defined selection screen can be called even if they do not atleast 1 input field declared using Parameters or Selectcontain an input field. options statement. Different Foramtting Options of the Selection Screen :1. Blank Lines :- To obtain blanks or blank lines on the selection screen we have to use the SKIP keyword along with the selection-screen statement. The value <n> generates number of blank lines and will have value between 1 and 9 SELECTION-SCREEN SKIP <n> 2. Underlines :- This addition creates an underline. SELECTION-SCREEN ULINE [/POS<LEN>]

3. Comments :- SELECTION-SCREEN COMMENT [POS<LEN>] <COMM> [FOR FIELD <F>]

4. Several elements in a single line :- If we want a set of parameters or comments in a single line on the selection screen then we have to use a block statement and inside this block statement we have to declare those parameters statement or comments. SELECTION-SCREEN BEGIN OF LINE.. . SELECTION-SCREEN END OF LINE. Some point to remember :- i) In a block statement the PARAMETERS name & the SELECTOPTIONS statements selection table name will not come.For that we have to use the COMMENT statement. ii) We have to use the POSITION addition only between the BEGIN OF LINE & END OF LINE. Here we use the POSITION addition for positioning the elements. 5. Blocks of element :- For creating logical blocks of element we have to use this block of statement on the selection-screen. SELECTION-SCREEN BEGIN OF BLOCK <BLOCK NAME> WITH FRAME [TITLE <TITLE NAME>] [NO INTERVALS]. SELECTION-SCREEN END OF BLOCK <BLOCK NAME>. A frame is drawn around the block User-defined Selection-Screen :- 3 ways User-defined Selection screen is called and we can create User-defined Selection-screen in Executable program,Function Module and in Module Pool program. CALL SELECTION-SCREEN <SCREEN NUMBER> [STARTING AT <X1> <Y1> ] [ENDING AT <X2> <Y2>] To display the user-defined Selection-Screen as a Modal dialog box.

6. Pushbuttons on the Selection-Screen :- To create a PUSHBUTTON on the Selection Screen we use this statement. SELECTION-SCREEN PUSHBUTTON [/] POS <LEN> <PUSH BUTTON NAME> USERCOMMAND <UCOMM NAME> Whenever Pushbutton related program will come, we have to take SSCRFIELDS tables statement to declare the structure.UCOMM is one of the field of the SSCRFIELDS table and this field is triggered when the Pushbutton is pressed. An ABAP program consists of a sequence of processing blocks (events) that are processed by the runtime system in a particular order. Classical Report Events :1. LOAD-OF-PROGRAM --- When an executable program, a module pool, a function group or a subroutine pool is loaded into the sap memory, then LOAD-OF-PROGRAM is triggred directly. For every program this event is executed only once at a time. 2. INITIALIZATION-- Occurs immediately after LOAD-OF-PROGRAM and before the selection screen processing of any existing standard selection screen. This event is triggered when we execute your program for the first time i.e., before selection screen is displayed. Purpose :- This block helps to pre-assign the values to the parameters and selectoptions of the selection screen. 3. AT SELECTION-SCREEN :- This event is called when the selection screen is processed, that means when the user triggers a function code on the selection screen (i.e., by clicking on push-button, hitting a function key, etc.).Also when data validity checking on selection screen field occurs and when appropriate messages sent back to the user (error, confirmation, warning messages). After the user enters new information, AT SELECTION-SCREEN is triggered again. 3. a) AT SELECTION-SCREEN ON <FIELD> :- This event can be used if the user wants checks or validations for a particular field on the selection screen.

AT SELECTION-SCREEN ON <FIELD> and AT SELECTION-SCREEN events, both do the same job i.e.validating the input fields present on the selection screen. The only difference is AT SELECTION-SCREEN event is used to validate all the fields on the selection screen where as AT SELECTION-SCREEN ON <FIELD> event is used to validate a particular field in the selection screen. When we use At Selection-screen on <field> event, and while performing the check or validation of that particular field if an error message is displayed, then that particular is only open and rest all the fields are grayed out. Whereas when we use At Selection-Screen event all the inputs fields are open and editable. At selection-screen on <field> is triggered first and then At selectionscreen event follows it. 4. START-OF-SELECTION :-

V_TDEVC is the name of the database table where all the packages/ development classes are stored.

TABLE MAINTENANCE GENERATOR :TMG is a tool --- used for customized tables created by end users --- TMG can change the table as required, such as making an entry to that table, deleting an entry, modifying an existing entry etc.

ABAP LIST VIEWER (ALV) :ALV is a simple, user friendly and better looking reporting tool as compared to the conventional / interactive reporting. We can approach an ALV program in 2 ways.

ADVANTAGES OF ALV :1. Looks better. 2. User friendly. a) Filtering / Sorting. b) Layout Change / Save. c) Summation, Download to excel, E-Mail. d) Data can be open for input / change etc. 3. Better Event handling. 4. Width of more than 256 characters possible. 5. Programming overhead of mentioning exact positions in write statements not needed. WORKING OF ALV REPORT (USING FUNCTION MODULES):ALV uses a set of function modules to which data in the form of an internal table is passed by a report program. The internal table is processed and displayed as a report. TYPES OF ALV REPORTS ACCORDING TO THE USE OF FUNCTION MODULES :1. Simple / Normal ALV Report 2. Blocked ALV report 3. Hierarchical Sequential ALV Report.

Classical Interactive In simple ALV report we use two of these function modules, i) REUSE_ALV_LIST_DISPLAY --- this is used for ALV LIST DISPLAY. ii) REUSE_ALV_GRID_DISPLAY --- this is used for ALV GRID DISPLAY. ALV LIST ALV GRID

1. ALV LIST can be coded using only FMs. object oriented 2. ALV LIST is used for Display only. EDITABLE for entry purpose.

1. ALV GRID Can be coded using FMs and concepts. 2. Whereas ALV Grid Can Be

http://www.sapdev.co.uk/reporting/alv/alvgrid.htm

http://www.sapgeek.net/2009/10/sap-alv-tutorial-%E2%80%93-event/ ----(This behind it) http://www.erpgreat.com/abap/what-are-the-events-in-alv.htm ---http://www.sapdev.co.uk/reporting/alv/alvgrid.htm ---- alv grid programs

article deals with event handling in SAP ALVand mechanism

http://www.sap-press.de/download/dateien/2502/sappress_abap_data_dictionary.pdf

ABAP DICTIONARY :A data dictionary is a centralized storage location for information about the data that is stored in a database. This information is often called metadata (data about data). The ABAP Dictionary centrally describes and manages all the data definitions used in the system. The ABAP Dictionary is completely integrated in the ABAP Development Workbench.
TABLES :-

A Table is Group of fields which can store multiple records.

A table definition in the ABAP Dictionary contains the following components. REFERENCE TABLES AND REFERENCE FIELDS :The reference table and reference field are the fields which specify the currency key or Unit of Measure. Suppose if the user specifies a currency amount say 1000$, the currency amount field would indicate the amount 1000 and the currency key indicates that the currency specified is in Dollars. A reference field is needed for all currency and quantity fields as the figures in this field need a currency or unit. If you have no reference field and table for fields of this kind you will get a syntax error. This syntactic constraint reflects a semantic fact: A figure in a field does not tell you a lot if you do not know to which quantities or currencies the figure is related: It does not suffice to know that you have, for example, five items, but you need to know if you have five meters, five Euros, five pound etc. And this information is provided the reference field and table.

INCLUDES : Structure A was included in table B. A new field is inserted in structure A. When structure A is activated, table B is adjusted to this change, that is the new field is also inserted there.

PRIMARY KEYS :A primary key is a field or group of fields that uniquely identify a single record in a table. Primary Key fields cannot be NULL and cannot contain duplicate values. If we want to link two tables, the primary key of one table will be added to another table where primary key of first table will be become the foreign key of second table.
Example: SUBJECT TABLE

Check Table or referenced Table


STUDENT TABLE

Foreign key Table or Dependent Table We will link these 2 table with the SUBJECT_CODE. Add the primary key of SUBJECT table: SUBJECT_CODE to STUDENT table. Now the SUBECT_CODE becomes the foreign key of STUDENT table and SUBJECT table becomes the check table.

STUDENT table after creating foreign key

HOW TO CREATE A FOREIGN KEY IN SAP TABLE The purpose of the foreign key is to validate the data that is being entered into a table by checking entries in a check table. Foreign keys are checked by the front end user interface only and it is not checked if you issue a direct a SQL statement to update the database. 1.) Open the STUDENT table. Select the field for which you want to create the foreign key and press Foreign Keys button. In this example, we select SubjectCode field.

2.) On the popup window, enter the check table name and press Generate proposal button. 3.) The system proposes the foreign key relation based on the domain. Check that the foreign key relationship proposed by the system is correct and press copy.

4.) Foreign key is created. Now save and activate the table. To check the foreign key go to Menu path Utilities >> Table Contents >> Create Entries. 5.) Try to create an entry in STUDENT table with SUBJECT CODE that is not exist in the SUBJECT table. Enter the values and try to save the entry.

6.) The error message will be displayed in the Status bar. The user interface does the foreign key validation before creating the entries.

You might also like