ABAP 7.40 Quick Reference - SAP Blogs
ABAP 7.40 Quick Reference - SAP Blogs
Community
Follow
Ask a Question
Write
Like a Blog Post Login
RSS Feed
Technical Articles
Jeffrey Towell
October 25, 2015 | 14 minute read
So you’re an experienced ABAP programmer wanting to leverage off the fantastic new functionality available to you in ABAP
7.40!
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.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 1/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
It gives examples of “classic” ABAP and its 740 equivalent. It goes into more details on the more difficult topics normally
via examples. This allows the reader to dive in to the level they desire. While this document does not contain everything
Follow
pertaining to ABAP 740 it certainly covers the most useful parts in the experience of the author.
The document has been compiled by drawing on existing material available online as well as trial and error by the author.
Like
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:
RSS Feed
ABAP Language News for Release 7.40
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):
http://zevolving.com/2015/05/abap-740-for-iteration-expression/
I compiled the below document to make the transition to using ABAP 740 easier for myself and my project team. It has
worked well for us and I hope it will do the same for you.
Regards,
Jeff Towell
Autho
Jeffrey Towell
r:
Create
2015
d:
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 2/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Contents
Follow
1. Inline Declarations
2. Table Expressions
Like
II. Example
I. Definition
5. FOR operator
I. Definition
II. Explanation
III. Example 1
IV. Example 2
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 3/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Follow I. Definition
II. Note
Like
III. Example 1
RSS Feed
IV. Example 2
V. Example 3
I. Definition
8. CORRESPONDING operator
I. Definition
III. Output
IV. Explanation
9.Strings
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 4/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
I. String Templates
III. Width/Alignment/Padding.
Like
IV. Case
RSS Feed
V. ALPHA conversion
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 5/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
1. Inline Declarations
Follow Descriptio
Before 7.40 With 7.40
n
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 6/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
RSS Feed
2. Table Expressions
If a table line is not found, the exception CX_SY_ITAB_LINE_NOT_FOUND is raised. No sy-subrc.
Descriptio
Before 7.40 With 7.40
n
Read READ TABLE itab INDEX idx wa = itab[ KEY key INDEX idx ].
Table
using USING KEY key
key
INTO wa.
Read READ TABLE itab wa = itab[ col1 = … col2 = … ].
Table WITH KEY col1 = …
with col2 = …
key INTO wa.
Read READ TABLE itab wa = itab[ KEY key col1 = …
Table WITH TABLE KEY key col2 = … ].
with COMPONENTS col1 = …
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 7/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
key col2 = …
compone INTO wa.
Follow nts
Does READ TABLE itab … IF line_exists( itab[ … ] ).
Like record
exist? TRANSPORTING NO FIELDS. …
ENDIF.
Get DATA idx type sy-tabix. DATA(idx) =
table line_index( itab[ … ] ).
index READ TABLE …
TRANSPORTING NO FIELDS.
idx = sy-tabix.
NB: 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 field symbol and check sy-subrc.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 8/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Follow
# = 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
With 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 9/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Follow
4. Value Operator VALUE
I. Definition
Like
Variables: VALUE dtype|#( )
coln1 TYPE i,
coln2 TYPE ty_columns1,
END OF ty_columns2.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 10/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
OR
Follow
itab = VALUE #( ( ) ( 1 ) ( 2 ) ).
5. FOR operator
I. Definition
FOR wa|<fs> IN itab [INDEX INTO idx] [cond]
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 11/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
II. Explanation
This effectively causes a loop at itab. For each loop the row read is assigned to a work area (wa) or field-symbol(<fs>).
Follow
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
Like
that subroutine. Index like SY-TABIX in loop.
III. Example 1
Populate internal table GT_CITYS with the cities from GT_SHIPS.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 12/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Before 7.40
Like
LOOP AT gt_ships INTO gs_ship.
gs_city = gs_ship–city.
With 7.40
IV. Example 2
Populate internal table GT_CITYS with the cities from GT_SHIPS where the route is R0001.
Before 7.40
With 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 13/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Note: ls_ship does not appear to have been declared but it is declared implicitly.
Follow
TYPES:
BEGIN OF ty_line,
col1 TYPE i,
col2 TYPE i,
col3 TYPE i,
END OF ty_line,
Before 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 14/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Before 7.40
Like
j = 1.
DO.
j = j + 10.
RSS Feed
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
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 15/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
result = iterated_value
…)
Follow
II. Note
While VALUE and NEW expressions can include FOR expressions, REDUCE must include at least one FOR expression.
Like You can use all kinds of FOR expressions in REDUCE:
III. Example 1
Count lines of table that meet a condition (field F1 contains “XYZ”).
Before 7.40
With 7.40
IV. Example 2
Sum the values 1 to 10 stored in the column of a table defined as follows
Before 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 16/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Before 7.40
V. Example 3
Using a class reference – works because “write” method returns reference to instance object
With 7.40
output->display( ).
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 17/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
[ ELSE resultn ] ) …
Follow
… SWITCH dtype|#( operand
[ ELSE resultn ] ) …
RSS Feed
II. Example for COND
DATA(time) =
COND string(
|High Noon|
ELSE
THROW cx_cant_be( ) ).
SWITCH #( sy-langu
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 18/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
8. Corresponding Operator
Follow I. Definition
, ls_line2–col2, ls_line2–col3.
SKIP.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 19/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
With 7.40
III. Output
IV. Explanation
Given structures ls_line1 & ls_line2 defined and populated as above.
TO ls_line2.
2 MOVE-CORRESPONDING ls_line1 ls_line2 = CORRESPONDING #
( BASE ( ls_line2 ) ls_line1
TO ls_line2. ).
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 20/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Like
TO ls_line2.
RSS Feed 1. The contents of ls_line1 are moved to ls_line2 where there is a matching column name. Where there is no
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 fields that must be excluded from the data transfer
… EXCEPT {t1 t2 …}
9. Strings
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 21/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
I. String Templates
A string template is enclosed by two characters “|” and creates a character string.
Follow
Literal text consists of all characters that are not in braces {}. The braces can contain:
data objects,
Like
calculation expressions,
table expressions,
predefined functions, or
Before 7.40
cl_demo_output=>display( output ).
With 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 22/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
II. Concatenation
RSS Feed
III. Width/Alignment/Padding
WRITE / |{ ‘Left’ WIDTH = 20 ALIGN = LEFT PAD = ‘0’ }|.
WRITE / |{ ‘Centre’ WIDTH = 20 ALIGN = CENTER PAD = ‘0’ }|.
WRITE / |{ ‘Right’ WIDTH = 20 ALIGN = RIGHT PAD = ‘0’ }|.
IV. Case
WRITE / |{ ‘Text’ CASE = (cl_abap_format=>c_raw) }|.
WRITE / |{ ‘Text’ CASE = (cl_abap_format=>c_upper) }|.
WRITE / |{ ‘Text’ CASE = (cl_abap_format=>c_lower) }|.
V. ALPHA conversion
DATA(lv_vbeln) = ‘0000012345’.
WRITE / |{ lv_vbeln ALPHA = OUT }|. “or use ALPHA = IN to go in other direction
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 23/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
I. Definition
Follow
LOOP AT itab result [cond] GROUP BY key ( key1 = dobj1 key2 = dobj2 …
[gs = GROUP SIZE] [gi = GROUP INDEX] )
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.
III. Example
With 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 24/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
With 7.40
Like
role TYPE char30,
END OF ty_employee,
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 25/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
With 7.40
Like
size = GROUP SIZE
ASCENDING
ASSIGNING FIELD-SYMBOL(<group>).
CLEAR: gv_tot_age.
ENDLOOP.
“Average age
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 26/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
With 7.40
Like
SKIP.
IV. Output
11. Classes/Methods
I. Referencing fields within returned structures
Before 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 27/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Before 7.40
ls_lfa1 = My_Class=>get_lfa1( ).
Like
lv_name1 = ls_lfa1–name1.
With 7.40
RSS Feed
DATA(lv_name1) = My_Class=>get_lfa1( )–name1.
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.
III. NEW operator
This operator can be used to instantiate an object.
Before 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 28/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Before 7.40
12. Meshes
Allows an association to be set up between related data groups.
I. Problem
Given the following 2 internal tables:
END OF t_manager,
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 29/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
END OF t_developer,
Like
Populated as follows:
Get the details of Jerry’s manager and all developers managed by Thomas.
II. Solution
With 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 30/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
With 7.40
III. Output
Jerry’s manager: Jason Salary: 3000
Thomas’ developers:
RSS Feed
I. Definition
… 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 flights based on a filter table that contains the fields
Cityfrom and CityTo.
III. Solution
With 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 32/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
With 7.40
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 33/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Follow
ABAP News for Release 7.50 - What is ABAP 7.50?
By Horst Keller Oct 20, 2015
Like
Related Questions
RSS Feed
OO ABAP 7.50 quick reference
By Himansu Gyala Apr 16, 2020
Difference between ABAP with Netweaver 7.40 and ABAP with Netweaver 7.02
By Manu Kapur Apr 20, 2015
65 Comments
Jitendra Soni
October 25, 2015 at 1:42 pm
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 34/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Hi Jeffrey,
Very informative blog.
Follow
Below syntax is not working for me.
Like
"SELECT * FROM dbtab INTO TABLE @DATA(lt_dbtab) WHERE field1 = @lv_field1."
ABAP version:
RSS
SAP_BASIS FeedSAPKB74007 0000 - SAP Basis Component
740 0007
SAP_ABA 740 0007 SAPKA74007 0000 - Cross-Application Component
Like 0 | Share
Jeffrey Towell | Blog Post Author
October 26, 2015 at 8:42 am
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.
Hi Jitendra/Jeffrey,
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.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 35/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
BR,
Follow
Christiano.
Like 0 | Share
Like
RSS Feed
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 find it.
Cheers,
Jeff
Like 0 | Share
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 36/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Former Member
October 26, 2015 at 5:03 am
Follow
Very much useful document Paul!
Like 0 | Share
Like
RSS Feed
Manu Kapur
October 26, 2015 at 11:22 am
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
Good point Raphael! If I can find a relatively easy way to do that I think I will.
Like 0 | Share
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 37/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Former Member
Follow
October 27, 2015 at 1:18 pm
RSS Feed
Former Member
October 28, 2015 at 12:20 pm
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 1 | Share
Guy, I thought the exact same thing at first 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 0 | Share
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 38/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Guy Lamoureux
October 29, 2015 at 11:37 am
Follow
Hi Jeffrey,
"after using it a while" the problem is right here. Not everybody is an ABAP programmer and not everybody programs in ABAP on a
Like
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
RSSwill
Feedneed 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 0 | Share
Christoph Schreiner
October 29, 2015 at 7:59 am
Former Member
November 8, 2015 at 10:56 am
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 39/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Aslam MD
November 18, 2015 at 7:17 am
Follow
Hi Jeffrey,
Former Member
November 18, 2015 at 8:36 am
Former Member
November 20, 2015 at 2:32 pm
Former Member
November 23, 2015 at 5:17 am
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 40/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
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
usingFollow
CONV:
TYPES ty_mytab TYPE SORTED TABLE OF t001w WITH NON-UNIQUE KEY fabkl.
Like
SELECT * FROM t001w INTO TABLE @DATA(lt_t001w).
DATA(lt_new_tab) = CONV ty_mytab( lt_t001w ).
RSS this
However, Feed
does not save you any time/typing compared to selecting directly into your defined internal table:
TYPES ty_mytab TYPE SORTED TABLE OF t001w WITH NON-UNIQUE KEY fabkl.
DATA: lt_new_tab TYPE ty_mytab.
Wilbert Sison
November 26, 2015 at 2:49 am
Former Member
November 26, 2015 at 2:52 am
Cheers Wilbo!
Like 0 | Share
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 41/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Michael Calekta
May 18, 2016 at 10:13 am
Follow
Thanks for your effort Jeffrey!
Yet there's a little mistake in the Mesh-Example:
Like
ASSIGN lt_developer[ name = 'Jerry' ] TO FIELD-SYMBOL(<ls_jerry>).
DATA(ls_jmanager) = ls_team-developers\my_manager[ jerry ].
RSS Feed
Second line should read instead:
DATA(ls_jmanager) = ls_team-developers\my_manager[ <ls_jerry> ].
Michael Calekta
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 42/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Follow
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 definition and value assignment from the original coding.
Like
I have copied the example and tried it, and it really works fine, once I could eliminate the syntax-errors because of the missing
letters.
RSSLike 0 | Share
Feed
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 finally added the code into the
document word by word (i.e. saving after each word) and discovered it was a field symbol causing the problem. When I
renamed the field symbol it saved.
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 effots of developer.
Regards,
Vinay Mutt
Like 0 | Share
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 43/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Follow
Martin Neuß
June 16, 2016 at 5:19 am
Like
... wonderful !
I am just trying
RSSto gather
Feed 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.
Thank you !
Regards,
Martin Neuss
Like 0 | Share
Former Member
August 18, 2016 at 10:08 am
Hi, experts. How can i fill itab with corresponding fields from structure variable and one field from another table using one statement ? my example:
data(RT_CONFIG_PERS_DATA) =
VALUE BSP_DLCT_PERS( for wa_touser in TOUSER
( CORRESPONDING #( RS_CONFIG_PERS_DATA EXCEPT PERS_FOR_USER ) PERS_FOR_USER = wa_touser-low ) ).
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 44/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Like 0 | Share
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_config_pers_data) =
VALUE bsp_dlct_pers( FOR wa_touser IN touser
( pers_for_user = wa_touser-low
component = rs_config_pers_data-component
viewname = rs_config_pers_data-viewname
role_key = rs_config_pers_data-role_key
component_usage = rs_config_pers_data-component_usage
object_type = rs_config_pers_data-object_type
object_sub_type = rs_config_pers_data-object_sub_type
changed_by = rs_config_pers_data-changed_by
changed_at = rs_config_pers_data-changed_at
config = rs_config_pers_data-config
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 45/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
parameters = rs_config_pers_data-parameters
config_type = rs_config_pers_data-config_type
Follow
invalid_flag = rs_config_pers_data-invalid_flag
marking_flag = rs_config_pers_data-marking_flag
Like
check_flag = rs_config_pers_data-check_flag ) ).
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 change
RSS Feed
to the structure bsp_dlct_pers.
Like 0 | Share
PRUTHVIRAJ DAYAM
August 30, 2016 at 2:09 pm
Cant we use Filter with Non-Key fields! .. 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 different way of writing the code.
Like 0 | Share
Ramesh Kothapally
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 46/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
March 17, 2017 at 9:27 am
Follow
Hi Jeffrey,
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
Like
Thank you very much.
RSS Feed
Thanks and Regards,
Ramesh Kothapally
Like 0 | Share
Sawyer Peng
July 12, 2017 at 6:57 am
Sawyer Peng
July 12, 2017 at 7:14 am
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 47/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Anurag Kashyap
RSSNovember
Feed 30, 2017 at 1:12 pm
This can be written also as :
SELECT * FROM dbtab INTO TABLE @DATA(itab WHERE FLD1 = @P_FIELD1. ” P_FIELD1 – Is the value coming from
selection screen.
Like 0 | Share
sridhar reddy
July 20, 2017 at 7:18 pm
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 different access paths, you can just declare multiple keys.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 48/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Like 2 | Share
Former Member
August 3, 2017 at 9:35 am
Ruthiel Trevisan
November 14, 2017 at 11:20 am
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 49/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Antonis Ioannidis
Follow
February 2, 2018 at 2:54 pm
First of all, Great Job Jeffrey Towell! This is an excellent post providing very useful information. Thank you!
But I cannot stop to wonder, are those new ways of writting any better than the older ones performance-wise?
Like
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.
What are RSS
your Feed on this?
thoughts
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 1 | 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 specific 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 the intent
is.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 50/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Old: var2 = var1. (Is this a conversion or just a shared value between vars of the same type ?)
New: var2 = conv char3( var1 ).
Follow
0 |Like
Like Share
RSS Feed
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 find all information which ich related to ABAP 740. But I have an comment to the II. Methods that return a
type BOOLEAN.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 51/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Regards
Ebrahim
Follow
Like 0 | Share
Like
RSS Feed
Bärbel Winkler
June 22, 2018 at 12:34 pm
Rather belated thanks from me as well, Jeffrey Towell for this detailed and very helpful list (h/t Jonathan Capps 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 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 0 | Share
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 52/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
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
Follow
are "fluent" 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
be Like
now 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.
RSS Feed
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.
Jeff
Like 0 | Share
Jayaprakash H J
December 21, 2018 at 1:43 pm
Hi,
Under many headings i could only find Before 7.40 . There is nothing in With 7.40 .
Please help.
Regards,
Jp
Like 0 | Share
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 53/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Srikanth Thogiti
May 1,Follow
2019 at 3:44 pm
Like 0 | Share
RSS Feed
Vimal Sharma
July 18, 2019 at 4:18 am
Like 0 | Share
Sandra Rossi
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 54/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
July 18, 2019 at 4:27 am
Follow
Eclipse ADT "quick fixes" to declare the variable explicitly (DATA BEGIN OF ...), change DATA into TYPES, and use that type name...
Like 2 | Share
Like
RSSBehara
Renuka Feed
December 17, 2019 at 6:09 pm
Vishal Kumar
May 2, 2020 at 5:57 am
Hello
Can someone help me with the syntax error in the attached code ?
It gives error "No components exists with the name 'FOR' "
TYPES:
BEGIN OF ty_for_final,
vbeln TYPE vbeln_va,
vbtyp TYPE vbak-vbtyp,
posnr TYPE vbap-posnr,
END OF ty_for_final.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 55/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Thanks Follow
Like 0 | Share
Like
Sandra Rossi
May 2, 2020 at 12:01 pm
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 = '0000
Like 0 | Share
Rajesh Nair
May 10, 2020 at 6:14 pm
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 56/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Hi Vishal,
True.Follow
This would be an error since the type ty_ord is a structure.
lv_new_table = NEW ty_ord( ( vbeln = '000000001' posnr = '0000001' vbtyp = 'L' ).
This would work. If you want multiple entries, then you could declare a table type as follows and then your code would work.
TYPES Like
ty_t_ord TYPE STANDARD TABLE OF ty_ord WITH EMPTY KEY.
lref_new_table = NEW ty_t_ord( ( vbeln = '000000001' posnr = '0000001' vbtyp = 'L' ) ( vbeln = '000000002' posnr = '
RSS Feed
Regards,
Rajesh P Nair
Like 0 | Share
Sandra Rossi
May 10, 2020 at 7:32 pm
the first one will not work because you still define two opening parentheses ( (
Instead use only one opening parenthesis:
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 flat
structure and we can use multiple entries only if we use a table type of ty_ord.
Regards,
Rajesh P Nair
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 57/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Like 0 | Share
Follow
Like
RAMNIK DHAR
June 10, 2020 at 11:31 am
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 2 | 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.
Thanks and Regards,
Ankit Maskara.
Like 1 | Share
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 58/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Paweł Karp
Follow
May 14, 2021 at 10:59 am
Joachim Rees
May 14, 2021 at 2:36 pm
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.
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 59/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
These things are not enhancements but an open outlet journey for some people to leave field of abap altogether.
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 fulfill these stupid desires which final equate to same sense ?.
And mind you its important to understand.You are in field of AI,Machine learning,Deep learning neural networks.But what i think in this case you are
trying to prove that human brain is different.
Just a new version is released,does that mean its the fault of customer or he should be penalized for that ?
Like 0 | Share
Find us on
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 60/61
8/25/2021 ABAP 7.40 Quick Reference | SAP Blogs
Newsletter Support
Follow
Like
RSS Feed
https://blogs.sap.com/2015/10/25/abap-740-quick-reference/ 61/61