Professional Documents
Culture Documents
A to Z of
SAP OData Services
Assignment 2 –Create OData Service in SAP using SEGW
Assignment:
Create OData Service using Transaction Code SEGW.
1. The service is created to get Purchase Order Header and Item data from tables
EKKO and EKPO respectively.
2. The fields required from Header are as below
Instructions:
1. [TCODE]: Go to Transaction code with name TCODE
2. Replace 00 in the object names with unique 2-digit identifier
3. SAP GUI theme used here is ‘SAP Signature Theme’
Create a package: Z00 (replace 00 with unique number). Every time you need to
enter a package – use this package.
4. Create a TR in [SE01]
Every time you need to select a TR – use this TR. Above TR is only for example.
Please create your own TR. This step is not repeated at all places in the solution.
Solution:
Step 1. [SEGW] Create a project.
Click on Create.
Created project will appear as below. Click Save to save the project.
Note: At all subsequent steps – use the same TR when a TR is asked for. This screenshot is not
repeated further.
Expand the node Data Model by clicking the highlighted triangle icon.
The 3 nodes i.e., Entity Types, Associations and Entity Sets will appear.
Step 2. [SE11] Create structures for Purchase Order Header and Purchase Order Item data.
As this structure contains Quantity (MENGE) and Amount (BRTWR) fields, providing
currency/quantity field reference currency/unit is mandatory.
Enter Entity Type Name as ‘POHeader’ and check the checkbox for Create Related Entity Set.
Entity Set Name will be populated automatically. Click okay.
Expand the POHeader node and double click on Properties to see all imported properties.
Similarly, create Entity Type for Item Data. Right click on Entity Type node and select Create.
Enter entity name as POItem, check the checkbox to Create Related Entity Set.
This time select PO Number i.e. EBELN and Item Number ilel EBELP both as keys.
Click Finish to get message that properties are added successfully. Ignore warnings if any at this
point.
All the fields will be populated already. You may choose to remove extra Z in all class names.
i.e., instead of ZCL_Z00_ use ZCL_00_. It is fine if you don’t do this and keep the names
proposed.
Click okay.
Save in TR.
Note: Remember, ZCL_00_PO_DATA_DPC_EXT is the data provider class extension where actual
code will be implemented.
The Runtime Artifact shows service name Z00_PO_DATA_SRV. This is the service name that will
be used to register / activate the service.
Select System Alias as LOCAL & Technical Service Name from previous step i.e.,
Z00_PO_DATA_SRV and click on Get Services.
Service will appear in the bottom section. Select the service and click on Add Selected Services.
You will get a popup saying service is created and metadata is loaded.
Provide service name as Z00_* (You can also provide full name).
Your service will appear as below. Now, click on SAP Gateway Client.
Since we have generated, registered and activated the service – we should be able to test the
service and the metadata.
Service URI: /sap/opu/odata/sap/Z00_PO_DATA_SRV/?$format=xml
Click Execute.
Service Creation is now complete. Next step to implement the service operations continues in
next assignment.
If you want to Master SAP OData Services Building, then ENROLL Today.
Course Curriculum - https://tinyurl.com/au47uvzn
Day wise break up - https://tinyurl.com/5h6uzfnf
Enrollment Fee 124 USD - https://www.zapcademy.com/s/store/courses/description/A-to-Z-
of-SAP-OData-Services
Course Days – 3, 4, 10, 11, 17, 18, 24 Sept, 1, 2 & 8 Oct 2022 IST Dates
Time: 7:30 AM - 10:00 AM IST
Server Access till Oct 31 2022