Objective : Create an Analytical App to get the details of Pending Operation till current date in Production Order at Work Center level for a Particular Plant as shown below.

In Addition, when the user will click on particular Row it should navigate to the Detail of all the Pending Operation for specific work center as displayed in Image: 2.

Further drill down details view will be in Tabular Format for a specific work center as displayed in Image: 3.

Step 1: Create a CDS Basic View to fetch Production Order.Header from AUFK and Work Center from CRHD Table and excluding the Confirmed Operation from standard CDS view IPPORDEROPSTS.
@AbapCatalog.sqlViewName: 'Z_L_OBDBASIC'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Basic Delivery Order'
@VDM.viewType : #BASIC
define view Z_C_OBDBASIC
as select from aufk
inner join afko on afko.aufnr = aufk.aufnr
inner join afvc on afvc.aufpl = afko.aufpl
inner join afvv on afvv.aufpl = afko.aufpl
inner join crhd on crhd.objid = afvc.arbid
inner join ipporderopsts on ipporderopsts.orderinternalid = afko.aufpl
{
@EndUserText.label: 'Production Order'
key aufk.aufnr,
@EndUserText.label: 'Operation Item'
key afvc.vornr,
@EndUserText.label: 'Work Center'
crhd.arbpl,
@EndUserText.label: 'Production Plant'
afvc.werks,
@EndUserText.label: 'Operation Short Text'
afvc.ltxa1
}
where
ipporderopsts.operationisconfirmed = ''
and afvv.sseld <= $session.system_date
group by
aufk.aufnr,
afvc.vornr,
crhd.arbpl,
afvc.werks,
afvc.ltxa1
Step 2: Get the Distinct Work Center with count, Here we are just using case statement to display only 1 so that it should display the total number of Operation at Tile Screen.
@AbapCatalog.sqlViewName: 'Z_L_OBDCOUNT'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'Distinct Work Center'
@Analytics: {dataCategory: #CUBE , dataExtraction.enabled: true }
@VDM.viewType: #COMPOSITE
define view Z_C_OBDCOUNT
with parameters
@EndUserText.label : 'Plant'
p_plant : werks_d
as select distinct from Z_C_OBDBASIC
{
key arbpl,
case arbpl
when '1' then 1
else 1
end as Operation,
sum(1) as TotalOperation
}
where
werks = $parameters.p_plant
group by
arbpl
Step 3: Combine the Basic View with the View with Unique work center.
@AbapCatalog.sqlViewName: 'Z_L_OBDCOMBINE'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_ALLOWED
@VDM.viewType: #COMPOSITE
@Analytics: {dataCategory: #CUBE , dataExtraction.enabled: true }
@EndUserText.label: 'Combine Operation Details'
define view Z_C_OBDCOMBINE
with parameters
@EndUserText.label:'Plant'
p_plant :werks_d
as select from Z_C_OBDCOUNT
(p_plant :$parameters.p_plant)
association [0..*] to Z_C_OBDBASIC as _Detail on _Detail.arbpl = Z_C_OBDCOUNT.arbpl
{
@EndUserText.label: 'Production Order'
key _Detail.aufnr,
@EndUserText.label: 'Operation Item'
key _Detail.vornr,
@EndUserText.label: 'Work Center'
Z_C_OBDCOUNT.arbpl,
@EndUserText.label: 'Operation Short Text'
_Detail.ltxa1,
@Aggregation.default : #SUM
Operation as TotalOperation,
_Detail
}
Step 4: Now Combine the Final view with all the relevant fields and also make sure to use the Annotation @Odata.publsh: true and @Analytics.query: true
@AbapCatalog.sqlViewName: 'Z_L_OBDOUTPUT'
@AbapCatalog.compiler.compareFilter: true
@EndUserText.label: 'Production Order Operation'
@AccessControl.authorizationCheck: #CHECK
@VDM.viewType: #CONSUMPTION
@Analytics.query: true
@OData.publish: true
@Metadata.ignorePropagatedAnnotations: true
@Analytics.dataExtraction.enabled: true
define view Z_C_OBDOUTPUT
with parameters
@EndUserText.label : 'Plant'
p_plant : werks_d
as select from Z_C_OBDCOMBINE(p_plant :$parameters.p_plant )
{
@EndUserText.label: 'Production Order'
key aufnr,
@EndUserText.label: 'Operation Item'
key vornr,
@EndUserText.label: 'Work Center'
arbpl,
@EndUserText.label: 'Operation Short Text'
ltxa1,
@EndUserText.label: 'Total Operation'
@Aggregation.default : #SUM
TotalOperation
}
Now we are done with the Data retrieval Part.
Step 5: Now go to Fiori Launchpad and click on Tab KPI Design and from there click on tile Create KPI as higlighted in Image: 4..

Step 6: Enter the Title of the Tile and short description for the title as displayed in Image: 5 and click on Activate and Add Evaluation and enter the Customizing TR number or save in the Local Object.
Now Click on Activate and Configure Tile.

Step 7: Enter the Evaluation name as displayed in Image: 6 and scroll down that will be displayed as sub text in Tile.

Step 8: Enter the CDS Name Z_C_OBDOUTPUT that we have created earlier and select the OData services from F4 help and do the same for Entity Set and value Measure as displayed in Image: 7.

Step 9: Enter the value for the Input parameters and Click on Activate and Configure Tile as highlighted in Image: 8.

Step 11: Click on Configure for the recent created evaluation as highlighted in Image: 9.

Step 12: Select the Dimension work center on which we have to display the Analytics Data i.e. the first level drill down that will be displayed after clicking on Tile as displayed in Image: 10.

Step 13: Select the Chart type and enter the Title Name and click on OK as displayed in Image: 11.

Step 14: Click on Add View as indicated in Image: 12, This view will be displayed on the next level drill down.

Step 15: Select all the required dimension which you want to display on Drill down as selected in Image: 13.



Step 18: Now click on Save Configuration.
Step 19: Click on Preview button to see your Analytical App.

Your KPI Analytical App is ready to use, Just add this app to your Home page for Quick Access.
Step 20: Go to Home => App Finder => Find Catalog in which we have added that KPI and Pin it to Home as Displayed in Image: 17.

Access this KPI from Home.
Click on Tile Pending Operation as displayed in Image: 18.

Once you will click on this tile, it will open the list of work center along with the pending operation in each work center as displayed in Image: 19.

If you further drill down this App to see the Pending Orders in the specific work center then select the work center as displayed in Image: 20.

Once you click on Operation Details after selecting the work center as displayed in Image: 20, it will display the list of pending operation in tabular format for the selected work center level as displayed in Image: 21.

Congratulation, you Smart Business KPI is ready to use.
As you can see how easily we have created a high level of analytical app with minimal coding and configuration, we have used the real power of CDS view to expose our data using Odata services and we have consumed the same in our App, Also you can see that how beautifully the KPI modeler has really minimized the efforts of UI design.
If you find this blog helpful, do let me know your inputs or any suggestion about this blog.
Regards.
Sonu Kumar
Original Article:
https://blogs.sap.com/2020/05/23/consume-cds-view-in-smart-business-service-kpi-for-pending-production-operation/