Vous êtes sur la page 1sur 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 2


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 3


Agenda

ABAP Language in Releases


Important ABAP Language News in AS ABAP 7.40

© 2013 SAP AG. All rights reserved. ABAP News 7.40 4


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

ABAP for HANA ABAP 7.40


(downward compatible)

ABAP 7.03/7.31 ABAP 7.3 ABAP 8.0x

ABAP 7.02 ABAP 7.2


AS ABAP for NGAP
ABAP for ERP (not downward compatible)
(downward compatible)
ABAP 7.01 ABAP 7.1/7.11

Development
ABAP 7.0 No development
Backport

© 2013 SAP AG. All rights reserved. ABAP News 7.40 5


Agenda

ABAP Language in Releases


Important ABAP Language News in AS ABAP 7.40

© 2013 SAP AG. All rights reserved. ABAP News 7.40 6


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 7


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 8


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 9


Expressions
Inline Declarations – DATA( )

Examples for Declaration Positions for Inline Declaration DATA(var)

LOOP AT itab INTO DATA(wa).


... oref->meth( IMPORTING p1 = DATA(a1)
ENDLOOP. IMPORTING p2 = DATA(a2)
... ).
READ TABLE itab INTO DATA(wa) ...

FIND ... IN ... MATCH COUNT DATA(cnt). DATA(ref) = class=>factory( ... ).

CALL TRANSFORMATION ... RESULT XML DATA(xml). … and many


more!

© 2013 SAP AG. All rights reserved. ABAP News 7.40 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.
DATA dref TYPE REF TO data.
CREATE DATA dref TYPE i.
dref = NEW i( 555 ).
ASSIGN dref->* TO <fs>.
<fs> = 555.

DATA oref TYPE REF TO class. DATA oref TYPE REF TO class.
CREATE OBJECT oref EXPORTING ... 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 TYPE t_itab.


DATA wa LIKE LINE OF itab.
wa-col1 = 1. wa-col2 = 2. DATA(itab) = VALUE t_itab(
APPEND wa TO itab. ( col1 = 1 col2 = 2 )
wa-col1 = 3. wa-col2 = 4. ( col1 = 3 col2 = 4 ) ).
APPEND wa TO itab.
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 text TYPE c LENGTH 255. DATA(xstr) = cl_abap_codepage=>convert_to(
DATA helper TYPE string. source = CONV #( text ) ).
helper = text.
DATA(xstr) = cl_abap_codepage=>convert_to(
source = helper ).

IF 1 / 3 > 0. IF CONV decfloat34( 1 / 3 ) > 0.


... ...
ENDIF. ENDIF.

IF ' ' = ` `. IF ' ' = CONV char1( ` ` ).


... ...
ENDIF. 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. DATA(number) =
SWITCH string( sy-index
WHEN 1 THEN 'one'
WHEN 2 THEN 'two'
WHEN 3 THEN 'three'
ELSE THROW cx_overflow( ) ).

© 2013 SAP AG. All rights reserved. ABAP News 7.40 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 wa = itab[ KEY key INDEX idx ].
USING KEY key INTO wa.

READ TABLE flights WITH KEY wa = itab[col1 = ... col2 = ... ].


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

READ TABLE flights WITH TABLE KEY key wa = itab[ KEY key COMPONENTS
COMPONENTS col1 = ... col2 = ... col1 = ... col2 = ... ].
INTO wa.

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

... itab[ ... ] ... READ TABLE ... ASSIGNING ...

Performance
considerations!

... VALUE type( itab[ ... ] ) ... READ TABLE ... INTO ...

... REF type( itab[ ... ] ) ... READ TABLE ... REFERENCE INTO ...

© 2013 SAP AG. All rights reserved. ABAP News 7.40 25


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

2 3 READ TABLE itab INTO DATA(wa1) INDEX 2.


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

8 9

11 12

13 14
10 DATA(num) = itab[ 2 ]-col2[ 1 ][ 2 ]-col1.
15 16

17 18

© 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 ...
LHS = RHS.

© 2013 SAP AG. All rights reserved. ABAP News 7.40 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 ...
result = class=>do_something(
EXPORTING p3 TYPE ...
EXPORTING p1 = ...
p4 TYPE ...
p2 = ...
CHANGING p5 TYPE ...
IMPORTING p3 = ...
p6 TYPE ...
p4 = ...
RETURNING VALUE(r) TYPE ...
CHANGING p5 = ...
p6 = ... ).

© 2013 SAP AG. All rights reserved. ABAP News 7.40 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 = 'a11'
col2 = 'a12'
col3 = itab2 #(
VALUE = VALUE
( col1#(= 'a11' col2 = 'a12' )
( col2 = 'x11'
( col1 = 'a21' col2 = 'a22' ) ) )
( col1 = 'b21' col3 = VALUE #( ( col2 = 'x11' col3 = 'x12' )
col2 = 'b22' ( col2 = 'x21' col3 = 'x22' )
col3 = VALUE #( ( col1 = 'b11' ( col2
col2 == 'b12' … constructor
'x31' ) col3 = 'x32' ) ) operator
( col1 = 'b21' col2 = 'b22'CORRESPONDING
) ) ) type( ... )
( col1 = 'c31' col4 = 'x12' )
col2 = 'c32' ( col2 = 'y21' coming soon!
col3 = VALUE #(col3 = VALUE
( col1 #(
= 'c11' ( col2
col2 == 'c12'
'y11' ) col3
MOVE-CORRESPONDING = TO
itab1 'y12' )
itab2.
( col1 = 'c21' ( col2
col2 == 'c22'
'y21' ) col3
MOVE-CORRESPONDING = TO
)itab1
) ). 'y22' ) KEEPING TARGET LINES.
itab2
( col2 = 'y31' col3
MOVE-CORRESPONDING = TO
itab1 'y32' ) )EXPANDING NESTED TABLES.
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) =


