Sei sulla pagina 1di 20

Explore SAP Customizing Implementation Guide SAP NetWeaver Gateway

Configuration Connection Settings SAP NetWeaver Gateway to SAP System. Click on the
Activity icon next to Manage GSDO Groups.

In Gateway:

9. On Supervisor Destination tab, click on Change Button and enter the RFC Destination created
in step 1. Then press the save button.
We need to get this

Getting following error.....

Gateway complex types are simply compound types, i.e. comprised of scalar types.
They allow you to describe a pattern that can be reused in entities. An address complex type
is a good example.

The Gateway design abstract only supports flat structures, you cannot design a 'deep' entity.
In order to obtain what you are looking for, such as sales order and items, you need to
implement both as separate entities. You then establish a relation between them by an
association and provide a navigation path by adding the association as a navigation property
to the parent ("header" entity).
Once this has been done, the client can request the order and its items in one feed by using
the $expand system query option.
Conversely, the client can also create a sales order header and items if a deep insert method is
implemented.
My advice is to concentrate on the simple entities first to become familiar with concepts and
practical building, then work up to the more complex features. Hopefully, knowing these are
possible will prevent you worrying that you are wasting time or that Gateway is not able to
do certain things. We have to start thinking differently when it comes to Gateway.

We have already seen the EntityContainer section of the metadata document


where
the EntitySets are defined.
The OData service document lists exactly all the EntitySets of an OData
service. You

can verify this fact by looking at the JSON representation of the service
document.

Entities are grouped in Entity Sets. For example, the Products Entity Set is a
set of
Product instances.
All entities of one entity set are of the same Entity Type.
Entities are instances of Entity Types, which are richly structured records with
a key.
The structure of an entity type is provided by its Properties.
An Entity Key is formed from a subset of the properties of the entity type.
The key (for example, Product ID or Supplier ID) is a fundamental concept used
to uniquely identify and persist entity instances and to allow entity instances to
participate in associations. The key of an entity is defined by one or many
properties.
Entities can be addressed individually by means of key values, or as collections
by
means of query options.
An Association is a named relationship between two entity types. Every
association
includes two association ends, which specify the entity types that are related,
and the
cardinality rules for each end of the association.
Entity types may include one or more Navigation Properties. The navigation
property derives its name from the fact that it allows navigation from one entity
to
others. A navigation property is tied to an association and allows navigation from
one
end of an association, the entity type that declares the navigation property, to
the other
related end, which can be anything from 0 or more related entities. The supplier
entity
type has exactly one navigation property named Products; the navigation
property
makes it possible to navigate from a supplier instance to all the products
delivered by
this supplier.

/sap/opu/odata/sap/Zes_gw_11_SRV/$metadata

Entity Types
Complex Types
Associations
Entity Sets
Association Sets
Function Imports

The structure of an entity type is provided by


its Properties. Properties define the
characteristics of the data that an entity type
instance will contain at runtime.
An Entity Key is formed from a subset of the
properties of the entity type.

Association :

A complex type can be reused inside an


OData Service from several entity types.

However, complex types can contain other


complex types, meaning that they can have a
deep structure. Within a complex type the
cardinality is always 1:1.
Complex types comprise:
A unique name
Properties (optional)

SalesOrderCollection?$filter=Vbeln eq '0000004970'
SalesOrderCollection('4970')/?$expand=Conecttoitems
SalesOrderCollection('4970')/Conecttoitems

http://gwd.sbpcorp.com/sap/opu/odata/sap/ZES_GW_22_SRV/SalesOrderCollectio
n('0000004971')

ZPSR_SO_HEADER
ZPSR_SO_ITEMS

Function imports:
Hello David, Which kind of parameters do you want to send? If you want to have
the pagination functionality, you have to use the IS_PAGING structure. For
custom parameters (e.g. they are not entity properties, or custom specific
values), you have to create custom operations, because GET_ENTITYSET
processes standard OData requests only.

Function import can be defined in SEGW as you have already found. Now the
implementation can be done in your Data Provider class. You need to implement the method
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION.

For each function import this method is called and the import parameter IV_ACTION_NAME
holds the name of the action to be processed.

Service Provider Interface (SPI) is an API intended to be implemented or


extended by a third party. It can be used to enable framework extension and
replaceable components

SAP Business Information Warehouse


Purpose
The reporting, analysis, and interpretation of business data is of central importance to a
company in guaranteeing its competitive edge, optimizing processes, and enabling it to react
quickly and in line with the market. As a core component of SAP NetWeaver, the SAP
Business Information Warehouse (SAP BW) provides data warehousing functionality, a
business intelligence platform, and a suite of business intelligence tools that enable
businesses to attain these goals

Generic Interaction Layer (GenIL)


The Generic Interaction Layer (GenIL) is a layer connecting the Business Object Layer
(BOL) model HRPAD to the HCM database table.

Screen Scraping Component


o

IW_SCS 200

You must install this component in your SAP Business Suite backend system
if you want to create content using the Screen Scraping generator.
These installation packages have a compressed format, so first unpack them into your local
file system. Next, import them using the installation tool. For detailed information on
unpacking the installation packages, see Loading Installation Packages from the Application
Server.
To install the SAP NetWeaver Gateway components:
1. Log on to the SAP system in which you want to install the SAP NetWeaver Gateway
components and enter the transaction SAINT.

2. Import the installation packages. For detailed information on importing the


installation packages, see Installing and Upgrading Add-ons.

OData Service: A service which implements the Open Data Protocol (OData).
Property: A generic term to represent a declared or dynamic property of an Entry.
Representational state transfer (REST): REST is a set of principles or style of software
architecture for distributed hypermedia systems such as the World Wide Web. OData applies
the principles of REST whenever possible.
Resource: A network-accessible data object or service identified by an IRI, as defined in
[RFC 2616]
Service Document: A document that describes the location and capabilities of one or more
Collections, as described by [RFC 5023]. See [OData: Core] for additional information on
using Service Documents with OData services.
Service Metadata Document (Metadata Document): A CSDL that describes the data model
(i.e. structure and organization of all the resources) exposed as HTTP endpoints by an OData
service. See [OData: Core] for additional information.
URI: A Uniform Resource Identifier as defined in [RFC3986]

Service Documents
As described in [OData-Core], if a service exposes several Collections, then to aid discovery
of those Collections by clients it is useful for the service to expose a Service Document which
lists the available Collections. Service Documents are described in AtomPub [RFC5023],
section 15.
For example, the URI http://services.odata.org/OData/OData.svc identifies the Service
Document of a sample OData service which exposes a Categories, Products and Suppliers
Collection. For convenience, a sample Service Document is shown in the listing below.
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<service xml:base="http://services.odata.org/OData/OData.svc/"
xmlns:atom="http://www.w3.org/2005/Atom"

xmlns:app="http://www.w3.org/2007/app"
xmlns="http://www.w3.org/2007/app">
<workspace>
<atom:title>Default</atom:title>
<collection href="Products">
<atom:title>Products</atom:title>
</collection>
<collection href="Categories">
<atom:title>Categories</atom:title>
</collection>
<collection href="Suppliers">
<atom:title>Suppliers</atom:title>
</collection>
</workspace>
</service>

Metadata(Service meta document)


<?xml version="1.0" encoding="utf-8" ?>
- <edmx:Edmx Version="1.0"
xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadat
a" xmlns:sap="http://www.sap.com/Protocols/SAPData">
- <edmx:DataServices m:DataServiceVersion="2.0">
- <Schema Namespace="ZES_GW_22_SRV" xml:lang="en"
xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
- <EntityType Name="SalesOrder" sap:content-version="1">
- <Key>
<PropertyRef Name="Vbeln" />
</Key>
<Property Name="Vbeln" Type="Edm.String" Nullable="false" MaxLength="10"
sap:label="Sales Document" sap:sortable="false" sap:filterable="false" />
<Property Name="Ernam" Type="Edm.String" Nullable="false" MaxLength="12"
sap:label="Created by" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Netwr" Type="Edm.Decimal" Nullable="false" Precision="15"
Scale="2" sap:label="Net value" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Knumv" Type="Edm.String" Nullable="false" MaxLength="10"
sap:label="Doc. condition no." sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />

<NavigationProperty Name="Conecttoitems"
Relationship="ZES_GW_22_SRV.SaleOrder" FromRole="FromRole_SaleOrder"
ToRole="ToRole_SaleOrder" />
</EntityType>
- <EntityType Name="SalesOrderItem" sap:content-version="1">
- <Key>
<PropertyRef Name="Vbeln" />
</Key>
<Property Name="Vbeln" Type="Edm.String" Nullable="false" MaxLength="10"
sap:label="Sales Document" sap:sortable="false" sap:filterable="false" />
<Property Name="Posnr" Type="Edm.String" Nullable="false" MaxLength="6"
sap:label="Sales Document Item" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Matnr" Type="Edm.String" Nullable="false" MaxLength="18"
sap:label="Material" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Arktx" Type="Edm.String" Nullable="false" MaxLength="40"
sap:label="Description" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
<Property Name="Netwr" Type="Edm.Decimal" Nullable="false" Precision="15"
Scale="2" sap:label="Net value" sap:creatable="false" sap:updatable="false"
sap:sortable="false" sap:filterable="false" />
</EntityType>
- <Association Name="SaleOrder" sap:content-version="1">
<End Type="ZES_GW_22_SRV.SalesOrder" Multiplicity="1"
Role="FromRole_SaleOrder" />
<End Type="ZES_GW_22_SRV.SalesOrderItem" Multiplicity="*"
Role="ToRole_SaleOrder" />
- <ReferentialConstraint>
- <Principal Role="FromRole_SaleOrder">
<PropertyRef Name="Vbeln" />
</Principal>
- <Dependent Role="ToRole_SaleOrder">
<PropertyRef Name="Vbeln" />

</Dependent>
</ReferentialConstraint>
</Association>
- <EntityContainer Name="ZES_GW_22_SRV" m:IsDefaultEntityContainer="true">
<EntitySet Name="SalesOrderCollection" EntityType="ZES_GW_22_SRV.SalesOrder"
sap:pageable="false" sap:addressable="false" sap:content-version="1" />
<EntitySet Name="SalesOrderItemCollection"
EntityType="ZES_GW_22_SRV.SalesOrderItem" sap:pageable="false"
sap:addressable="false" sap:content-version="1" />
- <AssociationSet Name="SaleOrderSet" Association="ZES_GW_22_SRV.SaleOrder"
sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:contentversion="1">
<End EntitySet="SalesOrderCollection" Role="FromRole_SaleOrder" />
<End EntitySet="SalesOrderItemCollection" Role="ToRole_SaleOrder" />
</AssociationSet>
</EntityContainer>
<atom:link rel="self"
href="http://gwd.sbpcorp.com/sap/opu/odata/sap/ZES_GW_22_SRV/
$metadata" xmlns:atom="http://www.w3.org/2005/Atom" />
<atom:link rel="latest-version"
href="http://gwd.sbpcorp.com/sap/opu/odata/sap/ZES_GW_22_SRV/
$metadata" xmlns:atom="http://www.w3.org/2005/Atom" />
</Schema>
</edmx:DataServices>
</edmx:Edmx>

IMPORTING RFC/BOR:
Structures are created as complex types

Tables are created as new entity types


Properties are defined for the entity type created

In cases when a model is created using the Import RFC/BOR function and later
has to be transported to another system where the DDIC objects may not be
available, it is recommended to create the model using the RFC destination as
NONE. If the RFC destination is NONE, then no DDIC objects will be assigned to the
entity type and the individual data element assignment to the properties (in the
ABAP type editor) will not happen and local data types will be generated in the
MPC.

