Você está na página 1de 57

ABAP Language News 7.

40
Horst Keller, TIP Core ABAP Platform & VM Tech, SAP AG

Disclaimer
This presentation outlines our general product direction and should not be relied on in making a
purchase decision. This presentation is not subject to your license agreement or any other agreement
with SAP. SAP has no obligation to pursue any course of business outlined in this presentation or to
develop or release any functionality mentioned in this presentation. This presentation and SAP's
strategy and possible future developments are subject to change and may be changed by SAP at any
time for any reason without notice. This document is provided without a warranty of any kind, either
express or implied, including but not limited to, the implied warranties of merchantability, fitness for a
particular purpose, or non-infringement. SAP assumes no responsibility for errors or omissions in this
document, except if such damages were caused by SAP intentionally or grossly negligent.

2013 SAP AG. All rights reserved.

ABAP News 7.40

Objectives
At the end of this presentation, you will be able to:
Name key features of ABAP language for Release 7.40
Perform development tasks with the new ABAP features

2013 SAP AG. All rights reserved.

ABAP News 7.40

Agenda
ABAP Language in Releases
Important ABAP Language News in AS ABAP 7.40

2013 SAP AG. All rights reserved.

ABAP News 7.40

ABAP Releases
ABAP Language and ABAP Runtime Environment as seen by sy-saprl

ABAP for HANA


(downward compatible)

ABAP 7.40

ABAP 7.03/7.31

ABAP 7.3

ABAP 7.02

ABAP 7.2
AS ABAP for NGAP

ABAP for ERP


(downward compatible)

(not downward compatible)

ABAP 7.01

ABAP 7.1/7.11

ABAP 7.0

2013 SAP AG. All rights reserved.

ABAP 8.0x

ABAP News 7.40

Development
No development
Backport

Agenda
ABAP Language in Releases
Important ABAP Language News in AS ABAP 7.40

2013 SAP AG. All rights reserved.

ABAP News 7.40

Important ABAP Language News in AS ABAP 7.40


Agenda
Expressions
ABAP Objects
Internal Tables
Database Access
External Interfaces
Documentation
Further News

2013 SAP AG. All rights reserved.

ABAP News 7.40

Important ABAP Language News in AS ABAP 7.40


Agenda
Expressions
Inline Declarations
Constructor Expressions
Table Expressions

ABAP Objects
Internal Tables
Database Access
External Interfaces
Documentation
Further News

2013 SAP AG. All rights reserved.

ABAP News 7.40

Expressions
Inline Declarations
Inline Declarations
... DATA(var) ...
... FIELD-SYMBOL(<fs>) ...
The new declaration operators DATA and FIELD-SYMBOL allow inline declarations of variables and field
symbols with declaration expressions in declaration positions.
Declaration positions are write positions where the operand type can be determined from the context
statically.

2013 SAP AG. All rights reserved.

ABAP News 7.40

Expressions
Inline Declarations DATA( )
Examples for Declaration Positions for Inline Declaration DATA(var)
LOOP AT itab INTO DATA(wa).
...
ENDLOOP.
READ TABLE itab INTO DATA(wa) ...

oref->meth( IMPORTING p1 = DATA(a1)


IMPORTING p2 = DATA(a2)
... ).

FIND ... IN ... MATCH COUNT DATA(cnt).

DATA(ref) = class=>factory( ... ).

CALL TRANSFORMATION ... RESULT XML DATA(xml).

2013 SAP AG. All rights reserved.

ABAP News 7.40

and many
more!

10

Expressions
Inline Declarations DATA( )
Example for Usage
DATA ixml
TYPE REF TO if_ixml.
DATA stream_factory TYPE REF TO if_ixml_stream_factory.
DATA document
TYPE REF TO if_ixml_document.
ixml
= cl_ixml=>create( ).
stream_factory = ixml->create_stream_factory( ).
document
= ixml->create_document( ).

DATA(ixml)
= cl_ixml=>create( ).
DATA(stream_factory) = ixml->create_stream_factory( ).
DATA(document)
= ixml->create_document( ).

