SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id....

86
SELECT-OPTIONS

Transcript of SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id....

Page 1: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SELECT-OPTIONS

Page 2: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SELECT-OPTIONS Syntax

TABLES customers.SELECT-OPTIONS id FOR

customers-id.START-OF-SELECTION.

Page 3: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SELECT-OPTIONS

“ต้�องการให้�แสดงข้�อมู�ล customers ข้องล�กค้�าที่��มู�ชื่��อ(ค้อล�มูน์� name ) ข้��น์ต้�น์ด�วยต้�ว ‘M’ และล�กค้�าที่��ชื่��อ ‘Smith’ และล�กค้�าที่��ชื่��ออย�!ระห้ว!าง ‘A’ ก�บ ‘John’ โดยใชื่�ค้$าส��ง SELECT”

SELECT * FROM customers WHERE (name LIKE ‘M%’) OR (name = ‘Smith’) OR (name BETWEEN ‘A’ AND ‘John’).

Page 4: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SELECT-OPTIONS

TABLES customers.SELECT-OPTIONS sname FOR customers-name.START-OF-SELECTION. SELECT * FROM customers WHERE name IN sname.

Page 5: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Internal Structure of Select-options

sname

Sign Option Low High

Internal Table Header Line

Page 6: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Internal Structure of SELECT-OPTIONS Field Value . Sign I = Include E = Exclude Option BT = Between CP = Contains Pattern EQ = Equal GT = Greater Than LT = Less Than GE = Grater Than or Equal LE = Less Than or Equal NE = Not Equal NB = Not Between

Page 7: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Internal Structure of SELECT-OPTIONS

snameSign Option Low High

I CP M* I EQ Smith I BT A John

Page 8: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SELECT-OPTIONS

Sign Option Low High

I CP M* I EQ Smith I BT A John

sname

SELECT * FROM customers WHERE name IN sname.

SELECT * FROM customers WHERE (name LIKE ‘M%’) OR (name = ‘Smith’) OR (name BETWEEN ‘A’ AND ‘John’).

Transform

Page 9: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SELECT-OPTIONS Options

SELECT-OPTIONS sname FOR customers-name OBLIGATORY.

Page 10: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

INITIALIZATION Event

PARAMETERS: nextday LIKE sy-datum.

INITIALIZATION. nextday = sy-datum + 1.

START-OF-SELECTION. WRITE nextday.

Page 11: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Checking User Input

TABLES customers.DATA pcode _len TYPE i.PARAMETERS pcode LIKE -customers postcode.AT SELECTION-SCREEN. pcode _len = STRLEN( pcode ). IF pcode _len <> 5. “ IF STRLEN( pcode ) <> 5. MESSAGE e000(38) WITH ‘Please enter postcode 5 characters’. ENDIF.START-OF-SELECTION. SELECT * FROM customers WHERE postcode = pcode. …

Page 12: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

ABAP Program Processing Steps

TABLES sflight.PARAMETERS nextday LIKE sy-datum.INITIALIZATION. nextday = sy-datum + 1.AT SELECTION-SCREEN. IF nextday < sy-datum. MESSAGE e000(38) WITH ‘Please enter date >= today’. ENDIF.START-OF-SELECTION. SELECT * FROM sflight WHERE ... fldate = nextday… …

1

2

34

5

Page 13: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

ABAP Exercise

Page 14: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Modularization

Page 15: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Modularization

Subroutine Function Module

Page 16: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SubroutineSTART-OF-SELECTION. PERFORM routine1. PERFORM routine2. PERFORM routine2. FORM routine1. SELECT * FROM customers INTO TABLE tab. ENDFORM. FORM routine2. LOOP AT tab. WRITE: / tab-id,tab-name. ENDLOOP. ENDFORM.

START-OF-SELECTION. SELECT * FROM customers INTO TABLE tab. LOOP AT tab. WRITE: / tab-id,tab-name. ENDLOOP. LOOP AT tab. WRITE: / tab-id,tab-name. ENDLOOP.

Page 17: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Modularization Avoid redundancy Make your program easy to

read & improve their structure

Re-use Program components

Page 18: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Subrountine (Program Structure)Subrountine (Program Structure)

REPORT ZSR1.*Data declarationTYPES: BEGIN OF strucbkpf, belnr TYPE bkpf-belnr, gjahr TYPE bkpf-gjahr , END OF strucbkpf.DATA tab TYPE TABLE OF strucbkpf with header line.*Processing blockSTART-OF-SELECTION. SELECT belnr gjahr INTO TABLE tab FROM bkpf WHERE blart = 'SA'. LOOP AT tab. WRITE: / tab-belnr,tab-gjahr. ENDLOOP. LOOP AT tab. WRITE: / tab-belnr,tab-gjahr. ENDLOOP.

REPORT ZSR2.*Data declarationTYPES: BEGIN OF strucbkpf, belnr TYPE bkpf-belnr, gjahr TYPE bkpf-gjahr , END OF strucbkpf.DATA tab TYPE TABLE OF strucbkpf with header line.*Processing blockSTART-OF-SELECTION. PERFORM read_data. PERFORM display_data. PERFORM display_data.*&---------------------------------------------------------------------*FORM read_data. SELECT belnr gjahr INTO TABLE tab FROM bkpf WHERE blart = 'SA'.ENDFORM. *&---------------------------------------------------------------------*FORM display_data. LOOP AT tab. WRITE: / tab-belnr,tab-gjahr. ENDLOOP.ENDFORM.

Page 19: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Calling and Defining SubroutinesCalling and Defining Subroutines REPORT ztest.

* Global Data TABLES customers.

DATA tmp TYPE i. * Subroutine Calls

PERFORM routine1. PERFORM routine2.

SSSSSSSSSS *

FORM routine1. DATA tmp1 TYPE p. SSSS“ WRITE tmp.ENDFORM.

2FORM routine . DATA tmp2(10). “Local data …. .ENDFORM.

Page 20: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Call by Value

a1

Memory Space(Subroutine)

f1

Copy

Page 21: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Call by ValueCall by Value

DATA 1 2: a ,a .a1 = ‘A’.a2 = ‘A’. SSS11 2. .…...

1 1 2FORM routine USING VALUE(f ) VALUE(f ). f1 = ‘X’. f2 = ‘X’.ENDFORM.

Page 22: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Call by Reference

a3

Memory Space(Subroutine)

f3

Address Passing

Page 23: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Call by ReferenceCall by Reference

DATA : 3.aa3 = ‘A’.

2 3PERFORM routine USING a . .…...

2 3FORM routine USING f . f3 = ‘X’.ENDFORM.

Page 24: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Call by Value and Result

a4

Memory Space(Subroutine)

f4

CopyCopy

Page 25: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Call by Value and ResultCall by Value and Result

DATA : 4, 5.a aa4 = ‘A’.a5 = ‘A’.

3 4 5PERFORM routine USING a a . .…...SSSS SSSSSSS3 4CHANGING VALUE(f ) VALUE(5) . f4 = ‘X’. f5 = ‘X’.ENDFORM.

Page 26: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Passing Structure as ParametersPassing Structure as Parameters

TABLES sflight.SELECT * FROM sflight. PERFORM subproc USING sflight.ENDSELECT.FORM subproc USING rec LIKE sflight. WRITE: / rec-carrid.ENDFORM.

Page 27: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Passing Internal Table as ParametersPassing Internal Table as Parameters

0DATA: tab LIKE sflight OCCURS WITH HEADER LINE. …

PERFORM sub TABLESt ab.

Page 28: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Passing Internal Table as ParametersPassing Internal Table as Parameters

FORM sub TABLES tab1 STRUCTURE tab. LOOP AT tab1. WRITE: / tab1-carrid. ENDLOOP.ENDFORM.

Page 29: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Module

Page 30: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Module : SE37

Function Group Function Library - Admin - Import/Export Parameter - Source Code - Main Program - Documentation

Page 31: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Creating Function Module

Page 32: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Group When you create a function module,

you must assign it to function group The function group is the main

program in which a function module is embedded

The function group is a program type F,and not executable

The entire function group is loaded in a program the first time that you call a function module that belongs to it

Page 33: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Group is a container for function modules When a function module is called,the

entire function group is loaded into the session of the program

Function group is used to define global data for function modules

A DATA statement in the global memory of a function group is shared by all the function modules that belong to that function group

Page 34: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Group : SE37

Page 35: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Group : SE80

Page 36: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Module is a code that can be called from any ABAP

program,therefore making it a globally accessible object

ABAP program pass data to function module from import parameters or internal tables

Function module receives data from a program,process the information in its own code, and then sends back information in the export parameters or internal tables

Page 37: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Module : SE37

Page 38: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Module

Page 39: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Module : Import

Page 40: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Module : Export

Page 41: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function Module : Source Code (Logic)Function Module : Source Code (Logic)

FUNCTION z_fmtest. result = number1 ** number2.ENDFUNCTION.

Page 42: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Program Example IProgram Example I

REPORT ztest. PARAMETERS: no1 TYPE i,

no2 TYPE i.DATA result TYPE i.START-OF-SELECTION. CALL FUNCTION ‘Z_FMTEST’ EXPORTING number1 = no1 number2 = no2 IMPORTING result = result.

WRITE: / result.

Page 43: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Exercise : Function Module

?

ABAP Program

Function Module

Page 44: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

EXCEPTIONS

Page 45: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Function ModuleFunction Module

FUNCTION z_fmtest. IF number1 > 9 AND number2 > 9. RAISE invalidnumber. ELSE. result = number1 ** number2. ENDIF.ENDFUNCTION.

Page 46: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Example II : Exceptions HandlerExample II : Exceptions Handler

REPORT ztest. PARAMETERS: no1 TYPE i,

no2 TYPE i.DATA result TYPE i.

START-OF-SELECTION. CALL FUNCTION ‘Z_FMTEST’ EXPORTING number1 = no1 number2 = no2 IMPORTING result = result EXCEPTIONS invalidnumber = 1. IF sy-subrc = 1. write: / ‘Please enter number < 10’. ELSEIF sy-subrc = 0. write: / result. ENDIF.

Page 47: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Exercise : Exceptions

?

ABAP Program

Function Module

Page 48: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

EXCEPTIONS VS AT SELECTION-SCREEN

FUNCTION Z_FMTEST.IF number1 > 9 AND number2 > 9. RAISE invalidnumber.ELSE. result = number1 ** number2.ENDIF.ENDFUNCTION.

REPORT ztest.PARAMETERS: no1 TYPE i, no2 TYPE i. AT SELECTION-SCREEN. IF no1 > 9 AND no2 > 9. MESSAGE e000(38) WITH ‘Please enter no < 10’. ENDIF.START-OF-SELECTION. CALL FUNCTION ‘Z_FMTEST’. …..

VS

Page 49: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Optional

ABAP Program

Function Module

Page 50: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Structure in Function Module

Page 51: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Example : Structure

Page 52: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Example : Structure

Page 53: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Internal Table in Function Module

Page 54: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Example : Internal Table

Page 55: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Example : Internal Table

Page 56: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

CATCH StatementCATCH Statement

REPORT ztest.PARAMETERS: num1 TYPE i, num2 TYPE i.DATA result TYPE i.START-OF-SELECTION. CATCH SYSTEM-EXCEPTIONS others = 1. result = num1 / num2. ENDCATCH. IF sy-subrc = 1. WRITE: /'Divide by zero'. ELSE. WRITE: / result. ENDIF.

Page 57: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

CATCH in Function Module

FUNTION Z_CAL.

IF number1 > 9 AND number2 > 9.

RAISE invalidnumber.

ELSE.

result = number1 ** number2.

ENDIF.

ENDFUNCTION.

FUNCTION Z_CAL. CATCH SYSTEM-EXCEPTIONS others = 1. result = number1 ** number2. ENDCATCH. IF sy-subrc = 1. RAISE invalidnumber. ENDIF.ENDFUNCTION.

Page 58: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Authorization in ABAP

Page 59: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Database Server

Application Server

Dispatcher

RequestQueue

D D D B…

SAP Buffer

Program

User ContextArea

1

3

46

79

10

11

Report zpsm1.

Tables customers.

Select single * from

customers where id = 1.

Write: / customers-name.

5

Execute ABAP statement

Check Program in Program Buffer

Roll in

8

Load&Generate Program

SQL Request

Send List

Generate Screen(List)Send Request

Request List

2 Search for free WP

Store request to queue

Send request to WP

SAP GUI

..

D010S

Report zpsm1.

Tables customers.

Select single * from

customers where id = 1.

Write: / customers-name.

SAP System : Dialog Processing

customers

Page 60: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

TaskHandler

DYNPRO Processor

ABAP Processor

Local Memory

Memory Space

DB Interface

List Buffer

Database Server

Dialog Work Process

User Context

Dialog Work Process Architecture

Result Set Memory

Page 61: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SAP Authorization PrinciplesSAP Authorization Principles All data in the SAP system must

be protected against access by unauthorized users

Since the SELECT statement does not perform any authorization checks,you must program these yourself with AUTHORITY-CHECK

Page 62: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

No Authorization CheckNo Authorization Check

