Wednesday 28 August 2013

AUGUST 28

Working with Screen Painter in SAP/ABAP

Screen Painter allows us to define the user input screen, meaning that we can define text boxes, drop-down menus, list boxes, input fields, tabbed areas of the screen and so on. It allows you to define the whole interface which the user will eventually use, and behind the initial elements that are put on the screen, you can also define the individual functions which are called when the user interacts with them.

A screen can contain a wide variety of elements, either for displaying field contents, or for allowing the user to interact with the program (for example, filling out input fields or choosing pushbutton functions). we use the Screen Painter to arrange elements on the screen.

Screen Elements:

       Text fields  :  Display elements, which cannot be changed either by the user or by the ABAP program.
       Input/output fields and templates : Used to display data from the ABAP program or for entering data on the screen. Linked to screen fields.
        Dropdown list boxes :  Special input/output fields that allow users to choose one entry from a fixed list of possible entries.
       Checkbox elements  : Special input/output fields that the user can either select (value ‘X’) or deselect (value SPACE). Checkbox elements can be linked with function codes.
    Radio button elements : Special input/output fields that are combined into groups. Within a radio button group, only a single button can be selected at any one time. When the user selects one button, all of the others are automatically deselected. Radio button elements can be linked with function codes.
        Pushbuttons : Elements on the screen that trigger the PAI event of the screen flow logic when chosen by the user. There is a function code attached to each pushbutton, which is passed to the ABAP program when it is chosen.
        Subscreens : Area on the screen in which you can place another screen.
        Table controls : Tabular input/output fields.
        Box : Display element, used for visual grouping of related elements on the screen, such as
radio button groups.
        Tabstrip controls : Areas on the screen in which you can switch between various pages.
        OK field : Every screen has a twenty-character OK_CODE field (also known as the function code field) that is not displayed directly on the screen.

Screen Attributes

Like all objects in the R/3 Repository, screens have attributes that both describe them and
determine how they behave at run time. Important screen attributes for ABAP programming:
 Program: The name of the ABAP program (type 1, M, or F) to which the screen belongs.
 Screen number : A four-digit number, unique within the ABAP program, that identifies the screen within the program.
 Screen type : A normal screen occupies a whole GUI window. Modal dialog boxes only cover a part of
a GUI window. Their interface elements are also arranged differently. Selection screens
are generated automatically from the definition in the ABAP program. We may not define
them using the Screen Painter. A sub screen is a screen that we can display in a
sub screen area on a different screen in the same ABAP program.
 Next screen : Statically-defined screen number, specifying the next screen in the sequence. If we
enter zero or leave the field blank, we define the current screen as the last in the chain.
If the next screen is the same as the current screen, the screen will keep on calling itself.
we can override the statically-defined next screen in the ABAP program.

Processing Screens:

There are two ways of calling a screen. we can either use a transaction code, or the CALL SCREEN statement in an ABAP program. When we call a screen, the PROCESS BEFORE OUTPUT event (PBO) is called, and the corresponding event block in the screen flow logic is processed. The screen itself is then displayed until the user triggers the PROCESS AFTER INPUT (PAI) event by choosing a function. In between, there may be field or input help processing. The corresponding event blocks in the flow logic are processed, if they exist. The main purpose of event blocks in the screen flow logic is to call dialog modules in the ABAP program and to provide the ABAP program with data.

Example of  screen in screen painter: