ABAP 7.40 Quick Reference SAP Blogs
ABAP 7.40 Quick Reference SAP Blogs
com/2015/10/25/abap-740-quick-reference/
Community Topics Groups Answers Blogs Events Programs Resources What's New
Technical Articles
Je�rey Towell
October 25, 2015 | 13 minute read
Follow Contents
1. I n l i n e D e c l a r a t i o n s
Like 2. Ta b l e E x p re s s i o n s
3. C o n v e r s i o n O p e r a t o r C O N V
4. Va l u e O p e r a t o r VA LU E
RSS Feed
5. FO R o p e r a t o r
6. Re d u c t i o n o p e r a t o r R E D U C E
7. C o n d i t i o n a l o p e r a t o r s C O N D a n d SW I TC H
8. C O R R E S P O N D I N G o p e r a t o r
9. S t r i n g s
1 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
10. Lo o p a t G ro u p B y
11. C l a s s e s / M e t h o d s
12. M e s h e s
13. F i l t e r
14. D o c u m e n t P u r p o s e
1. Inline Declarations
Before 7.40 With 7.40
D a ttaa
DATA text TYPE string. DATA(text) = 'ABC'.
text = 'ABC'.
Loooop
a tt iinnttoo DATA wa like LINE OF itab. LOOP AT itab INTO DATA(wa).
w
woorrkk LOOP AT itab INTO wa. ...
a rreeaa ... ENDLOOP.
ENDLOOP.
C
Caal ll
m
meetthhoo DATA a1 TYPE ... oref->meth(
d DATA a2 TYPE ... IMPORTING p1 = DATA(a1)
IMPORTING p2 = DATA(a2) ).
oref->meth(
IMPORTING p1 = a1
IMPORTING p2 = a2 ).
2 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Loooop
a tt FIELD-SYMBOLS: <line> type … LOOP AT itab
a s s i g nn ASSIGNING FIELD-SYMBOL(<line>).
iinngg LOOP AT itab ASSIGNING <line>. ...
... ENDLOOP.
ENDLOOP.
Re a d
a s s i g nn FIELD-SYMBOLS: <line> type … READ TABLE itab
iinngg ASSIGNING FIELD-SYMBOL(<line>).
READ TABLE itab
ASSIGNING <line>.
S e lleecctt
iinnttoo DATA itab TYPE TABLE OF dbtab. SELECT * FROM dbtab
ttaab llee INTO TABLE @DATA(itab)
SELECT * FROM dbtab WHERE fld1 = @lv_fld1.
INTO TABLE itab
WHERE fld1 = lv_fld1.
S e lleecctt
s iinnggllee SELECT SINGLE f1 f2 SELECT SINGLE f1 AS my_f1,
iinnttoo FROM dbtab f2 AS abc
INTO (lv_f1, lv_f2) FROM dbtab
WHERE ... INTO DATA(ls_struct)
WHERE ...
WRITE: / lv_f1, lv_f2.
WRITE: / ls_struct-my_f1,
ls_struct-abc.
3 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
2. Table Expressions
If a table line is not found, the exception CX_SY_ITAB_LINE_NOT_FOUND is raised. No sy-subrc.
Re a d
TTaab llee READ TABLE itab INDEX idx wa = itab[ KEY key INDEX idx ].
uussiinngg USING KEY key
k eeyy INTO wa.
Re a d
T
Taab llee READ TABLE itab wa = itab[ col1 = … col2 = … ].
w
wiitthh WITH KEY col1 = …
k eeyy col2 = …
INTO wa.
Re a d
TTaab llee READ TABLE itab wa = itab[ KEY key col1 = …
wwiitthh WITH TABLE KEY key col2 = … ].
k eeyy COMPONENTS col1 = …
c oommpp col2 = …
oonneen tt INTO wa.
s
4 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
D ooeess
rreeccoorrdd READ TABLE itab ... IF line_exists( itab[ ... ] ).
e xxiisstt?? TRANSPORTING NO FIELDS. ...
ENDIF.
IF sy-subrc = 0.
...
ENDIF.
GGeett
ttaab llee DATA idx type sy-tabix. DATA(idx) =
iinndde xx line_index( itab[ ... ] ).
READ TABLE ...
TRANSPORTING NO FIELDS.
idx = sy-tabix.
N B : There will be a short dump if you use an inline expression that references a non-existent record.
SAP says you should therefore assign a �eld symbol and check sy-subrc.
5 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
CONV dtype|#( … )
# = compiler must use the context to decide the type to convert to (implicit)
II. Example
Method cl_abap_codepage=>convert_to expects a string
Before 7.40
helper = text.
With 7.40
6 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Before 7.40
OR
Ta b l e s : VALUE dtype|#( ( … ) ( … ) … ) …
7 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
OR
itab = VALUE #( ( ) ( 1 ) ( 2 ) ).
8 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
5. FOR operator
I. De�nition
FOR wa|<fs> IN itab [INDEX INTO idx] [cond]
II. Explanation
This e�ectively causes a loop at itab. For each loop the row read is assigned to a work area (wa) or �eld-symbol(<fs>).
This wa or <fs> is local to the expression i.e. if declared in a subrourine the variable wa or <fs> is a local variable of
Given:
Row T K N U M [ C ( 1 0 ) ] N a m e [ C ( 1 2 ) ] City[ C
C((225 ))]] Route[C(6)]
1 001 John Melbourne R0001
9 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Row T K N U M [ C ( 1 0 ) ] N a m e [ C ( 1 2 ) ] City[ C
C((225 ))]] Route[C(6)]
2 002 Gavin Sydney R0003
3 003 Lucy Adelaide R0001
4 004 Elaine Perth R0003
III. Example 1
Populate internal table GT_CITYS with the cities from GT_SHIPS.
Before 7.40
With 7.40
IV. Example 2
Populate internal table GT_CITYS with the cities from GT_SHIPS where the route is R0001.
10 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Before 7.40
With 7.40
Note: ls_ship does not appear to have been declared but it is declared implicitly.
V. FO R w i t h T H E N a n d U N T I L | W H I L E
TYPES:
BEGIN OF ty_line,
11 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
col1 TYPE i,
col2 TYPE i,
col3 TYPE i,
END OF ty_line,
ty_tab TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
Before 7.40
DO.
j = j + 10.
IF j > 40. EXIT. ENDIF.
APPEND INITIAL LINE TO gt_itab ASSIGNING <ls_tab>.
<ls_tab>-col1 = j.
<ls_tab>-col2 = j + 1.
<ls_tab>-col3 = j + 2.
ENDDO.
With 7.40
12 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
III. Example 1
Count lines of table that meet a condition (�eld F1 contains “XYZ”).
Before 7.40
With 7.40
13 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Before 7.40
IV. Example 2
Sum the values 1 to 10 stored in the column of a table de�ned as follows
Before 7.40
With 7.40
14 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
V. Example 3
Using a class reference – works because “write” method returns reference to instance object
With 7.40
15 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
DATA(time) =
COND string(
WHEN sy-timlo < '120000' THEN
|{ sy-timlo TIME = ISO } AM|
WHEN sy-timlo > '120000' THEN
|{ CONV t( sy-timlo - 12 * 3600 )
TIME = ISO } PM|
WHEN sy-timlo = '120000' THEN
|High Noon|
ELSE
THROW cx_cant_be( ) ).
DATA(text) =
NEW class( )->meth(
SWITCH #( sy-langu
WHEN 'D' THEN `DE`
WHEN 'E' THEN `EN`
ELSE THROW cx_langu_not_supported( ) ) ).
8. Corresponding Operator
I. De�nition
16 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
With 7.40
17 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
III. Output
IV. Explanation
Given structures ls_line1 & ls_line2 de�ned and populated as above.
11
CLEAR ls_line2. ls_line2 = CORRESPONDING #( ls_line1 ).
MOVE-CORRESPONDING ls_line1
TO ls_line2.
2
MOVE-CORRESPONDING ls_line1 ls_line2 = CORRESPONDING #
TO ls_line2. ( BASE ( ls_line2 ) ls_line1 ).
3
DATA: ls_line3 like ls_line2. DATA(ls_line3) = CORRESPONDING line2
( BASE ( ls_line2 ) ls_line1 ).
ls_line3 = ls_line2.
MOVE-CORRESPONDING ls_line1
TO ls_line2.
1. The contents of ls_line1 are moved to ls_line2 where there is a matching column name. Where there is no
18 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
2. This uses the existing contents of ls_line2 as a base and overwrites the matching columns from ls_line1.
3. This creates a third and new structure (ls_line3) which is based on ls_line2 but overwritten by matching
columns of ls_line1.
… MAPPING t1 = s1 t2 = s2
EXCEPT allows you to list �elds that must be excluded from the data transfer
… EXCEPT {t1 t2 …}
9. Strings
I. String Templates
A string template is enclosed by two characters “|” and creates a character string.
Literal text consists of all characters that are not in braces {}. The braces can contain:
• data objects,
• calculation expressions,
• constructor expressions,
• table expressions,
19 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
• predefined functions, or
Before 7.40
cl_demo_output=>display( output ).
With 7.40
II. Concatenation
Before 7.40
20 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Before 7.40
With 7.40
III. Width/Alignment/Padding
IV. Case
V. ALPHA conversion
DATA(lv_vbeln) = '0000012345'.
WRITE / |{ lv_vbeln ALPHA = OUT }|. “or ALPHA = IN to go in other direction
21 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
I. Definition
LOOP AT itab result [cond] GROUP BY key ( key1 = dobj1 key2 = dobj2 …
[gs = GROUP SIZE] [gi = GROUP INDEX] )
[ASCENDING|DESCENDING [AS TEXT]]
[WITHOUT MEMBERS]
[{INTO group}|{ASSIGNING <group>}]
…
[LOOP AT GROUP group|<group>
…
ENDLOOP.]
…
ENDLOOP.
II. Explanation
The outer loop will do one iteration per key. So if 3 records match the key there will only be one iteration for these 3 records. The
structure “group” (or
“<group>” ) is unusual in that it can be looped over using the “LOOP AT GROUP” statement. This will loop over the 3 records
(members) of the group. The
structure “group” also contains the current key as well as the size of the group and index of the group ( if GROUP SIZE and
GROUP INDEX have been
assigned a field name). This is best understood by an example.
22 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
III. Example
With 7.40
CLEAR: gv_tot_age.
23 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
With 7.40
"Output info at group level
WRITE: / |Group: { <group>-index } Role: { <group>-role WIDTH = 15 }|
& | Number in this role: { <group>-size }|.
"Average age
gv_avg_age = gv_tot_age / <group>-size.
WRITE: / |Average age: { gv_avg_age }|.
SKIP.
ENDLOOP.
IV. Output
24 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Average age: 64
11. Classes/Methods
I. Referencing �elds within returned structures
Before 7.40
ls_lfa1= My_Class=>get_lfa1( ).
lv_name1 = ls_lfa1-name1.
With 7.40
Before 7.40
25 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Before 7.40
IF My_Class=>return_boolean( ) = abap_true.
…
ENDIF.
With 7.40
IF My_Class=>return_boolean( ).
…
ENDIF.
NB: The type “BOOLEAN” is not a true Boolean but a char1 with allowed values X,- and <blank>.
Using type “FLAG” or “WDY_BOOLEAN” works just as well.
Before 7.40
26 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Before 7.40
lo_deliv = lo_delivs->get_deliv( lv_vbeln ).
With 7.40
12. Meshes
Allows an association to be set up between related data groups.
I. Problem
Po p u l a t e d a s f o l l o w s :
27 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Ro w N a m e [C ( 1 0 ) ] S a l a r y [ I (4 ) ]
1 Jason 3000
2 Thomas 3200
Ro w N a m e [C ( 1 0 ) ] S a l a r y [ I (4 ) ] M a n a ge r [C ( 10 ) ]
II. SolutionGet the details of Jerry’s manager and all developers managed by Thomas.
With 7.40
28 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
With 7.40
ON name = manager,
END OF MESH m_team.
III. Output
Jerry’s manager: Jason Salary: 3000
Thomas’ developers:
29 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
13. Filter
Filter the records in a table based on records in another table.
I. De�nition
… FILTER type( itab [EXCEPT] [IN ftab] [USING KEY keyname]
WHERE c1 op f1 [AND c2 op f2 […]] )
II. Problem
Filter an internal table of Flight Schedules (SPFLI) to only those �ights based on a �lter table that contains the �elds
Cityfrom and CityTo.
III. Solution
With 7.40
30 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
With 7.40
SELECT * FROM spfli APPENDING TABLE lt_splfi.
Alert Moderator
DATA(lt_filter) = VALUE ty_filter_tab( f3 = 2
Assigned Tags ( cityfrom = 'NEW YORK' cityto = 'SAN FRANCISCO' )
( cityfrom = 'FRANKFURT' cityto = 'NEW YORK' ) ).
740 | ABAP Development | SAP NetWeaver | abap | document | overveiw | reference
DATA(lt_myrecs) = FILTER #( lt_splfi IN lt_filter
WHERE cityfrom = cityfrom View more...
AND cityto = cityto ).
Related Questions
SE21 - what happend to PACKTYPE ? SapGui problem
By Joachim Rees Jan 11, 2017
14 . D o c u m e n t P u r p o s e By Morales Lozano Joel Angel Jul 23, 2013
S o yo u ’ re a n ex p e r i e n c e d A BA P p ro g r a m m e r w a n t i n g t o l e ve r a g e o � t h e f a n t a s t i c n e w f u n c t i o n a l i t y
No ABAP syntax highlighting in
a vJava
a i l a bSAPGUI
l e t o yo7.50
u i non
A BMac
A P 7.4 0 !
By Cengiz Gürtusgil Aug 26, 2019
However, searching for information on this topic leads you to fragmented pages or blogs that refer to only a couple of
the new features available to you.
What you need is a quick reference guide which gives you the essentials you need and shows you how the code you are
familiar with can be improved with ABAP 7.40.
31 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
71 Comments It gives examples of “classic” ABAP and its 740 equivalent. It goes into more details on the more di�cult topics
normally via examples. This allows the reader to dive in to the level they desire. While this document does not contain
everything pertaining to ABAP 740 it certainly covers the most useful parts in the experience of the author.
You must be Logged on to comment or reply to a post.
The document has been compiled by drawing on existing material available online as well as trial and error by the
author. In particular the blogs by Horst Keller have been useful and are the best reference I have found (prior to this
document ). He has a landing page of sorts for his various blogs on the topic here:
Jitendra Soni
ABAP Language News for Release 7.40
October 25, 2015 at 1:42 pm
Hi Je�rey, Credit also goes to Naimesh Patel for his useful explanations and examples on ABAP 7.40. Here is his example of the
“FOR iteration expression” which I leaned on (links to his other 740 articles can be found at the bottom of the link):
Very informative blog.
http://zevolving.com/2015/05/abap-740-for-iteration-expression/
ABAP version:
Like 0 | Share
32 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Thanks Jitendra.
I am not sure which bits of ABAP 7.40 come in with exactly which version but here is some working code. If this does not work on your box
then its fair to say you do not have the relevant version yet.
Like 0 | Share
Hi Jitendra/Je�rey,
the new open sql syntax was created in ABAP 7.40 SP05 and enhanced in SP08. More information in ABAP News for 7.40, SP08 -
Open SQL.
BR,
Christiano.
Like 0 | Share
33 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Paul Bakker
October 25, 2015 at 9:52 pm
Unfortunately some of the code (inside the black borders) is truncated on the right hand side. But I think we can work it out
cheers
Paul
Like 0 | Share
Was also concerned about truncation on the right but found that if you click on the text and drag to the right that it all becomes visible.
Alternatively the scroll bar at the bottom works but it's a bit inconvenient scrolling down to �nd it.
Cheers,
Je�
Like 0 | Share
34 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Former Member
October 26, 2015 at 5:03 am
Like 0 | Share
Manu Kapur
October 26, 2015 at 11:22 am
Like 0 | Share
Raphael Pacheco
October 26, 2015 at 11:45 am
Just a suggestion ... I believe that would be less harmful to the blocks with commands have the edges a little thinner.
Like 0 | Share
35 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Good point Raphael! If I can �nd a relatively easy way to do that I think I will.
Like 0 | Share
Former Member
October 27, 2015 at 1:18 pm
Like 0 | Share
Former Member
October 28, 2015 at 12:20 pm
Like 0 | Share
36 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Guy Lamoureux
October 28, 2015 at 1:34 pm
Very Interesting. But I see that clarity and "ease of reading"continues to be vastly underestimated and undervalued. ABAP is going to the dark
side
Like 2 | Share
Guy, I thought the exact same thing at �rst along with others I have chatted to. However, after using it a while I realise it becomes more
clear as you get more familiar with the syntax. After years of using the old syntax it has become so familiar to us that it feels like we have
to think too much to understand what is being coded in the new syntax. Soon it will be second nature to you and hence easy to read.
Like 1 | Share
Guy Lamoureux
October 29, 2015 at 11:37 am
Hi Je�rey,
"after using it a while" the problem is right here. Not everybody is an ABAP programmer and not everybody programs in ABAP on
a regular base. I've seen a lot of functional analyst who can follow what's going on in an ABAP program. They do it for many
reasons but it's part of their job and the more we change the language to something more obscure, the less they will be able to
do it. They will need help from ABAP programmers. This will slow down the process.
On my part, I've worked as an ABAP programmer for 10 years, followed by 10 years of BW developement. I don't write ABAP code
on a regular base. This new syntax will keep being obscure.
Like 1 | Share
37 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Christoph Schreiner
October 29, 2015 at 7:59 am
Like 0 | Share
Former Member
November 8, 2015 at 10:56 am
Like 0 | Share
Aslam MD
November 18, 2015 at 7:17 am
Hi Je�rey,
Like 0 | Share
38 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Former Member
November 18, 2015 at 8:36 am
Like 0 | Share
Former Member
November 20, 2015 at 2:32 pm
Is there also some way, to have this as a sorted / hashed table or at least add secondary keys?
Like 1 | Share
Former Member
November 23, 2015 at 5:17 am
Not that I'm aware of Jakob. If you create a "type" of the kind you want with sorting etc. and call it say ty_mytab you could do a conversion
using CONV:
TYPES ty_mytab TYPE SORTED TABLE OF t001w WITH NON-UNIQUE KEY fabkl.
39 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
However, this does not save you any time/typing compared to selecting directly into your de�ned internal table:
TYPES ty_mytab TYPE SORTED TABLE OF t001w WITH NON-UNIQUE KEY fabkl.
Like 0 | Share
Wilbert Sison
November 26, 2015 at 2:49 am
Like 1 | Share
Former Member
November 26, 2015 at 2:52 am
Cheers Wilbo!
Like 0 | Share
40 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Michael Calekta
May 18, 2016 at 10:13 am
Nevertheless this is the �rst example I found, where the advantage of meshes can be seen.
All the best
Michael
Like 0 | Share
The amazing thing is that the code is a copy and paste from a working program I wrote and still have. I've noticed the "<" and ">" get
stripped o� my �eld symbols in this document before. My theory is that when it gets converted to HTML that the �eld symbols
sometimes look like HTML tags because they are between the <>. As such they are sometimes stripped out by this conversion to HTML.
41 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Thanks again.
Like 1 | Share
Michael Calekta
May 19, 2016 at 1:17 pm
Sorry to interrupt again, but it was not only the <> missing, which you have corrected, but also the ls_ which is still missing. I
don't think this can get lost by an html-conversion-error. Perhaps a missing de�nition and value assignment from the original
coding.
I have copied the example and tried it, and it really works �ne, once I could eliminate the syntax-errors because of the missing
letters.
Like 0 | Share
Interruption appreciated as you are correct that I forgot to add the "ls_" in. However, I can assure you that the original
code has both the "<>" and the "ls_" in. The HTML issue has caused problems in other parts of this document which is
why I know about it. In the "Loop at Group By" section it would not let me save the code I added. I �nally added the code
into the document word by word (i.e. saving after each word) and discovered it was a �eld symbol causing the problem.
When I renamed the �eld symbol it saved.
Like 0 | Share
Sergiu Iatco
November 15, 2022 at 1:23 pm
42 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Loop in loop is easier to understand and implement. What are the bene�ts of MESHES?
Like 0 | Share
Former Member
June 8, 2016 at 9:36 am
Thanks for documenting all the new changes. This comes as a helpful doc for all who wants to know the new features of ABAP Programming. The
Inline Declaration is a very helpful feature of ABAP 740 and it solves huge e�ots of developer.
Regards,
Vinay Mutt
Like 1 | Share
Martin Neuß
June 16, 2016 at 5:19 am
... wonderful !
I am just trying to gather some Information about Netweaver 7.40 ABAP for a forthcoming inhouse training here in our company, and found out
soon that the original SAP samples are hardly helpful.
Your examples are really straightforward, easy to understand and useful for "real life" developers.
43 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Thank you !
Regards,
Martin Neuss
Like 1 | Share
Former Member
August 18, 2016 at 10:08 am
Hi, experts. How can i �ll itab with corresponding �elds from structure variable and one �eld from another table using one statement ? my
example:
data(RT_CONFIG_PERS_DATA) =
44 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
<fs>-pers_for_user = wa_touser-low.
ENDLOOP.
Like 0 | Share
Je�rey Towell | Blog Post Author
August 19, 2016 at 12:07 am
Hi Konstantin,
Its possible to get it on one line by using each component of the structure instead of the "CORRESPONDING". In your case this would
look like:
DATA(rt_con�g_pers_data) =
45 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
( pers_for_user = wa_touser-low
component = rs_con�g_pers_data-component
viewname = rs_con�g_pers_data-viewname
role_key = rs_con�g_pers_data-role_key
component_usage = rs_con�g_pers_data-component_usage
object_type = rs_con�g_pers_data-object_type
object_sub_type = rs_con�g_pers_data-object_sub_type
changed_by = rs_con�g_pers_data-changed_by
changed_at = rs_con�g_pers_data-changed_at
con�g = rs_con�g_pers_data-con�g
parameters = rs_con�g_pers_data-parameters
con�g_type = rs_con�g_pers_data-con�g_type
invalid_�ag = rs_con�g_pers_data-invalid_�ag
marking_�ag = rs_con�g_pers_data-marking_�ag
check_�ag = rs_con�g_pers_data-check_�ag ) ).
Of course your "classic code" is better not just because the above is longer but also because the above will not work if there is ever a
46 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Like 0 | Share
PRUTHVIRAJ DAYAM
August 30, 2016 at 2:09 pm
Cant we use Filter with Non-Key �elds! .. any manipulation possible with declaration?!
Like 0 | Share
Rohit Gupta
February 23, 2017 at 6:11 pm
Are constructor operators are better in performance ? or It is just a di�erent way of writing the code.
Like 0 | Share
Ramesh Kothapally
March 17, 2017 at 9:27 am
Hi Je�rey,
Thanks for sharing very informative document with us.This blog help for all who wants to know new features and techniques in ABAP 7.4
programming and helpful to getting started with ABAP 7.4/7/5
47 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
T h a n k yo u ve r y m u c h .
Ramesh Kothapally
Like 1 | Share
Sawyer Peng
July 12, 2017 at 6:57 am
Like 1 | Share
Sawyer Peng
July 12, 2017 at 7:14 am
48 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
it should be:
Like 0 | Share
Anurag Kashyap
November 30, 2017 at 1:12 pm
SELECT * FROM dbtab INTO TABLE @DATA(itab WHERE FLD1 = @P_FIELD1. ” P_FIELD1 – Is the value coming from selection screen.
Like 0 | Share
49 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
sridhar reddy
July 20, 2017 at 7:18 pm
BTW, how do we READ table using binary search with the new syntax?
Like 1 | Share
Freek Cavens
July 24, 2017 at 1:50 pm
In the new syntax you would probably use a sorted or hashed table. A problem that I have encountered numerous times with the binary
search is that the table is not sorted correctly (often because the sort order is changed in a later adjustment of the code and the binary
search is overlooked), leading to an incorrect result. Using sorted table makes sure that the sorting of the table is correct. If you need to
read the table using di�erent access paths, you can just declare multiple keys.
data : lt_kunnr TYPE HASHED TABLE OF kna1 WITH UNQUE KEY kunnr
with non-unique sorted key k_city components ORT01,
**Get a speci�c customer (if no key is speci�ed, the default key is used, in this case the hashed key)
50 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Like 3 | Share
Former Member
August 3, 2017 at 9:35 am
Like 0 | Share
Ruthiel Trevisan
November 14, 2017 at 11:20 am
Like 2 | Share
Antonis Ioannidis
February 2, 2018 at 2:54 pm
First of all, G re a t J o b Je�rey Towell! This is an excellent post providing very useful information. Thank you!
51 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
But I cannot stop to wonder, are those new ways of writting any better than the older ones performance-wise?
In my point of view, if there is no actual performance gain by using the new methods, apart from some new additions like CONV which are indeed
very useful, it seems to me that it will just make the code a lot more complex for other programmers, not familiar with the new methods, to read.
Like 0 | Share
Michael Rudolph
March 9, 2018 at 2:18 pm
Hi Antonis,
maybe not better than older ones performance-wise. But the way you can code know safes a lot of performance while your typing! Don't
forgot that every letter you have not to type are saving time. Isn't it? Sure at the beginning it is sometimes hard to read but:it becomes
clear after a while. Now ABAP is a little bit closer to other programming languages.
regards
Micha
Like 2 | Share
Hi Antonis,
I haven't tested the performance of old vs new syntax however I would be surprised if SAP have made the new syntax work slower.
Presumably where one line of code in the new syntax does the work of multiple lines in the old then the new syntax will be quicker as it
will be optimized for the speci�c function it is carrying out.
In terms of readability it actually becomes easier to read once you are familiar with the syntax. Taking your CONV example, previously
you might have passed a value from one variable (say Type I) to another (say Char3) to convert it. While reading this you would not know
for sure a conversion is taking place. A value might just be shared between two variables of the same type. With CONV it is obvious what
52 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Old: var2 = var1. (Is this a conversion or just a shared value between vars of the same type ?)
Like 1 | Share
Himansu Gyala
May 15, 2018 at 8:28 am
Much Informative
Like 0 | Share
Ebrahim Hatem
June 20, 2018 at 3:34 pm
it is really interesting and anybody can �nd all information which ich related to ABAP 740. But I have an comment to the II. Methods that return a
type BOOLEAN.
53 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
ENDIF.
ENDIF.
Regards
Ebrahim
Like 0 | Share
Bärbel Winkler
June 22, 2018 at 12:34 pm
Rather belated thanks from me as well, Je�rey Towell for this detailed and very helpful list (h/t UserName Placeholder for UXP-4318 UserName
Placeholder for UXP-4318 whose recent post linked to yours)!
This list will help me to wrap my head around the (no longer really) new options to write ABAP-statements. I however also share some misgivings
others have mentioned earlier, namely that this shortened and arguably streamlined way to write ABAP-code is no longer quite as easy to read
and parse - esp. for people new to programming or to folks mostly working on the functional and customizing part of SAP within IT. With the old
"long-form" ABAP with spelled out statements, it was usually possible for a technically-minded colleague to at least understand the gist of what is
going on in a program, while either looking at the code in SE38/SE80 or during debugging. Considering that I'm having a hard time quickly
54 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
remembering and understanding what I'm looking at with many of the "new" constructs I can imagine how even more confusing this might look
for non-developers.
So, I'm wondering if there's perhaps some additional information needed to highlight the advantage(s) of the new constructs apart from
potentially having to type a few characters less? One such advantage might be performance or another hightened security. For me, brevity is not
always a bonus and longer but more self-explanatory statements can make life easier once the time comes that changes need to be applied.
Cheers
Baerbel
Like 1 | Share
I think the readability issues are due to us not being familiar with the new syntax. If, like me, you are still looking up some of the syntax
when coding then reading existing code will also be slower. However, a given statement in the new syntax can only have one meaning and
once we are "�uent" in the syntax its as easy to read as to write.
Your point about non-developers is well taken. Where non-developers have spent years slowly learning what is now legacy syntax they will
now be impeded when trying to read/debug code in new syntax.
If I wrote: "Thx 4 ur comment" it would save me 8 characters. If I was writing this statement frequently it would start saving me time and
I'd be able to read it as quickly as the full version.
I cannot speak to performance in terms of running the code. But in terms of debugging it is quicker as we now have one line of code
doing what multiple lines of code used to do. For example a 15 line case statement becomes a 1 line COND statement that can be
stepped over with one F6 in debug mode. I also think the COND is as easy to read.
Je�
55 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Like 1 | Share
Jayaprakash H J
December 21, 2018 at 1:43 pm
Hi,
Under many headings i could only �nd B e f o re 7.4 0 . There is nothing in W i t h 7.4 0 .
Please help.
Regards,
Jp
Like 0 | Share
Srikanth Thogiti
May 1, 2019 at 3:44 pm
It is really a useful info and It changes our job easy, especially with FILTER, GROUP, VALUE, FOR etc.
56 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Like 1 | Share
Vimal Sharma
July 18, 2019 at 4:18 am
SELECT kappl,
objky,
kschl,
spras,
FROM nast
INTO TABLE @DATA(gt_nast) .
IF sy-subrc is initial.
ENDIF.
"Declaration of perform
If declare a type and then tries to pass it here , it says type mismatch . So what to do while declaring a perform for internal table fetched with
literals.
57 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Like 0 | Share
Sandra Rossi
July 18, 2019 at 4:27 am
Eclipse ADT "quick �xes" to declare the variable explicitly (DATA BEGIN OF ...), change DATA into TYPES, and use that type name...
Like 3 | Share
Joachim Rees
February 16, 2022 at 8:20 am
(well, you could type your parameter with TYPE STANDARD TABEL, but the probably would not be useful in most cases)
best
Joachim
Like 0 | Share
Renuka Behara
December 17, 2019 at 6:09 pm
Like 0 | Share
58 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Vishal Kumar
May 2, 2020 at 5:57 am
Hello
Can someone help me with the syntax error in the attached code ?
TYPES:
BEGIN OF ty_for_final,
vbeln TYPE vbeln_va,
vbtyp TYPE vbak-vbtyp,
posnr TYPE vbap-posnr,
END OF ty_for_final.
Thanks
Like 0 | Share
Sandra Rossi
May 2, 2020 at 12:01 pm
Like 1 | Share
59 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Vishal Kumar
May 2, 2020 at 6:01 am
TYPES:
BEGIN OF ty_ord,
vbeln TYPE vbeln_va,
posnr TYPE posnr_va,
vbtyp TYPE vbak-vbtyp,
END OF ty_ord.
DATA:
lv_new_table TYPE REF TO DATA.
lv_new_table = NEW ty_ord( ( vbeln = '000000001' posnr = '0000001' vbtyp = 'L' ) ( vbeln = '000000002' posnr = '0000002'
Like 0 | Share
Rajesh Nair
May 10, 2020 at 6:14 pm
Hi Vishal,
This would work. If you want multiple entries, then you could declare a table type as follows and then your code would work.
60 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
lref_new_table = NEW ty_t_ord( ( vbeln = '000000001' posnr = '0000001' vbtyp = 'L' ) ( vbeln = '000000002' posnr
Regards,
Rajesh P Nair
Sandra Rossi
Like 0 | Share
May 10, 2020 at 7:32 pm
the �rst one will not work because you still de�ne two opening parentheses ( (
Like 0 | Share
Rajesh Nair
May 11, 2020 at 11:20 pm
Hi Sandra,
You are correct. That was a typo, I have copied from Vishal's message and removed the closing parenthesis, but not the
opening one. I was suggesting Vishal that multiple entries will not work for the type ty_ord since it represents a �at
structure and we can use multiple entries only if we use a table type of ty_ord.
Regards,
Rajesh P Nair
61 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Like 0 | Share
RAMNIK DHAR
June 10, 2020 at 11:31 am
Hi Guys,
Suppose I have a table with only one column and my requirement is to get all the contents of the table in a string separated by (,) and ending with
(.) e.g. Value1, Value2, Value3.
Any pointers on how to do this with the new syntax without concatenating.
Like 0 | Share
Joachim Rees
September 25, 2020 at 6:22 am
Huh, seems I missed this blog so far (found it now via https://blogs.sap.com/2018/09/13/abaps-new-syntax-tips-from-experience/ ) - this
seems like a very helpful resource, thanks!
Like 3 | Share
Ankit Maskara
October 19, 2020 at 6:51 am
Hi Joachim Rees ,
Thanks a lot for recommeding my blog. You are also an inspiration for many of us.
62 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Ankit Maskara.
Like 2 | Share
Paweł Karp
May 14, 2021 at 10:59 am
I just have only a small question - is in the �rst table with "inline declarations" not missing a sign "@"?
Best regards
Paweł
Like 1 | Share
Joachim Rees
May 14, 2021 at 2:36 pm
Like 1 | Share
63 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
I've no idea how that slipped through the cracks for the last 5.5 years this article has been up.
Like 1 | Share
Aditya Sharma
July 8, 2021 at 5:08 pm
When you are working with such a client where issues arises daily, they have to be met daily.
I have been requesting sap ,please with joined hands,�nalize your product.
You have been used to work in abap with a particular style of coding, why you will change it at �rst place ?
These things are not enhancements but an open outlet journey for some people to leave �eld of abap altogether.
64 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
You work with team with diverse kind of people. Some teams even are more than 30-50 abaper count .
Why make life of others hard to ful�ll these stupid desires which �nal equate to same sense ?.
And mind you its important to understand.You are in �eld of AI,Machine learning,Deep learning neural networks.But what i think in this case you
are trying to prove that human brain is di�erent.
Just a new version is released,does that mean its the fault of customer or he should be penalized for that ?
Like 0 | Share
65 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
Joachim Rees
February 16, 2022 at 7:33 am
Wow, this ABAP 7.40 Quick Reference is awesome, giving old/new examples for many features like Inline Declarations, Table Expressions, Value
Operator VALUE, etc.
Thanks a lot!
Joachim
PS: I now see on the comments, that I had already discovered that blog post in 2020 ... seems I could work on my knowledge management, or
just be happy about this re-discovery!
Like 0 | Share
Sergiu Iatco
February 16, 2022 at 7:40 am
To progress with ABAP 7.40 we need help from AI to convert existing code. Such tools are part of GPT-3 , but they do not include ABAP.
Like 0 | Share
Sergiu Iatco
April 1, 2022 at 10:11 am
66 of 67 21-11-2022, 12:21 pm
ABAP 7.40 Quick Reference | SAP Blogs https://blogs.sap.com/2015/10/25/abap-740-quick-reference/
CORRESPONDING - mapping
Syntax
Find us on
Extras:
Newsletter Support
67 of 67 21-11-2022, 12:21 pm