Application Example

Objective

After completing this lesson, you will be able to develop an extension for SAP S/4HANA with SAP BTP ABAP Environment

Extension Scenario

To better understand the procedure for a side-by-side extension, this lesson implements a corresponding example. The point is not to understand the concepts and programming models used in detail. Rather, the big picture of a side-by-side extension will be provided.

The figure explains, from where data, which displays on an application is coming from.

First, a base application is created on the SAP Business Technology Platform (BTP) ABAP Environment, which is to be used to manage customer invoice complaints. As a basis for this, a corresponding table is created on the SAP HANA database of the SAP BTP ABAP Environment with suitable fields. The fields invoice ID, customer ID, and customer name are thereby used to store the invoice data for which a complaint is created.

However, the existing customer invoices are managed in the SAP S/4HANA on-premise system. For this purpose, a corresponding custom business object was created in a previous exercise. In order to be able to select the invoice data for a complaint, a value help should therefore be offered on the SAP Fiori UI of the cloud application, via which the existing invoice data from the SAP S/4HANA on-premise system is displayed.

The figure visualizes the explanations given below.

The invoice data in the on-premise system is accessed via the OData service that was generated for the custom business object. This means that the OData service in the on-premise system is called from the ABAP-based cloud application with the help of the SAP BTP Connectivity service and the Cloud Connector.

How to Connect ABAP Development Tools to SAP BTP ABAP Environment and Create an ABAP Package

For the steps and data of this demonstration, refer to the exercise Connect ABAP Development Tools to SAP BTP ABAP Environment and Create an ABAP Package.

Connect ABAP Development Tools to SAP BTP ABAP Environment and Create an ABAP Package

In this exercise, you will create an ABAP Cloud Project in the ABAP Development Tools (ADT) to connect the development environment to the ABAP Service Instance in the SAP BTP ABAP Environment. To connect to the ABAP Service Instance used in this course, you will use a Service Key that has already been configured for the ABAP Service Instance. You then create an ABAP package on the ABAP Service Instance. All repository objects to be created in the following exercises will be assigned to this package.

Note

In this exercise, when the values include ##, replace ## with your group number.

Steps

  1. Connect ADT to the ABAP Service Instance using the Service Key provided by your instructor.

    1. If Eclipse is not yet started, open it via EclipseEclipse IDE in the Windows Start menu.

    2. Make sure that the ABAP perspective is displayed. To open the ABAP perspective, select the Open Perspective icon in the Eclipse toolbar. In the dialog that appears, select the ABAP perspective and choose Open.

    3. From the menu, choose FileNewABAP Cloud Project.

      Result

      The first page of the New ABAP Cloud Project creation wizard is opened.
    4. Choose the Use a Service Key radio button and choose Next.

      Result

      The System Connection Using a Service Key wizard page is opened.
    5. Copy the Service Key provided by your instructor and paste it into the Service Key in JSON Format text box.

    6. Choose Next.

      Result

      The Logon to the SAP Cloud System wizard page is opened.
    7. Choose the Open Logon Page in Browser button to log on to the ABAP system. As a result, the default browser is opened and displays a message that you have been successfully logged on.

      Note

      Authentication is performed in the browser.

      Note

      If you have not been logged on automatically, click the <xxxxxxxxx>.accounts.ondemand.com link that appears on the displayed browser page. If then prompted, enter your E-Mail address followed by the Password in the relevant input fields in the browser. You will receive the required e-mail address and password from your instructor. Finally choose the Log On button to log on to the ABAP system.
    8. Close the browser. The Service Instance Connection wizard page is opened. To adapt the logon language, enter the relevant abbreviation.

    9. Choose Next.

      Result

      The Project Name and Favorite Packages wizard page is opened.
    10. To create the ABAP Cloud Project, choose Finish.

    Result

    The ABAP Cloud Project is created and added in the Project Explorer.
  2. Create a new ABAP Package of type Development called ZS4D425_##_CLD under the generated package ZLOCAL.

    1. In ADT, expand the Favorite Packages folder under your ABAP Cloud Project folder in the Project Explorer.

    2. Right-click on ZLOCAL and select NewABAP Package.

    3. On the New ABAP Package dialog that displays, enter ZS4D425_##_CLD as Name and Side-by-Side Extension as Description. Make sure ZLOCAL is entered as Superpackage and Development is chosen as Package Type. Tick Add to favorite packages and choose Next.

    4. On the Selection of Transport Request screen, select the Create a new request option and enter Student ## as Request Description.

    5. Press Finish.

    Result

    Your new ABAP package ZS4D425_##_CLD is displayed in the Project Explorer under Favorite Packages.

Import Package ZS4D425_SOL_CLD from Github into the SAP BTP ABAP Environment

In preparation for the next exercises, import package ZS4D425_SOL_CLD from Github into the SAP BTP ABAP Environment.

Package ZS4D425_SOL_CLD contains sample solutions as well as copy templates.

Note

Since ABAP Git does not support all object types, package ZS4D425_SOL_CLD does not contain an executable implementation of the exercise scenario. The following repository objects, which are created accordingly by the students in their packages, are not included in package ZS4D425_SOL_CLD:
  • ZSC_D425_INVOICES_98 (Service Consumption Model)
  • Z_COMPLAINT_98 (BSP Application)
  • Z_COMPLAINT_98_UI5R (Fiori Launchpad App Descriptor Item)
  • ZD425_COMPLAINT_IAM_98_EXT (IAM App)
  • ZD425_COMPLAINT_BC_98 (IAM Business Catalog)

Steps

  1. Create a new ABAP package of type Development in software component ZLOCAL with name ZS4D425_SOL_CLD.

    1. In ADT, right-click your ABAP Cloud Project and select NewABAP Package from the context menu.

    2. In the ABAP Package dialog box, enter ZS4D425_SOL_CLD as the name and Side-by-Side Extension as the description. Select the Add to favorite packages check-box and make sure Development is chosen as the Package Type. Then press Next.

    3. Enter ZLOCAL as the Software Component and press Next.

    4. On the Selection of Transport Request dialog box, select the transport request you created in the previous demo and press Finish.

  2. Link the abapGit repository with URL https://github.com/s4d425/ZS4D425_SOL_CLD.git to package ZS4D425_SOL_CLD and pull the content of this repository.

    Note

    If the imported objects are not displayed under package ZS4D425_SOL_CLD in the Project Explorer, open the context menu for the package in the Project Explorer and select the Refresh item from it.
    1. Open the abapGit Repositories view. Select WindowShow OverviewOther…abapGit Repositories. The view will open in the lower part of the screen

    2. In the abapGit Repositories view, select the + icon in the toolbar (Link New abapGit Repository...).

    3. On the appearing Link abapGit Repository dialog box, enter the URLhttps://github.com/s4d425/ZS4D425_SOL_CLD.git and press Next.

    4. In the Branch and Package Selection step, enter ZS4D425_SOL_CLD as package. Make sure the branch refs/heads/main is chosen and select the Pull after link check-box. Then press Next.

    5. In the Selection of Transport Request step, select Finish.

    6. Wait until the value Pulled successfully is displayed in the Status column in the abapGit Repositories view for the triggered pull action. To do this, refresh the display via the Refresh icon in the toolbar of the abapGit Repositories view.

  3. Activate all pulled objects.

    1. Choose the Activate inactive ABAP development objects icon in the Eclipse toolbar or choose Ctrl+Shift+F3.

    2. In the dialog box that appears, make sure that all pulled objects are selected and press Activate.

How to Create a Database Table on the SAP BTP ABAP Environment

For the steps and data of this demonstration, refer to the exercise Create a Database Table on the SAP BTP ABAP Environment.

Create a Database Table on the SAP BTP ABAP Environment

In the side-by-side extensibility exercise scenario, we create an application on the SAP BTP ABAP Environment. This application is used to manage customer invoice complaints. The complaints are stored in a database table on the SAP BTP ABAP Environment.

After the base application is created, we will extend it to integrate an OData service from the SAP S/4HANA on premise system used in the training course. To do this, we will call the customer invoice OData service in the on premise system from the base application running on the SAP BTP ABAP Environment. This OData service was created via a Custom Business Object in a previous exercise. We will integrate the data that this OData service provides from the back-end into our base application as value help.

In the first step, we will now create the database table on the SAP BTP ABAP Environment that will be used to store the complaints in the cloud.

Note

In this exercise, when the values include ##, replace ## with your group number.

Sample Solution:Z425_COMPLAINT98 (Database Table)

