SAP CDS View
Author : Bala.G.Reddy
Company : Cognizant Technology solutions.
Created on: 22.11.2017
I am Bala.G.Reddy working as Senior Associate at Cognizant Technology Solutions, India. I joined Cognizant Technology Solutions in 2014 and I have extensively worked on multiple SAP BI implementation and support projects
Summary: In this document I am going to cover the below topics:
- How to add ABAP perspective in HANA studio
- How to create ABAP repository for CDS VIEW
- Creation of CDS view using data extraction annotation with Business scenario
- String Function in CDS view.
- How to add ABAP perspective in HANA studio:
First Login to HANA studio and follow below steps:
Add ABAP Project as shown below:
Then search for the SAP BW System like Dev or QAS or PRD since our system is BW 7.5 SP 02, login to system.
2) How to create ABAP repository for CDS view
Then left side you will 2 folders one favorite packages and system library, and create new ABAP repository
Click on Data definition
3) Creation of CDS view using data extraction annotation with Business scenario
Scenario: We have requirement to derive reference document number from VBAP-VGBEL where VBAK-AUART = ZPQC. To join these 2 tables VBAP-VBAK we have created above CDS view.
How do I find reference number which is having ZPQC?
First we need to join 2 tables VBAK-VBAP with document number matching as given below screen shot:
Note: You see the tables /BIC/ADVBAK_OM and /bic/dvbap_om active tables, Actually we have replicated ECC tables VBAP and VBAK through SLT and created data source and DSO(Standard DSO) Which is enabled as real time data load. On top of the active tables we have created CDS view.
Now we actually joined above 2 tables using inner join.
Next step is we need to link the reference document from VBAP-VGBEL to VBAK-VBELN:
Pass the reference document in VBAK-VBELN and check Document where ZPQC as given below screen shots:
To achieve above scenario we have created below CDS view:
Left outer join mapping condition is reference document from VBAP as b and document from vbak-vbeln(doc_number)
Output in where condition we need to take only document type is ZPQC which from VBAK table after passing the reference document.
4) String Function:
CDS view is defined on 2 tables VBRK and VBRP,
If you notice below screen shot the field DZUONR from VBRK table has value ‘000000000‘1000210588, I need the value from 10th digit so the substring function is used
substring(a./bic/dzuonr,9,10) as zuonr last 0 ends at 9th position and 1 starts from 10th position.
Final putput from CDS view: