Anda di halaman 1dari 231

SDN Community Contribution

(This is not an official SAP document.)

Disclaimer & Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade. SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk. SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.

640 Upgrade ABAP Delta Training


Spring 2005

Contents
Unit 1 Unit 2 Unit 3 Unit 4 Unit 5 Unit 6 Unit 7
Sunday, April 15, 2012

SE80 in 640 New Debugger (Code Inspector and Memory Inspector) Basic Syntax Exception Handling Object Orientation Shared Memory Classes RTTS (RunTime Type Services)
KEG 640 Upgrade ABAP Delta Training
3

Contents Continued
Unit 8 Unit 9 Unit 10 Unit 11 Unit 12 Unit 13 Unit 14 Unit 15
Sunday, April 15, 2012

ICM (Internet Communications Mgr) J2EE System XML WebServices E-Mail ITS ABAP Unit (Unit Test Tool) Adobe Forms
KEG 640 Upgrade ABAP Delta Training
4

Contents Continued
Unit 16 Unit 17 Unit 18 BSP (General) BSP (Custom Tags) BSP (Model View Controller) Exercises & Solutions Within Units

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

Unit 1 SE80 The ABAP Editor

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

SE80 - Overview

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

ABAP Editor New Features

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

SE80 Class Builder

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

SE80 - Packages

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

10

SE80 Mime Repository

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

11

SE80 Tag Browser

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

12

Transport Organizer

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

13

Adobe Forms Designer

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

14

New Options for Object Display

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

15

New Options for Code Insertion

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

16

New Worklist and Navigation Stack

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

17

Looking Forward WebAS 7.0

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

18

Looking Forward WebAS 7.0

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

19

Unit 1 Exercises

Unit 2 New Debugger

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

21

Activate New Debugger

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

22

Setting Breakpoints

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

23

New Debugger

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

24

New Debugger Binary String Display

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

25

New Debugger Dynamic Displays

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

26

New Debugger New Class Display

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

27

New Debugger Download Objects

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

28

New Debugger Inheritance View

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

29

New Debugger Object References

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

30

Debugger Memory Inspection

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

31

Debugger Memory Snapshot

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

32

Debugger Memory Delta

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

33

Debugger System Memory View

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

34

Runtime Memory Access


TRY. CALL METHOD cl_abap_memory_utilities=>get_memory_size_of_object EXPORTING object = isflight IMPORTING bound_size_alloc = size1 bound_size_used = size2 referenced_size_alloc = size3 referenced_size_used = size4 is_part_of_non_trivial_szk = flag1 szk_size_alloc = size5 szk_size_used = size6 low_mem = flag2 is_in_shared_memory = flag3. ENDTRY.
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

35

Code Inspector - Setup

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

36

Code Inspector - Results

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

37

Unit 2 Exercises

Unit 3 Basic Syntax

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

39

Dynamic Syntax
****Dynamic Creation data: linetype type string, itabref type ref to data, line type ref to data. field-symbols: <fs> type standard table, <fl> type any. parameter: tblname type tabname. select single tabname from dd02l into linetype where tabname = tblname. check not linetype is initial. create data itabref type standard table of (linetype). assign itabref->* to <fs>. select * from (linetype) into table <fs>. create data line like line of <fs>. assign line->* to <fl>. loop at <fs> into <fl>. write: / <fl>. endloop.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

40

Negative Operators
*6.40 if len is not initial. write: / 'Something there'. endif. *4.6C if not len is initial. write: / 'Something there'. endif.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

41

Is Supplied
CLASS test DEFINITION. PUBLIC SECTION. METHODS meth IMPORTING op TYPE i OPTIONAL EXCEPTIONS excp. ENDCLASS. CLASS test IMPLEMENTATION. METHOD meth. DATA: feld TYPE i. IF op IS SUPPLIED. CASE op. WHEN 1. feld = 100. WHEN 2. feld = 200. WHEN OTHERS. RAISE excp. ENDCASE. ENDIF. ENDMETHOD. ENDCLASS.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

42

Unicode

Using character sets, you can account for each language relevant to the SAP System. However, problems occur if you want to merge texts from different incompatible character sets in a central system. Equally, exchanging data between systems with incompatible character sets can result in unprecedented situations. One solution to this problem is to use a code comprising all characters used on earth. This code is called Unicode (ISO/IEC 10646) and consists of at least 16 bit = 2 bytes per character. ABAP programs must be modified wherever an explicit or implicit assumption is made with regard to the internal length of a character.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

43

NUMOFCHARS
*4.6C
len = strlen( example ). WRITE: / 'Strlen( example ) = ', len.

*6.40
CLEAR len. len = numofchar( example ). WRITE: / 'Numofchar( example ) = ', len.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

44

Lines
****Getting the Number of Lines DATA: lines1 TYPE i. ****4.6C DESCRIBE TABLE <fs> LINES lines1. WRITE: / 'Number of Lines: (Using Describe)'(001), lines1. ****640 CLEAR lines1. lines1 = lines( <fs> ). WRITE: / 'Number of Lines: (Using Lines) '(002), lines1.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

45

String Literals
*String Literals in 6.40 data: string1 type string. string1 = `Tom's Desk ` & `Tom's Chair`. write: string1.
Output: Tom's Desk Tom's Chair
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

46

Find
DATA: text TYPE STRING. text = 'Everyone knows this'. FIND 'know' IN text.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

47

Return

Unconditionally exits a processing block, that is, an event block, a dialog module or a procedure (function module, method, subroutine). Unlike CHECK and EXIT, RETURN is contextindependent. This means that the current processing block is exited, irrespective of whether RETURN occurs within or outside loops. If you want to leave a processing block, you should therefore always use RETURN instead of CHECK or EXIT.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

48

Strings in the DataBase

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

49

New Screen Functionality

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

50

Work Area Assign


Data: itab type table of sflight. Field-symbols: <wa_itab> like line of itab. Append initial line to itab assigning <wa_itab>. <Wa_itab>-carrid =

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

51

Helper Classes
CL_ABAP_TSTMP Helper Class for comparing and manipulating Time Stamps CL_ABAP_RANDOM Random number generator CL_ABAP_CHAR_UTILITIES Character Manipulation Utilities CL_ABAP_GZIP Compress and Uncompress Data streams (text and binary) CL_ABAP_LIST_LAYOUT & CL_ABAP_LIST_UTILITIES ABAP List Processing Helper (especially for Unicode)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

52

TRUNCATE DATASET
The new statement TRUNCATE DATASET sets the end of file to a specified item, therefore shortening or lengthening a file.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

53

LEAVE TO CURRENT TRANSACTION


you enter the new addition CURRENT TRANSACTION after LEAVE TO TRANSACTION, the current transaction is called with the transaction code you used to call CALL TRANSACTION or LEAVE TO TRANSACTION . Unless dealing with a parameter transaction or variant transaction, this is the transaction code also found in the system field sy-tcode. Parameter or variant transactions have these transaction codes, whereas sy-tcode contains the name of the called dialog transaction. You can get the transaction code of the current transaction with the new static method GET_CURRENT_TRANSACTION of the class CL_DYNPRO.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

54

Unit 3 Exercises

Unit 4 Exception Handling

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

56

Exception Handling

Since Release 6.10 it has been possible to catch class based exceptions in TRY...CATCH...ENDTRY blocks. This replaces exception handling using either catchable runtime errors or EXCEPTIONS parameters of function modules and methods.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

57

Try Catch EndTry


TRY. ... guarded section CATCH cx11 ... cx1n [INTO ex1]. ... handlers for exceptions cx11 to cx1n CATCH cx21 ... cx2m [INTO ex2]. ... handlers for exceptions cx21 bis cx2m ... other handlers CLEANUP. ... cleanup block ENDTRY.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

58

Class Based Exceptions

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

59

Raising an Exception With Generation of an Exception Object


The syntax is: RAISE EXCEPTION TYPE cx_... [EXPORTING ... fi = ai ...].

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

60

Raising an Exception with an Existing Exception Object


The syntax is: RAISE EXCEPTION ref.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

61

Defining Exceptions
All exception classes must inherit from the common superclass CX_ROOT and one of its subordinate classes: CX_STATIC_CHECK for exceptions that have to be declared. CX_DYNAMIC_CHECK for exceptions that do not have to be declared. CX_NO_CHECK for exceptions that must not be declared.
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

62

Exception Classes - Constructor


The constructor has two IMPORTING parameters: TEXTID of the SOTR_CONC type PREVIOUS of the CX_ROOT type

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

63

Exception Classes- Methods


In exception classes, you can define your own methods. The following two predefined methods are inherited from the root class CX_ROOT: GET_TEXT GET_SOURCE_POSITION

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

64

Exception Classes - Attributes


The attributes of exception classes are used to transport additional information on an error situation to the handler. The main piece of information is, however, always the fact that an exception of a particular class has occurred. The following attributes are inherited from CX_ROOT: TEXTID PREVIOUS KERNEL_ERRID
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

65

Using Exception Classes

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

66

Exception Classes Linked to Message Classes

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

67

Exception Classes Linked to Message Classes Continued

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

68

Unit 4 Exercises

Unit 5 Object Orientation

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

70

Unit 5 Object Orientation

Friends Persistent Services Transactional Services

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

71

