"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Daniel Ridder Best Practices SAP Gateway Builder
1. – SAP Gateway Builder –
Building OData Services
Best Practices
Daniel Ridder (V2016-03-09)
2. Topics
• Modeling and Creating Entities
– Basics
– Namespaces
– Search-Helps
– Re-Use OData Services
• Service Implementation
– Mapping
– Extend/Overwrite Mappings
– OData is type based
– SAP Annotations
Hints&Hacks using SAP NetWeaver
Gateway Builder for creating „good“
OData-Services
V2016-03-09 Best Practices for SAP Gateway Builder 2
3. MODELING AND CREATING ENTITIES
Best Practices
V2016-03-09 Best Practices for SAP Gateway Builder 3
4. Modeling und Creating Entities
• Create an entity via importing a
DDIC-Structure
• Do not address the underlying BO
directly for model import
Transp. Table
DDIC View
CDS View
BOPF
• Create a DDIC structure instead
This structure may look like the
underlying CDS View for instance
You are able to append additional
specific runtime fields later
V2016-03-09 Best Practices for SAP Gateway Builder 4
5. Mapping ABAP data types to OData
ABAP
• GUID (RAW16)
OData
• Set manually from Edm.Binary
(max. 16) to Edm.Guid
(without additional definition)
V2016-03-09 Best Practices for SAP Gateway Builder 5
http://help.sap.com/saphelp_nw74/helpdata/en/54/a326519eff236ee10000000a445394/content.htm
• Use Timestamps as Date
information (i.e. last change)
with DDIC domains
– TZNTSTMPS
– TZNTSTMPL
• Edm.DateTime
Common questions:
6. • The namespace of your service equals to the
technical service name by default
– It is influenced by your ABAP DEVC linked with
the TMS
If you have a reserved namespace (i.e.
/acme/) remove all slashes (they are not
allowed in the XML schema and SAPUI5 will
face problems while addressing search helps)
Use something like a common internet
address notation FQDN (i.e.
„your.company.project“).
To impress the relation between your service
and your Fiori-Application use the same
namespace as defined in the WebIDE
V2016-03-09 Best Practices for SAP Gateway Builder 6
Namespaces
7. • Let the Gateway
Builder create your
search helps directly
during model import
• Be sure not creating
them twice during
another model
import
Search Helps
V2016-03-09 Best Practices for SAP Gateway Builder 7
8. Re-Use of Search Helps
• If you have a bunch of common search helps
– Provide a dedicated project (service) for them
– Depending on the count of your search helps it
may be worth grouping them into several services
V2016-03-09 Best Practices for SAP Gateway Builder 8
9. • OData 2.0 does not support
cross service usage of
entities
To access a re-use OData-
Service include the specific
service
Do not redefine it
• Redefinition of a service
doesn't let you create own
entities
• It focuses extending and
overwriting existing services
V2016-03-09 Best Practices for SAP Gateway Builder 9
Re-Use OData-Services
11. • Map your EntitySet when ever
possible
Let the Service Adaptation Definition
Language (SADL) do the work for you
It will generate the specific design
time artifacts (ABAP classes) for you
You do not need to implement OData
specifics like „$top“, „$filter“ etc.
When using BOPF your service will be
fully CRUD compliant
V2016-03-09 Best Practices for SAP Gateway Builder 11
Mapping during Service
Implementation
12. • Mapping can be extended / overwritten
– Jump into ABAP Workbench and open your
service implementation *DPC_EXT class
– Redefine the appropriate CRUD-Method
– Extend: Call the generated super method first
(SADL)
– Extend/Overwrite: Add your specific code
• Use it to provide your additional transient
fields (go back to slide „Modeling und
Creating Entities“)
V2016-03-09 Best Practices for SAP Gateway Builder 12
Extend or overwrite your Mapping
Call the super-
method to
extend your
mapping
Add your own
code for
extending/
overwriting
13. Do not force generic
programming
– An OData service points to a
specific well formed resource
– You deal with typed data
– Implementing the CRUD interface-
methods directly will
force you to code OData-specifics
move the identification of types to
another place where you have to do
it on your own
Redefine the typed CRUD-
methods of your generated *DPC
class
V2016-03-09 Best Practices for SAP Gateway Builder 13
OData is type based
14. • Are essential for SAPUI5
SmartControls like
SmartTable
• Needed for UI
Adaptation at Runtime
V2016-03-09 Best Practices for SAP Gateway Builder 14
SAP Annotations