As cloud-based application development with ABAP continues to gain momentum, mastering the core elements of ABAP SQL becomes essential for building efficient and scalable business solutions. In this third installment of our ABAP on Cloud development series, we dive deep into the advanced features of ABAP SQL and data manipulation techniques.
This article explores practical topics such as JOIN statements, arithmetic operations, data type casting, CASE expressions, string handling, and more. You’ll also gain hands-on insights into powerful capabilities like currency and unit conversion, parameter usage, and dataset condensing. Whether you’re optimizing queries or designing robust cloud-ready logic, this guide will strengthen your foundational skills and enhance your productivity in the ABAP Cloud environment.
Arithmetic Calculations :
Create a CDS view with following code

Before we proceed with our tutorial, we would like to give you an opportunity to join our ZAPYard’s learning community where we have more than 35 groups and more than 1850 real SAP Consultants interacting with each other daily. Only SAP topics and not BS. Else, they will be banned from the community without warning. 👇👇👇👇
If you want to be part of ZAPYard’s Discussion Community, please feel free to check the below Link. We Ask, Answer, Help and Learn Together. There are more than 35 groups from different topics like Generative AI, SAP Joule, CAPM, BTP, RAP, BPT, Fiori, iRPA, CAI, CPI, PI/PO, ABAP on HANA, SAPUI5, SAP Build, SAP Adobe Forms, ChatBots, SAC etc. Join any group of your interest and interact with our Community.
Join ZAPYard’s WhatsApp Community – Ask, Answer, Propose & Defend SAP Topics
Fetch data from EKPO: Field EBELN, EBLP, MATNR, WERKS, LGORT, MENGE (Purchase order quantity) and convert the quantity into base unit of measure. Select all the other fields if needed. User mathematical calculation
Hint:
UMREZ UMBSZ DEC 5 0 0 Numerator for Conversion of Order Unit to Base Unit
UMREN UMBSN DEC 5 0 0 Denominator for Conversion of Order Unit to Base Unit
These two fields from the EKPO table can be used for the calculation.
Cast :
Assignment:
Tabe ZCP_EMP and ZCP_FA has 1 entry each.


But this join does not show any entry. Fix it using. Use CAST

Sample Code for data element conversion

Hint: May need to use more than just CAST.
CASE :
Example.

Currency and Unit Conversion :
Examples:
currency_conversion( amount => price,
source_currency => currency,
target_currency => :p_to_curr,
exchange_rate_Date => :p_conv_Date ) as ConvPrice
unit_conversion( quantity => brgew,
source_unit => meins,
target_unit => gewei ) as ConvF1
Condensing dataset :
Use aggregate function to create a CDS view with this functionality.
Show a report – Material, Material Description, Plant, Storage Location, Unrestricted stock, Ordered Quantity.
Ordered Quantity = open quantity to be delivered by the vendor.
Assumption: Vendor sends all the ordered quantity for a PO in one go. PO has only one line for a material. PO can have multiple material.
Data points:
Only 10 materials exists in the system and only 1 plant and 1 storage location.
Over 1 million Open PO line item exists.
Parameters :
Example:

Union :

Analyze the union by creating by more CDS views from customer and travel table without union.
If you found this article helpful, we’d love to hear from you! Share your thoughts, questions, or experiences in the comments below—your feedback is always welcome and helps us craft even more valuable content for your ABAP on Cloud journey. Stay tuned for the next part in the series, where we’ll continue exploring essential tools and techniques to level up your SAP development skills.
Please follow our LinkedIn Page, LinkedIn Group , Facebook Page, Facebook Group, Twitter & Instagram.
Do not forget to SUBSCRIBE to our YouTube Channel for Free Courses and Unconventional Interesting Videos.