Custom Reusable Elements, Custom Business Objects ...
Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
This blog explains how to add the custom field to standard VDM using
Custom Reusable Elements,
Custom Business Objects
Data Source Extensions of Custom Fields
Custom CDS View
Extend View
using the example scenarios.
The reason why I write this blog is it should be common request to add fields to analytical Fiori apps and Key User Tools in this blog should help effectively. But I am afraid not so many people woudl have been aware of the effectiveness of the tools. So, In the blog, I want to show it by explaining based on the typical cases.
With Custom Reusable Elements, Custom Code List can be created in which the code and description can be created manually or by uploading csv file. (No effort to create custom UI to update code and key).
With Custom Business Objects, Custom Business Object can be created in which data can be stored. It works as a kind of custom table. Fiori Elements List Report can be created using it as the source in which data can be maintained.
With Custom CDS Views, a Custom CDS View can be created. Custom Code List and Custom Business Object can be used as the source.
CDS View is generated or extended internally when creating objects with those tools. It is reused in the custom CDS View created with ABAP Development Tools(ADT).
With Extend View, the fields can be added with ADT, and object created with the tools above can be reused.
it is not possible to add fields in CompanyCode with Custom Fields as it is based on Customizing table (T*) so it is not possible to add fields in it, so that Business Context for those objects are not there in Custom Fields, e.g. Plant. In the case, mapping table has to be used to add fiedls. This is the reason why Custom Businss Object is created in this scenario.
Scenario1:
1. Data Source Extension: To add Company, an attribute of I_CompanyCode to I_GLAccountLineItemCube.
After launching Custom Fields and go to Data Source Extension tab, select Country/Region Key in Custom Code is added and renamed to Country.
Internally, Extend View is generated for I_GLAccountLineItemCube.
2. Custom Reusable Elements: To create Custom Code List of Region.
Launch Custom Reusable Elements.
The Code and Description can be created manually.
Or they can be uploaded from csv file.
Browse the file.
(Use the file layout downloaded from it.)
Codes and Descriptions are added. Push “Save and Publish”.
The custom Code List is created.
Generated CDS View.: ZZ1_REGION
Table: ZZ1_542DFB639D0D
Records in the table
Generated CDS View.: ZZ1_TV_REGION
Table: ZZ1_A0FD909624BA
3. Custom Business Objects: To create the mapping View between Country and Region in which the Custom Code List of Region can be used.
Custom Business Objects is launched.
Tab General Information
Name: Name of the object
Check
Determination and Validation: Uncheck (when checked, the logic of Determination and Validation can be created, but in this scenario, it is not necessary). See more about Determination and Validation in the blog.
Back End Service: Check (To create OData Service).
Can Be Associated: Unchecked. (When checked, this Custom Business Object can be used in Custom Fields).
System Administrative Data: Checked (to add Created On/Created By/Last Updated On/Last Updated By in the business object).
Region: Type Code List, set ZZ1_REGION as the Code List in the right side.
Tab: Logic
Nothing is changed. And push Publish.
CDS View is created.
OData is published.
@OData.publish: true
Transactional Processing is enabled with the following annotations.
@ObjectModel.transactionalProcessingEnabled: true
@ObjectModel.createEnabled: true
@ObjectModel.deleteEnabled: true
@ObjectModel.updateEnabled: true
Business Object is created.
Constants Interface: Z1_IF_ZZ1_COUNTRYREGION_C
Go to the ROOT node.
Node Overview
Alternative Keys
Properties
Associations
Actions
Determinations
Validations
Authorizations
The generated OData is added with Transaction /n/IWFND/MAINT_SERVICE. (ZZ1_COUNTRYREGION_CDS)
With Business Application Studio in BTP, Fiori Elements List Report app can be created using the generated OData Service. See more in the guide.
Create button is added for transactional OData Service in the List Report as below.
The code and description can be added.
4. Custom CDS View: To create custom CDS View in which the Custom Business Object is associated to Country in I_GLAccountLineItemCube.
Primary Data Source: I_GLAccountLineItemCube
Associated Data Source: ZZ1_COUNTRYREGION
Set Join Condition.
SAP_UUID is custom Business Object has to be added in the Join Condition as is the key. Both the Data Source Field and Value uses the same field: _ZZ1_COUNTRYREGION.SAP_UUID.
ZZ1_Country (added with Data Source Extension) and Region (from ZZ1_COUNTRYREGION), and other necessary fields are added.
Publish it.
Custom CDS View is generated.
ZZ1_COUNTRYREGION is associated.
ZZ1_Country1, _ZZ1_Country1 and _ZZ1_COUNTRYREGION.Region and _ZZ1_COUNTRYREGION._Region are added in the CDS View.
Run the Custom CDS View in which Country and Region are added.
SQL View name of the custom CDS View: ZZ1_6F75BC4E564A
Query: 2CZZ1_6F75BC4E564A/!2CZZ1_6F75BC4E564A
(2C<SQL View name of CUBE View>/!2C<SQL View name of CUBE View>
Result: Country and Region are available.
It is now possible to create a custom query on top of the view.
Sample scenario2:
5. Custom CDS View: To create custom CDS View in which the Custom Business Object is associated to Country in I_CompanyCode