2013 SAP AG. All rights reserved.

ABAP News 7.40

11

Expressions
Inline Declarations FIELD-SYMBOL( )
Declaration Positions for Inline Declaration FIELD-SYMBOL(<fs>)
ASSIGN ... TO FIELD-SYMBOL(<fs>).

LOOP AT itab ASSIGNING FIELD-SYMBOL(<line>).


...
ENDLOOP.

READ TABLE itab ASSIGNING FIELD-SYMBOL(<line>) ...

2013 SAP AG. All rights reserved.

ABAP News 7.40

12

Expressions
Inline Declarations FIELD-SYMBOL( )
Example for Usage
FIELD-SYMBOLS <line> LIKE LINE OF itab.
LOOP AT itab ASSIGNING <line>.
...
ENDLOOP.

LOOP AT itab ASSIGNING FIELD-SYMBOL(<line>).


...
ENDLOOP.

2013 SAP AG. All rights reserved.

ABAP News 7.40

13

Expressions
Constructor Expressions
Constructor Expressions
... NEW|VALUE|REF|EXACT|CONV|CAST|COND|SWITCH type( ... ) ...
The new constructor operators

NEW creates objects


VALUE creates values
REF gets references
EXACT performs lossless calculations or assignments
CONV converts values
CAST performs up or down casts
COND and SWITCH enable conditional expressions

allow to construct results of a specified type in general expression positions.

2013 SAP AG. All rights reserved.

ABAP News 7.40

14

Expressions
Constructor Expressions NEW( )
Instance Operator NEW

same value construction


capabilities as VALUE( )

FIELD-SYMBOLS <fS> TYPE data.


DATA dref TYPE REF TO data.
CREATE DATA dref TYPE i.
ASSIGN dref->* TO <fs>.
<fs> = 555.

DATA oref TYPE REF TO class.


CREATE OBJECT oref EXPORTING ...

DATA dref TYPE REF TO data.


dref = NEW i( 555 ).

DATA oref TYPE REF TO class.


oref = NEW #( ... ).

DATA(oref) = NEW class( ... ).

2013 SAP AG. All rights reserved.

ABAP News 7.40

15

Expressions
Constructor Expressions VALUE( )
Value Operator VALUE
DATA itab
DATA wa
wa-col1 =
APPEND wa
wa-col1 =
APPEND wa

TYPE t_itab.
LIKE LINE OF itab.
1. wa-col2 = 2.
TO itab.
3. wa-col2 = 4.
TO itab.

DATA(itab) = VALUE t_itab(


( col1 = 1 col2 = 2 )
( col1 = 3 col2 = 4 ) ).

meth( itab ).
meth( VALUE t_itab(
( col1 = 1 col2 = 2 )
( col1 = 3 col2 = 4 ) ) ).

2013 SAP AG. All rights reserved.

ABAP News 7.40

16

Expressions
Constructor Expressions REF( )
Reference Operator REF
DATA dref TYPE REF TO string.
GET REFERENCE OF para INTO dref.
DATA(ptab) =
VALUE abap_parmbind_tab(
( name = name
kind = cl_abap_objectdescr=>exporting
value = dref ) ).

