0% found this document useful (0 votes)
34 views86 pages

Research Paper1

This document provides set-up instructions for SAP S/4HANA Cloud's Key User Extensibility, detailing how users can create and maintain custom fields and business objects to enhance applications. It outlines prerequisites, UI flexibility, custom logic, and examples of use cases, emphasizing the role of key users in adapting applications without needing extensive technical skills. The guide also includes sections on custom CDS views, transport of extensions, and the extensibility cockpit.

Uploaded by

Plants
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views86 pages

Research Paper1

This document provides set-up instructions for SAP S/4HANA Cloud's Key User Extensibility, detailing how users can create and maintain custom fields and business objects to enhance applications. It outlines prerequisites, UI flexibility, custom logic, and examples of use cases, emphasizing the role of key users in adapting applications without needing extensive technical skills. The guide also includes sections on custom CDS views, transport of extensions, and the extensibility cockpit.

Uploaded by

Plants
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 86

Set-Up Instructions PUBLIC

SAP S/4HANA Cloud


2018-05-23

Setting Up Key User Extensibility (1N9)


Content

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

5 Custom Business Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31


5.1 Code Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.2 Create and Generate Custom Business Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.3 Assign Custom Business Object to Catalog. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.4 Add Child Node. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.5 Adding Logic to Actions, After Modification, and Before Save. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.6 Write from One Custom Business Object to Another. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.7 Test the Custom Business Object. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.8 Define Association from Custom Field to a Custom Business Object. . . . . . . . . . . . . . . . . . . . . . . . . . . 43

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

7 Custom CDS Views. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55


7.1 Create a Custom CDS View – Adding a Calculated Field. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
7.2 Create a Custom CDS View – Associating to Another View. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

8 Transport Custom Extensions to Production System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

9 Extensibility Cockpit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60

10 Extensibility Inventory. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

Setting Up Key User Extensibility (1N9)


2 PUBLIC Content
11 Example Use Cases. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
11.1 Use Case 1 – Combined Reporting for Professional Services Projects and Sales Orders. . . . . . . . . . . . . . 64
11.2 Use Case 2 – Analyze Projects for Unplanned Hours. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72

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

Setting Up Key User Extensibility (1N9)


Content PUBLIC 3
1 Purpose

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.

Setting Up Key User Extensibility (1N9)


4 PUBLIC Purpose
2 Prerequisites

● 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.

Business Role Business Role ID as Delivered by SAP

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:

Business Role Business Role ID as Delivered by SAP

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.

Setting Up Key User Extensibility (1N9)


Prerequisites PUBLIC 5
● Apps are extendible at runtime only if they use Smart Form controls. Only these controls can be edited in a UI
adaptation at runtime and they must have stable IDs. UI adaptation at runtime uses stable IDs to ensure that
the changes made by the key user are preserved and can be applied again, for example, after the app is
upgraded. Stable IDs are based on SAPUI5 static IDs and must not be changed. This is to prevent
inconsistencies or errors.

2.1 Business Conditions

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:

Scope Item Business Condition

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.

Setting Up Key User Extensibility (1N9)


6 PUBLIC Prerequisites
3 UI Flexibility

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.

3.1 UI Adaption of Monitor Purchase Order Items

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

1. Access the SAP Fiori launchpad.


2. Open the Monitor Purchase Order Items app.
3. Choose an item from the Purchase Order Items list.

Setting Up Key User Extensibility (1N9)


UI Flexibility PUBLIC 7
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.

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.

You can now make adaptations at runtime, for example:

Move form field or UI blocks

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.

Setting Up Key User Extensibility (1N9)


8 PUBLIC UI Flexibility
2. To move a form field, for example, the Plant field should be moved to the Order Status field's position within the
Basic Data section, hover over the Plant field so that it shows a bluish background and drag and drop it and
move it down so that the fields are immediately exchanged.

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

Setting Up Key User Extensibility (1N9)


UI Flexibility PUBLIC 9
1. To add a field from the field repository which is currently not displayed on the UI (for example, Next Scheduled
Delivery Date in the Basic Data section), right-click the section/field where you want to add it and choose Add
Field from the dropdown list. Select the field from the Available Fields dialog and choose Ok.

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.

3.2 UI Adaption of Project Management

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.

Setting Up Key User Extensibility (1N9)


10 PUBLIC UI Flexibility
Note
Adaptations impact the UI for every user.

Procedure

1. Access the SAP Fiori Launchpad.


2. Open the Custom Fields and Logic app in the Extensibility catalog.
3. Choose the + icon under the Custom Fields tab to create a new Custom Field with details:

Choose Create and Edit:

Setting Up Key User Extensibility (1N9)


UI Flexibility PUBLIC 11
4. On the UIs and Reports tab, choose Enable Usage for Create and Plan Customer Project and Create and Plan
Internal Project:

5. Choose Save and Publish.

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.

3.2.1 Add Custom Field to Customer Project Screens

To add a custom field to customer project screens, do as follows:

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.

Setting Up Key User Extensibility (1N9)


12 PUBLIC UI Flexibility
4. Right-click the Customer Project section and choose Add Field from the dropdown list:

5. Select the Project Short Description field from the Available Fields popup. See the figures:

Setting Up Key User Extensibility (1N9)


UI Flexibility PUBLIC 13
6. Choose OK.
7. 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.
8. To create a customer project, on the Create Customer Project screen, enter the required details and save.

