Many must be wondering with new updates from SAP everyday on different areas, what’s there for ABAP coding? Well now an ABAP Consultant is expected to know CDS, AMDP, BRF+, Odata and above all new open SQL way of life. The new way of ABAP Programming is not totally new but a bit of polished version with new syntaxes to make life what I can say a bit easier for the ABAP Consultants.
I will skip the basics like avoiding data declarations and using @data, data(workarea) or assigning field-symbol(<field-symbols>) syntax etc since it has already been covered in another useful article at SAPYard, but will move on to the more innovative ones. 🙂
New Training Announcement
SAP Adobe Forms for ABAP Developers (Enrolling Now) – Class Starts on 21st of Nov 2020
Training Days – 21, 22, 28, 29 Nov, 5, 6, 12, 13, 19 & 20 Dec 2020
Time – 7:30 AM to 9:30 AM IST GMD+5.5
Note: Here it is not possible to add the full code context since the new syntaxes are applied as part of large and complex builds, but I will add snippets of dummy coding lines which may help to explain the new syntaxes, which of course one can apply and test its significance during their builds.
1. FOR ALL ENTRIES
Ever thought of doing away with our ‘for all entries’ statement and treating the internal table like a database one in our select and use join instead? Well that can be done now.
Select va~vbeln, va~posnr from vbap as va inner join it_internaltable1 as it into table @data(it_table2) where va~vbeln = it~vbeln.
So start using this for your builds and see if it makes your coding simpler.
2. MOVE CORRESPONDING:
No need of writing our typical ‘move corresponding …..’ instead can use the simple one as below when all fields are not same and not in correct sequence:
data(wa_data1) = corresponding #( wa_data ).
3. CONVERSIONS
Our conversions, using FMs, can be replaced as below:
data(lv_matnr) = |{ wa_file_data-matnr alpha = in }|. data(lv_vbeln) = |{ wa_file_data-vbeln alpha = out }| .
4. CONCATENATION:
Concatenation can be done like below:
lv_descript = |{ text-001 } { gjahr } { space } { text-002 } { space } { monat }|.
5. READ table TRANSPORTING NO FIELDS for checking existence of values:
For validating a particular data in an internal table, we normally use ‘Read table….with key…..’ and then check sy-subrc value. Now can combine and check at one go like:
if line_exists( Sales_order_inter_table [ ordertype = ’ZOR’ ] ). *******add your statement here****** Endif.
Isn’t this pretty simple and useful? Try to use the above for checking error or success for BAPI return messages, you will like it.
6. FILTERING data to an internal table:
Ever thought of doing something as below avoiding read and moving the workarea data with matching key-fields from one internal table to another?
it_mseg_item = value #( base it_mseg_item for wa_stpo in it_stpo_temp ( matnr = wa_stpo-idnrk werks = wa_stpo-werks lgort = wa_stpo-lgort menge = wa_stpo-menge meins = wa_stpo-meins) ).
Try ‘except’ to get the other non-matching set.
7. NESTed field assignment at one go, how about it as below:
wa_collect-matnr = it_vbap[ vbeln = wa_filedata-vbeln posnr= wa_filedata-posnr ]-matnr.
8. APPENDING to internal table:
For appending data from workarea to an internal table we normally pass all the field data to the workarea-fieldname and then append workarea to internal table. Again we can combine and write at one go. Here we go!!!!
append value #( werks = wa_vbap-werks matnr = wa_vbap-matnr ) to it_internaltable3.
9. APPENDING with conditions:
We can even hard-code values or add conditions within the same statement like something as below, interesting right?
Append value #( werks = wa_vbap-werks matnr = wa_vbap-matnr flag = cond #( wa_sales_item-kwmeng gt 0 then ‘Y’ else ‘N’ ) ) to it_internaltable3.
Above are some of the commonly used syntax in Modern ABAP. Try to use them in your projects. They are not HANA DB dependent. If you have the right service pack, you may start using it in ECC too.
Comments Please
You may look more ABAP 7.4 Syntax in this Complete YouTube Playlist at our YouTube Channel.
Please follow our LinkedIn Page,LinkedIn Group, Facebook Page, Facebook Group, Twitter , Instagramand Telegram SAP Technical Group.
Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.
Also consider joining SAPYard’s Telegram Channel for SAP Blogs and Tutorials.
Save our number +1-251-727-9273 and send us a Whatsapp message ‘LEARN’ to be part of our Learning Community.
Check All ABAP Programming for SAP HANA Tutorials
- ABAP on SAP HANA. Part I. First Program in ABAP HANA
- ABAP on SAP HANA. Part II. ADT Eclipse and HANA Studio
- ABAP on SAP HANA. Part III. Debugging in ADT
- CDS Part 1. Core Data Services – Introduction
- CDS Part 2. Core Data Services – Deep Dive
- ABAP on SAP HANA. Part VI. New Age Open SQL ABAP 740
- ABAP on SAP HANA. Part VII. SQL Script and SAP HANA Stored Procedure
- ABAP on SAP HANA. Part VIII. ADBC – ABAP DataBase Connectivity
- ABAP on SAP HANA. Part IX. AMDP – ABAP Managed Database Procedure
- ABAP on SAP HANA. Part X. AMDP with SELECT OPTIONS
- ABAP on SAP HANA. Part XI. Are Native SQL and Open SQL Competitors?
- ABAP on SAP HANA. Part XII. Open SQL, CDS or AMDP, which Code to Data Technique to use?
- ABAP on SAP HANA. Part XIII. Sample Functional Specification of HANA Project
- ABAP on SAP HANA: Part XIV. HANA Ready, HANA-tization & HANA Plus
- CDS Part 3. Expose CDS Views as OData Service through Annotation
- ABAP on SAP HANA: Part XVI. HANAtization
- ABAP on SAP HANA: Part XVII. ATC – ABAP Test Cockpit Setup & Exemption Process
- SAP ABAP on HANA: Part XVIII. SALV IDA (Integrated Data Access)
- ABAP for SAP HANA. Part XIX. Sample Technical Specification of HANA Project
- ABAP for SAP HANA. Part XX. ALV Report On SAP HANA – Opportunities And Challenges
- 4 Useful Tips on ABAP and ABAP on HANA
- Associations in HANA – A Conceptual Approach
- CDS Part 5. ABAP CDS Views With Authorization
- ABAP for SAP HANA. Part XXII. How to Consume Native HANA Views Using ADBC?
- CDS Part 6. Basic Expressions & Operations Available for CDS View – I
- 115 ABAP for SAP HANA Interview Questions & Answers
- CDS Part 7. Basic Expressions & Operations Available for CDS View – II
- CDS Part 8. Usage of Built-In Functions in CDS – I
- CDS Part 9. Usage of Built-In Functions in CDS – II
- CDS Part 10. Usage of Built-In Functions in CDS – III
- CDS Part 11. How to Consume CDS View in Smart Business Service KPI Fiori Apps?
- CDS Part 12. Useful 6 CDS Related Tools in ADT
- CDS Part 13. Key Definition in CDS Views
- CDS Part 14. ABAP Annotations for Translatable Texts in CDS Views
- CDS Part 15. Associations in CDS Views – I
- ABAP for SAP HANA – Part 23. How to Access Database Schema Dynamically Using AMDP?
- Video Course – New Features and Syntaxes in SAP ABAP 7.40+ with Exercises
- CDS Part 16. Usage of Built-In Functions in CDS – IV
- ‘ABAP for SAP HANA’ Points to Remember
- Limitations of Open SQL Compared to SQL Script in HANA
- CDS Part 17. How to Overcome GUID Mismatch Linking Problem in ABAP CDS?
- Curious Case of ATC – Priority 2 – Low Performance Operations on Internal Tables
- ABAP for SAP HANA – Part 24. Custom Report Using AMDP
- ABAP on HANA – A Mini Guide to your Certification Path
- How to Append Standard Tables having Replacement Objects in S/4HANA
- CDS Part 19 – Finding Week of the Year in CDS Views
- CDS Part 20 – Virtual Elements (ABAP Functions) in CDS
- CDS Part 21 – CDS View Finder Tool
- ABAP for SAP HANA – 25 – GUID Mismatch: Table Function & AMDP as the Savior
- ABAP for SAP HANA – 26 – New way of ABAP Programming in HANA
- CDS – 26: Analyzing CDS with Analytical Annotation and Manipulating its Filter Options
Also Check Business Application Studio Tutorials
- BAS 1 – How to Migrate SAP Web IDE Application to SAP Business Application Studio in 10 Steps
- ABAP on Cloud – 18 – Business Application Studio – 1
- BAS 2 – How to Deploy Fiori App to On-Premise System from SAP Business Application Studio?
- BAS 3 – SAP Business Application Studio – Component Preload File with Sample App
- ABAP on Cloud – 19 – Business Application Studio – 2
- UI5 Tooling – Develop UI5 Apps in the Editor of your Choice – 1
- UI5 Tooling – Consume OData Service via UI5-Middleware-SimpleProxy – 2
- UI5 Tooling – How to Deploy UI5 App on Netlify – 3