DATA(ptab) =
CALL METHOD (class)=>(meth) PARAMETER-TABLE
ptab.
VALUE abap_parmbind_tab(
( name = name
kind = cl_abap_objectdescr=>exporting
value = REF #( para ) ) ).
CALL METHOD (class)=>(meth) PARAMETER-TABLE ptab.
2013 SAP AG. All rights reserved.

ABAP News 7.40

17

Expressions
Constructor Expressions EXACT( )
Lossless Operator EXACT
TYPES numtext TYPE n LENGTH 255.
DATA number TYPE numtext.
TRY.
MOVE EXACT '4 Apples + 3 Oranges' TO number.
CATCH cx_sy_conversion_error INTO DATA(exc).
...
ENDTRY.
TYPES numtext TYPE n LENGTH 255.
TRY.
DATA(number) = EXACT numtext( '4 Apples + 3 Oranges' ).
CATCH cx_sy_conversion_error INTO DATA(exc).
...
ENDTRY.
same for
COMPUTE
2013 SAP AG. All rights reserved.

ABAP News 7.40

18

Expressions
Constructor Expressions CONV( )
Conversion Operator CONV

DATA text TYPE c LENGTH 255.


DATA(xstr) = cl_abap_codepage=>convert_to(
source = CONV #( text ) ).

DATA text TYPE c LENGTH 255.


DATA helper TYPE string.
helper = text.
DATA(xstr) = cl_abap_codepage=>convert_to(
source = helper ).

IF 1 / 3 > 0.
...
ENDIF.

IF CONV decfloat34( 1 / 3 ) > 0.


...
ENDIF.

IF ' ' = CONV char1( ` ` ).


...
ENDIF.

IF ' ' = ` `.
...
ENDIF.
2013 SAP AG. All rights reserved.

ABAP News 7.40

19

Expressions
Constructor Expressions CAST( )
Casting Operator CAST
DATA structdescr TYPE REF TO cl_abap_structdescr.
structdescr ?= cl_abap_typedescr=>describe_by_name( 'T100' ).
DATA(components) = structdescr->components.

DATA(components) =
CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( 'T100' )
)->components.

2013 SAP AG. All rights reserved.

ABAP News 7.40

20

Expressions
Constructor Expressions COND( )
Conditional Operator COND
DATA time TYPE string.
IF sy-timlo < '120000'.
time = |{ sy-timlo TIME = ISO } AM|.
ELSEIF sy-timlo > '120000'.
time = |{ CONV t( sy-timlo - 12 * 3600 )
TIME = ISO } PM|.
DATA(time) =
ELSEIF sy-timlo = '120000'.
COND string(
time = |High Noon|.
WHEN sy-timlo < '120000' THEN
ELSE.
|{ sy-timlo TIME = ISO } AM|
RAISE EXCEPTION TYPE cx_cant_be.
WHEN sy-timlo > '120000' THEN
ENDIF.
|{ CONV t( sy-timlo - 12 * 3600 )
TIME = ISO } PM|
WHEN sy-timlo = '120000' THEN
|High Noon|
ELSE
THROW cx_cant_be( ) ).
2013 SAP AG. All rights reserved.

ABAP News 7.40

21

Expressions
Constructor Expressions SWITCH( )
Conditional Operator SWITCH
DATA number TYPE string.
CASE sy-index.
WHEN 1.
number = 'one'.
WHEN 2.
number = 'two'.
WHEN 3.
number = 'three'.
WHEN OTHERS.
RAISE EXCEPTION TYPE cx_overflow.
ENDCASE.

2013 SAP AG. All rights reserved.

ABAP News 7.40

DATA(number) =
SWITCH string( sy-index
WHEN 1 THEN 'one'
WHEN 2 THEN 'two'
WHEN 3 THEN 'three'
ELSE THROW cx_overflow( ) ).

22

Expressions
Table Expressions
Table Expressions
... itab[ ... ] ...
The new table expressions itab[ ] enable read access to internal tables at operand positions.
The operand positions can be read positions and also some write positions
Table expressions are LHS-expressions

2013 SAP AG. All rights reserved.

ABAP News 7.40

23

Expressions
Table Expressions table line
Line Specification
READ TABLE itab INDEX idx INTO wa.

wa = itab[ idx ].

READ TABLE itab INDEX idx


USING KEY key INTO wa.

wa = itab[ KEY key INDEX idx ].

READ TABLE flights WITH KEY


col1 = ... col2 = ... INTO wa.

wa = itab[col1 = ... col2 = ... ].

READ TABLE flights WITH TABLE KEY key


COMPONENTS col1 = ... col2 = ...
INTO wa.

wa = itab[ KEY key COMPONENTS


col1 = ... col2 = ... ].

wa = itab[ KEY key


col1 = ... col2 = ... ].

2013 SAP AG. All rights reserved.

ABAP News 7.40

24

Expressions
Table Expressions result
Controlling the Intermediate Result
READ TABLE ... ASSIGNING ...

... itab[ ... ] ...


Performance
considerations!
... VALUE type( itab[ ... ] ) ...

... REF type( itab[ ... ] ) ...

2013 SAP AG. All rights reserved.

ABAP News 7.40

READ TABLE ... INTO ...

READ TABLE ... REFERENCE INTO ...

25

Expressions
Table Expressions chaining
... itab[ ... ]-comp ...
... struct-comp[ ... ] ...
... itab[ ... ][ ... ] ...

11

12

13

14

15

16

17

18

READ TABLE itab


INTO DATA(wa1) INDEX 2.
READ TABLE wa1-col2 INTO DATA(wa2) INDEX 1.
READ TABLE wa2
INTO DATA(wa3) INDEX 2.
DATA(num) = wa3-col1.

DATA(num) = itab[ 2 ]-col2[ 1 ][ 2 ]-col1.

10

2013 SAP AG. All rights reserved.

ABAP News 7.40

26

Expressions
Miscellaneous
Many new expression enabled positions ...
Some new formatting options for string templates ...
New built-in function ipow:
cl_demo_output=>display( |** : { '1.2' ** 2 } \n| &&
|ipow: { ipow( base = '1.2' exp = 2 ) }| ).

2013 SAP AG. All rights reserved.

ABAP News 7.40

27

Expressions
ABAP is Extensively Expression Enabled
Skip Old Fashioned Style!

MOVE source TO target.

COMPUTE result = anything.

CALL METHOD meth EXPORTING ...


RECEIVING ...

2013 SAP AG. All rights reserved.

ABAP News 7.40

LHS = RHS.
28

Important ABAP Language News in AS ABAP 7.40


Agenda
Expressions
ABAP Objects
Internal Tables
Database Access
External Interfaces
Documentation
Further News

2013 SAP AG. All rights reserved.

ABAP News 7.40

29

ABAP Objects
Functional Methods
Parameter Interface of Functional Methods
A functional method can now have exporting and changing parameters besides its returning
parameter.
In functional method calls you can use the additions EXPORTING, IMPORTING, and
CHANGING to pass parameters.
CLASS-METHODS do_something
IMPORTING p1 TYPE ...
p2 TYPE ...
EXPORTING p3 TYPE ...
p4 TYPE ...
CHANGING p5 TYPE ...
p6 TYPE ...
RETURNING VALUE(r) TYPE ...

2013 SAP AG. All rights reserved.

ABAP News 7.40

result = class=>do_something(
EXPORTING p1 = ...
p2 = ...
IMPORTING p3 = ...
p4 = ...
CHANGING p5 = ...
p6 = ... ).

30

ABAP Objects
Interfaces in Test Classes
Partially Implemented
INTERFACES intf PARTIALLY IMPLEMENTED.

Only parts of interfaces must be implemented in test classes. Useful in test doubles.
CLASS mock_request DEFINITION FOR TESTING FINAL.
PUBLIC SECTION.
INTERFACES if_http_request PARTIALLY IMPLEMENTED.
ENDCLASS.

CLASS mock_request IMPLEMENTATION.


METHOD if_http_request~get_form_field.
value = SWITCH spfli-carrid( name WHEN 'carrid' THEN 'LH'
ELSE space ).
ENDMETHOD.
ENDCLASS.

2013 SAP AG. All rights reserved.

ABAP News 7.40

31

Important ABAP Language News in AS ABAP 7.40


Agenda
Expressions
ABAP Objects
Internal Tables
MOVE-CORRESPONDING
Built-in Functions
Empty Key

Database Access
External Interfaces
Documentation
Further News

2013 SAP AG. All rights reserved.

ABAP News 7.40

32

Internal Tables
Assignments
MOVE-CORRESPONDING for Internal Tables
MOVE-CORRESPONDING itab1 TO itab2.
[EXPANDING NESTED TABLES] [KEEPING TARGET LINES].
itab1 = VALUE
( col1 =
col2 =
col3 =
( col1 =
col2 =
col3 =
( col1 =
col2 =
col3 =

#(
'a11'
'a12'
itab2 #(
= VALUE
VALUE
( col1#(= 'a11' col2 = 'a12' )
( col2
= 'x11'
( col1
= 'a21' col2 = 'a22' ) ) )
'b21' col3 = VALUE #( ( col2 = 'x11' col3 = 'x12' )
( col2 = 'x21' col3 = 'x22' )
'b22'
constructor
col2 == 'b12'
'x31' ) col3
= 'x32' ) ) operator
VALUE #( ( col1 = 'b11' ( col2
( col1 = 'b21' col2 = 'b22'CORRESPONDING
) ) )
type( ... )
'c31' col4 = 'x12' )
coming soon!
'c32' ( col2 = 'y21'
= VALUE
#(
( col2
col2 == 'c12'
'y11' ) col3
= TO
'y12'
)
VALUE #(col3
( col1
= 'c11'
MOVE-CORRESPONDING
itab1
itab2.
( col2
col2 == 'c22'
'y21' ) col3
= TO
'y22'
) KEEPING TARGET LINES.
( col1 = 'c21'
)itab1
) ).
MOVE-CORRESPONDING
itab2
( col2 = 'y31' col3
= TO
'y32'
) )EXPANDING NESTED TABLES.
MOVE-CORRESPONDING
itab1
itab2
col4 = 'y22' )MOVE-CORRESPONDING
).
itab1 TO itab2 EXPANDING NESTED TABLES
KEEPING TARGET LINES.