Setting Up Key User Extensibility (1N9)


14 PUBLIC UI Flexibility
9. On the Plan Customer Projects screen, repeat steps from 2 to 6 to add the Project Short Description custom
field.

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.

Setting Up Key User Extensibility (1N9)


UI Flexibility PUBLIC 15
13. To reset the extensions made to all the views, go to the Create Customer Project screen and choose the user
logo on the top-left corner of the screen.
14. In the upcoming side panel, choose the Adapt UI icon to launch the UI Adaptation Mode.
15. Choose Reset at the top-right corner of the screen, and then choose OK to reset the UI changes.

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.

Setting Up Key User Extensibility (1N9)


16 PUBLIC UI Flexibility
3.2.2 Add Custom Field to Internal Project Screens

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:

Setting Up Key User Extensibility (1N9)


UI Flexibility PUBLIC 17
Setting Up Key User Extensibility (1N9)
18 PUBLIC UI Flexibility
Setting Up Key User Extensibility (1N9)
UI Flexibility PUBLIC 19
4 Custom Fields

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

1. Access the SAP Fiori launchpad.


2. Open Manage Purchase Orders.
3. Choose an item from the Manage Purchase Orders list.

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.

Setting Up Key User Extensibility (1N9)


20 PUBLIC Custom Fields
The UI Adaptation Mode is indicated by a ribbon on top of the screen with an option to perform UI adaptations
or to navigate through the fields with the Navigation option.

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.

8. Choose the plus icon (Create).


9. A dialog box is displayed where you can specify the extension field. Maintain the fields for example as follows:

Field Value

Business Context Purchasing Document (already preselected)

Label Comment

As soon as you have typed in the label title, it is automati­


cally taken over in the Identifier and Tooltip fields.

Identifier Comment

Blanks are not allowed in this technical name.

The prefix represents the customer namespace to ensure


that there is no naming collision of fields. The given suffix is
based on the business context and also ensures that there is
no naming conflict.

Tooltip Comment

Type Text

Length 20

10. Choose Create and Publish.

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.

Setting Up Key User Extensibility (1N9)


Custom Fields PUBLIC 21
When choosing the line item of the custom field in the Custom Fields and Logic app, you can view more details
and edit the custom field. For example, you can insert translations of the field name by choosing Translation (on
the Translations screen, choose the plus icon and add translations for the target language).
On the UIs and Reports tab, you can enable the usage of the custom field for more UIs and reports if needed.
For example, you can enable a specific API to use the custom field. For more information about how to access
the custom field through the enabled API, see the Access the Custom Field Through API chapter.
In the table, you can also add another column that shows the respective OData services. For this, choose the
Personalization button and choose Data Source.

11. Go back to the Manage Purchase Orders app.


12. Refresh the browser and re-enter the UI Adaptation Mode so that the UI can load the latest metadata with your
custom field.
13. Right-click the area where the field should be added.
14. Choose Add Field from the dropdown list.

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.

Setting Up Key User Extensibility (1N9)


22 PUBLIC Custom Fields
4.1 Translate Custom Field to a Different Language

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

1. Access the SAP Fiori launchpad.


2. Open the Custom Fields and Logic app in the Extensibility catalog.
3. Choose the Add icon on the Custom Fields tab to create a new custom field with details as shown below and
choose Create and Edit.

4. In the Details section on the General Information tab, choose Translation.

Setting Up Key User Extensibility (1N9)


Custom Fields PUBLIC 23
5. On the next screen, choose the Add icon and select the target language from the list into which you want to
translate the fields (for example, German). In the field in the Translation column, enter translations for the
original text in the target language. Repeat this step for any additional target language.

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.

Setting Up Key User Extensibility (1N9)


24 PUBLIC Custom Fields
Prerequisites

You have assigned the Sales Manager role to your business user as stated in Prerequisites.

Procedure

1. Access the SAP Fiori launchpad.


2. Open the Custom Fields and Logic app in the Extensibility catalog.
3. Choose the Add icon on the Custom Fields tab to create a new custom field with details.
4. Choose Create and Edit.

5. On the UIs and Reports tab of the Edit page, enable the Sales Document GUI Application with data source
SD_SALESDOC_GUI .

6. Save and publish.

Setting Up Key User Extensibility (1N9)


Custom Fields PUBLIC 25
7. Now, in the SAP Fiori Launchpad, launch the List Sales Orders app on the Sales Document Lists tab.
8. Enter the required search parameters on the List of Sales Orders page and choose Execute.
9. Select (double-click) a line item to display the contents of the sales order on the Change Standard Order
Overview page.
10. Choose the Display Header Details button as shown here:

11. Access the Custom Fields tab to gain access to the newly added custom field.

4.3 Add Custom Field to Content Form Template

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.

4.4 Enable Custom Fields for Multiple Business Scenarios

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.

Setting Up Key User Extensibility (1N9)


26 PUBLIC Custom Fields
Prerequisites

You have assigned the Purchaser role to your business user as mentioned in the Prerequisites [page 5] chapter.

Procedure

1. Access the SAP Fiori launchpad.


2. Open the Custom Fields and Logic app in the Extensibility catalog.
3. Repeat the steps in the Custom Fields [page 20] chapter to create a custom field. Enter the following details:

Field Name Value

Business Context SSP Purchase Requisition Item

Label Requisition Series