Friends
*Example of Friends ****The Private parts of one class are shared with their Friends. CLASS do_something2 DEFINITION. PUBLIC SECTION. METHODS write_stuff2. ENDCLASS. "do_something2 DEFINITION * CLASS do_something1 DEFINITION CREATE PRIVATE FRIENDS do_something2. PRIVATE SECTION. DATA a1(15) TYPE c VALUE 'Private Stuff'. ENDCLASS. "do_something1 DEFINITION * CLASS do_something2 IMPLEMENTATION. METHOD write_stuff2. DATA oref TYPE REF TO do_something1. CREATE OBJECT oref. WRITE oref->a1. ENDMETHOD. "write_stuff2 ENDCLASS. "do_something2 IMPLEMENTATION DATA: something2 TYPE REF TO do_something2. START-OF-SELECTION. CREATE OBJECT something2. something2->write_stuff2( ).

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

72

Persistent Service

The Persistence Service lets the ABAP programmer work with relational database data in an objectoriented way.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

73

Persistent Classes

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

74

Creating Persistent Classes

The new class implements all the methods of interface IF_OS_STATE. The application developer can only redefine the implementation of the two methods INIT and HANDLE_EXCEPTION. The other methods are reserved for internal use. The Class Builder automatically creates two further auxiliary classes with the new persistent class CL class. They are assigned to a separate class pool. These classes are needed for managing persistent objects using Object Services.
KEG 640 Upgrade ABAP Delta Training
75

Sunday, April 15, 2012

Persistent Data Mapper

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

76

Calling your Persistent Class


DATA: my_flight TYPE REF TO zcl_bc620_00_persist. CLASS: zca_bc620_00_persist DEFINITION LOAD. my_flight = zca_bc620_00_persist=>agent->get_persistent( i_carrid = p_carrid i_connid = p_connid i_fldate = p_fldate ). seatsfree = my_flight->get_seatsmax( ) - my_flight>get_seatsocc( ). WRITE: / 'Seats Free: '(001), seatsfree.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

77

Transactional Services

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

78

Transactional Services - Components

To work with the transaction service you need to have access to the Object Services Transaction Manager which implements the IF_OS_TRANSACTION_MANAGER interface. This access is enabled by the methods INIT_AND_SET_MODES and GET_TRANSACTION_MANAGER in the CL_OS_SYSTEM system service class
KEG 640 Upgrade ABAP Delta Training
79

Sunday, April 15, 2012

Transactional Services - Methods


The most important methods of a transaction are: START END UNDO

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

80

Unit 5 Exercises

Unit 6 Shared Memory Classes

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

82

Shared Memory Root Class

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

83

Shared Memory Area

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

84

Shared Memory Area Attributes

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

85

Shared Memory Monitor

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

86

Shared Memory Auto PreLoad

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

87

Shared Memory Auto PreLoad Cont.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

88

Unit 6 Exercises

Unit 7 RTTS RunTime Type Services

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

90

Dynamic Assign

Basic form
Assign component sy-index of structure <wa_line> to <wa_field>

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

91

Dynamic Table Substitution

Basic form
Create data tabref type table of (table).

Select * from (table) where (where).

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

92

Runtime Type Inquiry

Basic form
Data: scarrtype type ref to cl_abap_structdescr.

Scarrtype ?= cl_abap_typedescr=>describe_by_name(SC ARR).

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

93

Runtime Type Creation

Basic form
tableType = cl_abap_tabledescr=>create( p_line_type = jointype p_table_kind = cl_abap_tabledescr=>tablekind_sorted p_key = key ).

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

94

Unit 7 Exercises

Unit 8 ICM (Internet Communications Manager)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

96

SAP is now a Web Server!

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

97

Internet Communication Manager (ICM)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

98

Monitoring the ICM

From the menu, choose Administration -> System Administration -> Monitor -> System Monitoring -> Internet Communication Manager or enter transaction code SMICM.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

99

Service Setup

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

100

Service Details

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

101

Service Logon

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

102

Service Logon Cont.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

103

SAP Web Dispatcher

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

104

Integrated J2EE

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

105

Unit 9 J2EE

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

106

J2EE Logon Page

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

107

J2EE System Information

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

108

J2EE User Management

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

109

J2EE WebServices Navigator

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

110

J2EE WebDynpro

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

111

J2EE SLD (System Landscape Directory)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

112

J2EE Admin (go.bat)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

113

J2EE Dev Environment

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

114

Unit 10 XML

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

115

Call Transformation
Basic form
CALL TRANSFORMATION trans|(name)
[PARAMETERS ...] [OBJECTS ...] SOURCE ... RESULT ...

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

116

Types of Transformations
Using a transformation, you can transform: 1. XML documents into XML documents 2. XML documents into ABAP program data (data objects and objects) 3. ABAP program data into XML documents