TABLES spfli.SELECT * FROM spfli. WRITE: / spfli-carrid, spfli-connid, spfli-cityfrom, spfli-cityto.ENDSELECT.

Page 63: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Authorization CheckAuthorization Check

Syntax - AUTHORITY CHECK OBJECT <auth.Obj> ID < auth. field1 > FIELD <req.val> ID < auth. field2 > FIELD <req.val > ……. ID < auth. fieldn > DUMMY. I S - < > 0 . …. ENDIF .

Page 64: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Authorization CheckAuthorization Check

Selection

SELECT

AUTHORITY-CHECK

ProcessData

Message

sy-subrc = 0 ? No

Yes

Local Memory

User Context

Memory Space

List Buffer

Page 65: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Authorization CheckAuthorization Check

TABLES spfli.SELECT * FROM . AUTHORITY-CHECK OBJECT SSSS S S S SS S ID ‘CARRID’ FIELD -spfl i car r i d ID ‘ACTVT’ FIELD ‘03’. I S - sy subrc = 0 . WRITE - - SSSSS -SSSSSSSSS SSSSS-SSSSSSS: / ,, ,. ENDIF.ENDSELECT.

Page 66: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

SAP Authorization ObjectsSAP Authorization Objects

Transaction : SU03

Page 67: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Authorization Object FieldAuthorization Object Field

ABAP Editor : Pattern

Page 68: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Message in ABAP

Page 69: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Dynamic MessageDynamic Message

REPORT 1.PARAMETERS today LIKE sy-datum.AT SELECTION-SCREEN. IF today -<> sy datum. MESSAGE e000(38) WITH ‘Please enter today :S sy-datum. ENDIF.START-OF-SELECTION. WRITE : / ‘Today is :’, today.

Page 70: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Message TypeMessage Type

SyntaxMESSAGE [ A<nnn> ](message class) WITH <V 1> <V 2 > < V3 > <V4> .

E, W, I, S

Page 71: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Messages Type - A(Abend)Messages Type - A(Abend)

Message A000(38)...

Program Start

SelectionScreen

A Message Exit

Page 72: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Messages Type - E(Error)Messages Type - E(Error)

Message E000(38) ...

Program Start

SelectionScreen

Error Message

New input

Require

Page 73: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Messages Type - W(Warning)Messages Type - W(Warning)

Message W000(38)...

Program Start

SelectionScreen

Warning Message

New input

possible

START-OF-SELECTION

Enter

Page 74: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Messages Type - I(Information)Messages Type - I(Information)

Message i000(38)...

Program Start

SelectionScreen

Information Message

EnterSTART-OF-SELECTION

Page 75: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Messages Type - S(Success)Messages Type - S(Success)

Message S000(38)...

Program Start

SelectionScreen

List(Next Screen)

Page 76: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Debugging

Page 77: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Debugging Mode Debugging Mode

Page 78: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Debugging Mode : Internal Table Debugging Mode : Internal Table

Page 79: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Debugging Mode : Watchpoint Debugging Mode : Watchpoint

Page 80: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Watchpoint : SAP ECC 6.0 Watchpoint : SAP ECC 6.0

Page 81: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

GUI TITLE ... SET TITLEBAR ‘0100’.

Page 82: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

ABAP Exercise III

Page 83: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Sale Document : Data Model

Page 84: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Report Example

VBAK-VBELN

VBAK-ERDAT KNA1-NAME1 VBAP-MATNR VBAP-NETWR

ZEX_T

Page 85: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

Report Example : Group Header

Page 86: SELECT-OPTIONS. SELECT-OPTIONS Syntax TABLES customers. SELECT-OPTIONS id FOR customers-id. START-OF-SELECTION.

ON CHANGE OF …ON CHANGE OF …

… SORT tab BY vbeln.

LOOP AT tab. -ON CHANGE OF tab vbeln. - - WRITE: / sy vline,2(24) tab vbeln COLOR 4 INTENSIFIED OFF, - - 25 sy vline,26(20) tab erdat COLOR 4 INTENSIFIED OFF, - - 45 sy vline,46(30) tab name1 COLOR 2 INTENSIFIED OFF. ENDON. - - -25 45WRITE:syvline, sy vl i ne, sy vl i ne, - - 7 5 sy vline,7 6 (2 5 ) tab matnr COLOR 2 INTENSIFIED OFF, - - 100 101 18 2sy vline, ( ) tab netwr COLOR INTENSIFIED OFF, -120 sy vline. -NEW LINE. ENDLOOP.…