Type Text

Length 20

4. Choose Create and Edit.


5. Choose the UI and Reports tab. This section determines the availability of this field in the UI, API, and CDS
views. Enable the following highlighted entry:

Setting Up Key User Extensibility (1N9)


Custom Fields PUBLIC 27
6. Choose the Business Scenarios tab. This section determines the business scenarios where this field must be
enabled. Enable the entry as shown here:

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.

Setting Up Key User Extensibility (1N9)


28 PUBLIC Custom Fields
9. Choose the UI and Reports tab. Enable the following highlighted entry:

10. Choose Save and Publish.


11. To test whether the value of the custom field is getting passed from Purchase Requisition to Purchase Order, do
as follows:
1. As mentioned in the Custom Fields chapter, enable the Requisition Series field in the Manage Purchase
Order UI.
2. On the Home page, open the Create Purchase Requisition (Advanced) app and enter the required details to
create a purchase requisition:

3. Enter a value in the Requisition Series custom field:

Setting Up Key User Extensibility (1N9)


Custom Fields PUBLIC 29
4. On the Home page, open the Manage Purchase Requisitions app and search for the purchase requisition
created in the previous step.
5. Select the purchase requisition and choose Create Purchase Order to create a purchase order.
6. Choose Save.

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:

Setting Up Key User Extensibility (1N9)


30 PUBLIC Custom Fields
5 Custom Business Objects

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.

In the Custom Business Objects app you can:

● 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.

5.1 Code Lists

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.

Setting Up Key User Extensibility (1N9)


Custom Business Objects PUBLIC 31
Procedure

1. Open the Custom Business Objects app in the Extensibility catalog.


2. Create a new custom code list by choosing New on the Custom Code Lists tab.
A new window with three main tabs General Information, Code Values, and Translation is displayed.
3. On the General information tab, enter the following details:

Field Name Field Value

Name Roles

Code List ID YY1_ROLES

Maximum Code Length 2

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.

Setting Up Key User Extensibility (1N9)


32 PUBLIC Custom Business Objects
5.2 Create and Generate Custom Business Objects

Use Case

Let's create a Custom Business Object called Consultants, which stores the details of consultants. The structure
will be as follows:

Procedure

1. Access the SAP Fiori launchpad.


2. Open the Custom Business Objects app by choosing the corresponding Fiori tile in the Extensibility catalog.
3. Create a new custom business object by choosing New under Custom Business Objects.
4. In the new window, enter the name of the business object. The Identifier and Name in Plural fields are
automatically populated based on the value provided in the Name field:

Setting Up Key User Extensibility (1N9)


Custom Business Objects PUBLIC 33
Field Name Field Value

Name Consultant

Identifier YY1_CONSULTANT

Name in Plural Consultants

5. Choose Create to create a new business object.


6. Select Determination and Validation, UI Generation, and Service Generation.
7. Choose the Fields tab to maintain the fields for the structure.
8. Choose New in the Fields section to create two fields and make entries for Label, Type, Key, Length, and Read-
Only as shown here:

Label Type Key Length Read-Only

ID Text X 60

First Name Text 35 X

Last Name Text 35 X

Cost Center Text 20 X

Personnel Number Text 8 X

Org Unit Text 25 X

9. Choose Publish to publish the new custom business object YY1_CONSULTANT.


10. A message is displayed once the business object is published successfully.
11. After the custom business object is published, the links Maintain Catalog and Go To Generated UI appear on the
same screen as seen here:

Setting Up Key User Extensibility (1N9)


34 PUBLIC Custom Business Objects
Note
○ It may take some time for these links to become active. This is because the object generation in the
background may not be completed even if the publishing process was successful.
○ Once the Go To Generated UI link is available, you can find the app using App Finder. To make it available
to a greater audience, carry out the steps in the next chapter.

5.3 Assign Custom Business Object to Catalog

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.

Setting Up Key User Extensibility (1N9)


Custom Business Objects PUBLIC 35
Note
You can access the custom UI directly by selecting Generated UI in the Custom Business Objects app.
The following steps describe how to use the custom generated application, or in this case, the
Consultant app.

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.

5.4 Add Child Node

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:

Field Name Field Value

Name Projects

Identifier Projects

Setting Up Key User Extensibility (1N9)


36 PUBLIC Custom Business Objects
Field Name Field Value

Name in Plural Projects

5. Choose the Fields tab and select the Projects node.


6. Choose New in the Fields section to create the following fields and enter values for Label, Type, Length, and
Read-Only:

Label Type Length Read-Only Code List

Project Text 24

Role Code List YY1_ROLES

Start Date Date

End Date Date

7. Choose Publish to publish the YY1_CONSULTANT custom business object.


A success message is displayed once the business object is published.

Note
The child node created here will be used in an example later in the Write from One Custom Business Object to
Another chapter.

5.5 Adding Logic to Actions, After Modification, and Before


Save

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.

Setting Up Key User Extensibility (1N9)


Custom Business Objects PUBLIC 37
Procedure

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:

Field Name Field Value

Label Check Overbooking

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 – Retrieves employee data based on External ID