http://scn.sap.com/community/netweaver-gateway/blog/2013/06/03/making-waythrough-gate-finding-some-rest
http://scn.sap.com/community/process-orchestration/blog/2013/08/09/agateway-to-lightweight-services-enabling-mobile-and-web-applications

http://gwd.sbpcorp.com/sap/opu/odata/sap/ZES_GW_TEST_SRV/zenset?
$filter=TDate eq datetime'2013-09-20T00:00:00'
http://gwd.sbpcorp.com/sap/opu/odata/sap/ZES_GW_TEST_SRV/zenset?
$filter=TInt eq '88'

Gateway OData calls: convert IV_FILTER_STRING to


IT_FILTER_SELECT_OPTIONS
Posted by Lindsay Stanger in Lindsay's Blog on Dec 29, 2012 5:54:31 PM
inShare10

While setting up Gateway using the Service Builder I came across an issue which, once I
managed to resolve it, I thought would be helpful to share.
It seems that some OData calls which use filters do not populate the table
IT_FILTER_SELECT_OPTIONS. This has to be done manually in the backend by
converting IV_FILTER_STRING.

Scenario
Search for an order which is an Opportunity (ProcessType eq ZBOP) and where the Sales
Cycle Closing Date is between two dates (ScCdate ge datetime'2012-12-01T00:00:00' and
ScCdate le datetime'2012-12-09T00:00:00')

The OData call looks like this:


.../sap/opu/odata/sap/PROJECT_NAME/Orders?$filter=ProcessType eq ZBOP and ScCdate
ge datetime'2012-12-01T00:00:00' and ScCdate le datetime'2012-12-09T00:00:00'

When you make this call IV_FILTER_SELECT_OPTIONS, which would usually contain all
the filter options, is empty.
IV_FILTER_STRING is populated (as it always is when a filter is used) with the string :
( ( ( ProcessType eq 'ZBOP' ) and ( ScCdate le '20121231' ) ) and ( ScCdate ge '20121101' ) )
As you can see from this string, the two dates are not being grouped together, which I believe
is the reason for IT_FILTER_SELECT_OPTIONS not being generated.

I found that this is always the case when you try to look between two dates and filter by
another option as well. If youre just filtering between two dates then there seems to be no
issue, but its a good idea to implement the appropriate code to deal with this situation should
it occur unexpectedly. When making OData calls it shouldn't be the responsibilty of the
calling program to order the filters in the correct way, it should be managed in the backened
after the call is sent.

I resolved this problem with the following code, which converts IV_FILTER_STRING into a
table like IT_FILTER_SELECT_OPTIONS.
The important thing to note is that where there are two properties with the same name these
need to be combined into one line in the IV_FILTER_SELECT_OPTIONS with the high and
low values. The last part of my code shows how I did this.

*******METHOD CALL FOR CODE TO FIX FILTER_SELECT_OPTIONS********


if it_filter_select_options is initial.
me->set_filter_str(
exporting

iv_filter_string = iv_filter_string
importing
it_filter_select_options = lt_filter_select_options ).
endif.

*******METHOD SET_FILTER_STR********
method set_filter_str.
data:
lt_filter_string type table of string,
lt_key_value type /iwbep/t_mgw_name_value_pair,
ls_filter_string type string,
lv_input type string,
lv_name type string,
lv_value type string,
lv_sign type string,
lt_filter_select_options type table of /iwbep/s_mgw_select_option,
ls_filter_select_options type /iwbep/s_mgw_select_option,
lt_select_options type /iwbep/t_cod_select_options,
ls_select_options type /iwbep/s_cod_select_option,
lt_filter_select_options2 type /iwbep/t_mgw_select_option,
ls_filter_select_options2 type /iwbep/s_mgw_select_option.
field-symbols:
<fs_range_tab> like line of lt_filter_select_options ,
<fs_select_option> type /iwbep/s_cod_select_option,
<fs_key_value> like line of lt_key_value.
***************************************************************************
****
if iv_filter_string is not initial.
lv_input = iv_filter_string.
* *--- get rid of )( & ' and make AND's uppercase
replace all occurrences of ')' in lv_input with ''.
replace all occurrences of '(' in lv_input with ''.
replace all occurrences of `'` in lv_input with ''.
replace all occurrences of ' and ' in lv_input with ' AND '.
replace all occurrences of ' eq ' in lv_input with ' EQ '.
split lv_input at 'AND' into table lt_filter_string.

* *--- build a table of key value pairs based on filter string


loop at lt_filter_string into ls_filter_string.
clear: ls_select_options, ls_filter_select_options, lt_select_options.
append initial line to lt_key_value assigning <fs_key_value>.

condense ls_filter_string.
Split at space, then split into 3 parts
split ls_filter_string at ' ' into lv_name lv_sign lv_value.
translate lv_sign to upper case.
ls_select_options-sign = 'I'.
ls_select_options-option = lv_sign.
ls_select_options-low = lv_value.
append ls_select_options to lt_select_options.
ls_filter_select_options-property = lv_name.
ls_filter_select_options-select_options = lt_select_options.
append ls_filter_select_options to lt_filter_select_options.
clear: ls_filter_select_options.
endloop.
clear: ls_select_options, ls_filter_select_options, lt_select_options.
endif.

* Loop through the select options, look for two with the same property name, if it exisits,
copy into one!
sort lt_filter_select_options ascending by property.
data: count type i value 1,
countplus type i,
ls_temp like ls_filter_select_options,
lt_temp_op like lt_select_options,
ls_temp_op like ls_select_options,
lt_sel_op like lt_select_options,
ls_sel_op like ls_select_options,
ls_results like ls_filter_select_options,
lt_results like lt_filter_select_options.
read table lt_filter_select_options into ls_filter_select_options index count.
while sy-tabix <> 0.
ls_temp = ls_filter_select_options.
countplus = count + 1.
read table lt_filter_select_options into ls_filter_select_options index countplus.
if sy-tabix <> 0.
if ls_temp-property = ls_filter_select_options-property.
ls_sel_op-sign = 'I'.

ls_sel_op-option = 'EQ'.
lt_temp_op = ls_temp-select_options.
lt_select_options = ls_filter_select_options-select_options.
read table lt_temp_op into ls_temp_op index 1.
if ls_temp_op-option = 'GE' or ls_temp_op-option = 'GT'.
ls_sel_op-low = ls_temp_op-low.
read table lt_select_options into ls_select_options index 1.
ls_sel_op-high = ls_select_options-low.
else.
ls_sel_op-high = ls_temp_op-low.
read table lt_select_options into ls_select_options index 1.
ls_sel_op-low = ls_select_options-low.
endif.
append ls_sel_op to lt_sel_op.
ls_results-property = ls_temp-property.
ls_results-select_options = lt_sel_op.
append ls_results to lt_results.
count = count + 2.
else.
append ls_temp to lt_results.
count = count + 1.
endif.
else.
append ls_temp to lt_results.
exit.
endif.
clear: ls_temp, lt_temp_op[], ls_temp_op, lt_sel_op[], ls_sel_op, ls_results,
ls_filter_select_options.
read table lt_filter_select_options into ls_filter_select_options index count.
endwhile.
it_filter_select_options = lt_results.

endmethod.

http://gwd.sbpcorp.com/sap/opu/odata/sap/ZES_TEST1_SRV/testset?
$filter=TDate eq datetime'2013-09-25T00:00:00'&$inlinecount=allpages

$filter with multiple fields...


http://gwd.sbpcorp.com/sap/opu/odata/sap/ZES_TEST_RANGE_SRV/rangeset?
$filter=TNumc eq 'A*' and TInt eq 10

Checking association:
URI:
/sap/opu/odata/sap/ZGW100_XX_SO_SRV/SalesOrderCollection('0500000001')/?
$expand=SalesOrderItems

Read
Sorderset('0000004969')

Query

Potrebbero piacerti anche