A little roadmap to create an OData service in SAP.
If the version of the Netwearver is greater than 7.3, the component is already installed:
When the version is less than 7.4, you need to install these two components:
Transactions separated by Front End and Back End systems:
Go to SEGW (in the Back End System), and create a new project:
Entity Type: Is the Structure, define the types, etc.
Entity Set: Is the “Internal Table”.
Creating the data Model, based on SAP Table.
Choose the fields:
Needed to define a key:
Proprieties: are like the FIELDS.
Every Service Implementation Entity Set will have its own Operations (Create, GetEntity, Update, Delete etc).
Technical Service Name: Name which the external system needs to call.
Add Service to Service Catalog (Register the Service to Gateway Hub)
Go to your Gateway Hub (Front-end system) and execute t-code /n/IWFND/MAINT_SERVICE.
System Alias is the Back End System. Search for your External Service Name.
Click on it, and specify a package:
Search your service in the list, and check if it is activate (green.), if not, activate it.
Ok. We can test it, still in the front end, click in “SAP Gateway Client” or enter in the transaction /IWFND/GW_CLIENT.
Implementing the method POHEADERSET_GET_ENTITYSET to get return of Values.
Go to change mode in the DPC Extension class. Always edit the extension class, because we are enhancing the class.
Change like below, save and activate:
Now, we can test with the method:
Implementing the method to return a determine PO
same thing before, but now, redefine POHEADERSET_GET_ENTITY method, and change to code below.
DATA : ls_key_tab LIKE LINE OF it_key_tab,
* IT_KEY_TAB has key name and value
IF sy-subrc EQ 0.
* Select one PO entry
it is going to looks like this:
And in the GW client, we can search for one PO: