Research Paper1
Research Paper1
1 Purpose. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Prerequisites. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1 Business Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 UI Flexibility. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1 UI Adaption of Monitor Purchase Order Items. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 UI Adaption of Project Management. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Add Custom Field to Customer Project Screens. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Add Custom Field to Internal Project Screens. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4 Custom Fields. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.1 Translate Custom Field to a Different Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 Add Custom Field to Web GUI for HTML (Sales Order Header). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3 Add Custom Field to Content Form Template. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
4.4 Enable Custom Fields for Multiple Business Scenarios. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
6 Custom Logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.1 UI Field Control Using Custom Logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6.2 Prepopulating a Custom Field Using Custom Logic. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
6.3 External HTTP Call in Custom Logic for Validation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
9 Extensibility Cockpit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
10 Extensibility Inventory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
12 Appendix. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
12.1 Enable a Custom CDS View or Custom Business Object for External Consumption Using OData. . . . . . . .79
12.2 Access the Custom Field Through API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
12.3 View Browser. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
12.4 External Service Details. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
Customers apply many small changes and extensions to increase user productivity or implement adaptations to
the application logic without changing the major parameters of the respective business processes. As a key user in
your company, you're a business expert, but you don't necessarily have the technical or programming skills (unlike
admins or IT experts). In addition to your standard business tasks, you're also responsible for specific tasks. This
includes adapting apps to the changed business processes and releasing them to your team or to the company.
This guide describes how you can create and maintain custom fields that can be used to enhance applications that
have enabled their extensibility for key users. The apps Monitor Purchase Order Items and Manage Purchase Orders
are used in this guide as examples.
The Custom Business Objects [page 31] section describes how customers can create customer-specific tables. A
maintenance UI can be generated so that the table entries can be maintained.
The Custom Logic [page 47] section describes how the selected BADIs can be used in the cloud environment to
implement customer-specific business requirements.
The Custom CDS Views [page 55] section describes how customers can access the data in the way they need if
the system does not offer data in the desired way.
Besides key user extensibility, customers can also use SAP Cloud Platform to build new UIs based on the SAP Fiori
user experience. They can also integrate with other cloud applications from SAP, which is called side-by-side
extensibility. For more detailed information about side-by-side extensibility, refer to the 1RW scope item.
● The Key User Extensibility (1N9) scope item must be active. You can check this in the Manage Your Solution app
under View Solution Scope.
If the scope item is not active, please request the activation through BCP – Ticket Component: XX-S4C-OPR-
SRV.
● You must be assigned to one of the following roles. They are provided as example roles from SAP. You can use
these as a template to create your own role.
SAP_BR_ADMINISTRATOR
Administrator
SAP_BR_BPC_EXPERT
Configuration Expert
SAP_BR_ANALYTICS_SPECIALIST
Analytics Specialist
Note
Your user must be assigned to a business role that contains the Extensibility business catalog (ID:
SAP_CORE_BC_EXT).
● For the example given in this guide, the following roles also must be assigned:
SAP_BR_PURCHASER
Purchaser
SAP_BR_SALES_MANAGER
Sales Manager
SAP_BR_INTERNAL_SALES_REP
Internal Sales Representative
SAP_BR_SHIPPING_SPECIALIST
Shipping Specialist
SAP_BR_BILLING_CLERK
Billing Clerk
SAP_BR_BUPA_MASTER_SPECIALIST
Master Data Specialist - Business Partner Data
SAP_BR_PROJ_MANAGE_COMM
Project Management
SAP_BR_OVERHEAD_ACCOUNTANT
Cost Accountant - Overhead
SAP_BR_EMPLOYEE
Employee
Note
For more information about maintaining business users and roles, see Identity and Access Management.
The business process described in this document is part of a bigger chain of integrated business processes or
scope items. So, you must have completed the following processes and fulfilled the following business conditions
before you are able to start going through this scope item:
J11 - Customer Project Management - Project-Based Services You must have completed the steps described to create a cus
tomer project.
J12 - Time Recording - Project-Based Services You must have completed the steps described to record time.
J14 - Sales Order Processing - Project-Based Services You must have completed the steps described to create and
post a billing document.
J58 - Accounting and Financial Close You must have completed the steps described to maintain Fi
nancial Statement versions and Semantic Tags.
18J - Requisitioning You must follow the steps to generate a purchase requisition,
and then convert it to a purchase order.
BD9 - Sell from Stock You must follow the steps to create a sales order, outbound de
livery, picking, post goods issue, and billing document.
Use
As a key user, you can adapt app UIs in the SAP Fiori launchpad to fit the requirements of your company –
intuitively and at runtime of the apps (without having to create new code).
Adaptations made with UI adaptation at runtime apply to the whole app and therefore also to all users of the app. In
contrast, when an individual user personalizes an app, it applies only to that user.
Prerequisites
You have assigned the necessary business roles to your user as described in the Prerequisites [page 5] chapter.
Note
Adaptations will impact the user interface for every user.
Procedure
5. In the upcoming side panel, choose the Adapt UI icon to launch the UI Adaptation Mode.
The UI Adaptation Mode is indicated by a ribbon on top of the screen with an option to perform UI adaptations
or navigate through the fields with the Navigation option.
1. To move a section, for example, the Item Status should be moved to the Organization section, hover over the
Item Status section so that it shows a bluish background and drag and drop it to the Organization section.
Note
Alternatively, for moving UI elements you can also proceed as follows:
1. Right-click an element.
2. Choose Cut from the dropdown list.
3. Right-click the place where you want to move it to.
4. Choose Paste from the dropdown list.
Rename labels
1. To rename a label, for example, the header of the first section (Basic Data), double-click Basic Data.
2. Enter the new name for the label, for example, Basic Information.
Note
Alternatively, right-click the field, choose Rename from the dropdown list and enter a new label name.
Add field to UI from field repository / Hide a field / Combine multiple fields
Note
You can also add a complete new group. Right-click the section, for example, the Basic Data section, and
choose Create Group from the dropdown list.
2. To hide a field, for example, Deletion Indicator in the Basic Data section, right-click and choose Remove Field
from the dropdown list.
3. To combine multiple fields, for example, the fields Quantity and Value from the Basic Data section, select those
fields while pressing Ctrl and then make a right-click. On Mac OS, use the Command button instead of that.
Then choose Combine from the dropdown list.
Transport adaptions
1. To transport the adapted app from the test to the productive system, choose Publish from the black ribbon at
the top of the screen.
Note
To undo recent changes, choose the Undo button from the top.
To discard all UI changes and reset the app to the standard version, choose Reset from the top.
Use
As a key user, you can create custom field for project management (business context = Engagement Project), and
add the created custom field to the screens of either customer project or internal project where needed.
Prerequisites
You have assigned the necessary business roles to your user as described in the Prerequisites [page 5] chapter.
Procedure
Note
You can follow the same procedure to create a custom field with business context = Work package, which can be
added on the Work Packages tab of the Plan Customer Project and Edit Customer Project screens.
1. Access the SAP Fiori Launchpad, and open the Create Customer Project app.
2. On the Create Customer Project screen, choose the user logo on the top-left corner of the screen.
3. In the upcoming side panel, choose the Adapt UI icon to launch the UI Adaptation Mode.
The UI Adaptation mode is indicated by a ribbon on top of the screen with options to perform UI adaptations or
to navigate through the fields.
5. Select the Project Short Description field from the Available Fields popup. See the figures:
10. Choose the Work Packages tab, and choose an item to go to the detail screen. Repeat steps from 2 to 6 to add
the custom field (business context = Work package) to the Additional Information section.
11. Choose Edit at the bottom-right corner of the screen to go to the edit screen of customer project.
12. On the Edit Customer Project screen, repeat steps from 2 to 6 to add the Project Short Description custom field.
16. To transport the adapted app from the test to the productive system, choose Publish from the UI Adaptation
ribbon at the top of the screen. Else, you can choose Exit to save the changes.
You can create and add custom fields for internal project creation. You can also display and edit them. You can use
the custom field created with business context = Engagement Project, for internal project as well. See the UI
Adaption of Project Management [page 10] chapter.
To add or remove the custom fields to create, plan, and edit the internal project screens, the steps are similar to
that given in the Add Custom Field to Customer Project Screens [page 12] chapter. Only the screen names are
different. For example, have a look at the following screens:
Using the Custom Fields and Logic Fiori app and together with the UI adaptation mode, you can add and edit
custom fields.
The app completely hides the technical details of the underlying software stack (for example database table, CDS
views, OData services) from you as a key user.
This chapter covers the steps on how to create a custom field as a key user. The procedure is the same for all Fiori
apps. Here, the app Manage Purchase Orders serves as an example where a text field is added to the header area.
Prerequisites
You have assigned the necessary business roles to your user as described in the Prerequisites [page 5] chapter.
Procedure
4. On the Purchase Order Item screen, choose the user logo in the top left corner of the screen.
5. In the upcoming side panel, choose the Adapt UI icon to launch the UI Adaptation Mode.
6. To add a custom field, for example, in the right area of the General Data section, hover over the right area so
that the background of the area is highlighted. Right-click and choose Add Field from the dropdown list.
7. The Available Fields dialog box is displayed where you can select fields to be added from the underlying OData
service. To create your own custom field, choose the button with the plus icon (Create Custom Field) in the
dialog box.
The Custom Fields and Logic app opens.
In the Custom Fields and Logic app, the Custom Fields tab is displayed showing custom fields that have already
been created by key users. The relevant business context from the Manage Purchase Orders app has already
been selected, or filtered respectively, indicated by the bluish ribbon.
Note
You can also launch the Custom Fields and Logic app directly from the Fiori launchpad. However, when doing
so, you need to know the business context and select it manually.
Field Value
Label Comment
Identifier Comment
Tooltip Comment
Type Text
Length 20
Note
Before you continue, wait until the publishing process has finished (status of the field must be Published).
You might need to refresh the browser to see it as published.
Note
If a dialog box is displayed informing you that the client is out of sync with the server, choose Yes. Reload the
UI if you are prompted to do so.
15. Select the custom field Comment from the Available Fields list and choose OK to add it to the UI.
16. Choose Publish to release the adaptation to the UI for transport. A message is displayed stating that the UI
changes have been included in the transport.
17. Choose Exit.
Use
You can use the Custom Fields and Logic app to create a field and provide translations for the field labels and
properties in other languages.
Procedure
6. Go back to the Custom Fields and Logic screen, choose Save and Publish.
4.2 Add Custom Field to Web GUI for HTML (Sales Order
Header)
Use
In the UI Adaption of Monitor Purchase Order Items [page 7] section, we discussed some features that provide you
some flexibility to adapt the UI of apps in the SAP Fiori launchpad. An attempt to do the same with Web GUI for
HTML-based apps by adapting the UI at runtime results in the following error:
Error - Adaptation of UI is only supported for SAPUI5 applications
An extensibility operation such as the addition of a custom field requires a different approach. In this section, we
describe the steps required to add a custom field to a Web GUI for HTML-based apps.
You have assigned the Sales Manager role to your business user as stated in Prerequisites.
Procedure
5. On the UIs and Reports tab of the Edit page, enable the Sales Document GUI Application with data source
SD_SALESDOC_GUI .
11. Access the Custom Fields tab to gain access to the newly added custom field.
After creating the custom field, you can also add this custom field to a content form template. For more
information, see the Add Custom Field to the Content Form Template chapter in the Output Management (1LQ)
configuration guide.
You may want a new added custom field to appear in the subsequent business scenarios and with the value
retained. For example, if a custom field is introduced in Sales Order, then you would want the custom field and its
value to be passed to Delivery, Billing Document, and Journal entry. Or you may want a custom field in Purchase
Requisition to be passed to Purchase Order. Let's see how to do this.
You have assigned the Purchaser role to your business user as mentioned in the Prerequisites [page 5] chapter.
Procedure
Type Text
Length 20
7. Choose Save and Publish. On the Custom Fields and Logic screen, you will see another field created
automatically for the Purchasing Document business context.
8. Enable the custom field that got created automatically in the Purchasing Document business context for the
Purchase Order UI. For this, navigate to the details of the Requisition Series custom field under the Purchasing
Document business context.
Note
If the Create Purchase Order button is grayed out, ensure that the Assigned Supplier field is filled. You do
this by choosing the link under the Assigned Supplier field. For example, the link name could be 2
Sources, depending on how many available suppliers are determined.
For more information about creating purchase requisition and subsequent purchase orders, refer to the
scope item 18J documentation.
7. On the Home page, open the Manage Purchase Orders app and navigate to the details of the purchase
order created. Here you can see the value of the Requisition Series custom field:
With the Custom Business Objects Fiori app, you can create and manage custom business objects. A custom
business object is a hierarchical set of database tables with an API for creation, retrieval, update, and deletion of
data. You can provide business logic in a web editor using the cloud-enabled version of ABAP (same as for custom
Business logic). Custom business objects denote the capability of adding customer-specific fields to a business
context of an application in a 1:1 or 1:n relation.
In contrast to field extensibility, new customer-specific tables are created in the database.
This is accompanied by a set of API functions supporting the Create, Read, Update, and Delete (CRUD) services
through API classes, CDS views, and OData services.
Applications prepared for custom business objects integrate the customer-specific table through these APIs in all
the relevant layers.
● Create your own business objects and the corresponding database tables
● Add fields to business objects and delete fields and business objects that have not yet been transported to
your production system
● Create multiple subnodes for one business object (hierarchy allowed to level 1 only)
● Implement custom logic on node level
● Publish business objects, edit business objects that have already been published, and reset business objects to
their last published version
● Create code lists that can be reused in custom business objects
● Generate OData services for custom business objects to work with and modify custom business objects
externally
● Read or Write from one Custom Business Object to another Custom Business Object
In the following chapters, information is provided regarding the steps required to create a basic custom business
object. You can use them as reference. In the Custom Logic [page 47] chapter, an example is provided, which uses
this custom business object.
However, as a prerequisite, you must have assigned the necessary business roles to your user as described in the
Prerequisites [page 5] chapter.
A code list contains a list of values and descriptions. It is used, for example, to provide dropdown lists on UIs. In the
Custom Business Object app, you can define a code list data type for your solution and use it while creating your
custom business object.
In the steps that follow, we will go through the creation of a new custom code list, which can then be reused later for
the creation of fields in as many custom business objects as needed.
Name Roles
4. Choose New on the Code Value tab to create or add the code list entries as desired for your solution.
Code Description
R1 Junior Consultant
R2 Senior Consultant
R3 Platinum Consultant
R4 Manager
5. Choose Save and Publish in the bottom right corner to complete the creation of the new custom code list.
Note
The Custom Code List created here will be used in the subchapters of the Custom Business Objects chapter.
Use Case
Let's create a Custom Business Object called Consultants, which stores the details of consultants. The structure
will be as follows:
Procedure
Name Consultant
Identifier YY1_CONSULTANT
ID Text X 60
Procedure
1. Choose Maintain Catalog to maintain the business catalog for the generated UI to be displayed on the Fiori
launchpad.
The Custom Catalog Extension screen is displayed.
2. Choose Add to add the business catalog for the generated UI.
A new window is displayed with a list of available business catalogs.
3. Search for and select the catalog to which you would like to assign your custom business object.
4. Choose OK.
The selected business catalog is added to the list of catalogs on the first screen with the status Unpublished.
5. Select the business catalog assigned in the previous step and choose Publish.
6. To make the generated custom business object available on the Fiori launchpad, carry out the following steps:
1. On the Home Page, choose the icon in the top left corner:
2. Choose Edit Home Page to add the custom UI to the catalog maintained in the earlier steps.
3. Choose + to add the custom UI to a catalog of your choice.
4. Search for Consultant.
5. Choose the pin symbol to add the app to your catalog.
6. Choose Home in the upper left corner.
7. Choose Close to return to the Fiori launchpad.
The Consultant custom UI is now available in the catalog of your choice.
7. Choose the tile added in the previous step, or open the app using the link Generated UI in the Custom Business
Objects app.
The custom UI for Consultant is displayed in a new window.
8. To add a new record to the UI, choose the + icon.
9. Enter the values for respective input fields in the next screen and choose Save to create a new record.
10. For a list of all records, carry out an empty search by choosing Go.
We will extend this custom business object by adding a child node called Projects, which contains the details of the
projects assigned to the consultant. The structure will look as follows:
Procedure
1. Open the Custom Business Objects app by choosing the corresponding Fiori tile in the Extensibility catalog.
2. Navigate to the custom business object YY1_CONSULTANT and choose Edit Draft.
3. Choose the Nodes tab.
4. Choose New and enter the following details:
Name Projects
Identifier Projects
Project Text 24
Note
The child node created here will be used in an example later in the Write from One Custom Business Object to
Another chapter.
Custom Business Objects give you the option to add custom logic using restricted ABAP in the following 3 places:
● After Modification – As a prerequisite, select the Determination and Validation flag on the General tab of
custom business object. The logic gets executed once a field is modified on the UI.
● Before Save – As a prerequisite, select the Determination and Validation flag on the General tab of custom
business object. The logic gets executed just before saving the custom business object instance.
● Actions – This pattern is used to execute specific actions on data from a UI generated from the custom
business object. The Actions logic is implemented for one node. This means that the action has Read access to
all parts of the business object (input parameter). However, it has Write access only to the node on which the
Actions logic is implemented (changing parameter). You can also define an error, warning, and success
message that is displayed after the action is executed (exporting parameter).
In our use case, we will add the logic to the following sections:
● Automatically populate the First Name, Last Name, Cost Center, and other details of employee as soon as the
ID is filled. For this, we will write the logic in After Modification for the CONSULTANT node.
● Check whether the consultant is assigned to multiple projects in the same duration. For this, we will create an
action called Check Overbooking for the CONSULTANT node and write the logic.
1. Open the Custom Business Objects app by choosing the corresponding Fiori tile in the Extensibility catalog.
2. Navigate to the YY1_CONSULTANT custom business object and choose Edit Draft.
3. Choose the Logic tab and then the CONSULTANT node.
4. Choose New and enter the following details:
Identifier CheckOverbooking
5. Choose Publish.
6. To write logic in After Modification, do as follows:
1. On the Logic tab, under Determination and Validation, choose After Modification.
You will be navigated to the editor where you can write the logic.
2. Choose Create Draft, and in the Draft Logic section, write the following code:
Sample Code
Sample Code
"Sample Code – Retrieves all the projects under a consultant and checks for
overlapping dates
DATA: lt_projects1 TYPE yy1_ir_consultant=>tt_projects,
ls_project1 LIKE LINE OF lt_projects1,
lt_projects2 LIKE lt_projects1,
ls_project2 LIKE ls_project1.
lt_projects1 = association->to_projects().
lt_projects2 = lt_projects1.
LOOP AT lt_projects1 INTO ls_project1.
LOOP AT lt_projects2 INTO ls_project2 WHERE projects-project <> ls_project1-
projects-project.
IF ( ls_project2-projects-startdate > ls_project1-projects-enddate AND
ls_project2-projects-startdate > ls_project1-projects-startdate )
OR ( ls_project2-projects-enddate < ls_project1-projects-startdate AND
ls_project2-projects-enddate < ls_project1-projects-enddate ).
ELSE.
message = VALUE #(
severity = co_severity-warning
text = 'Consultant is Overbooked'
).
RETURN.
ENDIF.
ENDLOOP.
ENDLOOP.
message = VALUE #(
severity = co_severity-success
text = 'Consultant is not Overbooked'
).
4. Choose Publish.
It is possible to access a custom business object from another custom business object. All operations such as
Read, Create, Update, and Delete are possible.
We will extend our previous scenario. We will now create a new custom business object called Custom Projects and
assign team members to it. While assigning the team members, we will write to the CONSULTANT custom business
object. We will also call the Check Overbooking action to check whether the member is already overbooked.
1. Create the Custom Projects custom business object with the Team child node.
For more information, see the chapters Create and Generate Custom Business Objects and Add Child Node.
The structure of the business object should be as follows:
Custom Projects
Project ID Text X 24
Description Text 35
Team
ID Text 60
Overbooked Checkbox X
2. Publish the custom business object once the changes are done.
3. To generate UI, follow the steps in the Assign the Custom Business Object to a Catalog chapter.
4. To implement the Write logic, do as follows:
1. On the Logic tab, choose the Team node.
2. Under Determination and Validation, choose After Modification.
You are navigated to the editor where logic can be written.
3. Choose Create Draft.
4. In the Draft Logic section, write the following code:
Sample Code
"Sample Code – Retrieves all the projects under a consultant and checks for
overlapping dates
"Access the Custom Business Object by passing the name and key
TRY.
DATA lv_consultant TYPE yy1_kr_consultant.
lv_consultant = team-id.
DATA(lo_employee) = write->get_root(
business_object_id = 'YY1_CONSULTANT'
key = lv_consultant
).
CATCH cx_cbo_write_not_existing.
RETURN.
ENDTRY.
DATA: ls_proj_consultant TYPE yy1_projects_consultant.
DATA(ls_proj) = association->to_customprojects( ).
ls_proj_consultant = VALUE #(
project = ls_proj-customprojects-projectid
role = team-role
startdate = ls_proj-customprojects-startdate
enddate = ls_proj-customprojects-enddate
).
"Write Project Related data to the Custom Business Object
lo_employee->create_child(
node_id = 'Projects'
data = ls_proj_consultant ).
"Execute the Action of the Custom Business Object to check if consultant is
overbooked
DATA ls_consultant TYPE yy1_consultant.
lo_employee->execute_action(
EXPORTING
action_id = 'CheckOverbooking'
IMPORTING
data = ls_consultant
messages = DATA(lt_message)
).
READ TABLE lt_message WITH KEY severity = 'W' TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
team-overbooked = abap_true.
ENDIF.
As a prerequisite, you must have performed all the steps in the subchapters under the main chapter Custom
Business Objects. Ensure that the UIs are generated for both the custom business objects Consultant and
Customer Projects. Make sure that the Fiori tiles are on the My Home tab.
Procedure
1 Launch the Fiori app, and on the My The Fiori UI for the Consultant custom
Home tab, open the Consultants app. business object is displayed in the search
results.
2 Choose the + icon to create a new Re The consultant is saved along with de
cord. Enter an External ID of a valid em tails such as First Name, Last Name,
ployee and choose Save. Cost Center, and so on.
Note
To find a valid employee, have a pre
view of the I_EMPSHLP view using the
Custom CDS Views app. The
Employee field contains the external
ID.
3 Navigate back to the Home page and on The Fiori UI for the Custom Projects cus
the My Home tab, open the Custom tom business object is displayed in
Projects app. search results.
4 Choose the + icon to create a new The Custom Project is saved. The app
Project. Enter details of the Custom automatically navigates back to the
Project and choose Save. search result UI displayed in step 3.
Go.
6 Navigate to the Custom Project created A new UI opens for consultant details to
in step 4. Choose the Teams tab. Choose be filled.
the + icon to enroll a consultant to the
project.
8 Navigate back to the Home page and on All Consultants are displayed.
the My Home tab, open the Consultants
app. Choose Go.
9 Navigate to the Consultant created in You can see the Custom Project, Start
step 2. Choose the Projects tab. Date, and End Date created in step 4 and
also the role assigned in step 7.
Note
You can also do the following:
Procedure
12. Open the Custom Fields and Logic app in the Extensibility catalog.
13. To create a new custom field, choose the + icon on the Custom Fields tab.
14. Enter details as follows and then choose Create and Edit:
Note
Besides the created custom business object, you can also select standard CDS views from the dropdown list
of the Business Object field. Currently there is only one standard CDS view (Employee) available in the
dropdown list. If you have request for other standard CDS views, refer to SAP Note 2483157.
See the steps in the UI Adaption of Monitor Purchase Order Items chapter.
This chapter covers the steps to create a custom logic as a key user. Beyond UI extensibility, which allows the
adaptation of an application’s appearance, and field or table extensibility, which allow the enhancement of the data
structure of application, another extensibility capability is required. This is the enhancement of the behavior of
applications and processes. Prominent use cases for this capability include data validation, data calculation (for
example, supplying default values), and mapping of standard and extension fields within applications and
processes. The purpose is to implement lightweight BAdI released for cloud usage such as checks, mappings and
calculations, but not for application development. There is restricted ABAP syntax such as the following:
We will showcase a few use cases of Custom Logic where we will see how it can be used for field control,
prepopulating, changing the field values, and validation.
Prerequisites
You have assigned the necessary business roles to your user as described in the Prerequisites [page 5] chapter.
This chapter describes how Custom Logic can be used for UI Field Control for a custom field. As a prerequisite,
create a Cust Project SO custom field as described in the Custom Fields chapter, using following details:
Field Value
Identifier YY1_CUSTPROJECTSO
Type Text
Length 10
Enable the Sales Document GUI Application service on the UIs and Reports tab so that this field appears in the
Sales Order app. See the Add Custom Field to Web GUI for HTML (Sales Order Header) chapter to know about how
it is done.
Let's see how to make this custom field Read-Only on the Sales Order UI.
Procedure
Field Value
6. Choose Create.
7. Select the entire coding in the Draft Logic area and delete it.
8. Paste the following coding section:
Sample Code
Note
On the Definition Description tab, choose the link View Details to see more information about Sales Header Field
Properties. For implementation of custom fields and logic, see the documentation on Statements of ABAP for
Key Users. For more information about mail and form templates, see the set-up instructions of Output
Management (1LQ).
Log on with the Internal Sales Representative business role, and create a Sales Order. In the custom fields, you can
find the Cust Project SO field with properties as Read-Only.
This chapter describes how you can use Custom Logic to prepopulate fields. Ensure that the steps in the chapters
Add Custom Field to Web GUI for HTML (Sales Order Header) and UI Field Control Using Custom Logic are executed.
Make sure that the ProjectID and Cust Project SO custom fields are also created.
Procedure
1. Access the SAP Fiori launchpad and open the Custom Fields and Logic app in the Extensibility catalog.
2. Choose the Custom Logic tab and choose + to create a new logic implementation.
3. Create the following values:
Field Value
4. Choose Create.
5. Select the entire coding in the Draft Logic area and delete it.
Sample Code
Result
1. Log on with the Internal Sales Representative business role and create a Sales Order.
2. In the Custom Fields section, enter a valid customer Project ID.
Note
For creating a Customer Project, see the documentation for the scope item (J11) Customer Project
Management – Project-Based Services. Else, you can reuse the customer project created in the Add Custom
Field to Customer Project Screens chapter.
An external HTTP service call can be made from Custom Logic. This enables the solution to use existing external
services. Let's have a look at the steps required to enable an external service call.
In this scenario, we add a validation to check whether the VAT Number is valid when the Country is United Kingdom
(GB). The service https://www.isvat.eu is called for validation.
Create VAT Number custom field in the Customer Core View business context to capture the VAT Number. Refer to
theCustom Fields chapter to see how to do this. Details of the field to be created are as follows:
Field Value
Identifier YY1_VATNumber
Type Text
Length 20
On the UIs and Reports tab, enable the service OData service for customer (MD_CUSTOMER_MASTER_SRV_01
0001). Choose Save and Publish.
Refer to the Custom Fields chapter to see how to include this field in the Manage Customer Master Data Fiori UI. You
can find the app in the Customer Master catalog when you log on with the Master Data Specialist - Business Partner
Data business role. To go to the Customer Master details page, choose Create Organization , and then choose
OK. Add this custom field to the Customer Information section.
Procedure
1. Access the SAP Fiori launchpad and open the Custom Communication Scenarios app in the Extensibility
catalog.
2. Choose New, enter the following details, and then choose New in the pop-up.
Field Value
3. Choose the Outbound Services tab and choose+ to create a new Service ID.
4. Enter the following details and choose Create.
Field Value
6. Access the SAP Fiori launchpad and open the Communication Systems app in the Communication
Management catalog.
7. Choose New, enter the following details, and then choose Create.
Field Value
System ID VALIDATE_VAT
8. Enter the following information on the details page and choose Save.
Field Value
9. Access the SAP Fiori launchpad and open the Communication Arrangement app in the Communication
Management catalog.
10. Choose New, enter the following details, and then choose Create.
Field Value
Scenario YY1_VALIDATE_VAT
11. Enter the following details on the details page and choose Save.
12. Access the SAP Fiori launchpad and open the Custom Fields and Logic app in the Extensibility catalog.
13. Choose the Custom Logic tab and choose + to create a new logic implementation.
14. Enter the following values and choose Create.
Field Value
Sample Code
Note
Ensure that communication_scenario and outbound_service have the same value as that you had created in
the steps 2 and 4. Replace them accordingly if you are using other names. To know more about downloading and
installing the Trust Certificate of https://www.isvat.eu in the SAP S4HANA Cloud system, see the Appendix
chapter. It also provides details on how to get an access key, which must be used to call this external service.
Result
1. Log on with the Master Data Specialist – Business Partner Data (BUPA_MASTER_SPECIALIST) business role.
2. Choose the Manage Customer Master Data app in the Customer Master catalog.
3. To go to the Customer Master details page, choose Create Organization and then choose OK.
4. Enter the relevant details, such as Name 1, VAT Number, Customer Roles (FLCU00) or (FLCU01), Country,
Language, Company Code, Reconciliation Account, and so on.
Ensure that you enter Country as GB, and choose Company Code with the Country Key GB.
5. Choose Save.
The Custom Logic validation is called and the validity of VAT Number is checked.
This chapter covers the steps to be carried out to create a CDS view. If you need access to data in your system in a
way the system has not offered so far, you can create your own data access by making use of a Core Data Service
(CDS) view. CDS views allow you to model the data access without changing the underlying database tables. They
are used to combine and arrange the table fields of multiple data sources. At the same time, you can add metadata,
such as semantics or can just define a new label for a certain field.
With the custom CDS View app, you as a key user can model company-specific data access on top of public CDS
views. You can build custom CDS views on top of the following:
Custom CDS views can be used in various extensibility scenarios, such as Analytics. The custom CDS View app
allows you to do the following:
● Display a list of all predelivered data sources (VDM CDS views) and existing custom CDS views
● Preview the available data sources (CDS views)
● Create new custom CDS views
● Choose a primary data source
● Add one or more associated data sources according to your needs
● Select the fields and associations that you must use in the new custom CDS view
● Perform changes on the properties of the new fields
● Display the parameters of the selected data sources if they contain such parameters
● Delete custom CDS views
Procedure
10. In the field properties, you can set properties such as default aggregation, semantic, and master data view to a
field of Custom CDS View.
11. Activate the created Custom CDS View by choosing Save Draft and then the Publish button.
12. The newly created Custom CDS View can be viewed on the Home screen of the Custom CDS View tile.
13. Double-click the selected Custom CDS View to view the details.
You can view the data of the created Custom CDS View by choosing the Preview option.
Note
You can also view the created Custom CDS View in the View Browser app. Search for the Custom CDS View
created by entering the name in the Search field.
Procedure
Note
You can create Custom CDS Views by associating with Custom Business Objects, which have been enabled for
association and other Custom CDS views.
You can use Custom CDS views to create Custom Analytical Queries. For details on how to do this, see the
documentation of the scope item, (2P6) Extensibility for Embedded Analytics in SAP S/4HANA Cloud. Sample
use cases are mentioned in the Example Use Cases chapter.
You can find further examples of enabling Custom CDS views as OData service for external consumption in the
Appendix chapter.
In addition to testing the required extensions, you may also want to make the custom extensions available in the
production system. To do this, you must add custom extension items such as custom fields, custom logic, email
templates, form templates, or queries to a Software Collection so that they can then be exported to the production
system. In the Manage Software Collection app, you can do the following:
Procedure
Q system
1. In the SAP Fiori launchpad of your Q system, launch Export Software Collection in Manage Software Collection.
2. Choose the Add Item button to search for and add the needed extension items, for example, the
YY1_CONSULTANT custom business object. For more information, see the Create and Generate Custom
Business Objects [page 33] chapter. For more information about the assignment to a catalog see the Assign
Custom Business Object to Catalog [page 35] chapter.
3. Select the items and choose OK to add them to the software collection.
4. From the list of items included in the software collection, use the Check button to verify any existing
inconsistencies and dependencies.
5. Choose Export to export the software collection and transport the extension items added to the software
collection.
Note
To export items as hotfix independently from the regular software export process, add these items to a
hotfix collection. You can access the hotfix collection by choosing the Hotfix icon.
P system
1. In the SAP Fiori launchpad of your P system, launch Import Software Collection in Manage Software Collection.
2. Choose Go.
The list of collections to be imported is displayed.
3. Find your collection in the Version section. Make sure that the status is Ready for Import.
Note
You can choose the collection to check the items that are included. Make sure that the item you have added
in the Q system is available.
Result
(Optional, if you have imported the custom business object). Go to the Custom Business Objects app. You can see
that the YY1_CONSULTANT business object was added to the list and can be further processed.
The same goes for the import of the assignment to a business catalog. You can find the imported app in the
assigned catalog.
To extend S/4HANA solution, customers, partners, and developers can explore the extensibility options. Using the
Extensibility Cockpit app, they can view the extensible objects in a more logical drill-down manner starting with a
given cloud edition and navigating through the solution scope.
4. Choose Go.
5. Choose the object with the Purchasing Document business context.
6. On the UIs and Reports tab, you can view the extensible UIs or reports of Purchasing Document.
For example, the Manage Purchase Orders Version 2 user interface is listed for extension, and in the Custom
Fields Added column, you can see the Requisition Series field, which you had created earlier:
Note
Only the custom field that has MM_PUR_PO_MAINT_V2_SRV 0001 enabled (as described in the Custom
Fields chapter), will be listed under Manage Purchase Orders MM_PUR_PO_MAINT_V2_MDL 0001 .
Result
You can go to each tab, for example,UIs and Reports, APIs, and so on, to view the various extensibility options
available for Purchasing Document.
Using the Extensibility Inventory app, you can display an overview of all extensibility items that are managed by
Adaptation Transport Organizer (ATO). The app also shows dependencies between extensibility items that are
known to ATO.
A list of all extensibility items, which match the defined criteria, is displayed.
4. Choose an extensibility item to view the details:
The Header area displays name and type of the extensibility item, the date of the last change, and the person
who changed it. It also displays information about whether the extensibility item has been deleted, imported,
exported, or imported and exported.
The USES area displays other extensibility items that the extensibility item uses and extensibility item types. It
also displays further extensibility items used by or using these extensibility items.
This hierarchical display reflects indirect usage of other extensibility items by the extensibility item in question.
By choosing any extensibility item listed here, you can view its administrative information.
In this case, we've associated the PO_Node custom business object and the Priority code list to the PO_Check
extensibility item.
In this chapter, let's look at a few use cases in which you can use a combination of extension objects to achieve
desired results. Note that before implementing any of these use cases, check the functional correctness of the
solution.
Scenario
In the Professional Services scenario, Customer Projects are used to record the costs and revenues. The costs are
primarily captured when the employee records time in timesheet and the procurement-related activities are done.
Revenue is realized based on the billing rate of the employee. The difference between revenue and costs helps in
calculating the Project Profitability.
However, revenue derived from any other means is difficult to capture in Customer Projects, for example, Sell from
Stock. Hence, it can be difficult to capture profitability for the sales orders related to a customer project.
Probable Solution
There are CDS views and reports, which show the profitability of Customer Projects and Sales Orders respectively.
However, there is no report, which can show the combined profitability. Here we will attempt to achieve this through
Extension.
Steps
Field Value
Name YY1_CombinedReport
3. Add the Primary Data Source and the Associated Data Source:
Field Value
4. Join the two data sources by using the SalesDocument (I_SALESDOCUMENT) and SalesOrder
(I_GLACCOUNTLINEITEMSEMTAG) fields with Cardinality of Exactly one hit.
5. Choose the Field Selection tab and choose Add to create a calculated field:
Field Value
6. Add all the standard fields from these two views that might be required for reporting.
7. Add the fields, which you may require for authorization purposes.
For our use case, add the following fields from the I_GLACCOUNTLINEITEMSEMTAG view:
BilledRevenueAmtInCoCodeCrcy, RecognizableCostAmtInCCCrcy, RecognizedMarginAmtInCCCrcy,
CompanyCodeCurrency, SalesOrder, Ledger, Customer, AccountingDocumentType, FixedAsset, OrderID,
SalesDocument, and Supplier.
8. Choose Save Draft and then Publish.
The CDS view is ready now to be used in the analytical query.
3. To create a Custom Analytical query, the business role Analytics Specialist is required. On the Home Page,
choose the Custom Analytical Queries app under Catalog Query Design. ( For more information about Custom
Analytical Queries, refer to the scope item, (2P6) Extensibility for Embedded Analytics in SAP S/4HANA
Cloud.)
1. Choose New and enter the following details:
Field Value
2. Choose OK.
3. On the Field Selection tab, select the fields that you need as dimensions and measures to be displayed in
the Query.
Choose the CombinedID field since this would contain the Project ID.
4. Choose the Filters tab.
5. Maintain any filters that are needed for your report. For this use case, maintain the following filters for the
following fields:
Field Value
Filter Value 0L
6. Choose Save Draft and Publish. The Custom Analytical Query YY1_COMBINEDREPORT_Q is now published.
Prerequisites
The I_GLACCOUNTLINEITEMSEMTAG view uses Semantic Tags to derive values for fields such as
BilledRevenueAmtInCoCodeCrcy, RecognizableCostAmtInCCCrcy, and RecognizedMarginAmtInCCCrcy. Refer to
the scope item J58 to find out how to maintain Financial Statement versions and Semantic Tags.
Do as follows:
1. Create a Customer Project PROJTIMEMATERIAL. Execute the steps in the scope items J11, J12, and J14 to
record all the steps from creation of customer project until the billing document. For more details, refer to the
scope items J11, J12, and J14 as mentioned.
A Sales Order will be automatically created for this Customer Project. The sales order ID is displayed in a
dialog box.
10. Log on to the SAP Fiori launchpad using the Billing Clerk role.
11. Create a billing document and then post it:
2. Log on to the SAP Fiori launchpad using the Internal Sales Representative - Professional Services role.
3. Create a Sales Order for the same customer with relevant items.
1. Ensure that the ProjectID Custom Field has the value PROJTIMEMATERIAL.
2. Execute the steps of the BD9 scope item to create billing document from this sales order.
The main steps are shown here. So now create a Sales Order and note down the sales order ID.
5. Log on to the SAP Fiori launchpad using the Billing Clerk role.
6. Create a billing document and post it.
4. Log on to the SAP Fiori launchpad using the Project Management business role.
1. Execute the analytical query YY1_COMBINEDREPORT_Q with the Combined ID as PROJTIME-MATERIAL.
The result will look like this:
You can see the Total Project Profitability with a break up at the Sales Order level as well.
Scenario
During the execution cycle of a customer project, we plan costs against work packages and staff the employees
against them. Once the project is in Execution phase, the employee books the time against the project, which
translates into actual costs.
There are probable scenarios where the employee might be required to work on an unplanned task. At the end of
the project cycle, it is beneficial to know the percentage of time spent on unplanned tasks so that future projects
can be planned in a better way.
Probable Solution
The Projects – Actuals report gives a detailed break-up of all costs incurred in a project. Our aim is to introduce the
following three columns in the report:
● Unplanned Hours
● Unplanned Costs
● Percentage of Unplanned Task
Steps
Note
Enable Extensibility in TimeSheet using the Self-Service Configuration UI. For this, do as follows:
1. Create a UnplannedTask custom field in the HCM: Timesheet Fields business context.
This is used to indicate whether the time is being booked against an unplanned task. To do this, see the Custom
Fields chapter.
Details of the field to be created are as follows:
Field Value
Label UnplannedTask
Identifier YY1_UnplannedTask
Type Checkbox
2. On the UIs and Reports tab, enable the services Manage Time Entry Details and Manage my timesheet Time
Entry Details.
3. Choose the Business Scenarios tab and enable the service Project Based Services: transfer from Time recording
to Invo.
4. Choose Save and Publish.
Another field with the same name is automatically created in the Accounting: Coding Block business context.
For more information about enabling custom field in multiple business scenarios, see the Enable Custom fields
for Multiple Business Scenarios chapter.
This custom field is needed for reporting purposes later. For this, do the following:
1. Navigate to the Custom Fields and Logic details screen for the YY1_UnplannedTask field for the Accounting:
Coding Block business context.
2. On UIs and Reports, enable the service Accounting Journal Entry Item Cube (Data Source:
I_JOURNALENTRYITEMCUBE).
3. Choose Save and Publish.
5. Create a Custom CDS view, which acts as a data source for eventual Custom Analytical Query to report
Unplanned Tasks.
To know more about how to create calculated columns, see the Custom CDS Views chapter.
To create Custom CDS view, do as follows:
1. Open the Custom CDS Views app and choose Create.
2. Enter the following details:
Name YY1_UnplannedEffort
Field Value
Field Value
case
I_JournalEntryItemCube.YY1_Unplann
edTask_COB when
'X'
then
I_JournalEntryItemCube.Quantity
else
0
end
Field Value
case
I_JournalEntryItemCube.YY1_Unplann
edTask_COB when
'X'
then
I_JournalEntryItemCube.AmountInTra
nsactionCurrency
else
0
end
6. To create a Custom Analytical query, you require the Analytics Specialist business role.
1. On the Home page, choose the Custom Analytical Queries app in the Query Design catalog.
For more information about Custom Analytical Queries, refer to the 2P6 the scope item.
2. Choose New and enter the following details:
Field Value
3. Select the fields that you need as dimensions and measures to be displayed in the Query.
4. Choose Display to add calculated measure. Now do as follows:
1. Choose Add Add Calculated Measure .
Field Value
Name UnplannedEffortPercent
3. Choose OK to continue.
4. Choose Edit to form the following expression:
Sample Code
5. Choose the Filters tab and maintain the filters required for your report.
For this use case, let's maintain the following filters for the following fields:
Field Value
Filter Value 0L
Prerequisites:
Include the Unplanned Task custom field in the Manage My Timesheet app. Refer to the steps in the Custom Fields
chapter to see how it is done. The custom field after inclusion should look like this:
Now do as follows:
3. Change the status of the project to Contract Preparation and choose Save.
4. Maintain the Billing Plan Item details as shown here and choose Save again.
The employee is now eligible to record time against the work package.
3. Log on to the SAP Fiori launchpad as the assigned employee.
4. While doing time recording, ensure that you select the UnplannedTask option if the time recorded is for
unplanned activity.
5. Log on to the SAP Fiori launchpad using the Project Management business role.
6. Execute the YY1_UNPLANNEDEFFORT_Q analytical query with the project as CUSTOMERPROJQ1.
The result will look like this:
You can enable Custom CDS views and Custom Business Objects for external consumption through OData
services. The OData service generated for Custom CDS views allows read-only operations. However, the OData
service generated for custom business object allows Create, Read, Update, and Delete operations. The prerequisite
is that during creation, these objects should have been marked for Association.
Procedure
Field Value
Field Value
System ID BROWSER_READ
Field Value
5. Choose Save.
Field Value
Scenario YY1_UNPLANNED_EFFORT
4. On the details page, enter the Communication System as BROWSER_READ and then save.
Test
1. Copy and paste the URL, which is displayed on the Communication Arrangements screen, in a browser.
You will be prompted for user and password.
2. Enter the username and password you had created in step 2.
You can now view the data.
After you enable the usage of the custom field for an API, for example API_PURCHASEORDER_PROCESS_SRV, you
can access this field through the API.
1. Create a communication user, communication system, and communication arrangement. For more
information, see the Enable a Custom CDS View or Custom Business Object for External Consumption Using
OData chapter.
Field Value
System ID BROWSER_CustField
Field Value
Scenario SAP_COM_0053
Note
To get the communication scenario, go to the API hub. Search for API_PURCHASEORDER_PROCESS_SRV, for
example.
2. On the Communication Arrangements view, you can see the URL to be used for data access. To view the
custom field, use the URL https://{host}:{port}/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/
$metadata.
If the Key User wants more information on SAP delivered CDS views, use the View Browser application in the Query
Design catalog can be useful. This application provides the following information:
● Type of view (Basic, Composite, and so on), category of view (Query, Dimension, Cube, and so on
● Field names along with Semantics, CDS-level annotations, and association to other views
You can also create a Tile for a custom analytical query and assign it to a custom business catalog.
To enable an external HTTP call from SAP S/4HANA Cloud system, you must maintain a trust with the external
service. To do this, proceed as follows:
5. Go to the Details tab, export the certificate, and store it in a local file.
Hyperlinks
Some links are classified by an icon and/or a mouseover text. These links provide additional information.
About the icons:
● Links with the icon : You are entering a Web site that is not hosted by SAP. By using such links, you agree (unless expressly stated otherwise in your agreements
with SAP) to this:
● The content of the linked-to site is not SAP documentation. You may not infer any product claims against SAP based on this information.
● SAP does not agree or disagree with the content on the linked-to site, nor does SAP warrant the availability and correctness. SAP shall not be liable for any
damages caused by the use of such content unless damages have been caused by SAP's gross negligence or willful misconduct.
● Links with the icon : You are leaving the documentation for that particular SAP product or service and are entering a SAP-hosted Web site. By using such links, you
agree that (unless expressly stated otherwise in your agreements with SAP) you may not infer any product claims against SAP based on this information.
Example Code
Any software coding and/or code snippets are examples. They are not for productive use. The example code is only intended to better explain and visualize the syntax and
phrasing rules. SAP does not warrant the correctness and completeness of the example code. SAP shall not be liable for errors or damages caused by the use of example
code unless damages have been caused by SAP's gross negligence or willful misconduct.
Gender-Related Language
We try not to use gender-specific word forms and formulations. As appropriate for context and readability, SAP may use masculine word forms to refer to all genders.