4. ABAP program data into ABAP program data


ABAP program data can be data objects or objects.
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

117

Transformations
A transformation must be available as a repository object, and you maintain it in the Object Navigator of the ABAP Workbench via the path Edit object -> More objects -> XSL Transformation as an XSLT program.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

118

XSLT
For Basic Serialization XML->ABAP or ABAP>XML SAP provides two XSLT Programs ID ID_INDENT For Transformation to HTML you must write your own XSLT Program. Example: SXSLTDEMO_CONNECTIONS_HTML
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

119

Unit 10 Exercises

Unit 11 WebServices

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

121

Exposing Functions as WebServices 620

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

122

WSDL Web Service Definition Language

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

123

Call SAP WebServices from VS.Net

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

124

Exposing Functions as WebServices 640

Create a Virtual Interface(SE80) Create a WebService Definition(SE80) Create a WebService Release(WSCONFIG) Setup SICF parameters (SICF) Administer WebService(WSADMIN)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

125

640 Virtual Interface

Create a Virtual Interface

Can be created off of a BAPI, Function Module, or Function Group

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

126

640 Virtual Interface Cont.

Rename or Reduce Elements via the Virtual Interface

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

127

640 Virtual Interface Cont.

Register Object Screen??? (640 SP10)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

128

640 WebService Definition


Create the WebService Definition itself

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

129

640 WebService Definition - Features

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

130

640 WebService Definition - Features

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

131

640 WebService Definition - Features

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

132

Publish to UDDI

Publish TModel to a UDDI

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

133

Release our WebService

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

134

Administer our WebService

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

135

WebService Home Page

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

136

640 Calling a WebService

Creating a Client Proxy

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

137

640 Calling a WebService

Generated Class and Structures

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

138

Setting up the Logical port

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

139

Logical Port Security Profiles

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

140

Unit 11 Exercises

Unit 12 E-Mail

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

142

SAPConnect in 640

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

143

SAPConnect in 640

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

144

Inbound Distribution

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

145

Inbound Processing

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

146

Process Inbound Method

IO_SREQ contains the E-Mail and any attachments along with the sender information IT_RECIPIENTS contains all the receipients IT_DOCTYPES contains the document class (RAW or FAX) E_RETCODE: used to send back a processing return Code ES_T100MSG: used to send back messages for the SCOT Log

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

147

Inbound Processing Code


**** get document li_document = io_sreq->get_document( ). **** get no. of body parts l_parts = li_document->get_body_part_count( ). **** Read which body part contains the file we are looking for do l_parts times. attribute = li_document->get_body_part_attributes( sy-index ). if attribute-subject cs 'cr.csv'. move sy-index to currency_attachment. endif. enddo.

****Read the actual content ls_content = li_document->get_body_part_content( currency_attachment ). attribute = li_document->get_body_part_attributes( currency_attachment ).
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

148

Inbound Processing Code Cont.


* * * * ---------------------------------------------------------------------------------------error handling ---------------------------------------------------------------------------------------system error catch cx_os_object_not_found cx_alert_recipient_unknown cx_document_bcs cx_send_req_bcs cx_address_bcs. try. **** send reply l_subject = 'Message could not be processed'. **** build content for reply ls_text = 'An internal system error occured!! Please send the message again.'. append ls_text to lt_text. ls_text = 'If this error occurs again please call your system administrator.'. append ls_text to lt_text. me->send_reply( io_reply = lo_reply ip_subject = l_subject it_content = lt_text ). * e_retcode = 4. catch cx_document_bcs cx_address_bcs cx_send_req_bcs. * e_retcode = 4. endtry. endtry. **** exit has done its work e_retcode = if_inbound_exit_bcs=>gc_terminate.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

149

Outbound Processing

In 4.6C it was done with Function Module: SO_NEW_DOCUMENT_ATT_SEND_API1 In 640 we use the class CL_BCS (Business Communication Service) We have the option to send immediately in 640, however SCOT still logs the E-Mail

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

150

Outbound Processing Code


TRY. * Create persistent send request send_request = cl_bcs=>create_persistent( ). * Build the Subject Line MOVE 'This is a test'(s01) TO subject. * Create document CLEAR mail_line. MOVE 'This is a test E-Mail'(d01) TO mail_line. CONCATENATE mail_line cl_abap_char_utilities=>newline INTO mail_line. APPEND mail_line TO l_mailtext. * Build the Main Document num_rows = lines( l_mailtext ). num_rows = num_rows * 255. MOVE num_rows TO textlength. document = cl_document_bcs=>create_document( i_type = 'RAW' i_text = l_mailtext i_length = textlength i_subject = subject ). * Add document to send request CALL METHOD send_request->set_document( document ).

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

151

