Sei sulla pagina 1di 6

SAP S/4HANA Deep Dive Workshop Exercise

Create Custom CDS

1. In this step we would create


a CDS View.

To define an ABAP CDS


entity it is required to create
a DDL object in the
appropriate ABAP
development object.

For each ABAP CDS entity


defined with DDL source
code a SQL view is
generated in the ABAP
Dictionary, like views created
by means of Dictionary tools
(transaction SE11).

2. Enter a unique name in the


CDS Name. Ensure that you
do not have any name
conflict with other users by
following the naming
convention. Create the CDS
View in the $TMP package.

3. Insert the following code @AbapCatalog.sqlViewName: 'ZAKNSQPURVAL'


snippet. Ensure the @AbapCatalog.compiler.compareFilter: true
uniqueness of the SQL view @AccessControl.authorizationCheck: #NOT_REQUIRED
name by following the @VDM.viewType: #CONSUMPTION
naming convention. @Analytics.dataCategory: #CUBE
@OData.publish: true
We would create a CDS view
based on the Interface view @EndUserText.label: 'Z_AK_NSQ_PURVAL_CDS'
like
define view Z_AK_NSQ_PUR_VAL
I_PurchaseOrderItem as select from I_PurchaseOrderItem
{
Ensure creation of the key
field. Also complete the key PurchaseOrder,
annotations key PurchaseOrderItem,

@OData.publish: true
I_PurchaseOrderItem._PurchaseOrder.Supplier,
which would enable this to be _PurchaseOrder.PurchasingOrganization,
consumed in the KPI _PurchaseOrder.PurchasingGroup,
modeler. @Semantics.currencyCode: true
_PurchaseOrder._CompanyCode.Currency as
Exposing this as a cube CompanyCodeCurrency,
would show the view _PurchaseOrder.PurchaseOrderDate,
available for consumption in _PurchaseOrder._Supplier.
embedded BW and other BI _StandardAddress.Country,
tools.
@DefaultAggregation: #SUM
@Analytics.dataCatego @Semantics.amount.currencyCode:
ry: #CUBE 'CompanyCodeCurrency'
I_PurchaseOrderItem.NetAmount //,
// @DefaultAggregation: #SUM
// I_PurchaseOrderItem.OrderQuantity

4. Save and Activate the CDS


view you created.
5. Explore the VDM for the CDS
view you created using the
graphical editor.

6. Explore the data preview for


the CDS View, so that you
could validate the results you
get in the Fiori Launchpad.
CDS Views can be
consumed in 2 ways: in BI
tools which use the InA
protocol and in embedded
analytics in Fiori by oData
protocol.

7. Once CDS View is published


with the annotation

@OData.publish: true

services needs to be
registered in the NW Front End
server. Access the Front End
server M21 from the SAP GUI
and the user and pwd as
provided to your user.

In the transaction menu enter

/n/iwfnd/maint_services

8. Go to Add Service: check for


the service you have created
service.
9. Optional: Add System Alias.
This is required for the first
time when the service in
frontend server is connected
to the backend system MG4.

10. At this step your service


should be registered
successfully and you can
now use this in the KPI
Modeler for creating KPIs.

11. The service once activated


would appear in the list of
services available in the
system M21.

12. You could alternatively


search for your service from
the filter on the service
catalog as well.
13. Select the service from the
service catalog.

14. You can test the service for


the oData and the entity sets
in the frontend server.
Execute the service in the
Gateway client.

15. Analyze the response.


Status 200 with Ok status
indicates that you are ready
to create the KPIs and other
artefacts in the Smart
Business Modeler.

16. Check the status of


execution. You should have
status as Green.
17. In the KPI Modeler, launch
tile create KPI. You would
now be able to search for the
CDS view you created and
the oData service which has
been registered in the
Frontend server.

18. Optional: you could create


KPI, Evaluation, Tiles and
other artefacts in Smart
Business with the newly
created CDS view.

Potrebbero piacerti anche