2013 SAP AG. All rights reserved.

ABAP News 7.40

33

Internal Tables
Built-in Functions
Two new Built-in Functions for Internal Tables
... line_index( ... ) ...
... line_exists( ... ) ...

READ TABLE itab WITH ... TRANSPORTING NO FIELDS.


DATA(idx) = sy-tabix.

DATA(idx) =
line_index( itab[ ... ] ).

READ TABLE itab WITH ... TRANSPORTING NO FIELDS.


IF sy-subrc = 0.
...
ENDIF.

IF line_exists( itab[ ... ] ).


...
ENDIF.

2013 SAP AG. All rights reserved.

ABAP News 7.40

34

Internal Tables
Empty Key
Explicit Declaration of Empty Table Key
... WITH EMPTY KEY ...

2013 SAP AG. All rights reserved.

ABAP News 7.40

35

Important ABAP Language News in AS ABAP 7.40


Agenda
Expressions
ABAP Objects
Internal Tables
Database Access
HANA
Open SQL
Native SQL

External Interfaces
Documentation
Further News

2013 SAP AG. All rights reserved.

ABAP News 7.40

36

Database Access
SAP HANA Views
SE11

External Views

ABAP
HANA Studio

ADT
2013 SAP AG. All rights reserved.

ABAP News 7.40