Outbound Processing Code Cont.


* Get sender object sender = cl_sapuser_bcs=>create( sy-uname ). * Add sender CALL METHOD send_request->set_sender EXPORTING i_sender = sender.

* Create recipient recipient = cl_cam_address_bcs=>create_internet_address( c_address ).


* Add recipient with its respective attributes to send request CALL METHOD send_request->add_recipient EXPORTING i_recipient = recipient i_express = ' ' i_copy = ' ' i_blind_copy = ' '.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

152

Outbound Processing Code Cont.


* Set that you don't need a Return Status E-mail CALL METHOD send_request->set_status_attributes EXPORTING i_requested_status = 'E' i_status_mail = 'E'. * set send immediately flag send_request->set_send_immediately( 'X' ).

* Send document CALL METHOD send_request->send( ). COMMIT WORK. MESSAGE i014(zes_job) WITH uname. CATCH cx_bcs MESSAGE ID NUMBER WITH INTO bcs_exception. bcs_exception->msgid TYPE 'I' bcs_exception->msgno bcs_exception->msgv1 bcs_exception->msgv2 bcs_exception->msgv3 bcs_exception->msgv4.

ENDTRY.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

153

Unit 12 Exercises

Unit 13 Integrated ITS

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

155

Integrated ITS

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

156

Integrated ITS

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

157

Integrated ITS

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

158

Integrated ITS Admin (SITSPMON)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

159

Integrated ITS Admin (SITSPMON)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

160

External ITS (ZES_ITS1)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

161

Unit 14 ABAP Unit

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

162

ABAP Unit

Unit Test Plans written in ABAP Local Class within the object you will test Each Method of the local class is a single test

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

163

ABAP Unit

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

164

ABAP Unit

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

165

ABAP Unit

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

166

ABAP Unit Assert Methods

Methods of the Class CL_AUNIT_ASSERT


The class CL_AUNIT_ASSERT contains the following methods for checking test expectations: ASSERT_EQUALS Validates the equality of two data objects ASSERT_BOUND Asserts the validity of the reference of a reference variable ASSERT_NOT_BOUND Asserts whether the reference of a reference variable is invalid ASSERT_INITIAL Asserts whether the data object has its initial value ASSERT_NOT_INITIAL Asserts whether the data object does NOT have its initial value FAIL Terminates the test with an error

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

167

Unit 14 Exercises

Unit 15 Adobe Forms Tool

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

169

Adobe Form Capabilities

Generate forms that contain data extracted from SAP business applications Generate PDF forms which unlock additional functionality in Adobe Reader Use dynamic or static forms Complete forms online or offline Allow users to print forms Submit data from the form back to SAP business applications
KEG 640 Upgrade ABAP Delta Training
170

Sunday, April 15, 2012

System Layout

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

171

System Layout Cont.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

172

Unit 15 Exercises

Unit 16 BSP Business Server Pages

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

174

Layout of a BSP Application

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

175

Controllers

Controllers contain business logic and application data. Controllers assess the data of an incoming request based on a model and then select a suitable view for rendering the response to the user.
KEG 640 Upgrade ABAP Delta Training
176

Sunday, April 15, 2012

Business Server Pages


BSPs are the Web sites that are displayed in the browser when the application is in use. BSPs can contain static HTML code and dynamic scripting code (ABAP or JavaScript). The scripting code is interpreted on the server. A page can have the following versions:

Page with flow logic


These are simple pages with event handlers, but without much application logic or visualization elements. It is possible to build a BSP application exclusively out of pages with flow logic and event handlers.

View
Views are used to visualize data.

Page fragment
These are created in the same way as normal BSPs, but are then marked as page fragments. Other BSPs can also include these fragments using the include directive .

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

177

Navigation Structure

The navigation structure determines which navigation request is used to direct the navigation process from which page to which subsequent page.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

178

Application Class

The business logic of a BSP application is encapsulated in an application class. The application class is implemented using a global ABAP class. This global class implements access to business data, for example, via BAPI calls. Every page of a BSP application can directly reference the components of this class (attributes, methods, and so on) using the predefined Object application. You can also assign several BSP applications to an application class.
179

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

Mime Objects

In the SAP system, all MIMEs, such as graphics, style sheets (used to define formatting properties of individual HTML tags), audio files, video files, and so on, are stored and administered in a central repository, the MIME repository. For every new BSP application, a directory of the same name is created in the MIME repository. This directory is used as a storage location for all application-specific MIMEs.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

180

Themes

A theme is a container for MIME objects. These MIME objects can be used to modify the appearance of one or more BSP applications after the application has been created. You can replace every MIME object in your application with another object from the file system. A theme is created as an independent development object in the Web Application Builder. A theme can be assigned to BSP applications in order to redefine style sheets and MIMEs in the pages of a BSP application after they have been created. The theme concept is a powerful tool for easily changing the layout of your pages in accordance with your needs, without the need for modifying the layout source code.
KEG 640 Upgrade ABAP Delta Training
181

