Note: To see the latest information about the Operator, go to the SC3 documentation.
Creating a well-defined SAP Gateway OData service for use with IBM App
Connect
Learn how to create a well-defined SAP Gateway OData service, as part of the general
requirements for SAP OData, to enable IBM® App
Connect to pass key information between a SAP OData
system and your apps.
About this task
As part of the general requirements for connecting SAP OData to App Connect, the SAP Gateway
OData service must conform to the following requirements:
Define your SAP objects without relationships. The SAP OData connector in App Connect does not
support object relationships. If your SAP service is defined with object relationships, then App
Connect lists your SAP objects for CRUD operations, but ignores the relationship information.
Ensure that your SAP Gateway OData service is enabled with sap:creatable:true
flag. If sap:creatable:false is used, then App Connect ignores the objects
identified from your SAP service for CREATE operations; however your objects will be available for
RETRIEVE, UPDATE, and DELETE operations.
Ensure that the operations are implemented for the service. App Connect uses a
SERVICE_URL/metadata call to obtain a list of operations to display. But it does not verify if the
obtained operations are implemented.
Ensure that an object property that you want to use does not have
sap:filterable="false". If all the fields of an object have sap:filterable='false'
then App Connect won't support the RETRIEVE operation.
Ensure that your SAP objects do not have composite keys. (Composite keys are currently not
supported by App Connect.) Example of a Customer object with composite
key
To configure a well-defined SAP Gateway OData service, complete the following steps in
your SAP system. These steps cover the general procedure, but need some consideration for your own
SAP OData system and your preferred techniques for configuring SAP.
Display the SAP Gateway Service Builder (transaction SEGW)
Create a project
Figure 1. Select Create Project
Configure details for the project
Chose a project name, give your project a description, select Standard generation strategy, and
specify the package. The project will be saved as a local object (Package: $TMP, or click Local
Object.)
Figure 2. Create Project, specify details
Create the Entity type by importing a pre-defined DDIC Structure for the Order header.
Right-click Data Model, and then select Import > DDIC Structure.
Figure 3. Data Model, Import > DDIC Structure
Choose the required structure.
If the Sales order structure is not available in your SAP system, select the ABAP structure ZST_VBAK. Click Next.
Figure 4. Import from DDIC Structure, step 1 of 3
Choose the required fields, and then click Next.
Figure 5. Import from DDIC Structure, step 2 of 3
Select the key field, VBELN, and then click Finish.
Figure 6. Import from DDIC Structure, step 3 of 3 Result: You should now see the new Entity that has been created.
Repeat the same sequence of steps from 4 to 7 to import the next structure,
OrderStatus.
This structure might be an Item structure. The following example shows the import of another
custom structure called ZST_SO_STATUS.
Second Import from DDIC Structure, step 1 of 3
Second Import from DDIC Structure, step 2 of 3
Second Import from DDIC Structure, step 3 of 3
When you have completed the preceding steps, you should see the two newly-created Entity
Types: OrderStatus and SalesOrder: Figure 7. Result of Import from DDIC Structures – The two
newly-created Entity Types: OrderStatus and SalesOrder
Create the Entity Sets for the entity types that you have just created.
Right-click the folder Entity Sets, and then select Create.
Figure 8. Create Entity Sets
Create an Entity Set SalesOrderSet for the entity type SalesOrder.
(A naming convention is to make the Entity Set name by appending ‘_Set’ to the Entity Type name.)
Figure 9. Create Entity Set SalesOrderSet for the entity type SalesOrder
Create an Entity Set OrderStatusSet for the entity type OrderStatus:
Figure 10. Create Entity Set OrderStatusSet for the entity type OrderStatus
You should now see the newly-created entity sets:
Figure 11. The newly-created Entity Sets
Create the Associations which sets the cardinal rules, and then click Next.
Figure 12. Create Association, step 1 of 3
Set the Dependent Property, Vbeln, and then click Next.
Figure 13. Create Association, step 2 of 3
Click Finish.
Figure 14. Create Association, step 3 of 3
Click Save.
Figure 15. Save the changes made
Check Consistency. Right-click ZORDER_MAINTAIN and then select Check Consistency:
Figure 16. Check Consistency
Generate runtime objects
To use the service with the changes that you have
made, you need to generate the runtime objects. This creates the underlying ABAP classes that
contain all the information that you've specified in the service builder. Click the Generate Runtime
Objects icon or right-click ZORDER_MAINTAIN and then select Generate Runtime: Figure 17. Generate
Runtime Objects
While generating the runtime objects, the class
and service details are generated as shown below.
Figure 18. Generate Runtime Objects – Model
and Service Definition
Now, you should see that the runtime objects were created successfully:
Figure 20. Messages confirming that the runtime objects were created
This completes the design stage. Next, you need to develop the code as part of the implementation.
Expand the Runtime Artifacts folder.
Figure 21. Expand the Runtime Artifacts folder
Double-click the Data Provider Class Extension (DPC_EXT)
Figure 22. Double-click the Data Provider Class Extension (DPC_EXT)
Implement the insert method
Because more than one structure or table is involved, you need to implement the method
'/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY' for implementing CREATE (POST) functionality for
deep insert. However, for single insert, you can use the CREATE_ENTITY method.
To implement the method, first click the Change Mode icon:
Figure 23. Click the Change Mode icon
Select the method:
Deep Insert (Nested)
Figure 24. Select the Deep Insert method
Independent Insert Implement separate CREATE ENTITY methods as shown below:
Figure 25. Select the Independent Insert method
After selecting the method, click the Redefine icon.
Figure 26. Click the Redefine icon to redefine and edit the method
The method has been redefined and is available to code the business logic.
Add the business logic for your requirements.
Figure 27. Add business logic to the method
After completing the logic development, the CREATE functionality is complete.
Register the service Use Service Registration: Transaction: /IWFND/MAINT_SERVICE
In the Activate and Maintain Service window, click Add Service
Figure 28. Activate and Maintain Service window – Add Service
Get the Technical service name from the transaction SEGW.
The Runtime artifact which ends with 'SRV' in SEGW refers to the Technical Service; for
example:
Figure 29. Example runtime artifact in SEGW that refers to the Technical Service
In the next screen, specify the System Alias (created by Basis) and the new service which has been created.
After that, click the Get Services icon. The result is displayed:
Figure 30. Result: New service has been added
Click Add Selected Services.
This adds the service so that it can be used by App Connect.
Results
A well-defined SAP Gateway OData service has been created so that it can be used by App
Connect.