Steps

  1. Create a database table with name Z425_COMPLAINT## in your package ZS4D425_##_CLD with description Customer complaints about invoices.

    1. In ADT, right-click on your package ZS4D425_##_CLD and select NewOther ABAP Repository Object.

    2. On the dialog that opens, search for Database Table, select it and click Next.

    3. On the New Database Table screen, enter Z425_COMPLAINT## as Name and Customer complaints about invoices as Description. Then choose Next.

    4. In the Selection of Transport Request step, make sure that the option Choose from requests in which I am involved is selected. Select the transport request you created in the last exercise and choose Finish.

    Result

    An editor with the definition of the new database table opens. It contains the following code:
    Code Snippet
    123456789
    @EndUserText.label : 'Customer complaints about invoices' @AbapCatalog.enhancement.category : #NOT_EXTENSIBLE @AbapCatalog.tableCategory : #TRANSPARENT @AbapCatalog.deliveryClass : #A @AbapCatalog.dataMaintenance : #RESTRICTED define table z425_complaint## { key client : abap.clnt; }
  2. Create the following fields for the table:

    NameTypeLengthKeyNot Null
    clientabap.clnt XX
    uuidsysuuid_x16 XX
    complaint_idabap.numc10 X
    invoice_idabap.numc10  
    customer_idabap.numc8  
    customer_nameabap.char25  
    reasonabap.char256  
    actionabap.char256  
    closedabap_boolean   
    local_created_byabp_creation_user   
    local_created_atabp_creation_tstmpl   
    local_last_changed_byabp_locinst_lastchange_user   
    local_last_changed_atabp_locinst_lastchange_tstmpl   
    last_changed_atabp_lastchange_tstmpl   

    Note

    For the exercises that follow, it is important that the table fields are defined exactly as indicated above.
    1. Define the fields of the database table as follows:

      Code Snippet
      123456789101112131415161718192021
      @EndUserText.label : 'Customer complaints about invoices' @AbapCatalog.enhancement.category : #NOT_EXTENSIBLE @AbapCatalog.tableCategory : #TRANSPARENT @AbapCatalog.deliveryClass : #A @AbapCatalog.dataMaintenance : #RESTRICTED define table z425_complaint## { key client : abap.clnt not null; key uuid : sysuuid_x16 not null; complaint_id : abap.numc(10) not null; invoice_id : abap.numc(10); customer_id : abap.numc(8); customer_name : abap.char(25); reason : abap.char(256); action : abap.char(256); closed : abap_boolean; local_created_by : abp_creation_user; local_created_at : abp_creation_tstmpl; local_last_changed_by : abp_locinst_lastchange_user; local_last_changed_at : abp_locinst_lastchange_tstmpl; last_changed_at : abp_lastchange_tstmpl; }
  3. Save and activate your work.

    1. To save your input you can use the keyboard shortcut Ctrl+S.

    2. The activation can be done via the keyboard shortcut Ctrl+F3.

Base Application

The base application uses an OData service to access the database table created in the last exercise. In the next step, this OData service is implemented using the ABAP RESTful Application Programming Model.

Since ABAP RESTful application programming model is not the topic of this training course, a generator is used to create the required ABAP RESTful application programming model-based OData service.

The following figures provide a brief overview of RAP. Details about ABAP RESTful application programming model can be found in the documentation as well as in separate training courses.

The ABAP RESTful Application Programming Model defines the architecture for end-to-end development of SAP HANA-optimized OData services. It supports the development of all types of Fiori applications as well as publishing Web APIs. It is based on technologies and frameworks such as Core Data Services (CDS) for defining semantically rich data models and a service model infrastructure for creating OData services with bindings to an OData protocol and ABAP-based application services for custom logic and SAPUI5-based user interfaces.

The ABAP RESTful Application Programming Model is available in the following products:

  • SAP BTP ABAP Environment
  • SAP S/4HANA Cloud
  • Application Server ABAP 7.55 SP03
See description below.

The above diagram structures the development of an OData service from a design time perspective. In other words, it displays the major development artifacts that you have to deal with during the creation of an OData service with the ABAP RESTful Programming Model. The diagram takes a bottom-up approach that resembles the development flow. The main development tasks can be categorized in three layers, data modeling and behavior, business services provisioning and service consumption.

See description below.

The above diagram provides a runtime perspective of the ABAP RESTful Programming Model. Runtime objects are necessary components to run an application. This runtime stack is illustrated in a top-down approach. An OData client sends a request, which is then passed to the generic runtime frameworks. These frameworks prepare a consumable request for ABAP code and dispatch it to the relevant business logic component. The request is executed by the business object (BO) when data is modified or by the query if data is only read from the data source.

How to Generate the OData Service for the Base Application

For the steps and data of this demonstration, refer to the exercise Generate the OData Service for the Base Application.

Generate the OData Service for the Base Application

In the exercise scenario for the side-by-side extension we implement an application on the SAP BTP ABAP Environment. For this purpose, a database table was created on the SAP BTP ABAP Environment in the previous exercise, which can be used to persist complaints about customer invoices.

In this exercise, an OData service is generated that enables read and write access to the database table. To create the OData service, we use a managed business object based on the ABAP RESTful Application Programming Model (RAP).

We use the so-called ABAP Repository Objects Generator, to generate the required ABAP RAP repository objects for us.

Note

In this exercise, when the values include ##, replace ## with your group number.

Steps

  1. To create the OData UI Service and all the underlying objects, call ABAP Objects Repository Generator with reference to your database table Z425_COMPLAINT##. Use generatorOData UI Service. To configure the generator, use the following values:

    Values for generator OData UI Service

    CategoryPropertyValue
    GeneralReferenced ObjectZ425_COMPLAINT##
    DescriptionComplaint ##
    Business Object; Data ModelCDS Entity NameZR_425_COMPLAINT##
    Alias NameComplaint
    Business Object; BehaviorBehavior Implementation ClassZBP_R_425_COMPLAINT##
    Draft Table NameZ425_COMPL##D
    Service Projection; Service Projection EntityCDS Entity NameZC_425_COMPLAINT##
    Service Projection; Service Projection BehaviorBehavior Implementation ClassZBP_C_425_COMPLAINT##
    Business Service; Service DefinitionService Definition NameZUI_425_COMPLAINT##_O4
    Business Service; Service BindingService Binding NameZUI_425_COMPLAINT##_O4
    Binding TypeOData V4 - UI
    1. Place cursor on your database table Z425_COMPLAINT##.

    2. Press secondary mouse-key and call function Generate ABAP Repository Objects.

    3. In screen Select Generator, select ABAP RESTful Aplication Programming ModelOData UI Service. Press Next.

    4. In the next screen, in field Package enter your package ZS4D425_##_CLD, and press Next.

    5. In screen Configure Generator, enter the values for each category and property as given in the table above. Change the proposed values if necessary. Press Next.

    6. In the next screen, check the preview. Press Next.

    7. In the next screen, select your transport request and press Finish. Then the artifacts will be generated.

  2. Refresh the display of your package ZS4D425_##_CLD in the Project Explorer to show the generated objects under your package.

    1. Right-click on your package ZS4D425_##_CLD in the Project Explorer and select Refresh from the context menu. Alternatively, you can press F5.

  3. Examine the generated interface view ZR_425_COMPLAINT_##.

    Where does this view read its data from?

    _____________________________________________________________________________

    The view defines alias names in camel case for the table field names. What are the alias names of the following table fields?

    Table field nameAlias name
    COMPLAINT_ID 
    INVOICE_ID 
    CUSTOMER_ID 
    CUSTOMER_NAME 
    1. To open the interface view ZR_425_COMPLAINT## in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDCore Data ServicesData Definitions. Then double-click on ZR_425_COMPLAINT##.

    2. The view reads its data from the database table Z425_COMPLAINT##.

    3. It defines the following alias names:

      Table field nameAlias name
      COMPLAINT_IDComplaintID
      INVOICE_IDInvoiceID
      CUSTOMER_IDCustomerID
      CUSTOMER_NAMECustomerName
  4. Examine the generated projection view ZC_425_COMPLAINT##.

    Where does this view read its data from?

    _____________________________________________________________________________

    1. To open the projection view ZC_425_COMPLAINT## in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDCore Data ServicesData Definitions. Then double-click on ZC_425_COMPLAINT##.

    2. The view reads its data from the interface view ZR_425_COMPLAINT_##.

  5. Examine the generated behavior definition ZR_425_COMPLAINT## for the interface view ZR_425_COMPLAINT##, which defines the behavior of the RAP business object.

    What is the name of the global class used to implement the behavior?

    _____________________________________________________________________________

    What transactional operations are defined in the behavior definition for the RAP business object?

    _____________________________________________________________________________

    1. To open the behavior definition ZR_425_COMPLAINT## in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDCore Data ServicesBehavior Definitions. Then double-click on ZR_425_COMPLAINT##.

    2. The name of the global class used to implement the behavior is ZBP_R_D425_Complaint##.

    3. The transactional operations create, update, and delete are defined for the RAP business object.

  6. Examine the generated projection behavior definition ZC_425_COMPLAINT_## for the projection view ZC_425_COMPLAINT_##, which exposes a subset of the elements of the underlying base behavior definition ZR_425_COMPLAINT_##.

    Which transactional operations for the RAP business object defined in the underlying base behavior definition ZR_425_COMPLAINT_## are reused in the projection behavior definition?

    _____________________________________________________________________________

    1. To open the projection behavior definition ZC_425_COMPLAINT## in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDCore Data ServicesBehavior Definitions. Then double-click on ZC_425_COMPLAINT##.

    2. The projection behavior definition reuses the operations create, update, and delete from the base behavior definition.

  7. Examine the generated service definition ZUI_425_COMPLAINT##_O4.

    Which CDS entity is exposed via this service definition for the business service?

    _____________________________________________________________________________

    Which alias name is defined for this CDS entity?

    _____________________________________________________________________________

    1. To open the service definition ZUI_425_COMPLAINT##_O4 in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDBusiness ServicesService Definitions. Then double-click on ZUI_425_COMPLAINT##_O4.

    2. The service definition exposes the CDS entity ZC_425_COMPLAINT##.

    3. The alias name Complaint is defined for this CDS entity.

  8. Examine the generated service binding ZUI_425_COMPLAINT##_O4.

    On which service definition is this service binding based?

    _____________________________________________________________________________

    Which binding type is implemented with this service binding?

    _____________________________________________________________________________

    1. To open the service binding ZUI_425_COMPLAINT##_O4 in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDBusiness ServicesService Bindings. Then double-click on ZUI_425_COMPLAINT##_O4.

    2. The service binding is based on the service definition ZUI_425_COMPLAINT##_O4.

    3. The binding type OData V4 - UI is implemented with the service binding.

  9. Publish the service binding ZUI_425_COMPLAINT##_O4.

    1. Open the service binding ZUI_425_COMPLAINT##_O4 in the editor if it is not already open.

    2. Click the Publish button in the service binding editor to publish the service binding.

      Note

      Be patient, publishing the service binding takes a little time.
  10. Open the SAP Fiori elements app preview for the Complaint entity set.

    1. Open the service binding ZUI_425_COMPLAINT##_O4 in the editor if it is not already open.

    2. Select the entity set Complaint in the Entity Set and Association section of the service binding editor.

    3. Click the Preview... button.

      Note

      If you are not logged on automatically, click the <xxxxxxxxx>.accounts.ondemand.com link that appears on the displayed browser page. If then prompted, enter your E-Mail address followed by the Password in the relevant input fields in the browser. You will receive the required e-mail address and password from your instructor. Finally choose the Log On button to log on to the ABAP system.
  11. Create a new complaint via the SAP Fiori elements app preview. Then update the saved complaint and finally delete it again.

    Note

    Via the generated SAP Fiori elements app preview, complaints can not only be displayed, but also created, updated and deleted. This is due to the fact that create, update, and delete operations have been defined for the RAP business object (see above).

    1. Use the corresponding UI elements of the SAP Fiori elements app preview to perform the create, update and delete operations.