37

Database Access
SAP HANA SQLScript Procedures
Calling SQLScript Procedures using Database Procedure Proxies
DATA: in TYPE if_dbproc_proxy=>in,
out TYPE if_dbproc_proxy=>out.
CALL DATABASE PROCEDURE dbproc_proxy EXPORTING in = in
IMPORTING out = out.
INTERFACE if_dbproc_proxy PUBLIC.
TYPES: in TYPE ...,
out TYPE ...
ENDINTERFACE.

Database Procedure Proxy


in

ABAP Dictionary
2013 SAP AG. All rights reserved.

out

Mapping
Input
Output

ABAP News 7.40

ADT

Input

API

Output

/* SQLScript */
BEGIN
...
END;

Database
38

Database Access
ABAP Managed Database Procedures
Outlook: AMDP

CLASS cl_demo_amdp IMPLEMENTATION.


METHOD increase_price BY DATABASE PROCEDURE FOR HDB
LANGUAGE SQLSCRIPT
USING sflight.
update sflight set price = price + inc
SQLScript
where mandt = clnt;
ENDMETHOD.
ENDCLASS.

CLASS cl_demo_amdp DEFINITION


PUBLIC FINAL CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
METHODS increase_price
IMPORTING
VALUE(clnt) TYPE sy-mandt
VALUE(inc) TYPE sflight-price .
ENDCLASS.

ABAP Managed
Code Pushdown!

