SAP ABAP Beginner Tutorials – Previously you’ve learn how to use variable, arithmetic and flow control in ABAP Programming. On this article we learn how to create interface with user in ABAP Program, There are multiple ways to create interface for user but this session we will learn create classic selection screen ABAP Program.

The basic keywords of classic selection screen programming are shown below in table. We will explain each of these in more details throughout this section.

KeywordDescription
SELECTION-SCREENDefines a screen
PARAMETERGets input for a single variable from
the user
SELECT-OPTIONSGets a range of data from the user
BLOCKUsed to organize the different input
items on the screen

In the selection screen flow, you ask the user for some input, process that input, and provide results. This process could be used to complete a query and display the results or to complete some actions using the data that you find.

1.SELECTION-SCREEN

You can gather data from the user using the PARAMETER and SELECT-OPTIONS keywords, but those keywords must be contained inside a SCREEN or a within a BLOCK inside a screen. Screens are given a unique number to distinguish them from one another. Every ABAP program contains a standard screen 1000 when created.

If you want to create additional screens to use in addition to the default screen 1000, you can do so with the BEGIN OF SCREEN keyword. You can then call your screen using the CALL SELECTION-SCREEN keyword. Because the default screen is always 1000, your new screen will not be called unless you specifically call it.

For example : We create new selection screen with an id 1000.

2. BLOCK

The BLOCK is used to organize the input elements within the selection Organize input screen. If you start your ABAP program with a BLOCK, that BLOCK will elements be added to screen 1000. A block can have any alphanumeric name, unlike the screen, which can only have a numeric identifier. Blocks can be reused across multiple screens in an ABAP program.

BLOCK OptionDescription
WITH FRAMEAdds a frame around the input
options inside of the block
WITH FRAME TITLE ( title )Adds a title to the top of the block
NO INTERVALSRemoves the second input box from
SELECT -OPT! ONS within the block to
make the entire block have a smaller
width .

For Example :

Result:

selection-screen-abap-1

To create text symbol for title of block and Selection Text for description of parameter in SE80 you can open menu Goto -> Text Elements -> Text Symbols. or the other way creating text symbol you can double click on ABAP code on after FRAME TITLE , TEXT-F01.

selection-screen-abap-2

3.PARAMETER

Now that you know how to organize the input controls using screens and blocks, it’s time to cover the actual input controls, beginning with the PARAMETER keyword. The parameter keyword will take a single input from a user and save the input in a PARAMETER variable.

Note : Parameter variable names must 8 characters in length or less.

Example:

This following list is parameter options.

Parameter OptionDescription
OBLIGATORYUser cannot execute the program until a value is
entered.
DEFAULTSet a default value for the parameter.
AS CHECKBOXParameter is set as a checkbox that will return
ABAP _TRUE or ABAP FALSE when selected or
not selected.
RADIOBUTTON GROUP
group
Works like a checkbox, but will only allow one
parameter to be selected within a defined group.
AS LISTBOX VISIBLE
LENGTH n
Will create a dropdown selection for all possible
optiom for the parameter data type. The
dropdown list width is defined by n.

You can add the OBLIGATORY option to prevent the user from running the program without entering a value:

Parameters can also be given a default value by adding the DEFAULT keyword with a value:

When radio buttons are used, only one radio button per group can be  selected at a time, but it’s possible for the user to click EXECUTE on the buttons selection screen without any radio button selected. For this reason, you want to set one button as selected by default. To do so, set the default value to ‘X’:

The radio button group identifier can be any four characters, and you can create multiple groups of radio buttons by changing that identifier:

Result :

selection-screen-abap-3

4.SELECT-OPTIONS

The SELECT-OPTIONS keyword allows for the user to select from a range of options. This keyword comes in handy when you need to access data from a database.

Unlike PARAMETER , SELECT-OPTIONS requires a variable based on a data types database table in order to define what options are available to be selected.

Example :

Result :

selection-screen-abap-4

The next article we will learn ABAP Events ..

 

Leave a Reply

Your email address will not be published. Required fields are marked *