Intro to ABAP Chapter 14

background image

BC170_2.14.1

Selection Screens

and User Messages

background image

BC170_2.14.2

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

background image

BC170_2.14.3

Selection Screens

background image

BC170_2.14.4

? ? ?

SELECT-OPTIONS <selection name> FOR <field

name>

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

The SELECT-OPTIONS

Statement

background image

BC170_2.14.5

SIGN

OPTION

LOW

HIGH

I

BT

3

10

I

EQ

1

E

GE

7

Selection Tables

background image

BC170_2.14.6

Multi-Row Selection Tables

To get here

Click here

background image

BC170_2.14.7

Creating User-Friendly Selection

Texts

Maintain
Selection
Texts

Selection

Screen

background image

BC170_2.14.8

The CHECK Statement

SELECT-OPTIONS s_one FOR SY-INDEX.
DO 10 TIMES.

CHECK s_one.
WRITE: / SY-INDEX.

ENDDO.

Using CHECK with SELECT-OPTIONS

1
2
3
4
6
9

10

Selection Table
Contents:
I

BT

1

10

E

EQ

5

E

BT

7

8

background image

BC170_2.14.9

PARAMETERS P_FNAME(50)TYPE C DEFAULT ‘/tmp/abap/myfile’

LOWER CASE
OBLIGATORY.

File Name

/tmp/abap/myfile

Declaring Fields with

PARAMETERS

background image

BC170_2.14.10

Creating Parameters as

Checkboxes

PARAMETERS: P_INV AS CHECKBOX DEFAULT ‘X’.

TABLES: KNA1.

SELECT KUNNR NAME1

INTO (KNA1-KUNNR, KNA1-NAME1)

FROM KNA1.

WRITE: / KNA1-KUNNR, KNA1-NAME1.

IF P_INV = ‘X’.

PERFORM GET_AND_WRITE_INV.

ENDIF.

ENDSELECT.

background image

BC170_2.14.11

Creating Parameters as Radio

Buttons

TABLES: KNA1
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME

TITLE TEXT-001.

PARAMETERS: P_1TIME RADIOBUTTON GROUP GP1,

P_REG RADIOBUTTON GROUP GP1,
P_BOTH RADIOBUTTON GROUP GP1
DEFAULT ‘X’.

SELECTION-SCREEN END OF BLOCK B1.
IF P_1TIME = ‘X’.
PERFORM WRITE_ONE_TIME_CUST.
ELSEIF P_REG = ‘X’.
PERFORM WRITE_REG_CUST.
ELSE.
PERFORM WRITE_CUST.
ENDIF.

background image

BC170_2.14.12

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>.

background image

BC170_2.14.13

Additional Selection Screens

SELECTION-SCREEN BEGIN OF SCREEN 1200.
SELECT-OPTIONS S_CUSNUM FOR KNA1-

KUNNR.

SELECTION-SCREEN END OF SCREEN 1200.

[….]

CALL SELECTION-SCREEN 1200.
SELECT NAME1 INTO (KNA1-NAME1) FROM

KNA1

WHERE KUNNR IN S_CUSNUM.

background image

BC170_2.14.14

Creating Pushbuttons on the

Application Toolbar

background image

BC170_2.14.15

The Screen Fields Table:

SSCRFIELDS

Name

Key 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

background image

BC170_2.14.16

Creating Pushbuttons on the

Selection Screen

background image

BC170_2.14.17

User Message

background image

BC170_2.14.18

Error Message at 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.

Using the AT SELECTION-SCREEN

event, access to the output can be

prevented until valid data is

entered on the selection screen

The selection screen is

continuously redisplayed until

valid data is entered or the

program is terminated

background image

BC170_2.14.19

Table T100: Messages

background image

BC170_2.14.20

Table T100: Messages

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

MESSAGE <type><number> [WITH <up to four
variables>].

Example
MESSAGE E001 WITH KNA1-KUNNR KNA1-BUKRS.

Message Types
A

Abend

E

Error

I
Information
S

Success

W

Warning

background image

BC170_2.14.21

REPORT Y30A0715 MESSAGE-ID ZL.

1. Double-click on the newly

entered Message ID.

Creating Message IDs and

Messages

2. After being

prompted

to create the

message class, the

Maintain Message

Class screen

appears.

3. After maintaining the

message

class and clicking on the

MESSAGE pushbutton, the

Maintain Message screen

appears.

background image

BC170_2.14.22

Summary

The participants should 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


Document Outline


Wyszukiwarka

Podobne podstrony:
Intro to ABAP Chapter 13
Intro to ABAP Chapter 07
Intro to ABAP Chapter 12
Intro to ABAP Chapter 15
Intro to ABAP Chapter 08
Intro to ABAP Chapter 11
Intro to ABAP Chapter 01

więcej podobnych podstron