"Reading data from standard CDS view
SELECT SINGLE * FROM I_EMPSHLP INTO @DATA(ls_empshlp) WHERE employee =
@CONSULTANT-id.
"Assigning data read from CDS view to Custom Business Object fields
CONSULTANT-FIRSTNAME = ls_empshlp-GivenName.
CONSULTANT-LASTNAME = ls_empshlp-FamilyName.
CONSULTANT-COSTCENTER = ls_empshlp-CostCenterName.
CONSULTANT-PERSONNELNUMBER = ls_empshlp-PersonnelNumber.
CONSULTANT-ORGUNIT = ls_empshlp-OrganizationalUnitName.

3. Choose Publish and then navigate back.


7. To write logic in the Check Overbooking action, do as follows:

Setting Up Key User Extensibility (1N9)


38 PUBLIC Custom Business Objects
1. On the Logic tab, under Actions of CONSULTANT, choose Check Overbooking.
You will be navigated to the editor where logic can be written.
2. Choose Create Draft.
3. 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
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.

5.6 Write from One Custom Business Object to Another

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.

Setting Up Key User Extensibility (1N9)


Custom Business Objects PUBLIC 39
Procedure

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

Label Type Key Length Read-Only

Project ID Text X 24

Description Text 35

Start Date Date

End Date Date

Planned Amount With


Profitability Currency

Team

Setting Up Key User Extensibility (1N9)


40 PUBLIC Custom Business Objects
Label Type Length Read-Only Code List

ID Text 60

Role Code List YY1_ROLES

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.

Setting Up Key User Extensibility (1N9)


Custom Business Objects PUBLIC 41
5. Choose Publish.

5.7 Test the Custom Business Object

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

Test Step # Instruction Expected Result

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.

5 On this UI of Custom Projects, choose A l list of Custom Projects is displayed.

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.

Setting Up Key User Extensibility (1N9)


42 PUBLIC Custom Business Objects
Test Step # Instruction Expected Result

7 Enter the external ID (same ID as in step ● The Consultant is assigned to the


2). Choose a role, for example Junior Custom Project.
Consultant, and then choose Save. ● If the consultant is assigned to mul­
tiple projects in the same duration,
the Overbooked status is selected.

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:

● Add more Consultants


For this, repeat the steps from 1 to 2.
● Add more Projects and assign consultants to them
For this, repeat the steps from 3 to 7.
● Check whether the list of Projects to which a consultant has been assigned can be seen
For this, repeat the steps from 8 to 9.

5.8 Define Association from Custom Field to a Custom


Business Object

Procedure

1. Open the Custom Business Objects app in the Extensibility catalog.


2. Create a new custom business object Procurement_Type. For more information about creating and
generating custom business objects, see the Create and Generate Custom Business Objects [page 33]
chapter.
3. Select the UI Generation, Service Generation, and Can Be Associated checkboxes:

Setting Up Key User Extensibility (1N9)


Custom Business Objects PUBLIC 43
4. To create fields, proceed to Go To Fields and Logic and in the Fields section, choose New.
5. Make entries for Label, Type, and Key as shown here:

6. Publish the newly created custom business object.


7. This step is optional. Add the custom generated application to your Fiori Launchpad, in this case, the
Procurement_Type app. For more information, see the Assign Custom Business Object to Catalog [page 35]
chapter.
8. Choose the tile added in the previous step or open the app using the Go To Generated UI link in the Custom
Business Objects app.
9. The Custom UI for Procurement_Types opens in a new window.
10. To add a new record to the UI, choose the + icon.
11. Enter values for the respective input fields in the next screen and then choose Save.

Setting Up Key User Extensibility (1N9)


44 PUBLIC Custom Business Objects
Procurement Type Description Reason Workflow Enabled

PT01 Standard Procurement Standard No

PT02 Operational Procurement Direct / Indirect Materials Yes

PT03 Strategic Procurement Fitment Yes

PT04 Subcontracting External Service No

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.

15. On the Edit page, enable Manage Purchase Order:

Setting Up Key User Extensibility (1N9)


Custom Business Objects PUBLIC 45
16. On the Business Scenarios tab, enable the context scenario for Purchase Order to Delivery on header level:

17. Save the details and then publish.


18. Add the newly created Procurement Type custom field to the Manage Purchase Order screen:

See the steps in the UI Adaption of Monitor Purchase Order Items chapter.

Setting Up Key User Extensibility (1N9)


46 PUBLIC Custom Business Objects
6 Custom Logic

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:

● Any database operation except selects from released views


● Tweaking new tasks
● Dynamic programming
● Obsolete ABAP statements
● Code generation

Only whitelisted (released) APIs can be used.

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.

6.1 UI Field Control Using Custom Logic

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

Business Context Sales: Sales Document

Label Cust Project SO

Identifier YY1_CUSTPROJECTSO

Type Text

Setting Up Key User Extensibility (1N9)


Custom Logic PUBLIC 47
Field Value

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

1. Access the SAP Fiori launchpad.


2. Open the Custom Fields and Logic app in the Extensibility catalog.
3. Choose the Custom Logic tab.
4. Choose + to create a new logic implementation.
5. Create the following values:

Field Value

Business Context Sales: Sales Document

Definition Description Sales Header Field Properties

Implementation Description FIELD CONTROL

6. Choose Create.
7. Select the entire coding in the Draft Logic area and delete it.
8. Paste the following coding section:

Sample Code

loop at field_properties assigning field-symbol(fs_field_properties). if


fs_field_properties-field_name = YY1_CUSTPROJECTSO_SDH'. fs_field_properties-
read_only = 'X'. endif. endloop.