Sunday, April 15, 2012

BSP Page Overview

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

182

BSP Built-in Objects

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

183

BSP Events

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

184

Stateful

A stateful BSP application is executed like a normal SAP transaction, independent of all user interactions - in one single context (roll area). This means that data specified by the user during the application execution or data determined by the application itself is available potentially throughout the entire execution duration of the session. Since the HTTP protocol itself operates in stateless mode and knows no implicit mechanism to assign independent requests to a common logical session, the BSP runtime uses Session Cookies to group requests into one common session. The name of the cookie is sap-contextid, the validity area is restricted to the URL of the BSP application. This means that a BSP application can be executed within a browser only once at any one time. Different BSP applications can operate in parallel in the same browser. Multiple users/browsers can execute the same BSP application in parallel as often as required.
KEG 640 Upgrade ABAP Delta Training
185

Sunday, April 15, 2012

Stateful
Advantage The main advantage of stateful BSP applications is that they are simple to program. As usual, you have access to data determined previously and reading or recalculating data can often be omitted. For database-intensive applications, this can lead to considerably better system performance compared to a procedure where identical read operations have to be executed for every request. Disadvantage This significant advantage is at the same time however a disadvantage the improved runtime is offset by a larger memory requirement. The number of possible parallel sessions in an SAP Web Application Server is restricted not least by the amount of available memory space. When this space is exhausted, no further sessions can be started and users cannot log on. A further disadvantage is the fact that, unlike SAPGUI, Web browsers do not log off servers, that is, if users navigate in their Web browsers to a different Web site, the SAP Web Application Server is not be informed. Thus, an open session cannot be terminated and is retained in the application server until the context is released by the timeout mechanism. Since this can take some time, scarce resources are unnecessarily blocked in the application server.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

186

Stateless

Stateless BSP applications only block resources on the SAP Web Application Server during the time one single request is being processed. When the request has been processed, all resources in particular the application context are returned to the system for use in other requests. Stateless applications allow - at least from the viewpoint of the memory resource optimal scaling regardless of the number of users. On the other hand, releasing the application context after every request may mean that identical data is read from the database and formatted multiple times. In this respect, the runtime may offset the memory saving. This should be evaluated and analyzed on a case by case basis.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

187

Storing data in Stateless mode

Temporary (Invisible) Storage of Data on the Web Site Itself: Storing Data in Client-Side Cookies: Server-Side Cookies: Application-Specific DB Table for Temporary Data Storage

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

188

Unit 16 Exercises

Unit 17 BSP Extensions (Custom Tags)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

190

What are BSP Extensions?

A BSP extension contains a collection of BSP elements. In the BSP context, each element is assigned to an ABAP class to represent the element functionality, which the generation of the HTML coding usually contains.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

191

HTMLB

SAP delivers a set of predefined extensions such as HTML Business for BSP (htmlb), which are available and can be used in every SAP Web Application Server 6.20 system.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

192

How does a BSP Extension Work?

Each BSP extension consists of a collection of BSP elements. Each element has specific attributes and is assigned to an ABAP class. The usual notation for XML elements is used when elements are written to BSPs. The attributes available in the element are used as input parameters for the ABAP class that is assigned to the element.
KEG 640 Upgrade ABAP Delta Training
193

Sunday, April 15, 2012

How does a BSP Extension Work?


You can define a simple pushbutton on a BSP as follows, for example: <htmlb:button id="btn1" text="Hit Me!" /> Here "htmlb" is the XML namespace, "button" is the element and "id" and "text" are attributes.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

194

How does a BSP Extension Work?


If the BSP compiler sees the element, it generates the following pseudocode. data: btn1 type ref to CL_HTMLBL_BUTTON. create object btn1. btn1->writer = current_output_writer. btn1->id = btn1. btn1->text = Hit Me!. btn1->begin_tag( ). btn1->end_tag( ).

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

195

BSP Extension Advantages

The standard XML syntax that is used can be parsed and checked during the BSP compile time. The returned HTML coding need only be generated once (by an expert) in the ABAP element class, thereby ensuring that the coding is correct. The element class can contain additional logic for generating browser-dependent HTML code. The HTML coding that is generated contains correct references to the style sheets that are available.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

196

HTMLB Examples
See BSP Application HTMLB_Samples -> Page Default.htm

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

197

BSP Extensions Quick Look