Result

The SAP Fiori elements app preview provides a nearly fully fledged UI with capabilities for searching and filtering as well as creating, updating, and deleting complaints.

However, no value help is provided in the application. Later, we will provide a value help for the invoice ID, that will also populate the customer ID and customer name fields with values. For this purpose, we will use the customer invoice OData service from the SAP S/4HANA on premise system, which we created in a previous exercise by means of a Custom Business Object. We will integrate this OData service as value help via a side-by-side extension into the application on the ABAP Environment .

For the Closed table field, the label Truth Value is used in the SAP Fiori elements app preview. This and some other labels will be adjusted in the next exercise.

How to Adjust the Labels of the SAP Fiori Elements Application

For the steps and data of this demonstration, refer to the exercise Adjust the Labels of the SAP Fiori Elements Application.

Adjust the Labels of the SAP Fiori Elements Application (optional)

In the last exercise, you tested the OData service for the base application via the SAP Fiori elements app preview. The labels displayed in the SAP Fiori elements application are specified via a so-called metadata extension generated by the RAP Generator.

In this exercise, you will adjust one of the labels in the SAP Fiori elements application via this generated metadata extension.

Note

In this exercise, when the values include ##, replace ## with your group number.

Sample Solution:ZC_425_Complaint98 (Metadata Extension)