9. Choose Save Draft.


10. Choose Publish.

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).

Setting Up Key User Extensibility (1N9)


48 PUBLIC Custom Logic
Result

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.

6.2 Prepopulating a Custom Field Using Custom Logic

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

Business Context Sales: Sales Document

Definition Description Sales Header Modification

Implementation Description HEADER_MODIFICATION

4. Choose Create.
5. Select the entire coding in the Draft Logic area and delete it.

Setting Up Key User Extensibility (1N9)


Custom Logic PUBLIC 49
6. Paste the following coding section:

Sample Code

SELECT SINGLE salesorder FROM i_salesorderitemcube( P_EXCHANGERATETYPE = 'M',


P_DISPLAYCURRENCY = 'EUR' ) INTO @salesdocument_extension_out-
yy1_custprojectso_sdh WHERE customerproject = @salesdocument_extension_in-
yy1_projectid_sdh.

7. Choose Save Draft and Publish.

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.

3. Save the Sales Order.


The Cust Project SO field is automatically populated.

6.3 External HTTP Call in Custom Logic for Validation

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.

Setting Up Key User Extensibility (1N9)


50 PUBLIC Custom Logic
Prerequisite

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

Business Context Customer Core View

Label VAT Number

Identifier YY1_VATNumber

Tooltip VAT Number

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

Communication Scenario ID YY1_VALIDATE_VAT

Description Validate VAT

3. Choose the Outbound Services tab and choose+ to create a new Service ID.
4. Enter the following details and choose Create.

Field Value

Description Validate VAT

Outbound Service ID YY1_VALIDATE_VAT_REST

Setting Up Key User Extensibility (1N9)


Custom Logic PUBLIC 51
Field Value

URL Path /live

5. Choose the Outbound Service created and choose Publish.

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

System Name VALIDATE_VAT

8. Enter the following information on the details page and choose Save.

Field Value

Host Name www.isvat.eu

HTTPS Port 443

User for Outbound Communication NONE

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

Arrangement Name YY1_VALIDATE_VAT

11. Enter the following details on the details page and choose Save.

Setting Up Key User Extensibility (1N9)


52 PUBLIC Custom Logic
Field Value

Communication System VALIDATE_VAT

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

Business Context Customer Core View

Definition Description Validate Customer BADI

Implementation Description Validate VAT

15. Enter the following code in the Draft Logic:

Sample Code

" Sample Code DATA LS_VALIDATIONMESSAGE LIKE LINE OF CT_VALIDATIONMESSAGE.


READ TABLE it_customer_gen INTO DATA(ls_cust_gen) INDEX 1. READ TABLE
it_customer_compcode INTO DATA(ls_cust_compcode) INDEX 1. CHECK ls_cust_gen-
include-yy1_vatnumber_cus IS NOT INITIAL. CHECK ls_cust_compcode-country =
'GB'. CHECK cl_ble_http_client=>is_service_available( communication_scenario =
'YY1_VALIDATE_VAT' outbound_service = 'YY1_VALIDATE_VAT_REST' ) = abap_true.
DATA(lo_client) = cl_ble_http_client=>create( communication_scenario =
'YY1_VALIDATE_VAT' outbound_service = 'YY1_VALIDATE_VAT_REST' ). CONCATENATE '/
GB/' ls_cust_gen-include-yy1_vatnumber_cus INTO DATA(lv_vat). DATA(request) =
cl_ble_http_request=>create( ). request->set_method( 'GET' )-
>set_resource_extension( lv_vat ). TRY . DATA(response) = lo_client-
>send( request ). DATA(lv_body) = response->get_body( ). " Response in fetched

Setting Up Key User Extensibility (1N9)


Custom Logic PUBLIC 53
in String Format. " Do appropriate Split operations to fetch the relevant data
SPLIT lv_body AT 'valid":' INTO lv_body DATA(lv_body2). SPLIT lv_body2 AT ','
INTO DATA(lv_valid) lv_body2. IF lv_valid CS 'false'. LS_VALIDATIONMESSAGE-
MSGTY = 'E'. LS_VALIDATIONMESSAGE-MSGID = 'CVI_API'. LS_VALIDATIONMESSAGE-
MSGNO = '010'. LS_VALIDATIONMESSAGE-MSGV1 = 'GB'. APPEND LS_VALIDATIONMESSAGE
TO CT_VALIDATIONMESSAGE. ENDIF. CATCH cx_ble_http_exception INTO DATA(lx).
ENDTRY.

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.

Setting Up Key User Extensibility (1N9)


54 PUBLIC Custom Logic
7 Custom CDS Views

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:

● Public views of the SAP delivered Virtual Data Model (VDM)


● Your own custom CDS views

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

7.1 Create a Custom CDS View – Adding a Calculated Field

Procedure

1. Open the Custom CDS view app in the Extensibility catalog.


On the initial screen, all the available data sources are listed.
2. To create a new Custom CDS view, choose Create.
Note that you can select the appropriate data source and choose Create, or you can add the data sources later.
3. Enter the name and label of the new Custom CDS View to be created.
4. Select the OData API option if you want to use the CDS as an OData service.
5. Select Analytical As cube or dimension for query and reporting purpose.
For example, create a Custom CDS View with the name YY1_CustomerProjectPeriod.

Setting Up Key User Extensibility (1N9)