<%@page language="abap" %> <%@extension name="htmlb" prefix="htmlb" %> <%@extension name="ZKEG" prefix="ZKEG" %> <htmlb:content design = "design2003" labelDesignBar = "light" > <htmlb:document> <htmlb:documentBody> <htmlb:form action = "Index_Frames.htm" target = "_parent" > <ZKEG:pageHeaderDesign2003 NumberOfParents = "2" RFCDest = "<%= application->rfcdest %>" /> </htmlb:form> </htmlb:documentBody> </htmlb:document> </htmlb:content>

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

198

Building BSP Extensions

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

199

Creating and editing BSP extensions

In the Object Navigator (SE80), you first create a BSP extension as a new development object. Then you create one or several BSP elements and declare the individual element attributes.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

200

Generating the element handler class

For each BSP element, you can generate a corresponding element handler class and its basis class in the Class Builder

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

201

Integration in the Tag Browser

Through activation, each new BSP extension is copied, without additional effort, as an entry into the Tag Browser in SE80. On the BSP application pages, you can then place the corresponding tags and their attributes wherever you want them in the editor using Drag&Drop.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

202

BSP Extensions - Properties

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

203

BSP Extensions - Attributes

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

204

BSP Extensions Compile Time


method if_bsp_element~compile_time_is_valid . ****Call the Inherited Method call method super->if_bsp_element~compile_time_is_valid exporting element_info = element_info compiler_messages = compiler_messages element_data = element_data validator = validator receiving valid = valid. check valid = 'X'. ****Validate the Disabled Flag * validator->to_enum( name = 'Disabled' enums = 'TRUE/FALSE' ). validator->to_boolean( 'Disabled' ). valid = validator->m_all_values_valid. endmethod.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

205

BSP Extensions Runtime


method if_bsp_element~runtime_is_valid . ****Verify Content Parent Tag if me->mc_content is initial. " ensure <htmlb:content> me->get_class_named_parent( class_name = 'CL_HTMLB_CONTENT' ). endif. ****This tag requires Design 2003 because of the use of PHTMLB tags internally if me->mc_content->design <> cl_htmlb_content=>co_design_2003. me->raise_error( msg = 'BSP elements of BSP extension <zkeg:*> supported for DESIGN2003 only.'(002) ). endif. ****If the user didn't specify an ID we will generate one. if me->id is initial. me->mc_content->m_button_id_counter = me->mc_content->m_button_id_counter + 1. me->id = me->mc_content->m_button_id_counter. condense me->id no-gaps. concatenate 'zkeg_download_' me->id into me->id. endif. ****Validate the Text me->text = m_validator->bindable_to_string( name = 'text' value = me->text binding_path = me->_text page_context = m_page_context ). ****Validate the Disabled Parameter me->disabled = m_validator->to_enum( name = 'Disabled' value = me->disabled enums = 'TRUE/FALSE' ). endmethod.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

206

BSP Extensions Do At Beginning


****Build the Download Image data: image type ref to cl_htmlb_image. * data: img_src type string. * img_src = cl_bsp_mimes=>sap_icon( `ICON_EXPORT` ). ****Create the Image image ?= cl_htmlb_image=>factory( id = me->id id_postfix = '__image' src = 'ICON_EXPORT' ). ****Render the Image while m_page_context->element_process( element = image ) = co_element_continue. endwhile. "End Image Render me->print_string( '&nbsp' ).
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

207

BSP Extensions Overloading Events


****Trap the popup menu onSelect Event and redirect it our event data: class_desc type ref to cl_abap_typedescr. class_desc = cl_abap_classdescr=>describe_by_object_ref( me ). data: class_name type string. class_name = class_desc->get_relative_name( ). concatenate me->ondownload '::' class_name '::DownloadChoosen' into popup_menu->onselect.
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

208

Unit 17 Exercises

Unit 18 BSP MVC (Model View Controller)

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

210

MVC What Is It?

Not SAP Specific Similar implementation to JSP and Jakarta Struts It is a Design Paradigm Allows for encapsulation and reusability Heavily relies on OO concepts

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

211

MVC Quick Look

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

212

MVC-Diagram

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

213

MVC Model Class

The Model is the encapsulation of your business object (application logic) It exposes all business data to the rest of your BSP application

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

214

MVC- Model Simple Example

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

215

MVC Controller

Controls the flow of your application Responds to events from the User Interface and passes actions on to the Model Class Selects which View will be used Responsible for the lifetime of the Model

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

216

MVC Controller Properties Page

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

217

MVC Controller Initialization

In a stateful application this initialization will just be called once. We create the Model at this point. This is the DO_INIT method of the Controller Class

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

218

MVC Controller Initialization Code