ABAP Class
Input
Output

2013 SAP AG. All rights reserved.

ABAP News 7.40

/* SQLScript */
BEGIN
...
END;

Database
39

Database Access
Open SQL
Renovation of Open SQL Compiler Infrastructure

Modern ANTLR-based OpenSQL Parser


One Compiler for Static and Dynamic OpenSQL
Better compile-time checks
Better Performance

Table Buffer and Secondary Indexes


Buffer exploits the secondary indexes defined in the ABAP Dictionary for static accesses
Considerable speedup for buffered tables
Rule-based optimizer decides which index to use

Outlook: Expressions in Open SQL

2013 SAP AG. All rights reserved.

ABAP News 7.40

40

Database Access
Native SQL
Bulk Access with ADBC

New

2013 SAP AG. All rights reserved.

ABAP News 7.40

41

Important ABAP Language News in AS ABAP 7.40


Agenda
Expressions
ABAP Objects
Internal Tables
Database Access
External Interfaces
JSON
ABAP Channels

Documentation
Further News

2013 SAP AG. All rights reserved.

ABAP News 7.40

42

External Interfaces
ABAP and JSON
JSON Support in sXML-Library

Backported to
7.02!

JSON - JavaScript Object Notation, data format in text form for data exchange.
JSON-XML - SAP-specific representation of JSON data in XML format

asJSON - ABAP Serialization JSON,


Canonical JSON representation for serialization/deserialization of ABAP data by transformation ID

2013 SAP AG. All rights reserved.

ABAP News 7.40

43

External Interfaces
ABAP and JSON Readers and Writers
JSON to JSON-XML and Vice Versa
DATA(json) = cl_abap_codepage=>convert_to( `{"TEXT":"JSON"}` ).
DATA(json_reader) = cl_sxml_string_reader=>create( json ).
DATA(xml_writer) = cl_sxml_string_writer=>create( ).
json_reader->next_node( ).
json_reader->skip_node( xml_writer ).
cl_demo_output=>display_xml( xml_writer->get_output( ) ).

DATA(xml) = cl_abap_codepage=>convert_to(
`<object><str name="TEXT">JSON</str></object>` ).
DATA(xml_reader) = cl_sxml_string_reader=>create( xml ).
DATA(json_writer) = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
xml_reader->next_node( ).
xml_reader->skip_node( json_writer ).
cl_demo_output=>display_json( json_writer->get_output( ) ).

2013 SAP AG. All rights reserved.

ABAP News 7.40

44

External Interfaces
ABAP and JSON Transformation ID
JSON to JSON-XML and Vice Versa
DATA(json) = `{"TEXT":"JSON"}`.
CALL TRANSFORMATION id SOURCE XML json
RESULT XML DATA(xml).
cl_demo_output=>display_xml( xml ).

DATA(xml) = `<object><str name="TEXT">JSON</str></object>`.


DATA(json_writer) = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
CALL TRANSFORMATION id SOURCE XML xml
RESULT XML json_writer.
cl_demo_output=>display_json( json_writer->get_output( ) ).

2013 SAP AG. All rights reserved.

ABAP News 7.40

45

External Interfaces
ABAP and JSON asJSON
ABAP to JSON and Vice Versa
DATA(text) = `JSON`.
DATA(json_writer) = cl_sxml_string_writer=>create( type = if_sxml=>co_xt_json ).
CALL TRANSFORMATION id SOURCE text = text
RESULT XML json_writer.
cl_demo_output=>display_json( json_writer->get_output( ) ).

DATA(json) = `{"TEXT":"JSON"}`.
DATA text TYPE string.
CALL TRANSFORMATION id SOURCE XML json
RESULT text = text.
cl_demo_output=>display( text ).

2013 SAP AG. All rights reserved.

ABAP News 7.40

46

External Interfaces
ABAP Channels - AMC
ABAP Messaging Channels and ABAP Push Channels

A
P
C
AS ABAP Session
Application Server x

2013 SAP AG. All rights reserved.

A
P
C
AMC

ABAP News 7.40

WebSocket Protocol

AS ABAP Session
Application Server y