Custom CDS Views PUBLIC 55
6. Choose Add and select Primary Data Source. For example, choose I_ENGAGEMENTPROJECT.
7. Choose the Field Selection tab.
8. Select the required fields for the new Custom CDS View from Available Fields and Associations and check the
appropriate key fields from Selected Fields and Association.
9. To add a new calculated field, choose Add and form the expression.
For example create a calculated field called Project Period, and enter the expression as shown here:

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.

7.2 Create a Custom CDS View – Associating to Another View

Procedure

1. Open the Custom CDS view app in the Extensibility catalog.


2. Open and edit the custom CDS view created in the previous chapter Create a Custom CDS View – Adding a
Calculated Field.
3. Choose Add, select Add Associated Data Source, and choose I_BusinessPartner.
4. Maintain the association between Primary Data Source and Associated Data Source by choosing the link under
Actions.

Setting Up Key User Extensibility (1N9)


56 PUBLIC Custom CDS Views
5. Maintain the association by selecting the appropriate fields:

6. Choose the Field Selection tab.


7. Select the required fields for the new Custom CDS View from Available Fields and Associations, and check the
appropriate keys from Selected Fields and Associations.
8. Choose the OrganizationBPName1 field to view the Customer Name.
9. Activate the view by choosing Save Draft and Publish.

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.

Setting Up Key User Extensibility (1N9)


Custom CDS Views PUBLIC 57
8 Transport Custom Extensions to
Production System

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:

● Add items to your software collection


● Check items of your software collection for inconsistencies and dependencies
● Export a software collection
● Do a hotfix export

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.

Setting Up Key User Extensibility (1N9)


58 PUBLIC Transport Custom Extensions to Production System
4. Select the collection and choose Import.
5. Confirm the import version dialog box and choose Import.
6. Once the import is done, you can see a green finished successfully message and Status: Imported on the Import
Software Collection Details screen.
7. Choose Ok.

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.

Setting Up Key User Extensibility (1N9)


Transport Custom Extensions to Production System PUBLIC 59
9 Extensibility Cockpit

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.

For this, do as follows:

1. Access the SAP Fiori launchpad.


2. Launch the Extensibility Cockpit app in the Extensibility Explorer catalog.
3. Search for the extensible objects using filters.
For example, to view the extensible objects of purchasing document, customize the filter with the following
criteria:

Field Name Field Value

Edition SAP S/4HANA Enterprise Management Cloud

Solution Scope Supply Chain

Scope Item Return to Supplier (BMK)

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:

Setting Up Key User Extensibility (1N9)


60 PUBLIC Extensibility Cockpit
For more information, see the Custom Fields [page 20] chapter.

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.

Setting Up Key User Extensibility (1N9)


Extensibility Cockpit PUBLIC 61
10 Extensibility Inventory

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.

For this, do as follows:

1. Access the SAP Fiori launchpad.


2. Launch the Extensibility Inventory app by choosing the corresponding Fiori tile in the Extensibility catalog.
3. Customize the filter and choose Go:

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.

Setting Up Key User Extensibility (1N9)


62 PUBLIC Extensibility Inventory
The USED BY area displays other extensibility items that use the extensibility item, extensibility item type, and
other extensibility items that use or are used by these extensibility items.
This hierarchical display reflects indirect usage of other extensibility items by the extensibility item in question.
By choosing an extensibility item listed here, you can view this item's administrative information.
The CHANGE HISTORY area (available in cloud version only) displays all changes made to the extensibility item,
such as ATO Notification, Assign to Collection, Export, and Import.

Setting Up Key User Extensibility (1N9)


Extensibility Inventory PUBLIC 63
11 Example Use Cases

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.

11.1 Use Case 1 – Combined Reporting for Professional


Services Projects and Sales Orders

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

Setting Up Key User Extensibility (1N9)


64 PUBLIC Example Use Cases
1. Use the Custom Field Project ID created in the Custom Fields chapter. This field will be used to capture the
Customer Project ID for which the sales order is being created.
2. Create a Custom CDS view that acts as a data source for eventual Custom Analytical Query for combined
Project Profitability reporting. Refer to the Custom CDS Views chapter to see how to create calculated columns
and join two CDS views in details.
To create Custom CDS view, do as follows:
1. Go to the Custom CDS Views app and choose Create.
2. Enter the following details:

Field Value

Name YY1_CombinedReport

Label Combined Report

ODATA API Checked

Analytical Checked As Cube

3. Add the Primary Data Source and the Associated Data Source:

Field Value

Primary Data Source I_GLACCOUNTLINEITEMSEMTAG

Associated Data Source I_SALESDOCUMENT

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

Field Label Combined ID

Field Name CombinedID

Logic concat( I_GLAccountLineItemSemTag.Project, _I_Sales­


Document_1.YY1_ProjectID_SDH )

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.

Setting Up Key User Extensibility (1N9)


Example Use Cases PUBLIC 65
Note
You may encounter the DCL creation failed error after choosing Save Draft. In that case, go back to the
Custom CDS views application. Reselect the YY1_CombinedReport Custom CDS view, choose Edit,
and then Publish.

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

Query Name YY1_COMBINEDREPORT_Q

Data Source YY1_COMBINEDREPORT

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

Field Name Ledger

Filter Value 0L

6. Choose Save Draft and Publish. The Custom Analytical Query YY1_COMBINEDREPORT_Q is now published.

Test the Query

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.

