4.2 Activating the OData Services
In Chapter 3, we discussed how the SAP Fiori client, ABAP front-end, and ABAP back-end communicate, and how apps send OData requests through the ABAP front-end server to the ABAP back-end server securely by a trusted RFC. In this section, we’ll discuss how to activate the OData service. For those who are new to OData services, we’ll discuss it in greater detail in Chapter 7. To keep it simple, OData is a standardized protocol built over existing HTTP and REST protocols to support CRUD operations for creating and consuming data APIs.
To begin activating the OData services for your app, follow these steps:
-
From the app-specific page (Create Sales Order) in the apps reference library, copy the technical name of the OData service from the oData Service section (see Figure 4.6).
Figure 4.6 OData Service for Create Sales Order App
- Run Transaction /IWFND/MAINT_SERVICE to activate and maintain services on the front-end server, and press (Enter).
-
On the Activate and Maintain Services page, click Add Service (see Figure 4.7).
Figure 4.7 Adding Service
- Enter the System Alias of your back-end system.
-
In the External Service Name field, enter the information shown in Figure 4.8. Then, enter the Technical Service Name of the OData service for your app. (In this example, it’s the technical name that you copied in Step 1.) Click Get Services.
Figure 4.8 Get Services
-
Select the service name in the Select Back-end Services section. From here, click Add Selected Services (see Figure 4.9).
Figure 4.9 Adding Selected Service
- Enter the Technical Service Name for the service in your customer namespace.
- Assign a package, or click Local Object (see Figure 4.10).
- Click Execute to save the service.
- After the service is activated, you should receive a pop-up message, which you can confirm (click the green checkmark; see Figure 4.11).
Figure 4.10 Assigning Package
Figure 4.11 Activation Confirmation
The service is now added and activated successfully!
Now, let’s check whether this service is responding by running it in a browser. To do so, follow these steps:
-
Click the
button to go back to the Activate and Maintain Services screen.
- Check whether the SAP System Alias is maintained correctly. If not, delete the alias and add the correct one.
-
Select the ODATA node, and click Call Browser (see Figure 4.12).
Figure 4.12 Calling OData Service
-
Select the Remember My Decision checkbox, and then click Allow (see Figure 4.13).
Figure 4.13 Allowing Access
You’ve now tested the service, and it works like a charm. Next, let’s check whether the hash key is generated. A hash key is generated whenever you call a service. This key is required for the generation of an authorization profile. You can restrict access to the system on the system level.
You can verify the hash key generation in the hash key table. To do so, follow these steps:
- Return to SAP GUI (front-end server), and run Transaction SE16 to view the table contents.
-
Enter “USOBHASH” in Table Name, and click on the Table Content button (see Figure 4.14).
Figure 4.14 Hash Key Table
-
On the next screen, enter the following details, and click Execute (see Figure 4.15):
- PGMID: “r3tr” (program ID)
- OBJECT: “IWSG” (object type)
- OBJ_NAME: “ZSRA017*” (service name activated in the previous steps)
Figure 4.15 Selection Screen
You should see a table content screen, like the one in Figure 4.16.
Figure 4.16 Hash Key
You’ve now activated the ICF and OData service successfully. The next step is to set up the roles and authorizations for users to access this app.