method do_init . data: model1 type ref to zcl_bsp_m_doc_srch_query. ****Get a pointer to the Model Object. model1 ?= get_model( 'MQ' ). if model1 is initial. ****Create the Model to hold data for the Document Search Controller data: model type ref to cl_bsp_model. model = create_model( model_id = 'MQ' class_name = 'ZCL_BSP_M_DOC_SRCH_QUERY' ). endif. data: model2 type ref to zcl_bsp_m_doc_srch_query. data: appl type ref to zcl_em_bsp_appl_doc_search. ****Get a pointer to the Model Object. model2 ?= get_model( 'MQ' ). ****Get a Pointer to the application Object appl ?= application. ****Tell the Application object about the Model Object appl->search_model ?= model2. model2->get_defaults( rfcdest = appl->rfcdest ip_address = ip_address ). Endmethod.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

219

MVC Controller DO_REQUEST

This method called every time this is a page request The program flow is really controlled from here This is where we call our view This method also pass the model class to the view

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

220

MVC Controller DO_REQUST Code


method do_request . data: view type ref to if_bsp_page. data: model1 type ref to zcl_bsp_m_doc_srch_query. ****Get a pointer to the Model Object. model1 ?= get_model( 'MQ' ). view = create_view( view_name = 'query.htm' ). view->set_attribute( name = 'model' value = model1 ). call_view( view ). endmethod.
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

221

MVC Controller - Top Level Controller


if input is available, dispatch this input to subcomponent. * this call is only necessary for toplevel controllers. * ( if this is not a toplevel controller or no input is present, * this call returns without any action) dispatch_input( ). * if any of the controllers has requested a navigation, * do not try to display, but leave current processing if is_navigation_requested( ) is not initial. return.
Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

222

MVC Controller DO_HANDLE_EVENT

This method is responsible for processing input events If necessary it will gather input data from the View It will trigger business logic through the model if necessary

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

223

MVC Controller DO_HANDLE_EVENT Code


method do_handle_event . data: event_id type string.

event_id = event. if htmlb_event is not initial. event_id = htmlb_event->id. endif.


data: model type ref to zcl_bsp_m_doc_srch_query. data: appl type ref to zcl_em_bsp_appl_doc_search. ****Get a pointer to the Model Object. model ?= get_model( 'MQ' ). ****Get a Pointer to the application Object appl ?= application. data: ddlb type ref to cl_htmlb_dropdownlistbox. ddlb ?= cl_htmlb_manager=>get_data( request = request id = 'qy_mq_cache' name = 'dropdownListBox' ). case event_id. when 'qy_QUERY'. appl->search_model->perform_query( appl = appl ). when 'qy_mq_doctype'. appl->search_model->get_objtype_values1( rfcdest = appl->rfcdest ). appl->search_model->gets_statusx_values1( i_rfcdest = appl->rfcdest ). endcase. endmethod.

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

224

MVC View

This is where your presentation layout and logic reside

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

225

MVC View Properties

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

226

MVC View Layout


<%@page language="abap" %> <%@extension name="htmlb" prefix="htmlb" %> <%@extension name="bsp" prefix="bsp" %> <%@extension name="xhtmlb" prefix="xhtmlb" %> <%@extension name="zkeg" prefix="zkeg" %> <htmlb:gridLayout cellSpacing = "1" cellPadding = "0" width = "100%" rowSize = "6" columnSize = "2" > <%-- *Row 1 Column1 --%> <htmlb:gridLayoutCell columnIndex = "1" rowIndex = "1" style = "STANDARD" > <htmlb:label for = "mq_doctype" text = "//model/DOCTYPE_DESC" /> : &nbsp &nbsp <htmlb:dropdownListBox id = "mq_doctype" table = "//model/DOCTYPE_VALUES" selection = "//model/DOCTYPE" onSelect = "myDropDownSel" nameOfKeyColumn = "key" nameOfValueColumn = "value" /> </htmlb:gridLayoutCell>

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

227

MVC View Page Attributes

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

228

MVC Model Binding


<htmlb:dropdownListBox id = "mq_doctype" table = "//model/DOCTYPE_VALUES" selection = "//model/DOCTYPE" onSelect = "myDropDownSel" nameOfKeyColumn = "key" nameOfValueColumn = "value" />

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

229

MVC Advanced Model Binding


<% loop at model->shlp_mvc assigning <wa_mvc>. move sy-tabix to tabix. clear input2. create object input2. concatenate <wa_mvc>-select_fld tabix '_field' into input2->id. condense input2->id no-gaps. concatenate '//model/shlp_mvc[' tabix '].select_fld' into input2->_value. input2->VISIBLE = 'FALSE'. clear input_string. input_string = input2->IF_BSP_BEE~RENDER_TO_STRING( page_context ). %> <%= input_string %> <% endloop. %>

Sunday, April 15, 2012

KEG 640 Upgrade ABAP Delta Training

230

Unit 18 Exercises