Setting Up Key User Extensibility (1N9)


66 PUBLIC Example Use Cases
The main steps are as follows:
1. Create a Customer Project PROJTIMEMATERIAL.
2. Change the Stage of the project to Contract Preparation and choose Save.
3. Maintain the Billing Plan Item details, and choose Save again.

A Sales Order will be automatically created for this Customer Project. The sales order ID is displayed in a
dialog box.

4. Change the status of the project to In Execution and choose Save.


5. Log on to the SAP Fiori launchpad as Overhead Accountant.
6. Open the Enter Activity Allocation page.
7. Enter activity allocation of 1 H for the T001 activity type for the PROJTIMEMATERIAL.1.1 WBS Element.
Note that you can find the Cost Center in your customer project header and the WBS Element on the Work
Packages tab.

Setting Up Key User Extensibility (1N9)


Example Use Cases PUBLIC 67
8. Log on to the SAP Fiori launchpad as Project Manager - Commercial Services, and open Release Billing
Proposals.

9. Run Resource Related Billing to create a debit memo request (DMR):

Setting Up Key User Extensibility (1N9)


68 PUBLIC Example Use Cases
The DMR 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.

Setting Up Key User Extensibility (1N9)


Example Use Cases PUBLIC 69
3. Log on to the SAP Fiori launchpad using the Shipping Specialist role.
4. Create an Outbound Delivery from the sales order created in the previous step, execute Picking, and post
Goods Issue:

5. Log on to the SAP Fiori launchpad using the Billing Clerk role.
6. Create a billing document and post it.

Setting Up Key User Extensibility (1N9)


70 PUBLIC Example Use Cases
You can see the document flow at the end of the exercise as shown here:

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.

Setting Up Key User Extensibility (1N9)


Example Use Cases PUBLIC 71
11.2 Use Case 2 – Analyze Projects for Unplanned Hours

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. Log on with the BPC_EXPERT role.


2. Choose the Manage Your Solution app in the Implementation Cockpit catalog.
3. Choose Configure Your Solution and search for Time Recording.
4. Navigate to the details and choose Configure for Maintain Data Entry Profiles.
5. Choose the Data Entry Profile as S4H_INT.
6. Choose Edit and select Extensibility Mode.
7. Choose Save.

Setting Up Key User Extensibility (1N9)


72 PUBLIC Example Use Cases
Now proceed 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

Business Context HCM: Timesheet Fields

Label UnplannedTask

Identifier YY1_UnplannedTask

Tooltip Unplanned Task

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:

Setting Up Key User Extensibility (1N9)


Example Use Cases PUBLIC 73
Field Value

Name YY1_UnplannedEffort

Label Unplanned Effort

ODATA API Checked

Analytical Checked As Cube

3. Add the Primary Data Source:

Field Value

Primary Data Source I_JOURNALENTRYITEMCUBE

4. Choose the Field Selection tab.


5. Choose Add to create two calculated fields:

Field Value

Field Label Unplanned Hours

Field Name UnplannedHours

Logic Sample Code

case
I_JournalEntryItemCube.YY1_Unplann
edTask_COB when
'X'
then
I_JournalEntryItemCube.Quantity
else
0
end

Field Value

Field Label Unplanned Costs

Field Name UnplannedCosts

Setting Up Key User Extensibility (1N9)


74 PUBLIC Example Use Cases
Field Value

Logic Sample Code

case
I_JournalEntryItemCube.YY1_Unplann
edTask_COB when
'X'
then

I_JournalEntryItemCube.AmountInTra
nsactionCurrency
else
0
end

6. Add all the standard fields required for reporting.


7. Add the fields required for authorization purposes.
For our use case, we add the following fields:
Project, WBSElement, Quantity, AmountInTransactionCurrency, TransactionCurrency, BaseUnit, Customer,
AccountingDocumentType, FixedAsset, OrderID, SalesDocument, and Supplier.
8. Choose Save Draft and go back to the Custom CDS views application.
9. Reselect the YY1_UnplannedEffort Custom CDS view, and choose Edit Draft.
10. Choose the Field Properties tab and maintain the following values for Unplanned Costs and Unplanned
Hours as follows.

11. Choose Save Draft and Publish.


The CDS view is now ready to be used in the analytical query.

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

Query Name YY1_UNPLANNEDEFFORT_Q

Data Source YY1_UNPLANNEDEFFORT

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 .

Setting Up Key User Extensibility (1N9)


Example Use Cases PUBLIC 75
2. Enter the following details:

Field Value

Label Unplanned Effort In Percent

Name UnplannedEffortPercent

3. Choose OK to continue.
4. Choose Edit to form the following expression:

Sample Code

( "UnplannedHours" / "Quantity" ) * 100

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

Field Name Ledger

Filter Value 0L

6. Choose Save Draft and Publish.

Setting Up Key User Extensibility (1N9)


76 PUBLIC Example Use Cases
The YY1_UNPLANNEDEFFORT_Q custom analytical query is now published.

Test the Query

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:

1. Create a CUSTOMERPROJQ1 customer project.


2. Execute the steps, in the scope items J11 and J12, related to assigning an employee and time recording.
The main steps are as follows:
1. Create a CUSTOMERPROJQ1 customer project.
2. Assign an employee to the CUSTOMERPROJQ1.1.1 work package.

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.

Setting Up Key User Extensibility (1N9)