DATA(idx) = sy-tabix. line_index( itab[ ... ] ).

READ TABLE itab WITH ... TRANSPORTING NO FIELDS. IF line_exists( itab[ ... ] ).
IF sy-subrc = 0. ...
... ENDIF.
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
External Views SE11

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


/* SQLScript */
Mapping ADT Input BEGIN
in Input ...
API Output
out Output END;
ABAP Dictionary Database

© 2013 SAP AG. All rights reserved. ABAP News 7.40 38


Database Access
ABAP Managed Database Procedures
Outlook: AMDP CLASS cl_demo_amdp IMPLEMENTATION.
METHOD increase_price BY DATABASE PROCEDURE FOR HDB
LANGUAGE SQLSCRIPT
CLASS cl_demo_amdp DEFINITION USING sflight.
PUBLIC FINAL CREATE PUBLIC . update sflight set price = price + inc SQLScript
PUBLIC SECTION. where mandt = clnt;
INTERFACES if_amdp_marker_hdb. ENDMETHOD.
METHODS increase_price ENDCLASS.
IMPORTING
VALUE(clnt) TYPE sy-mandt ABAP Managed
VALUE(inc) TYPE sflight-price . Code Pushdown!
ENDCLASS.

ABAP Class
/* SQLScript */
Input BEGIN
...
Output END;
Database

© 2013 SAP AG. All rights reserved. ABAP News 7.40 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 A
WebSocket Protocol
P P
C C

AS ABAP Session AMC AS ABAP Session


Application Server x Application Server y

© 2013 SAP AG. All rights reserved. ABAP News 7.40 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. METHOD if_apc_ws_extension~on_message.


... ...
IF amc_flag = abap_true. IF amc_flag = abap_true.
TRY. CAST if_amc_message_producer_text(
i_context->get_binding_manager( cl_amc_channel_manager=>create_message_producer(
)->bind_amc_message_consumer( i_application_id = 'DEMO_AMC'
i_application_id = 'DEMO_AMC' i_channel_id = '/demo_text' )
i_channel_id = '/demo_text' ). )->send( i_message = ... ).
CATCH cx_apc_error INTO DATA(exc). ELSE.
MESSAGE exc->get_text( ) TYPE 'X'. DATA(message_manager) =
ENDTRY. i_message->get_context( )->get_message_manager( ).
ELSE. DATA(message) = message_manager->create_message( ).
"Default behavior message->set_text( ... ).
ENDIF. message_manager->send( message ).
ENDMETHOD. ENDIF.

© 2013 SAP AG. All rights reserved. ABAP News 7.40 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 ADT
© 2013 SAP AG. All rights reserved. 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

Vous aimerez peut-être aussi