0% found this document useful (0 votes)
4 views27 pages

Chapter 13_Selection Screens User Messages

The document outlines the objectives and functionalities related to creating selection screens and user messages in ABAP programs. It covers various aspects including the use of SELECT-OPTIONS, PARAMETERS, checkboxes, radio buttons, and error handling through messages. Additionally, it provides examples and guidelines for formatting selection screens and managing user interactions.

Uploaded by

Aniruddha_Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views27 pages

Chapter 13_Selection Screens User Messages

The document outlines the objectives and functionalities related to creating selection screens and user messages in ABAP programs. It covers various aspects including the use of SELECT-OPTIONS, PARAMETERS, checkboxes, radio buttons, and error handling through messages. Additionally, it provides examples and guidelines for formatting selection screens and managing user interactions.

Uploaded by

Aniruddha_Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 27

IBM Global Services

Selection Screens and User Messages

Selection Screens and User Messag Dec-2008 © 2005 IBM Corporation


es |
IBM Global Services

Objectives

 The participants will be able to:


 Create Selection Screen Parameters.
 Check input data from a Selection Screen in an ABAP Program.
 Format Selection Screen fields.
 Create User-Defined Messages.

2 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Selection Screens

3 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

The SELECT-OPTIONS Statement

SELECT-OPTIONS <selection name> FOR <field name>


[DEFAULT <value> [TO <value>]]

???

4 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Selection Tables

Sign Option Low High

I BT 3 10

I EQ 1

E GE 7

5 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Multi-Row Selection Tables

Click Here

To get Here

6 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Creating User-Friendly Selection Texts

Maintain Text
Elements

Selection Screen

7 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

The CHECK Statement

SELECT-OPTIONS S1 FOR SY-INDEX.


DO 10 TIMES.
CHECK S1.
WRITE: / SY-INDEX.
ENDDO.

Using CHECK with SELECT-OPTIONS

1
2
3
4
Selection Table 6
Contents: 9
I BT 1 10
10
E EQ 5
E BT 7 8

8 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

The REJECT Statement

NODES: KNA1, BSID.


GET KNA1.
WRITE: / KNA1-KUNNR,
KNA1-NAME1.
COUNTER = 0.
GET BSID. The REJECT statement immediately
ADD 1 TO COUNTER. moves to the specified record
(in this case KNA1).
IF COUNTER > 3.
REJECT ‘KNA1’.
ENDIF.
WRITE: / BSID-BUDAT, BSID-DMBTR.
GET KNA1 LATE.
ULINE.

9 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Declaring Selection Screen Fields with PARAMETERS

REPORT ZTEST.
PARAMETERS: p_mtrl TYPE matnr
DEFAULT ‘test_mat’ OBLIGATORY.

10 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Creating Parameters as Checkboxes

REPORT ztest.
CONSTANTS: c_checked(1) TYPE c VALUE 'X'.
DATA: it_kna1 TYPE STANDARD TABLE OF kna1,
wa_kna1 TYPE kna1.

PARAMETERS: incl_inv AS CHECKBOX default c_checked.

SELECT * FROM kna1 into table it_kna1.

loop at it_kna1 into wa_kna1.


WRITE: / wa_kna1-kunnr, wa_kna1-name1.
IF incl_inv = c_checked.
PERFORM get_details.
ENDIF.
endloop.

11 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Creating Parameters as Radio Buttons

CONSTANTS: c_checked(1) TYPE c VALUE 'X'.


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME
TITLE TEXT-001.
PARAMETERS: ONE_TIME RADIOBUTTON GROUP GP1,
REGULAR RADIOBUTTON GROUP GP1,
BOTH RADIOBUTTON GROUP GP1
DEFAULT ‘X’.
SELECTION-SCREEN END OF BLOCK B1.
IF ONE_TIME = c_checked. PERFORM WRITE_ONETIME_CUST.
ELSEIF REGULAR = c_checked. PERFORM WRITE_REG_CUST.
ELSE. PERFORM WRITE_CUST.
ENDIF.

12 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Attaching Matchcodes to Parameters

PARAMETERS: CUSTNO TYPE KUNNR


MATCHCODE OBJECT DEBI.

Note: Search Help is now used instead of the Matchcode.

13 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Formatting the Selection Screen

