user dialog overview. update statement tables customers. select single * from customers where id =...

30
User Dialog Overview

Upload: myles-matthews

Post on 02-Jan-2016

213 views

Category:

Documents


0 download

TRANSCRIPT

User Dialog Overview

Update Statement

TABLES customers.SELECT SINGLE * FROM customers

WHERE id = 1.IF sy-subrc = 0. customers-name = ‘John’. UPDATE customers.ENDIF.

Database Server

Application Server

Dispatcher

RequestQueue

D D D D…

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&Gen 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

SAP System : Dialog Processing

D010Scustomers

TaskHandler

DYNPRO Processor

ABAP Processor

Local Memory

Memory Space

DB Interface

List Buffer

Database Server

Dialog Work Process

User Context

Dialog WP : Report

Result Set Memory

Database Server

Application Server

Dispatcher

RequestQueue

D D D D…

SAP Buffer

Program

User ContextArea

1

3

46

79

10

11

5

Execute ABAP statement

Check Program in Program Buffer

Roll in

8

Load&Gen Program

SQL Request

Send List

Send Request

Request

2 Search for free WP

Store request to queue

Send request to WP

SAP GUI

SAP System : Dialog Processing

Generate Dialog Screen

ScreenPROGRAM sapmzex001.

INCLUDE ….

CALL SCREEN 100.

D010Scustomers

TaskHandler

DYNPRO Processor

ABAP Processor

Local Memory

Memory Space

DB Interface

Screen Buffer

Database Server

Dialog Work Process

User Context

Dialog WP : Dialog Program

Result Set Memory

Dialog Program : Transaction

Dialog Program ComponentsTransaction Code

Transaction Code

Screen : 100100(Screen Layout)

Screen : 200200(Screen Layout)

Flow Logic

Flow Logic

PBO

PAI

ABAP Module Pool

ABAP Module Pool

PBO

PAI

ABAP Module Pool

ABAP Module Pool

Dialog ProgramDialog Program Program Naming Convention : SAPM[Z/Y]…

Data Transfer (Local Memory)

Screen BufferABAP Memory Space

Screen Work Area ABAP Work Area

PBOPBO

PAIPAIcustomers-id

customers

id name city … 0000000

ok_code

ok_code

Local Memory

Element List

Flow Logic Process Before Output(PBO)

After it has processed all of the modules in the PBO processing block, the system copies the contents of the fields in the ABAP work area to their corresponding fields in the screen work area.

Process After Input(PAI) Before it processes the first module in the PAI

processing block, the system copies the contents of the fields in the screen work area to their corresponding fields in the ABAP work area.

OK Code Field in Screen

OK Code Field orCommand Field

(ok_code in Element List)

Defining Screen (4 Steps) Screen Attribute Screen Layout Flow Logic Element List

Element List(ok_code

field)

Flow Logic in Screen 100

PROCESS BEFORE OUTPUT.MODULE STATUS_0100.

PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

PBO in Screen 100

MODULE status_0100 OUTPUT.SET PF-STATUS ‘0100’.

SET TITLEBAR ‘0100’.ENDMODULE.

PAI in Screen 100MODULE user_command_0100 INPUT. CASE ok_code. WHEN ‘BACK’. LEAVE PROGRAM. WHEN space. SELECT SINGLE * FROM customers WHERE id

= customers-id. IF sy-subrc = 0. LEAVE TO SCREEN 200. ENDIF. ENDCASE.ENDMODULE.

How to Create Dialog Program

Transaction SE80 : Create Dialog Program (SAPMY/Z…)

Create Screen(4 steps) Screen Attribute (Description) Screen Layout (Graphic Screen Painter) Flow Logic(PBO,PAI) Define Variable ok_code in Element List

Define Data Objects in ABAP Work Area at TOP Include(TABLES, DATA,...)

Check and Activate Dialog Program Create Transaction Code (Y/Z…)

Example I

Maintain Customers Data

Screen : 100 Screen : 200

Example I

Create Dialog Program SAPMZEX<nn> for changing Customers table Screen 100

Field customers-id Screen 200

Field customers-id and customers-name

Example I

Screen 100

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

PROCESS AFTER INPUT. MODULE USER_COMMAND_0100.

Example I

Screen 100

MODULE status_0100 OUTPUT. SET PF-STATUS ‘0100’. SET TITLEBAR ‘0100’. CLEAR ok_code.

ENDMODULE.

Example I

Screen 100MODULE user_command_0100 INPUT.

CASE ok_code. WHEN ‘BACK’. LEAVE PROGRAM. “leave to screen 0 WHEN space. SELECT SINGLE * FROM customers WHERE id = customers-id. LEAVE TO SCREEN 200. ENDCASE.

ENDMODULE.

Example I

Screen 200

PROCESS BEFORE OUTPUT.

MODULE STATUS_0200.

PROCESS AFTER INPUT. MODULE USER_COMMAND_0200.

Example I

Screen 200

MODULE status_0200 OUTPUT. SET PF-STATUS ‘0200’. SET TITLEBAR ‘0200’. CLEAR ok_code.

ENDMODULE.

Example I Screen 200

MODULE user_command_0200 INPUT. CASE ok_code. WHEN ‘BACK’. LEAVE TO SCREEN 100. “SET SCREEN 100. LEAVE

SCREEN. WHEN ‘SAVE’. UPDATE customers. MESSAGE s000(38) WITH ‘Update OK!’. LEAVE TO SCREEN 100. ENDCASE. ENDMODULE.

Example I

TOP IncludeTABLES customers.DATA ok_code TYPE sy-ucomm. Create Transaction CodeTransaction Code : ZEX<nn>

Exercise

Create Dialog Program : SAPMZCUST<nn>

Transaction Code : ZCUST<nn>

Exercise : Customers Maintenance

Screen : 100 Screen : 200

Checking User Input

Check Input Data Using Check Input Data Using FIELD FIELD StatementStatement

FIELD Statement

Screen 100 : Flow Logic (PAI)

PROCESS AFTER INPUT.

FIELD customers-id MODULE user_command_0100.

Example I

Screen 100 : PAIMODULE user_command_0100 INPUT.

... WHEN SPACE. SELECT SINGLE * FROM customers WHERE id = customers-id. IF sy-subrc <> 0. MESSAGE e000(38) WITH ‘Customers data not found’. ELSE. LEAVE TO SCREEN 200. ENDIF. ENDCASE.

ENDMODULE.