Example Use Cases PUBLIC 77
5. Change the project status to In Execution, and choose Save.
6. Confirm the Employee Assignment.

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:

Setting Up Key User Extensibility (1N9)


78 PUBLIC Example Use Cases
12 Appendix

12.1 Enable a Custom CDS View or Custom Business Object


for External Consumption Using OData

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

1. Create a Communication Scenario.


1. Log on with the Administrator business role.
2. Choose the Custom Communication Scenarios app in the Extensibility catalog.
3. Choose New and fill the following details:

Field Value

Communication Scenario ID YY1_UNPLANNED_EFFORT

Description Unplanned Effort

4. Choose the Inbound Services tab.


5. Choose + to create a new Inbound Service.

Setting Up Key User Extensibility (1N9)


Appendix PUBLIC 79
6. Search for an existing service, for example YY1_UNPLANNEDEFFORT_CDS.
7. Choose the service and then choose OK.
8. Select the Inbound Service entry and choose Publish.
The Communication Scenario has now been set up.

2. Create a Communication User.


1. Log on with the Administrator business role.
2. Choose the Maintain Communication Users app in the Communication Management catalog.
3. Choose New.
4. Enter Username, Description, and Password.
5. Choose Create.
3. Create a Communication System.
1. Log on with the Administrator business role.
2. Choose the Communication Systems app in the Communication Management catalog.
3. Choose New and enter the following details:

Field Value

System ID BROWSER_READ

System Name BROWSER_READ

4. On the details page, enter the following details:

Field Value

Host Name test

HTTPS Port 443

User for Inbound Communication User created in step 2

5. Choose Save.

4. Create a Communication Arrangement.


1. Log on with the Administrator business role.
2. Choose the Communication Arrangements app in the Communication Management catalog.
3. Choose New and enter the following details:

Field Value

Scenario YY1_UNPLANNED_EFFORT

Arrangement Name YY1_UNPLANNED_EFFORT

4. On the details page, enter the Communication System as BROWSER_READ and then save.

Setting Up Key User Extensibility (1N9)


80 PUBLIC Appendix
OData service for external consumption is created as shown here:

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.

12.2 Access the Custom Field Through API

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

System Name BROWSER_CustField

Host Name dummy

Setting Up Key User Extensibility (1N9)


Appendix PUBLIC 81
Field Value

HTTPS Port 443

User for Inbound Communication Communication user created

Field Value

Scenario SAP_COM_0053

Arrangement Name SAP_COM_0053_test

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.

12.3 View Browser

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

Setting Up Key User Extensibility (1N9)


82 PUBLIC Appendix
● Relevant CDS views - If you are familiar with the table name, you can search by entering the table name in the
Search field:

You can also create a Tile for a custom analytical query and assign it to a custom business catalog.

For more information, see the 2P6 scope item.

12.4 External Service Details

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:

1. Open Google Chrome in the Administrator mode.


2. Enter the https://www.isvat.eu URL and choose Enter.
3. Choose the Secure symbol to view the security Report
4. Choose the Valid link under Certificate.

5. Go to the Details tab, export the certificate, and store it in a local file.

Setting Up Key User Extensibility (1N9)


Appendix PUBLIC 83
6. Log on to SAP S/4HANA Cloud system with the Administrator role.
7. Choose the Maintain Certificate Trust List application in the Security catalog.
8. Choose + and upload the certificate you had downloaded.
This establishes the trust connection between S/4HANA Cloud system and the external HTTP Service.

Setting Up Key User Extensibility (1N9)


84 PUBLIC Appendix
Important Disclaimers and Legal Information

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.

Beta and Other Experimental Features


Experimental features are not part of the officially delivered scope that SAP guarantees for future releases. This means that experimental features may be changed by SAP at
any time for any reason without notice. Experimental features are not for productive use. You may not demonstrate, test, examine, evaluate or otherwise use the
experimental features in a live operating environment or with data that has not been sufficiently backed up.
The purpose of experimental features is to get feedback early on, allowing customers and partners to influence the future product accordingly. By providing your feedback
(e.g. in the SAP Community), you accept that intellectual property rights of the contributions or derivative works shall remain the exclusive property of SAP.

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.

Setting Up Key User Extensibility (1N9)


Important Disclaimers and Legal Information PUBLIC 85
go.sap.com/registration/
contact.html

© 2018 SAP SE or an SAP affiliate company. All rights reserved.


No part of this publication may be reproduced or transmitted in any
form or for any purpose without the express permission of SAP SE
or an SAP affiliate company. The information contained herein may
be changed without prior notice.
Some software products marketed by SAP SE and its distributors
contain proprietary software components of other software vendors.
National product specifications may vary.
These materials are provided by SAP SE or an SAP affiliate company
for informational purposes only, without representation or warranty
of any kind, and SAP or its affiliated companies shall not be liable for
errors or omissions with respect to the materials. The only
warranties for SAP or SAP affiliate company products and services
are those that are set forth in the express warranty statements
accompanying such products and services, if any. Nothing herein
should be construed as constituting an additional warranty.
SAP and other SAP products and services mentioned herein as well
as their respective logos are trademarks or registered trademarks of
SAP SE (or an SAP affiliate company) in Germany and other
countries. All other product and service names mentioned are the
trademarks of their respective companies.
Please see https://www.sap.com/about/legal/trademark.html for
additional trademark information and notices.

You might also like