SELECTION-SCREEN <option>.

SELECTION-SCREEN SKIP <n>.

SELECTION-SCREEN ULINE [ [/]<pos(len)>].

SELECTION-SCREEN COMMENT [/]<pos(len)> <name> [FOR FIELD <f>].

SELECTION-SCREEN BEGIN OF LINE.


:
:
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN POSITION <pos>.

14 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Additional Selection Screens

DATA: KUNNR TYPE KUNNR.

SELECTION-SCREEN BEGIN OF SCREEN 1200.


SELECT-OPTIONS S_CUST FOR KUNNR.
SELECTION-SCREEN END OF SCREEN 1200. [….]
CALL SELECTION-SCREEN 1200.
SELECT * FROM KNA1 INTO TABLE IT_KNA1
WHERE KUNNR IN S_CUST.

15 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Creating Pushbuttons on the Application Toolbar

16 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

The Screen Fields Table: SSCRFIELDS

Name Type Length/dec Description

SSCRFIELDS-UCOMM CHAR C 70 Interact.: Command field


SSCRFIELDS-FROM_TEXT CHAR C 12 Text (length 12)
SSCRFIELDS-TO_TEXT CHAR C 12 Text (length 12)
SSCRFIELDS-FUNCTXT_01 CHAR C 20 Selection screen: Text fo
SSCRFIELDS-FUNCTXT_02 CHAR C 20 Selection screen: Text fo
SSCRFIELDS-FUNCTXT_03 CHAR C 20 Selection screen: Text fo
SSCRFIELDS-FUNCTXT_04 CHAR C 20 Selection screen: Text fo
SSCRFIELDS-FUNCTXT_05 CHAR C 20 Selection screen: Text fo

17 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Creating Pushbuttons on the Selection Screen

18 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

User Message

19 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Error Message at the Selection Screen

Using the AT SELECTION-SCREEN


event, access to the output can be
prevented until valid data is
entered on the selection screen
AT SELECTION-SCREEN.
AUTHORITY-CHECK OBJECT ‘F_KNA1_BUK’
ID ‘ACTVT’ DUMMY
ID ‘BUKRS’ FIELD BUKRS.
IF SY-SUBRC <> 0.
MESSAGE E000 WITH BUKRS.
ENDIF.

The selection screen is


continuously redisplayed until
valid data is entered or the
program is terminated

20 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Table T100: Messages

21 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Declaration of Messages

REPORT <report name> MESSAGE-ID <message-ID>.

MESSAGE <type><number> [WITH <up to four


variables>].

Example
MESSAGE E001 WITH TEXT-001

Message Types
A Abend
E Error
I Information
S Success
W Warning
X Termination

22 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Creating Message IDs and Messages

1. Double-click on the newly


entered Message ID.

REPORT Z1_KB MESSAGE-ID zkb. 2. After being prompted


to create the message
3. After maintaining the message class, the Maintain
class and clicking on the Message Class screen
MESSAGE tab, the Maintain appears.
Message screen appears.

23 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Demonstration

 Creation of a custom program with a selection screen comprising of blocks,check


boxes & radio buttons.

24 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Practice

 Creation of a custom program with a selection screen comprising of blocks,check


boxes & radio buttons.

25 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Summary

 Selection screen automatically comes with a logical database program.


 SELECT-OPTIONS statement creates selection criteria for a particular database
field.
 Selection tables are system-generated internal tables that have standard field
format: SIGN, OPTION, LOW and HIGH.
 PARAMETERS statement creates a single entry field on the selection screen.
 AS CHECKBOX clause is used to create a parameter as a checkbox.
 RADIOBUTTON GROUP clause is used to create parameters as radio buttons.
 INITIALIZATION event will always be processed before anything else.
 SELECTION-SCREEN PUSHBUTTON statement is used to create a pushbutton
on the selection screen.
 Messages are displayed on the message line at the bottom of the screen. The
only exceptions are abend messages which terminate the program and
information messages which are displayed in a dialog box.

26 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Questions

 What are the different types of messages used in ABAP?


 How do you trap any user action on a pushbutton defined on the selection
screen?
 What is the difference between a checkbox and a radio button.

27 Selection Screens and User Messages | Dec-2008 © 2005 IBM Corporation

You might also like