Professional Documents
Culture Documents
2. Create the first entity by importing an RFC interface. For this right-click on Data Model and choose Import ->
RFC/BOR Interface
3. Enter the following values in the wizard and then choose Next:
Entity Type Name
SalesOrder
Target System
Local
BAPI_EPM_SO_GET_LIST
5. In the first line, SO_ID, select the field Is Key and choose Finish:
6. Create the second entity again by importing an RFC interface. Right-click Data Model and choose Import ->
RFC/BOR Interface
SalesOrderItem
Target System
Local
BAPI_EPM_SO_GET_LIST
9. In the first and second line, SO_ID, SO_ITEM_POS, select the field Is Key and choose Finish:
Now our project has 2 entities one for the Sales Order and one for the Sales Order Line Item. As
a next step we create entity-sets out of these entities.
1. Expand the node Data Model and double-click Entity Sets:
2. Click the Create button twice to add two new lines to the table:
Name
SalesOrderCollection
SalesOrder
SalesOrderItemCollection
SalesOrderItem
4. Choose Save:
Now the basic definition of the Model is done. As a next step we can generate the necessary
runtime artifacts.
1. Choose the Generate pushbutton:
Please note the Technical Service Name ZGW100_XX_SO_SRV is equal to the External Service Name
required to consume this service later on.
3. Choose Local Object:
2. Select system ZME and choose the Register button. Please note that the entries listed here
depend on the System Alias configuration you have done in the SAP NetWeaver Gateway
Implementation Guide (IMG). In a local deployed environment (Backend and Hub components
deployed on the same box) you might also find LOCAL with the RFC destination NONE here.
4. Press F4 to select the system alias. Select ERP_EMEA from the input help. Please note that you
wont get any popup if there is only 1 System Alias maintained. As mentioned above, depending
on the deployment method and IMG configuration you possibly see an alias LOCAL instead of
the ones shown in the screen shot:
6. Leave the default values and enter $tmp as the package and choose Enter:
The External Service Name is defaulted with the Technical Service Name from the Generation Step.
7. Verify that the service has been registered and activated successfully:
Now we can run our service the first time. Please note that weve only maintained the basic
model data so far. As a consequence we can access the metadata of the service, but not yet any
business data (that will come in part 2).
1. Open a new window, start transaction /IWFND/GW_CLIENT.
2. Enter URI: /sap/opu/odata/sap/ZGW100_XX_SO_SRV/$metadata and choose Execute:
Nishant Kumar
Sep 23, 2015 6:20 AM
Great Note on OData Services. Thank you so much.
Kavitha Fredrick in response to Volker Drees on page 19
Jul 15, 2015 8:00 AM
Done..
Thanks
Volker Drees in response to Kavitha Fredrick on page 19
Jul 14, 2015 3:33 PM
Hi Kavitha,
the mentioned buttons are typically greyed out if the project has not been generated. In that case no runtime
artifacts exist which can be used for e.g. registration.
Can you please try to generate the project and check if the buttons are still disabled?
Best Regards, Volker
Kavitha Fredrick
Jul 14, 2015 7:22 AM
Hi Volker,
This is an excellent document. Thank You.
During "Service Maintenance", after I select the system, I see all buttons like "Register,Maintain, Error Log and
Gateway Client" are disabled(greyed out). What cloud be the reason?
Please help. Is that role assignment issue?
Regards,
Kavitha
Archana Bellamkonda
Jun 2, 2015 12:23 AM
Thank you for the blog. It was really helpful to get started.
-Archana
Volker Drees in response to Arshad Ansary on page 20
Jan 23, 2015 5:22 PM
Hi Arshad,
I assume you are on 7.40? Have you tried to use "Add Service" to add the GWSAMPLE_BASIC service if it is
not yet present in the list of registered services?
As per the pagination in a SELECT statement, you can only use the "up to x rows" statement to reduce the
number of items to be read. As a consequence the efficiency is higher if you are browsing the first pages of
your entityset.
In my example I first prepare some helper varaibles (all of type i):
lv_top = io_tech_request_context->get_top( ).
lv_skip = io_tech_request_context->get_skip( ).
IF ( lv_top > 0 ).
lv_maxrows = lv_top + lv_skip.
ENDIF.
And in the SELECT statement I use the lv_maxrows variable to limit the number of records to be read. sydbcnt helps me to skip the records at the beginning (though they still need to be read from the DB). Sorting and
filtering takes place along with the SELECT statement.
SELECT
<...some fields...>
INTO (<...some fields...>)
FROM ( <...some joined tables...> )
UP TO lv_maxrows ROWS
WHERE (lv_where_clause)
ORDER BY (lv_orderby_clause).
IF ( sy-dbcnt > lv_skip ).
APPEND ls_entity TO et_entityset.
ENDIF.
ENDSELECT.
hth
Best Regards, Volker
Arshad Ansary in response to Volker Drees on page 21
Jan 23, 2015 5:07 AM
Hi Volker,
I am in SP10 and I am not able to find your sample service GWSAMPLE_BASIC in /IWFND/MAINT_SERVICE.
Can you post the code of pagination handling in select
if we can limit the records at the select itself(instead of at the DPC classes),we can hugely improve the
performance.
Moreover how the pagination should work along with sort is also a question. Because ideally sort should
happen first and then top skip pagination should happen next.
In our project we are currently getting all records from DB and then doing sorting and pagination after that
which is affecting perfomance
Regards
Arshad
Martin Maruskin in response to Volker Drees on page 21
Jan 14, 2015 7:52 PM
Thanks for clarifying this, much appreciated!
Volker Drees in response to Martin Maruskin on page 21
Jan 14, 2015 4:04 PM
Hello Martin,
the BAPI BAPI_EPM_SO_GET_LIST unfortunately does not expose the parameter IS_PAGING_OPTIONS.
Therefore it is not possbile to use it when calling the BAPI.
In the generated DPC method (...GET_ENTITYSET) the paging is handled out of the box. But this is done
in a generic way - after the BAPI has provided the full list. You can adjust the generated coding to fill the
MAX_ROWS parameter based on the paging request. That can improve the performance when calling the
BAPI.
I'm not aware of any standard BAPI that supports full paging. If you have access to a NW 7.40 system with
SAP_GWFND SP8 installed you can check my sample service (
/sap/opu/odata/IWBEP/GWSAMPLE_BASIC) which implements the paging by performing a direct database
access (SELECT).
Best Regards, Volker
Martin Maruskin
Jan 14, 2015 2:42 PM
Hi Volker,
interesting blog! I have a question whether pagination can be done within your example - BAPI
BAPI_EPM_SO_GET_LIST. I see that within the code of the BAPI the pagination related parameter
(IS_PAGING_OPTIONS) of method QUERY_BY_HEADER are not passed. So I not think it is supported but
maybe you found a way for this...
In case you agree with me that no pagination supported by the above mentioned BAPI... Are you aware of any
other standard SAP BAPI which supports pagination functionality within the result set?
thanks
m./
Volker Drees in response to Arshad Ansary on page 22
Jun 13, 2014 3:49 PM
Hi Arshad,
the reason for not marking SOHEADERDATA was to keep the Entity Type name that you defined on the first
page of the wizard. The blog was created based on GW 2.0 SP5. Now with SP8 (and SP9 coming soon) the
behavior of SEGW has changed a bit. So it's not a problem if the SOITEMDATA or SOHEADERDATA nodes
are marked. You just need to make sure that you get the expected Entity Type name in the end.
Also the Entity-Sets you do not need to add manually anymore. This is done using the "Create Default Entity
Set" check-box automatically.
As per the 2nd error it's more tricky to say what is wrong. I learned that you e.g. need to have the certificates
generated in STRUSTSSO2. But there might be more steps necessary.
Best Regards,
Volker
Arshad Ansary
Jun 11, 2014 10:23 AM
Hi Volker,
Thanks for the blog. This is very helpful for beginners in Gateway.
I followed your steps and I registered the service using /iwfnd/maint_service in LOCAL server.
1 While creating data model for Gateway servcice , I am not able to select the individaul fields w/o selecting the
SOITEMDATA and SOHEADERDATA nodes.
2 I am not able to test the service in /IWFND/GW_CLIENT it syas some HTTP error. But I copied the URL and
paste it in chrome browser . I am able to get the result but the individual fields in Entity is not shown
Regards
Arshad
Matteo Somensi in response to Volker Drees on page 24
May 12, 2014 9:21 AM
hi, someone can help me?
I followed step by step your guide, but it does not work, the service when I call SalesOrderCollection or
SalesOrderItemCollection gives me an error like this:
Akhila M
Dec 4, 2013 6:14 AM
Thanks so much Volker, It is really helpful
Phillip Parkinson