Steps

  1. Open the generated metadata extension ZC_425_Complaint##.

    1. To open the metadata extension ZC_425_Complaint## in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDCore Data ServicesMetadata Extensions. Then double-click on ZC_425_Complaint##.

  2. In the metadata extension ZC_425_Complaint##, adjust the labels for both the table on the List Report and the Object Page as follows:

    ElementGenerated label for List Report and Object PageAdjusted label for List Report and Object Page
    ClosedTruthvalueClosed
    ComplaintIDComplaintIDComplaint ID
    InvoiceIDInvoiceIDInvoice ID
    CustomerIDCustomerIDCustomer ID
    CustomerNameCustomerNameCustomer Name

    Then activate your metadata extension ZC_425_Complaint##.

    1. In the metadata extension, look for the following annotations to the Closed element:

      Code Snippet
      123456789101112
      @UI.identification: [ { position: 80 , label: 'Truth value' } ] @UI.lineItem: [ { position: 80 , label: 'Truth value' } ] @UI.selectionField: [ { position: 80 } ] Closed;

      Adjust them as follows:

      Code Snippet
      12345678910
      @EndUserText.label: 'Closed' @UI.identification: [ { position: 80 } ] @UI.lineItem: [ { position: 80 @UI.selectionField: [ { position: 80 } ] Closed;
    2. Repeat this for the other elements.

    3. To activate the metadata extension you can use the keyboard shortcut Ctrl+F3.

  3. Test your adjustments via the SAP Fiori elements app preview for the Complaint entity set.

    1. Open the service binding ZUI_425_COMPLAINT##_O4 in the editor if it is not already open.

    2. Select the entity set Complaint in the Entity Set and Association section of the service binding editor.

    3. Choose Preview....

      Note

      If you are not logged on automatically, click the <xxxxxxxxx>.accounts.ondemand.com link that appears on the displayed browser page. If then prompted, enter your E-Mail address followed by the Password in the relevant input fields in the browser. You will receive the required e-mail address and password from your instructor. Finally choose the Log On button to log on to the ABAP system.
    4. Check if the adjusted labels are displayed in the List Report table and on the Object Page of the app.

How to Compute the Semantic Key

For the steps and data of this demonstration, refer to the exercise Compute the Semantic Key.

Compute the Semantic Key (optional)

To provide the semantic key field ComplaintID automatically with a value, we will implement a so-called determination in this exercise.

Note

Physically, field UUID is key field of behavior definition ZR_425_COMPLAINT##. But semantically (i.e. human readable) field ComplaintID is like a key field.

A determination is an optional part of the business object behavior that modifies instances of business objects based on trigger conditions. Here, a determination is implemented to calculate the ID of a complaint that is readable by the user of the application. As soon as the user creates a new complaint, the determination is executed and calculates the corresponding value for the semantic key field.

The implementation of the determination is done in a local class called LHC_COMPLAINT, which is part of the global behavior implementation class ZBP_R_425_COMPLAINT##. Both this global class and the local class have already been created by the generator. Therefore, only the CALCULATECOMPLAINTID method needs to be implemented on the local class LHC_COMPLAINT. For simplicity, in this exercise, copy the local class LHC_COMPLAINT from the sample solution and adapt it to your business object.

Note

In this exercise, when the values include ##, replace ## with your group number.

Sample Solutions:

Global Class ZBP_R_425_COMPLAINT98

Behavior Definition ZR_425_COMPLAINT98

Metadata Extension ZC_425_COMPLAINT98

Steps

  1. Set field ComplaintID to readonly in behavior definition ZR_425_COMPLAINT##.

    1. Open behavior definition ZR_425_COMPLAINT##.

    2. Search for field ( readonly ).

    3. Add ComplaintID to the list of readonly fields.

    The field ( readonly ) clause should read:

    Code Snippet
    123456
    field ( readonly ) UUID, LastChanged, LocalLastChanged;

  2. Add a determination to behavior definition ZR_425_COMPLAINT##.

    1. Open behavior definition ZR_425_COMPLAINT##.

    2. Search for the line before the last line:

    Search for

    Code Snippet
    12345678
    mapping for z425_complaint## { UUID = uuid; ... LastChanged = last_changed; } }

    Add this coding (before the last curly bracket):

    Code Snippet
    1
    determination CalculateComplaintID on save { create; }

    Altogether is has to read:

    Code Snippet
    123456789
    mapping for z425_complaint## { UUID = uuid; ... LastChanged = last_changed; } }

    Note

    You can ignore the displayed messages. They will disappear after the next step.
  3. Activate the behavior definition.

    1. Choose function Activate.

  4. Copy from method implementation CalculateComplaintID from local class LHC_ZR_425_COMPLAINT98 from global class ZBP_R_425_COMPLAINT98.

    1. Select the Open ABAP Development Object icon from the Eclipse toolbar or press Ctrl+Shift+A.

    2. On the Open ABAP Development Object dialog, enter ZBP_R_425_COMPLAINT98 as search string. Select ZBP_R_425_COMPLAINT98 from the Matching Items area and choose OK.

    3. At the bottom of the editor that opens, select the Local Types tab.

    4. Mark the complete coding of implementation of method CalculateComplaintID of class LHC_ZR_425_COMPLAINT98, which is now displayed, (for example, via CTRL+A) and then copy it (for example, via CTRL+C).

  5. Replace the implementation of method CalculateComplaintID of local class LHC_ZR_425_COMPLAINT## in your global class ZBP_R_425_COMPLAINT## with the copied coding.

    1. To open global class ZBP_R_425_COMPLAINT## in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDSource Code LibraryClassesZBP_R_425_COMPLAINT##. Then double-click on LHC_ZR_425_COMPLAINT##.

    2. In the editor that opens, replace the coding of the implementation of method CalculateComplaintID of class LHC_ZR_425_COMPLAINT##, which is displayed, with the copied code.

  6. Adjust the copied code in the following three places to match your group number:

    Copied codeAdjusted code
    READ ENTITIES OF zr_425_complaint_98IN LOCAL MODEREAD ENTITIES OF zr_425_complaint_##IN LOCAL MODE
    SELECT SINGLE FROM z425_complaint98FIELDS MAX( complaint_id ) INTO @DATA(max_complaint).SELECT SINGLE FROM z425_complaint##FIELDS MAX( complaint_id ) INTO @DATA(max_complaint).
    MODIFY ENTITIES OF zr_425_complaint_98IN LOCAL MODEMODIFY ENTITIES OF zr_425_complaint_##IN LOCAL MODE

    Then activate your class ZBP_R_425_COMPLAINT##.

    Note

    For simplicity, the determination implementation selects from the database the highest complaint ID assigned so far. The selected value is then incremented to generate further semantic keys that can be read by the user. In a productive application, one would rather use a number range.
    1. Adjust the copied coding to match the following:

      Code Snippet
      1234567891011121314151617181920212223242526272829303132333435363738
      CLASS lhc_zr_425_complaint## DEFINITION INHERITING FROM cl_abap_behavior_handler. PRIVATE SECTION. METHODS: calculatecomplaintid FOR DETERMINE ON SAVE IMPORTING keys FOR Complaint~CalculateComplaintID . ENDCLASS. CLASS lhc_zr_425_complaint## IMPLEMENTATION. METHOD calculatecomplaintid. "Ensure idempotence READ ENTITIES OF zr_425_complaint_ IN LOCAL MODE ENTITY Complaint FIELDS ( ComplaintID ) WITH CORRESPONDING #( keys ) RESULT DATA(complaints). DELETE complaints WHERE ComplaintID IS NOT INITIAL. CHECK complaints IS NOT INITIAL. "Get max complaintID SELECT SINGLE FROM z425_complaint FIELDS MAX( complaint_id ) INTO @DATA(max_complaint). "update involved instances MODIFY ENTITIES OF zr_425_complaint_ IN LOCAL MODE ENTITY Complaint UPDATE FIELDS ( ComplaintID ) WITH VALUE #( FOR complaint IN complaints INDEX INTO i ( %tky = complaint-%tky ComplaintID = max_complaint + i ) ) REPORTED DATA(lt_reported). "fill reported reported = CORRESPONDING #( DEEP lt_reported ). ENDMETHOD. ENDCLASS.
    2. To activate the class you can use the keyboard shortcut Ctrl+F3.

  7. Change the title information to metadata extension ZC_425_COMPLAINT##. Change the annotations for title and description. You can as well copy the changed part from solution metadata extension ZC_425_COMPLAINT98.

    AnnotationOld ValueNew Value
    @UI.headerInfo.title.value:'Uuid''ComplaintId'
    @UI.headerInfo.description.value:'Uuid''CustomerName'

    Activate the metadata extension.

    1. Open metadata extension ZC_425_COMPLAINT##.

    2. In the metadata extension, look for the following annotations to the Closed element:

      Code Snippet
      12345678
      @Metadata.layer: #CORE @UI.headerInfo.title.type: #STANDARD @UI.headerInfo.title.value: 'Uuid' @UI.headerInfo.description.type: #STANDARD @UI.headerInfo.description.value: 'Uuid'

      Adjust them as follows:

      Code Snippet
      12345678
      @Metadata.layer: #CORE @UI.headerInfo.title.type: #STANDARD @UI.headerInfo.title.value: 'ComplaintId' @UI.headerInfo.description.type: #STANDARD @UI.headerInfo.description.value: 'CustomerName'
    3. Activate the metadata extension.

  8. Test the determination implementation via the SAP Fiori elements app preview for the Complaint entity set. Test the new appearance of title and description.

    1. Open the service binding ZUI_425_COMPLAINT##_O4 in the editor if it is not already open.

    2. Select the entity set Complaint in the Entity Set and Association section of the service binding editor.

    3. Choose Preview....

      Note

      If you are not logged on automatically, click the <xxxxxxxxx>.accounts.ondemand.com link that appears on the displayed browser page. If then prompted, enter your E-Mail address followed by the Password in the relevant input fields in the browser. You will receive the required e-mail address and password from your instructor. Finally choose Log On to log on to the ABAP system.
    4. In the displayed SAP Fiori elements app, press the Create button.

    5. Fill out the form and press Create.

      Result

      Check the numbering for the semantic key: The Complaint ID field should now show a 1.

      Check the title and the description. For title now the Complaint ID should appear. For description the Customer Name.

Backend Integration

The figure illustrates the service consumption model, which is described below.

In order to consume the OData service of the SAP S/4HANA on-premise system in the SAP BTP ABAP Environment, you need a local representation of the remote service. With the help of a service consumption model, you can import the OData metadata of the remote service into the SAP BTP ABAP Environment and create proxy artifacts for the remote service. The wizard that creates the proxy artifacts requires a CSDL XML document of the external service as a basis for the service consumption model. The generated abstract entities mirror the data model of the remote service.

The figure visualizes the consumption scenario, which is described below.

The data model for the value help is defined in a CDS custom entity. That is, the custom entity defines the elements to be used in the value help and types them.

Unlike CDS views, custom entities do not have a select statement to retrieve the data from a data source. The runtime of a custom entity must be implemented in a related ABAP class, which must be referenced using the annotation @ObjectModel.query.implementedBy.

This so-called query implementation class has to implement the select method of the interface IF_RAP_QUERY_PROVIDER to handle query requests by the client. In the implementation of this method, the invoice data is selected via the remote service using the generated client proxy.

How to Create a Service Consumption Model for the On-Premise OData Service

For the steps and data of this demonstration, refer to the exercise Create a Service Consumption Model for the On-Premise OData Service.

Create a Service Consumption Model for the On-Premise OData Service

In the previous exercises, the OData service of the base application was implemented. In the preview of the associated SAP Fiori elements app, it could be seen that this application does not provide any value help on the UI for managing complaints.

Using a side-by-side extension, we now want to add such a value help for the invoice ID. For this purpose, we use the customer invoice OData service from the on-premise system, which was created via a Custom Business Object in an earlier exercise. This OData service will provide the data for the value help for the invoice ID, which will also fill the fields for the customer name and the customer ID with values.

In this exercise, we will first create a service consumption model for the customer invoice OData service, which we then use later to call this service in the on-premise system from the application on the SAP BTP ABAP environment.

Note

In this exercise, when the values include ##, replace ## with your group number.

Steps

  1. Save the service metadata document of the customer invoice OData service from the on-premise system in a local file named $metadata.xml in the directory N:\Documents.

    Note

    You can access the service metadata document in the browser using the URL https://s4dhost.wdf.sap.corp:44310/sap/opu/odata/sap/ZZ1_CUSTOMERINVOICE##_CDS/$metadata.

    Note

    The service consumption model takes the description of an external interface (currently OData, SOAP and RFC are supported) as input. In the case of OData, the so-called OData service metadata document provides the corresponding interface description. Based on the information in the service metadata document, OData consumption proxy objects are generated for the service consumption model. With these objects you can write ABAP code that allows you to call remote OData services.
    1. If the Chrome browser is not yet started, open it via the Windows Start menu.

    2. Type the following URL and then press ENTER: https://s4dhost.wdf.sap.corp:44310/sap/opu/odata/sap/ZZ1_CUSTOMERINVOICE##_CDS/$metadata

    3. If prompted, log on to the S4D system with your TRAIN-## user and the associated password.

      Result

      The service metadata document is displayed in the browser.
    4. Perform a right click in the browser window and choose Save as... from the displayed context menu.

    5. On the dialog that appears, select the folder N:\Documents and type $metadata.xml as File name. Then choose Save.

  2. Based on the saved service metadata document, create a service consumption model for the entity set ZZ1_CUSTOMERINVOICE## of the customer invoice OData service in your package ZS4D425_##_CLD. Use ZSC_D425_INVOICES_## as the name and Invoices from S4D as the description for the service consumption model.

    1. In ADT, right-click on your package ZS4D425_##_CLD and select NewOther ABAP Repository Object.

    2. On the dialog that opens, search for Service Consumption Model, select it and click Next.

    3. On the Service Consumption Model screen, enter ZSC_D425_INVOICES_## as Name and Invoices from S4D as Description. Make sure that OData is selected as Remote Consumption Mode. Then choose Next.

    4. On the appearing dialog, choose Browse... to select the file N:\Documents\$metadata.xml that you created in the previous step. Choose Next.

    5. In the Components of OData Service step, you see all components from the service metadata file. Choose Next..

    6. In the ETag Support step, you do not need to change anything. Choose Next.

    7. In the Selection of Transport Request step, make sure that the option Choose from requests in which I am involved is selected. Select the transport request you created in a previous exercise and choose Finish.

      Result

      The service consumption model is generated and displayed in the editor.
  3. Examine the service consumption model that is generated.

    Which service entity sets can be accessed via the service consumption model?

    _____________________________________________________________________________

    For which operations does the service consumption model provide sample code for entity set access?

    _____________________________________________________________________________

    1. If the service consumption model is not already open, open it as follows: Expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDBusiness ServicesService Consumption Models. Then double-click on ZSC_D425_INVOICES_##.The service entity sets that can be accessed via the service consumption model is displayed in the Service Entity Sets section of the editor: among it you will find ZZ1_CUSTOMERINVOICE##. Select this entry with the mouse.

    2. In the Service Entity Set Details section of the editor, the code samples for entity set access can be found. For the following operations sample code is provided: Create, Read, Read List, Update, Delete.

How to Create a Console Application to Test the Service Consumption Model

For the steps and data of this demonstration, refer to the exercise Create a Console Application to Test the Service Consumption Model.

Create a Console Application to Test the Service Consumption Model

In this exercise you will create a small console application to test the service consumption model. In this way, you will check whether calling the OData service in the on-premise system from the SAP BTP ABAP Environment works. Finding any errors that may occur is much easier via a console application than later, when the service consumption model has already been integrated into the base application.

Note

In this exercise, when the values include ##, replace ## with your group number.

Sample Solution:ZCL_CE_D425_INVOICES_98 (Global Class)

Steps

  1. Create a global class with nameZCL_CE_D425_INVOICES_## in your package ZS4D425_##_CLD. Use Query implementation custom entity as the description for the class. Make sure that the class implements the interface IF_OO_ADT_CLASSRUN.

    Note

    The call of the OData service in the on-premise system will later be integrated into the base application via a so-called custom entity. For this purpose, the class created now will be reused as a query implementation of the custom entity. Therefore, we already choose the class name and description accordingly here. The CE in the class name indicates that this class serves as a query implementation for a custom entity.
    1. In ADT, right-click on your package ZS4D425_##_CLD and select NewOther ABAP Repository Object.

    2. On the dialog that opens, search for ABAP Class, select it and click Next.

    3. On the ABAP Class screen, enter ZCL_CE_D425_INVOICES_## as Name and Query implementation custom entity as Description.

    4. Still on the ABAP Class screen, press the Add... button. On the appearing Add ABAP Interface dialog, search for IF_OO_ADT_CLASSRUN, select it and click OK. Then choose Next on the ABAP Class screen.

    5. In the Selection of Transport Request step, make sure that the option Choose from requests in which I am involved is selected. Select the transport request you created in a previous exercise and choose Finish.

      Result

      The class is generated and displayed in the ABAP class editor. Make sure your coding looks similar to the following:
      Code Snippet
      1234567891011121314151617
      CLASS zcl_ce_d425_invoices_## DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_ce_d425_invoices_## IMPLEMENTATION. METHOD if_oo_adt_classrun~main. ENDMETHOD. ENDCLASS.
  2. Add the following type declaration to the Public Section of your class ZCL_CE_D425_INVOICES_##:

    Code snippet
    Expand

    Note

    The data returned by the OData service called in the on-premise system is made available as internal table via the service consumption model. The data type created here will later be used to create corresponding internal tables.
    1. Make sure your coding looks similar to the following:

      Code Snippet
      123456789101112131415161718
      CLASS zcl_ce_d425_invoices_## DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_ce_d425_invoices_## IMPLEMENTATION. METHOD if_oo_adt_classrun~main. ENDMETHOD. ENDCLASS.
  3. Add the following method definition to the Public Section of your class ZCL_CE_D425_INVOICES_##:

    Code snippet
    Expand

    Note

    The get_invoices method is used to implement access to the remote OData service. The method accepts filter conditions (OData query option $filter) and values for paging the data (OData query options $top and $skip) as optional import parameters. These parameters are passed through to the called OData service later in the method's implementation via the service consumption model. The export interface of the get_invoices method returns the matching data supplied by the OData service.

    1. Make sure your coding looks similar to the following:

      Note

      You can ignore the displayed error that the implementation for method get_invoices is missing. The implementation will be added in the next step.
      Code Snippet
      1234567891011121314151617181920
      CLASS zcl_ce_d425_invoices_## DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. TYPES tt_business_data TYPE zsc_d425_invoices_##=>tyt_zz_1_customerinvoice_##_ty. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_ce_d425_invoices_## IMPLEMENTATION. METHOD if_oo_adt_classrun~main. ENDMETHOD. ENDCLASS.
  4. Implement the two methods if_oo_adt_classrun~main and get_invoices on your class ZCL_CE_D425_INVOICES_##. To do this, copy the corresponding method implementations from sample solution ZCL_CE_D425_INVOICES_98.

    In the implementation of method get_invoices, match the copied code to your group number as follows.

    In the implementation of method if_oo_adt_classrun~main, there is nothing to change. (But do not forget to copy it.)

    Copied coding of method get_invoices:

    Code Snippet
    12345678910111213141516171819
    METHOD get_invoices. [...] DATA(lo_odata_client_proxy) = /iwbep/cl_cp_factory_remote=>create_v2_remote_proxy( EXPORTING is_proxy_model_key = VALUE #( repository_id = 'DEFAULT' proxy_model_id = 'ZSC_D425_INVOICES_98' proxy_model_version = '0001' ) io_http_client = lo_http_client iv_relative_service_root = '/sap/opu/odata/sap/ZZ1_CUSTOMERINVOICE98_CDS' ). " Navigate to the resource and create a request for the read operation DATA(lo_request) = lo_odata_client_proxy->create_resource_for_entity_set( 'ZZ_1_CUSTOMERINVOICE_98' )->create_request_for_read( ). [...] ENDMETHOD.

    Adjusted coding of method get_invoices:

    Code Snippet
    123456789101112131415161718
    METHOD get_invoices. [...] DATA(lo_odata_client_proxy) = /iwbep/cl_cp_factory_remote=>create_v2_remote_proxy( EXPORTING is_proxy_model_key = VALUE #( repository_id = 'DEFAULT' proxy_model_id = 'ZSC_D425_INVOICES_##' proxy_model_version = '0001' ) io_http_client = lo_http_client iv_relative_service_root = '/sap/opu/odata/sap/ZZ1_CUSTOMERINVOICE##_CDS' ). " Navigate to the resource and create a request for the read operation DATA(lo_request) = lo_odata_client_proxy->create_resource_for_entity_set( 'ZZ_1_CUSTOMERINVOICE_##' )->create_request_for_read( ). [...] ENDMETHOD.

    Then activate your class ZCL_CE_D425_INVOICES_##.

    1. Select the Open ABAP Development Object icon from the Eclipse toolbar or press Ctrl+Shift+A.

    2. On the Open ABAP Development Object dialog, enter ZCL_CE_D425_INVOICES_## as search string. Select ZCL_CE_D425_INVOICES_98 from the Matching Items area and choose OK.

    3. In the ABAP class editor that opens, mark the code that is highlighted below and then copy it (for example, via CTRL+C).

      The complete coding:

      Code Snippet
      123456789101112131415161718192021222324252627282930
      CLASS zcl_ce_d425_invoices_## DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES: if_oo_adt_classrun. TYPES tt_business_data TYPE zsc_d425_invoices_##=>tyt_zz_1_customerinvoice_##_ty. METHODS get_invoices IMPORTING it_filter_cond TYPE if_rap_query_filter=>tt_name_range_pairs OPTIONAL iv_top TYPE i OPTIONAL iv_skip TYPE i OPTIONAL EXPORTING et_business_data TYPE tt_business_data RAISING /iwbep/cx_cp_remote /iwbep/cx_gateway cx_web_http_client_error cx_http_dest_provider_error. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_ce_d425_invoices_## IMPLEMENTATION. ENDCLASS.
    4. Go back to your class ZCL_CE_D425_INVOICES_##. Delete the following code from the implementation part of the class:

      Code snippet
      Expand
    5. Then paste the copied code into the implementation part of the class. Modify it as described above.

    6. To activate the class you can use the keyboard shortcut Ctrl+F3.

  5. Run your ABAP class ZCL_CE_D425_INVOICES_## as a console application.

    Note

    The copied code assumes that a Destination named S4D_100 has been created, which is used to establish the connection to the SAP S/4HANA on-premise system. Adjust the Destination name used in the code if necessary.
    Code Snippet
    12345
    " Create http client DATA(lo_http_destination) = cl_http_destination_provider=>create_by_cloud_destination( i_name = '' i_authn_mode = if_a4c_cp_service=>service_specific ).

    Note

    In the if_oo_adt_classrun~main method, a filter is set that selects only invoices with an ID greater than or equal to 1. In addition, the result is limited to 3 records. Adjust these restrictions to your data if necessary.
    Code Snippet
    123456789101112131415161718
    lt_ranges_table = . lt_filter_conditions = VALUE #( ( name = 'ID' range = lt_ranges_table ) ). TRY. me->get_invoices( EXPORTING it_filter_cond = lt_filter_conditions iv_top = iv_skip = IMPORTING et_business_data = lt_business_data ) . out->write( lt_business_data ). CATCH cx_root INTO DATA(lx_exception). out->write( cl_message_helper=>get_latest_t100_exception( lx_exception )->if_message~get_longtext( ) ). ENDTRY.
    1. To run your class ZCL_CE_D425_INVOICES_## as a console application, right-click in the ABAP editor where your class is displayed and select Run As1 ABAP Application (Console). Alternatively, you can press F9.

    Result

    The Console view now displays the records returned by the remote OData service. The output should look something like this:

    Code Snippet
    1234
    Table SAP_UUID APPLYCUSTOMERDISCOUNT_AC APPLYCUSTOMERDISCOUNT_AC_VC ID ID_VC CUSTOMERID ... 005056044E851EDBBCA9087C5A80EF49 X 0000000815 99999999 005056044E851EDBBCEF851328D60939 X 0000004712 99999999 005056044E851EDBBCEFD06F059A6A5C X 0000004713 99999999

How to Create a Custom Entity

For the steps and data of this demonstration, refer to the exercise Create a Custom Entity.

Create a Custom Entity

To be able to integrate the OData service from the SAP S/4HANA on-premise system into the base application via a value help, you now create a custom entity. This custom entity defines the data model via which the data from the remote OData service is made available for the value help.

Unlike "normal" CDS views, which read data from database tables or other CDS views, the data retrieval for custom entities is implemented manually. That is, the data for the data model defined via the custom entity is selected code-based via an ABAP class that implements the interface IF_RAP_QUERY_PROVIDER. We will do the corresponding query implementation for the custom entity in the next exercise. To do this, we will reuse the class created in the last exercise.

Note

In this exercise, when the values include ##, replace ## with your group number.

Sample Solution:ZCE_D425_INVOICES_98 (Data Definition)

Steps

  1. Create a custom entity with nameZCE_D425_INVOICES_## and descriptionCustom entity for invoices from S4D in your package ZS4D425_##_CLD. Use the data definition templateDefine Custom Entity with Parameters for this purpose.

    Note

    No parameters are required for the custom entity in this exercise. However, there is no template for creating a custom entity without parameters. Therefore, in the next step, you will delete the code generated for the parameters.
    1. Right-click on your package ZS4D425_##_CLD and select NewOther ABAP Repository Object.

    2. On the dialog that opens, search for Data Definition, select it and choose Next.

    3. On the Data Definition screen, enter ZCE_D425_INVOICES_## as Name and Custom entity for invoices from S4D as Description. Then choose Next.

    4. In the Selection of Transport Request step, make sure that the option Choose from requests in which I am involved is selected. Select the transport request you created in a previous exercise and choose Next.

      Caution

      Do not choose Finish in this step. Otherwise you will not get to the dialog where you can select the template.
    5. On the Templates screen, select the template Define Custom Entity with Parameters and choose Finish.

      Result

      The custom entity is generated and displayed in the editor. Make sure your coding looks similar to the following:
      Code Snippet
      1234567
      @EndUserText.label: 'Custom entity for invoices from S4D' define custom entity ZCE_D425_INVOICES_## with parameters parameter_name : parameter_type { key key_element_name : key_element_type; element_name : element_type; }
  2. Delete the statement with parameters parameter_name : parameter_type from the source code of your custom entity ZCE_D425_INVOICES_##. Also remove the following two lines from the definition of the custom entity:

    Code Snippet
    12
    key key_element_name : key_element_type; element_name : element_type;

    Note

    You can ignore the displayed error. It will disappear when elements are added to the custom entity in the next step.
    1. Delete the above statements from the source code. Ensure your implementation now looks like this:

      Code Snippet
      12345
      @EndUserText.label: 'Custom entity for invoices from S4D' define custom entity ZCE_D425_INVOICES_## { }
  3. Add the following elements to the definition of your custom entity ZCE_D425_INVOICES_##:

    Code Snippet
    12345678
    key SAP_UUID : sysuuid_x16; ID : abap.numc( 10 ); Customer_ID : abap.numc( 8 ); Customer_Name : abap.char( 25 ); @Semantics.amount.currencyCode: 'Amount_C' Amount_V : abap.curr( 16, 3 ); @Semantics.currencyCode: true Amount_C : abap.cuky;

    Note

    To keep the data model simple, not all fields from the remote OData service are to be exposed via the custom entity for the value help. For the sake of simplicity, we will limit ourselves to a few fields here.
    1. To open the copy template ZD425_##_ZZ1_CUSTOMERINVOICE## in the editor, expand the following nodes under your package in the Project Explorer: ZS4D425_##_CLDCore Data ServicesData Definitions. Then double-click on ZD425_##_ZZ1_CUSTOMERINVOICE##.

    2. One by one, copy the above elements from the copy template and then paste them between the curly braces into your custom entity. Make sure that the definition of your custom entity finally looks like this:

      Code Snippet
      123456789101112
      @EndUserText.label: 'Custom entity for invoices from S4D' define custom entity ZCE_D425_INVOICES_## { key SAP_UUID : sysuuid_x16; ID : abap.numc( 10 ); Customer_ID : abap.numc( 8 ); Customer_Name : abap.char( 25 ); @Semantics.amount.currencyCode: 'Amount_C' Amount_V : abap.curr( 16, 3 ); @Semantics.currencyCode: true Amount_C : abap.cuky; }
  4. Adjust the number of decimal places for field Amount_V from 3 to 2 as follows:

    Code Snippet
    1
    Amount_V : abap.curr( 16, );

    Caution

    Only amount fields with 2 decimal places are supported.
    1. In the definition of your custom entity ZCE_D425_INVOICES_##, make the change described above. Make sure that the definition now looks like this:

      Code Snippet
      123456789101112
      @EndUserText.label: 'Custom entity for invoices from S4D' define custom entity ZCE_D425_INVOICES_## { key SAP_UUID : sysuuid_x16; ID : abap.numc( 10 ); Customer_ID : abap.numc( 8 ); Customer_Name : abap.char( 25 ); @Semantics.amount.currencyCode: 'Amount_C' Amount_V : abap.curr( 16, ); @Semantics.currencyCode: true Amount_C : abap.cuky; }
  5. Now define the class ZCL_CE_D425_INVOICES_##, which you created in the last exercise, as the query implementation class for your custom entity. To do this, add the following annotation in front of the statement define custom entity ZCE_D425_INVOICES_## in your custom entity:

    Code Snippet
    1
    @ObjectModel.query.implementedBy: 'ABAP:ZCL_CE_D425_INVOICES_##'

    Note

    In the next exercise, you will modify class ZCL_CE_D425_INVOICES_## accordingly.

    Then activate your custom entity ZCE_D425_INVOICES_##.

    1. Update the coding of your custom entity as described above. Make sure that the definition of your custom entity now looks like this:

      Code Snippet
      12345678910111213
      @EndUserText.label: 'Custom entity for invoices from S4D' define custom entity ZCE_D425_INVOICES_## { key SAP_UUID : sysuuid_x16; ID : abap.numc( 10 ); Customer_ID : abap.numc( 8 ); Customer_Name : abap.char( 25 ); @Semantics.amount.currencyCode: 'Amount_C' Amount_V : abap.curr( 16, 2 ); @Semantics.currencyCode: true Amount_C : abap.cuky; }
    2. To activate the custom entity you can use the keyboard shortcut Ctrl+F3.

How to Implement the Query Implementation Class of the Custom Entity

For the steps and data of this demonstration, refer to the exercise Implement the Query Implementation Class of the Custom Entity.

Implement the Query Implementation Class of the Custom Entity

In the last exercise, you created the custom entity ZCE_D425_INVOICES_## and specified the previously created class ZCL_CE_D425_INVOICES_## as the query implementation class for this custom entity.

In this exercise, you will now modify class ZCL_CE_D425_INVOICES_## accordingly. To do this, you will need to implement interface IF_RAP_QUERY_PROVIDER on class ZCL_CE_D425_INVOICES_##. This interface has a method called select, which is used to implement data retrieval for the custom entity. In the implementation of this method you will delegate the data retrieval to the get_invoices method that already exists in the class.

Note

In this exercise, when the values include ##, replace ## with your group number.

Sample Solution:ZCL_CE_D425_INVOICES_98 (Global Class)

Steps

  1. Implement interface IF_RAP_QUERY_PROVIDER on your class ZCL_CE_D425_INVOICES_## by adding the following statement to the Public Section of the class:

    Code Snippet
    1
    INTERFACES if_rap_query_provider.

    Note

    You can ignore the displayed warning that the implementation for method if_rap_query_provider~select is missing. The implementation will be added in the next step.
    1. Adjust your class as described above. Make sure that the definition part of your class looks like this:

      Code Snippet
      12345678910111213
      CLASS zcl_ce_d425_invoices_## DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. ... PROTECTED SECTION. PRIVATE SECTION. ENDCLASS.
  2. Implement the method if_rap_query_provider~select on your class ZCL_CE_D425_INVOICES_##. To do this, copy the corresponding method implementation from sample solution ZCL_CE_D425_INVOICES_98.

    Note

    In the implementation of the select method, the io_request import parameter of this method is used to retrieve OData query options of the incoming OData call.

    Paging related settings are queried by io_request->get_paging( )->get_page_size( ) (query option $top) and io_request->get_paging( )->get_offset( ) (query option $skip). Any filters that have been set (query option $filter) are retrieved via io_request->get_filter( )->get_as_ranges( ).

    The paging and filter settings are passed to the existing get_invoices method, which then returns the appropriate data from the SAP S/4HANA on-premise system.

    However, not all OData query options are passed through to the OData service in the SAP S/4HANA on-premise system. For example, any requested sorting of the data (system query option $orderby) is not taken into account. This means that it will not be possible to sort the invoice data in the value help.

    1. If not already done, you can open the sample solution ZCL_CE_D425_INVOICES_98 in the ABAP class editor as follows:

      Select the Open ABAP Development Object icon from the Eclipse toolbar or press Ctrl+Shift+A. On the Open ABAP Development Object dialog that appears, enter ZCL_CE_D425_INVOICES_98 as search string. Then select ZCL_CE_D425_INVOICES_98 from the Matching Items area and choose OK.

    2. In the sample solution ZCL_CE_D425_INVOICES_98, mark the code of method implementation if_rap_query_provider~select and then copy it (for example, via CTRL+C).

      Code Snippet
      12345678910111213141516171819202122232425262728293031323334353637
      CLASS zcl_ce_d425_invoices_98 DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. ... METHODS get_invoices IMPORTING it_filter_cond TYPE if_rap_query_filter=>tt_name_range_pairs OPTIONAL iv_top TYPE i OPTIONAL iv_skip TYPE i OPTIONAL EXPORTING et_business_data TYPE tt_business_data RAISING /iwbep/cx_cp_remote /iwbep/cx_gateway cx_web_http_client_error cx_http_dest_provider_error. PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_ce_d425_invoices_98 IMPLEMENTATION. METHOD if_oo_adt_classrun~main. ... ENDMETHOD. METHOD get_invoices. ... ENDMETHOD. ENDCLASS.
    3. Paste the copied code into the implementation part of your class ZCL_CE_D425_INVOICES_##. Make sure that your class now looks like this:

      Code Snippet
      12345678910111213141516171819202122232425
      CLASS zcl_ce_d425_invoices_## DEFINITION PUBLIC FINAL CREATE PUBLIC . PUBLIC SECTION. INTERFACES if_oo_adt_classrun. INTERFACES if_rap_query_provider. ... . PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. CLASS zcl_ce_d425_invoices_## IMPLEMENTATION. METHOD if_oo_adt_classrun~main. ... ENDMETHOD. METHOD get_invoices. ... ENDMETHOD. ENDCLASS.
  3. Activate your class ZCL_CE_D425_INVOICES_##.

    1. To activate the class you can use the keyboard shortcut Ctrl+F3.

How to Expose the Custom Entity via the Service Definition and Integrate It as Value Help into the Base Application

For the steps and data of this demonstration, refer to the exercise Expose the Custom Entity via the Service Definition and Integrate It as Value Help into the Base Application.

Expose the Custom Entity via the Service Definition and Integrate It as Value Help into the Base Application

In this exercise, you will expose the previously created and implemented custom entity via the OData service of the base application. To do this, you add the custom entity to the corresponding service definition. You will then use the custom entity in the base application to provide a value help for customer invoices. Finally, you will test the application using the SAP Fiori elements app preview.

Note

In this exercise, when the values include ##, replace ## with your group number.

Sample Solution:

  • ZUI_425_COMPLAINT98_O4 (Service Definition)
  • ZC_425_COMPLAINT98 (CDS Projection View)

Steps

  1. Expose your custom entity ZCE_D425_INVOICES_## via service definition ZUI_425_COMPLAINT##_O4 by adding the following statement to the service definition:

    Code Snippet
    1
    expose ZCE_D425_INVOICES_## as Invoice;
    1. If not already done, you can open the service definition ZUI_425_COMPLAINT##_O4 in the editor as follows:

      Select the Open ABAP Development Object icon from the Eclipse toolbar or press Ctrl+Shift+A. On the Open ABAP Development Object dialog that appears, enter ZUI_425_COMPLAINT##_O4 as search string. Then select ZUI_425_COMPLAINT##_O4 from the Matching Items area and choose OK.

    2. Add the above statement to the service definition. Make sure that the service definition looks like this:

      Code Snippet
      1234
      define service ZUI_425_COMPLAINT##_O4 { expose ZC_425_COMPLAINT## as Complaint; }
  2. Activate your changes.

    1. To activate the service definition you can use the keyboard shortcut Ctrl+F3.

  3. Now define your custom entity ZCE_D425_INVOICES_## as a value help for field InvoiceID in the base application by adding the following annotation to this field in projection view ZC_425_COMPLAINT##:

    Code Snippet
    1234567
    @Consumption.valueHelpDefinition: [{ entity : { name: 'ZCE_D425_INVOICES_##', element: 'ID' }, additionalBinding : [{ localElement: 'CustomerID', element: 'Customer_ID' }, { localElement: 'CustomerName', element: 'Customer_Name' }] }] InvoiceID, ...

    Note

    The additionalBinding annotation ensures that the values of fields CustomerID and CustomerName in the base application are copied to the value help dialog when the value help is called. Accordingly, when a customer invoice is selected in the value help, these fields are filled with the values of the fields with the same names from the value help.
    1. If not already done, you can open the projection view ZC_425_COMPLAINT## in the editor as follows:

      Select the Open ABAP Development Object icon from the Eclipse toolbar or press Ctrl+Shift+A. On the Open ABAP Development Object dialog that appears, enter ZC_425_COMPLAINT## as search string. Then select ZC_425_COMPLAINT## from the Matching Items area and choose OK.

    2. Add the above annotation to the InvoiceID field in the projection view. Make sure that the projection view looks like this:

      Code Snippet
      123456789101112131415161718192021222324
      @AccessControl.authorizationCheck: #CHECK @Metadata.allowExtensions: true @EndUserText.label: 'Projection View for Complaint' @ObjectModel.semanticKey: [ 'ComplaintID' ] @Search.searchable: true define root view entity ZC_425_COMPLAINT## as projection on ZR_D425_COMPLAINT_## { key UUID, @Search.defaultSearchElement: true @Search.fuzzinessThreshold: 0.90 ComplaintID, InvoiceID, CustomerID, CustomerName, Reason, Action, Closed, CreatedBy, CreatedAt, LastChangedBy, LastChangedAt }
  4. Activate your changes.

    1. To activate the projection view you can use the keyboard shortcut Ctrl+F3.

  5. Finally, test the value help. To do this, open the SAP Fiori elements app preview for the Complaint entity set. Create a new complaint in the app and call the now available value help for the Invoice ID field on the Object Page.

    1. Open the service binding ZUI_425_COMPLAINT##_O4 in the editor if it is not already open.

    2. Select the entity set Complaint in the Entity Set and Association section of the service binding editor.

      Note

      In addition to entity set Complaint, entity set Invoice is now also displayed in this section.
    3. Choose Preview....

      Note

      If you are not logged on automatically, click the <xxxxxxxxx>.accounts.ondemand.com link that appears on the displayed browser page. If then prompted, enter your E-Mail address followed by the Password in the relevant input fields in the browser. You will receive the required e-mail address and password from your instructor. Finally choose the Log On button to log on to the ABAP system.
    4. In the displayed app, choose Create.

    5. On the Object Page, click the value help icon displayed for the Invoice ID field to open the value help.

      Result

      The value help dialog opens and displays the customer invoices selected from the SAP S/4HANA on-premise system in the Items table.
    6. Select an invoice from the Items table.

      Result

      The selected record is transferred to the Object Page, i.e. fields Invoice ID, Customer ID, and Customer Name are filled with the corresponding values.

SAP Fiori Launchpad Integration

To make the application available on the SAP BTP ABAP Environment via the SAP Fiori launchpad, the following steps must be implemented: First, a List Report Object Page application is created using the SAP Business Application Studio. This application is deployed to the ABAP service instance, which, among other things, creates a Fiori Launchpad App Descriptor Item on the ABAP Environment.

The figure visualizes the explanations given below.

Subsequently, an IAM app is created via ADT, to which the Fiori Launchpad App Descriptor Item is assigned. Next, an IAM business catalog is created in ADT, which in turn is assigned the IAM app.

Finally, a business role is created via the SAP Fiori launchpad, to which the previously created IAM business catalog is added. In addition, the business users who are to have access to the application are also added to the business role.

After this has been configured accordingly, the authorized users can open the application via the App Finder in the SAP Fiori launchpad.

How to Create an SAP Fiori Elements Application Based on the Developed OData Service in SAP Business Application Studio

For the steps and data of this demonstration, refer to the exercise Create an SAP Fiori Elements Application Based on the Developed OData Service in SAP Business Application Studio.

Create an SAP Fiori Elements Application Based on the Developed OData Service in SAP Business Application Studio (optional)

In the previous exercises, you created an application for managing customer complaints on the SAP BTP ABAP Environment. In this application, you integrated a value help via a side-by-side extension that gets its data via an OData service called in the SAP S/4HANA on-premise system used in this class.

The user interface of the application has so far been made available by means of an SAP Fiori elements app preview, which can be called from the ABAP Development Tools. The following exercises will now focus on creating the user interface for the application using the SAP Business Application Studio and then deploying it to the SAP BTP ABAP Environment.

Note

In this exercise, when the values include ##, replace ## with your group number.

Note

The following data is required in the exercise to connect the SAP Business Application Studio with Cloud Foundry. It will be provided by your instructor:
  • E-mail Address
  • Password
  • Organization

Steps

  1. Open your dev space S4D425_## in the SAP Business Application Studio. Execute the command CF: Login to Cloud Foundry to connect the SAP Business Application Studio with Cloud Foundry.

    1. Open the SAP Business Application Studio using the URL you received from your instructor.

    2. If you have not been logged on automatically, choose the <xxxxxxxxx>.accounts.ondemand.com link that appears on the displayed browser page. If then prompted, enter your E-Mail address followed by the Password in the relevant input fields in the browser. You will receive the required E-mail address and password from your instructor. Finally choose the Log On button to log on to the SAP Business Application Studio.

      Result

      The Dev Space Manager is displayed in the browser.
    3. Make sure that your dev space is in the RUNNING state. If it is not, start it.

    4. Click the name S4D425_## of your dev space as soon as it is in the RUNNING state.

      Result

      The SAP Business Application Studio is opened in your SAP Fiori dev space S4D425_##.
    5. From the SAP Business Application Studio menu, select the path ViewCommand Palette.

    6. On the palette that appears, look for the command CF: Login to Cloud Foundry and select it.

      Result

      The wizard for Cloud Foundry login is started.
    7. In the Enter Cloud Foundry endpoint step, confirm the displayed URL with ENTER.

    8. In the Enter e-mail address step, enter the e-mail address provided by your instructor and confirm your input with ENTER.

    9. In the Enter password step, enter the password provided by your instructor and confirm your input by pressing ENTER.

    10. In the next step, select the Organization provided by your instructor.

    11. In the Select Space step, select the displayed Space named dev.

      Result

      You are now logged in to Cloud Foundry, Organization and Space have been set.
  2. Now create an SAP Fiori application using the List Report Page floorplan in the SAP Business Application Studio. The application is to be based on your OData service developed in ADT. To do this, use the following values in the respective wizard steps:

    Data Source and Service Selection

      
    Data sourceConnect to a System
    SystemABAP Environment on SAP Business Technology Platform
    ABAP environmentdefault_abap
    Service

    ZUI_425_COMPLAINT##_O4(0001) - OData V4

    Entity Selection

      
    Main entityComplaint
    Automatically add table columns?Yes

    Project Attributes

      
    Module names4d425_complaint_##
    Application titleComplaints
    Application namespace
    DescriptionManage Complaints
    Project folder path/home/user/projects
    Add deployment configurationYes
    Add FLP configurationYes
    Configure advanced optionsNo

    Deployment Configuration

      
    Please choose the targetABAP
    Destinationabap-cloud-default_abap-...
    SAPUI5 ABAP Repository (Maximum length: 15 characters)Z_COMPLAINT_##
    PackageZS4D425_##_CLD
    Transport Request<your transport request>
    Deployment DescriptionStudent ##

    Note

    You can look up your transport request number as follows:

    1. For How do you want to enter Transport Request select Choose from existing.
    2. Then in field Transport Request select via dropdown menu your ADT request (for example, H01K900008).

    Note

    The deployment configuration can be edited after creating the project via the file ui5-deploy.yaml in the project directory.

    Fiori Launchpad Configuration

      
    Semantic ObjectComplaint
    Actionmanage##
    TitleManage Complaints
    Subtitle (optional)Student ##

    Note

    The Fiori launchpad configuration can be edited after creating the project via the file webapp/manifest.json in the project directory.
    1. Choose FileNew Project from Template from the SAP Business Application Studio menu.

    2. In the Project From Template wizard that appears, select the SAP Fiori application tile and choose Start.

    3. In the Floorplan Selection step, select SAP Fiori Application as Application Type, choose the List Report Page tile and press Next.

    4. In the Data Source and Service Selection step, enter the values from the corresponding table above and choose Next.

    5. In the Entity Selection step, enter the value from the corresponding table above and choose Next.

    6. In the Project Attributes step, enter the values from the corresponding table above and choose Next.

    7. In the Deployment Configuration step, enter the values from the corresponding table above and choose Next.

    8. In the Fiori Launchpad Configuration step, enter the values from the corresponding table above and choose Finish.

      Result

      Your SAP Fiori elements project is generated and saved for future use.
  3. Open the s4d425_complaint_## project you just created in a workspace.

    1. Select FileOpen Workspace... from the SAP Business Application Studio menu.

    2. In the Open Workspace dialog box that appears, select the s4d425_complaint_## folder and choose Open.

      Result

      The s4d425_complaint_## project is opened in the SAP Business Application Studio.
  4. In the next exercise, you will deploy the SAP Fiori elements application you just created to the SAP BTP ABAP Environment. Before that, test the application in this last step in SAP Business Application Studio.

    1. Right-click on the webapp folder in your project s4d425_complaint_## and select Preview Application from the context menu that appears.

    2. In palettePreview Options select start (Fiori run …) in the dialog that appears.

      Result

      The application will now be displayed in a new tab. The user interface should be similar to the one displayed via the SAP Fiori elements app preview in ADT.
    3. Press Go on the displayed List Report page to view the existing records.

    4. Select a record from the table to display the associated Object Page.

How to Deploy the SAP Fiori Elements Application to the SAP BTP ABAP Environment

For the steps and data of this demonstration, refer to the exercise Deploy the SAP Fiori Elements Application to the SAP BTP ABAP Environment.

Deploy the SAP Fiori Elements Application to the SAP BTP ABAP Environment (optional)

In this exercise, you will deploy the SAP Fiori elements application created in the SAP Business Application Studio to the SAP BTP ABAP Environment. You will then check in ADT the development objects that were created by the deployment to the SAP BTP ABAP Environment.

Note

In this exercise, when the values include ##, replace ## with your group number.

Steps

  1. Deploy your project s4d425_complaint_## from the SAP Business Application Studio to the SAP BTP ABAP Environment. To do this, use the npm run deploy command in the terminal.

    1. Choose TerminalNew Terminal from the SAP Business Application Studio menu.

    2. At the command prompt in the terminal, enter the npm run deploy command and press ENTER:

      Code Snippet
      1
      user: s4d425_complaint_## $

      Note

      Make sure that the terminal is opened in the project directory. The $ character must be preceded by user: s4d425_complaint_##.
    3. When prompted, confirm the deployment configuration displayed and then press y.

      Result

      The deployment to the SAP BTP ABAP Environment is now executed. At the end of the deployment process, you should see the Deployment Successful message in the terminal.
  2. Several development objects were created on the SAP BTP ABAP Environment via the deployment. The following two objects are particularly important for the next exercise: The actual SAPUI5 application was stored as a BSP application with the name Z_COMPLAINT_##. The configuration for integrating the application into the SAP Fiori launchpad, on the other hand, was saved in a so-called Fiori Launchpad App Descriptor Item with the name Z_COMPLAINT_##_UI5R.

    Check whether these two development objects are displayed in ADT under your package. To do this, first refresh the display of your package in ADT.

    Note

    Neither the BSP application nor the Fiori Launchpad Application Descriptor Item can be opened in ADT.
    1. Right-click in ADT on your package ZS4D425_##_CLD and select Refresh from the context menu that appears. Alternatively, you can also use the function key F5.

    2. The BSP application Z_COMPLAINT_## should now be displayed under the following node in your package: ZS4D425_##_CLDBSP LibraryBSP Applications.

    3. The Fiori Launchpad Application Descriptor Item Z_COMPLAINT_##_UI5R should appear under the following node in your package: ZS4D425_##_CLDFiori Launchpad App Descr Items.

How to Integrate the SAP Fiori Elements Application into the SAP Fiori Launchpad of the SAP BTP ABAP Environment

For the steps and data of this demonstration, refer to the exercise Integrate the SAP Fiori Elements Application into the SAP Fiori Launchpad of the SAP BTP ABAP Environment.

Integrate the SAP Fiori Elements Application into the SAP Fiori Launchpad of the SAP BTP ABAP Environment (optional)

In this exercise, you will integrate the SAP Fiori elements application that you deployed to the SAP BTP ABAP Environment in the last exercise into the SAP Fiori launchpad. To do this, you will first create an IAM app in ADT. To configure the IAM app, you will enter the Fiori launchpad app descriptor item for your application in the properties of the IAM app. Then you will create an IAM business catalog in ADT, to which you will add the IAM app via a so-called IAM app to catalog assignment. Then, after you have published the IAM app and the IAM business catalog locally, you will finally create a business role via the SAP Fiori launchpad (of the ABAP Cloud Service) and assign both the IAM business catalog and your user to it.

Note

In this exercise, when the values include ##, replace ## with your group number.

Steps

  1. In ADT, create an IAM app with the name ZD425_COMPLAINT_IAM_## and the description Complaint IAM App.

    Note

    The development environment automatically appends the suffix _EXT to the name of the IAM app.

    Assign your existing Fiori launchpad app descriptor item Z_COMPLAINT_##_UI5R to the IAM app.

    Don't forget to save your changes.

    1. In ADT, right-click on your package ZS4D425_##_CLD and select NewOther ABAP Repository Object.

    2. On the dialog that opens, search for IAM App, select it and click Next.

    3. Enter ZD425_COMPLAINT_IAM_## as Name and Complaint IAM App as Description. Make sure that EXT - External App is selected as Application Type and press Next.

    4. In the Selection of Transport Request step, make sure that the option Choose from requests in which I am involved is selected. Select the transport request you created in a previous exercise and choose Finish.

      Result

      The IAM app is generated and displayed in the editor.
    5. In the Fiori Launchpad App Descr Item ID field, enter the value Z_COMPLAINT_##_UI5R.

      Note

      You can use an input help for this in the field, which can be called via Ctrl+Space.
    6. Finally, save the IAM app.

  2. Publish your IAM app ZD425_COMPLAINT_IAM_##_EXT locally.

    1. Make sure that your IAM app ZD425_COMPLAINT_IAM_##_EXT is displayed in the editor.

    2. Choose Publish Locally in the upper right corner of the editor.

  3. Now create an IAM business catalog with the name ZD425_COMPLAINT_BC_## and the description Complaint IAM Business Catalog ##. Add your IAM app ZD425_COMPLAINT_IAM_##_EXT to this catalog.

    Note

    For this step, use the link Create a new Business Catalog and assign the App to it that is displayed in the editor for your IAM app ZD425_COMPLAINT_IAM_##_EXT.
    1. Make sure that your IAM app ZD425_COMPLAINT_IAM_##_EXT is displayed in the editor.

    2. Click on the link Create a new Business Catalog and assign the App to it.

    3. In the Business Catalog dialog that opens, enter the nameZD425_COMPLAINT_BC_## and descriptionComplaint IAM Business Catalog ## and press Next.

    4. In the Selection of Transport Request step, make sure that the option Choose from requests in which I am involved is selected. Select the transport request you created in a previous exercise and choose Finish.

      Result

      The Business Catalog App Assignment dialog opens.
    5. Make sure that the dialog shows ZD425_COMPLAINT_BC_##_0001 as the name and Business Catalog to IAM App assignment as the description. Then press Next.

    6. In the Selection of Transport Request step, make sure that the option Choose from requests in which I am involved is selected. Select the transport request you created in a previous exercise and choose Finish.

  4. Publish your IAM business catalog ZD425_COMPLAINT_BC_## locally.

    1. Make sure that your IAM business catalog ZD425_COMPLAINT_BC_## is displayed in the editor.

    2. Choose Publish Locally in the upper right corner of the editor.

  5. Now open the Maintain Business Roles application via the SAP Fiori launchpad of the SAP BTP ABAP Environment. Create a new business role with the business role ID ZD425_BR_## and the business role description S4D425 Student ##.

    Add your IAM business catalog ZD425_COMPLAINT_BC_## and your business user to the newly created business role.

    Note

    For details on the business user assigned to you, contact your instructor.
    1. Right-click on your ABAP Cloud Project in the Project Explorer and select Properties in the context menu that appears.

    2. In the dialog box that opens, select ABAP Development on the left side, and then click the System URL that appears on the right side.

    3. If you are not automatically logged in, click the <xxxxxxxxx>.accounts.ondemand.com link on the page displayed in the browser to perform the logon. If then prompted, enter your E-Mail address followed by the Password in the relevant input fields in the browser. You will receive the required e-mail address and password from your instructor. Finally choose Log On to log on to the ABAP system.

    4. Now select the Maintain Business Roles tile from the Identity and Access Management page (in space Administration).

    5. In the Maintain Business Roles application that appears, select New from the footer bar.

    6. On the New Business Role dialog, enter ZD425_BR_## as the Business Role ID and S4D425 Student ## as Business Role Description. Then choose Create.

    7. On the page that appears, select the Assigned Business Catalogs tab.

    8. Select Add on the Assigned Business Catalogs tab.

    9. On the Add Business Catalogs dialog, search for your business catalog ZD425_COMPLAINT_BC_## (Complaint IAM Business Catalog ##), select it, and press OK.

    10. Now switch to the Assigned Business Users tab.

    11. Press Add on the Assigned Business Users tab.

    12. On the Add Business Users dialog, search for your business user, select it, and press OK.

    13. In tab General Role Details, set for field Access CategoriesWrite, Read, Value Help the value Unrestricted. For field Read, Value Help set value Unrestricted, too.

    14. Finally, save your business role using the Save button. Confirm the pop-up that may appear by pressing OK.

  6. Finally, add the SAP Fiori elements application to the Communication Management page of space Administration of the SAP Fiori launchpad and test the application from the launchpad.

    Note

    To ensure that the business role configuration you just performed is active in the system, it may be necessary to refresh the SAP Fiori launchpad in the browser first.
    1. Open the User Actions Menu via the button in the upper right corner of the SAP Fiori launchpad and select the Edit current page entry.

    2. For group Communication Management, select function Add Section.

    3. To the new section, apply S4D425 Functions as title. Move the section up to the very top.

    4. Select Add tile from within your new section.

    5. On the left side in the App Finder, select your business catalog Complaint IAM Business Catalog ##.

      Result

      On the right side of the screen, you will now see the Manage Complaints - Student ## tile.
    6. Click on the pin in the lower right corner of the tile.

    7. Now select Home (the SAP icon) from the navigation menu to return to the Edit current page page.

    8. Choose Back to return to the homepage.

    9. Select the tile Manage Complaints - Student ## to start the application.

    10. On the List Report page that appears, choose Go to view the available records.

    11. Select a record from the table to call the corresponding Object Page.

Log in to track your progress & complete quizzes