Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
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.
Expressions
Inline Declarations
Constructors
Internal Table Expressions
See:
http://en.wikipedia.org/wiki/Declarative_programming
http://en.wikipedia.org/wiki/Functional_programming
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.
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( ).
Constructor Expressions
... NEW|VALUE|REF|EXACT|CONV|CAST|COND|SWITCH type( ... ) ...
DATA(ptab) =
VALUE abap_parmbind_tab(
( name = name
kind = cl_abap_objectdescr=>exporting
value = dref ) ).
DATA(ptab) =
VALUE abap_parmbind_tab(
( name = name
kind = cl_abap_objectdescr=>exporting
value = REF #( para ) ) ).
DATA(components) =
CAST cl_abap_structdescr(
cl_abap_typedescr=>describe_by_name( 'T100' )
)->components.
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
wa = itab[ idx ].
READ TABLE itab INDEX idx INTO wa.
READ TABLE itab INDEX idx wa = itab[ KEY key INDEX idx ].
USING KEY key INTO wa.
Performance
considerations!
... VALUE type( itab[ ... ] ) ... READ TABLE ... INTO ...
... REF type( itab[ ... ] ) ... READ TABLE ... REFERENCE INTO ...
11 12
13 14
10
15 16
DATA(num) = itab[ 2 ]-col2[ 1 ][ 2 ]-col1.
17 18
READ TABLE itab WITH ... TRANSPORTING NO FIELDS. IF line_exists( itab[ ... ] ).
IF sy-subrc = 0. ...
... ENDIF.
ENDIF.
wa-c1 = 7.
wa-c2 = 9.
INSERT wa INTO TABLE itab.
wa-c1 = 3.
wa-c2 = 5.
INERT wa INTO TABLE itab.
DATA:
factory TYPE REF TO cl_factory,
id_string TYPE string.
Obfuscating Performance
itab1[ 1 ]-a = itab2[ 1 ]-x.
lcl=>cm_ii( itab1[ 1 ]-b = itab2[ 1 ]-y.
lcl=>factory2( itab1[ 1 ]-c = itab2[ 1 ]-z.
f_in1 = lcl=>factory0( )->im_ii( i )
f_in2 = lcl=>cm_ii( 2 ** i ) - 3 +
itab[ 2 ]-s-xtab[ x = 'abc' ]
)->m_ii(
lcl=>factory1( f_in = itab[ a = 2
b = 4711 / 2
]-x
)->m_lif_i( lcl=>cm_ii( 5 ) )->im_ii( 6 )
)
).
No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.
The information contained herein may be changed without prior notice.
Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.
These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and
SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth
in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.
SAP and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and
other countries.