47

External Interfaces
ABAP Channels - AMC
ABAP Messaging Channels
Enable message based communications between ABAP programs across the boundaries of application servers.
CAST if_amc_message_producer_text(
cl_amc_channel_manager=>create_message_producer(
i_application_id = 'DEMO_AMC'
i_channel_id
= '/demo_text' )
)->send( i_message = ... ).
cl_amc_channel_manager=>create_message_consumer(
i_application_id = 'DEMO_AMC'
i_channel_id
= '/demo_text'
)->start_message_delivery( i_receiver = receiver ).
WAIT FOR MESSAGING CHANNELS
UNTIL receiver->text_message IS NOT INITIAL
UP TO 60 SECONDS.
2013 SAP AG. All rights reserved.

ABAP News 7.40

48

External Interfaces
ABAP Channels APC, ABAP side
ABAP Push Channels
Enable bidirectional communications between ABAP programs and the
internet using the WebSocket protocol. APCs can be connected to AMCs.

METHOD if_apc_ws_extension~on_start.
...
IF amc_flag = abap_true.
TRY.
i_context->get_binding_manager(
)->bind_amc_message_consumer(
i_application_id = 'DEMO_AMC'
i_channel_id
= '/demo_text' ).
CATCH cx_apc_error INTO DATA(exc).
MESSAGE exc->get_text( ) TYPE 'X'.
ENDTRY.
ELSE.
"Default behavior
ENDIF.
ENDMETHOD.

2013 SAP AG. All rights reserved.

ABAP News 7.40

METHOD if_apc_ws_extension~on_message.
...
IF amc_flag = abap_true.
CAST if_amc_message_producer_text(
cl_amc_channel_manager=>create_message_producer(
i_application_id = 'DEMO_AMC'
i_channel_id
= '/demo_text' )
)->send( i_message = ... ).
ELSE.
DATA(message_manager) =
i_message->get_context( )->get_message_manager( ).
DATA(message) = message_manager->create_message( ).
message->set_text( ... ).
message_manager->send( message ).
ENDIF.

49

External Interfaces
ABAP Channels APC, Internet side

2013 SAP AG. All rights reserved.

ABAP News 7.40

50

Important ABAP Language News in AS ABAP 7.40


Agenda
Expressions
ABAP Objects
Internal Tables
Database Access
External Interfaces
Documentation
ABAP Doc
ABAP Keyword Documentation

Further News

2013 SAP AG. All rights reserved.

ABAP News 7.40

51

Documentation
ABAP Doc for ADT
Inline Documentation of Source Code based Development Objects

F2

2013 SAP AG. All rights reserved.

ABAP News 7.40

52

Documentation
ABAP Keyword Documentation in ADT
Permanent Input Field, Executable Examples

F1

2013 SAP AG. All rights reserved.

ABAP News 7.40

53

Important ABAP Language News in AS ABAP 7.40


Agenda
Expressions
ABAP Objects
Internal Tables
Database Access
External Interfaces
Documentation
Further News

2013 SAP AG. All rights reserved.

ABAP News 7.40

54

Further News
Security Checks
SLIN_SEC
DATA name TYPE string.
DATA customers TYPE TABLE OF scustom WITH EMPTY KEY.

cl_demo_input=>request( CHANGING field = name ).


DATA(cond) = `country = 'DE' AND name = '` && name && `'`.
TRY.

SELECT * FROM scustom


INTO TABLE customers
WHERE (cond).
cl_demo_output=>display( customers ).
CATCH cx_sy_dynamic_osql_syntax.
cl_demo_output=>display( 'Wrong input' ).
ENDTRY.

2013 SAP AG. All rights reserved.

ABAP News 7.40

55

Further News
See ABAP Keyword Documentation

Classic
2013 SAP AG. All rights reserved.

ADT
ABAP News 7.40

56

Presentation Summary
You should now be able to:
Name key features of ABAP language for 7.40
Perform development tasks with the new ABAP features

Thanks for your attention!

2013 SAP AG. All rights reserved.

ABAP News 7.40

57

Você também pode gostar