SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Enrich your Shell Plug-in with OData Services

Learn how to enrich your shell plug-in with the use of OData Services to expose user-related information.

Overview

🎓 intermediate 45 min. SAP BTP ABAP EnvironmentIntermediateABAP DevelopmentSAP Business Application StudioSAP S 4hana Cloud ABAP Environment

You will learn

  • โœ”How to create an OData Service to expose user-related information using the ABAP Developer Tool in Eclipse.
  • โœ”How to add the OData Service to your SAPUI5 project in Business Application Studio.
  • โœ”How to adjust your SAPUI5 project so that the user-related data is displayed when accessing the application.

Prerequisites

Prerequisites

This tutorial was written for SAP BTP ABAP Environment. However, you should be able to use it in SAP S/4HANA Cloud Environment in the same way.

Throughout this tutorial, you will create various development objects and UI components. Wherever the suffix ### or 000 is used, please replace it with your initials or group number.

Steps

Step 1 Create a Business User Role Data Definition
โ€”

In this tutorial you will continue working on the shell plug-in you created in the pervious tutorial in this series. You will learn how to enrich it using OData Services to expose user-related information. To do this, you will first need to create a Data Definition to expose the User ID of the current user and the corresponding Business Role information.

  1. Access ABAP Developer Tool in Eclipse, connect to your SAP BTP ABAP Environment, and open the package you created as part of the previous tutorial.

  2. Right click on the package and select New > Other ABAP Repository Object:

    Create data definition
    Create data definition

  3. In the search bar, search for Data Definition and click on it.

    Create data definition - create
    Create data definition - create

  4. Enter a Name and a Description. Click on Next.

    Create data definition - create 2
    Create data definition - create 2

  5. Click on Next, then on Finish.

    Create data definition - no tr needed
    Create data definition - no tr needed

  6. The Data Definition is initialized with a pre-filled code based on your chosen template. Adjust it as follows:

    ABAP
    @AccessControl.authorizationCheck: #NOT_REQUIRED
    @EndUserText.label: 'Business User Role'
    define root view entity Z_C_BusinessUserRole_### as select from I_IAMBusinessUserBusinessRole as _BusinessUserRole
    association [0..*] to I_IAMBusinessRoleText as _BusinessRoleText on $projection.BusinessRoleUUID = _BusinessRoleText.BusinessRoleUUID
    {
    key abap.char'Me' as ID,
    key _BusinessUserRole.BusinessRoleUUID as BusinessRoleUUID,
    _BusinessUserRole.BusinessRole as BusinessRole,
    _BusinessRoleText.Name as Name,
    /* Associations */
    _BusinessRoleText
    }
    where _BusinessUserRole.UserID = $session.user
  7. Save your Data Definition and activate it using the Activate icon.

    Activate
    Activate

Step 2 Create a Business User Data Definition
+
Step 3 Create a Service Definition
+
Step 4 Create a Service Binding
+
Step 5 Add the OData Service to your SAPUI5 Project
+
Step 6 Adjust your SAPUI5 Project
+
Step 7 Preview your SAPUI5 Application
+
Step 8 Deploy your Enhanced Shell Plug-in
+
Step 9 Test your Shell Plug-in
+
Step 10 Test Yourself
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 10
1. Create a Business User Role Data Definition 2. Create a Business User Data Definition 3. Create a Service Definition 4. Create a Service Binding 5. Add the OData Service to your SAPUI5 Project 6. Adjust your SAPUI5 Project 7. Preview your SAPUI5 Application 8. Deploy your Enhanced Shell Plug-in 9. Test your Shell Plug-in 10. Test Yourself

Learn more →