Skip to content

Instantly share code, notes, and snippets.

@venkyvb
Created December 8, 2017 04:09
Show Gist options
  • Save venkyvb/2b55c976ad8fd612ed97cd5931ab9448 to your computer and use it in GitHub Desktop.
Save venkyvb/2b55c976ad8fd612ed97cd5931ab9448 to your computer and use it in GitHub Desktop.
Using SAP Hybris Cloud for Customer Operational Data Provisioning API (payload samples)

Operational Data Provisioning (ODP) payload examples

This document outlines some example payloads for using ODP (Operational Data Provisioning) API to pull data from SAP Hybris Cloud for customer (SAP Hybris C4C) system to non-BW systems. For integration with SAP NetWeaver Business Warehouse systems refer to the help documentation.

Configuring your tenant to enable ODP

Please refer to the help documentation that outlines the steps needed to set-up ODP in your SAP Hybris C4C tenant.

Operational Call Sequence

GetList -> GetDetails -> FetchDataDirect

Operation GetList

This operation is used to get a list of ALL Data sources that are exposed for external consumption by C4C.

Request Payload Example

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bw="http://sap.com/bw">
   <soapenv:Header/>
   <soapenv:Body>
      <bw:OperationalDataProvisioningGetListRequest>
         <SubscriberTypeID>BOBJ_DS</SubscriberTypeID>
         <ContextID>BYD_MDAV</ContextID>
      </bw:OperationalDataProvisioningGetListRequest>
   </soapenv:Body>
</soapenv:Envelope>

Response Payload

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Header/>
   <soap-env:Body>
      <nm:OperationalDataProvisioningGetListResponse xmlns:nm="http://sap.com/bw" xmlns:prx="urn:sap.com:proxy:ABC:/1SAI/TASA1EBD20E4DAEF52D65EC:804">
         <NodeStructure>
            <NodeID>BPCSCONTB$P</NodeID>
            <Description>Provides the contacts of a corporate account, including the</Description>
            <SemanticsCode>P</SemanticsCode>
            <DisplayID>BPCSCONTB</DisplayID>
         </NodeStructure>
         <NodeStructure>
            <NodeID>SEODACCOUNTSRQB01$P</NodeID>
            <Description>Shows all accounts and their service requests</Description>
            <SemanticsCode>P</SemanticsCode>
            <DisplayID>SEODACCOUNTSRQB01</DisplayID>
         </NodeStructure>
         <NodeStructure>
            <NodeID>Z180E20B95FFE7BE00$P</NodeID>
            <Description>Data source example</Description>
            <SemanticsCode>P</SemanticsCode>
            <DisplayID>Z180E20B95FFE7BE00</DisplayID>
         </NodeStructure>
         <NodeStructure>
            <NodeID>ZC560753E376516E00$P</NodeID>
            <Description>SRQ + Contact data</Description>
            <SemanticsCode>P</SemanticsCode>
            <DisplayID>ZC560753E376516E00</DisplayID>
         </NodeStructure>
      </nm:OperationalDataProvisioningGetListResponse>
   </soap-env:Body>
</soap-env:Envelope>

The response gives you a list of data sources that are exposed by SAP C4C. Please note that this is NOT a fixed list. The most important attribute is the in the result. This is to be used in the GetDetails call, to get the metadata details of the specific data source.

Operation GetDetails

This operation is used to get the metadata details of a specific data source. The has to be specified in the Request. This is the value from the Response of the GetList call above.

Request Payload Example

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bw="http://sap.com/bw">
   <soapenv:Header/>
   <soapenv:Body>
      <bw:OperationalDataProvisioningGetDetailsRequest>
         <SubscriberTypeID>BOBJ_DS</SubscriberTypeID>
         <ContextID>BYD_MDAV</ContextID>
         <OperationalDataProviderID>SEODACCOUNTSRQB01$P</OperationalDataProviderID>
      </bw:OperationalDataProvisioningGetDetailsRequest>
   </soapenv:Body>
</soapenv:Envelope>

Response Payload


<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Header/>
   <soap-env:Body>
      <nm:OperationalDataProvisioningGetDetailsResponse xmlns:nm="http://sap.com/bw" xmlns:prx="urn:sap.com:proxy:ABC:/1SAI/TASAE928368750CA51ED714:804">
         <SupportsFullExtractionIndicator>true</SupportsFullExtractionIndicator>
         <DisplayID>SEODACCOUNTSRQB01</DisplayID>
         <SemanticsCode>P</SemanticsCode>
         <FieldStructure>
            <FieldID>SRQ_UUID</FieldID>
            <DataTypeImplementationCode>CHAR</DataTypeImplementationCode>
            <LengthValue>32</LengthValue>
            <OutputLengthValue>32</OutputLengthValue>
            <IsKeyIndicator>true</IsKeyIndicator>
            <SupportsEqualSelectionIndicator>true</SupportsEqualSelectionIndicator>
            <SupportsBetweenSelectionIndicator>true</SupportsBetweenSelectionIndicator>
            <SupportsPatternSelectionIndicator>true</SupportsPatternSelectionIndicator>
            <Description>Service Request</Description>
         </FieldStructure>
         <FieldStructure>
            <FieldID>ACCOUNT_UUID</FieldID>
            <DataTypeImplementationCode>CHAR</DataTypeImplementationCode>
            <LengthValue>32</LengthValue>
            <OutputLengthValue>32</OutputLengthValue>
            <IsKeyIndicator>true</IsKeyIndicator>
            <SupportsEqualSelectionIndicator>true</SupportsEqualSelectionIndicator>
            <SupportsBetweenSelectionIndicator>true</SupportsBetweenSelectionIndicator>
            <SupportsPatternSelectionIndicator>true</SupportsPatternSelectionIndicator>
            <Description>Account</Description>
         </FieldStructure>
         <FieldStructure>
            <FieldID>ACCOUNT_ID</FieldID>
            <DataTypeImplementationCode>CHAR</DataTypeImplementationCode>
            <LengthValue>10</LengthValue>
            <OutputLengthValue>10</OutputLengthValue>
            <IsKeyIndicator>true</IsKeyIndicator>
            <SupportsEqualSelectionIndicator>true</SupportsEqualSelectionIndicator>
            <SupportsBetweenSelectionIndicator>true</SupportsBetweenSelectionIndicator>
            <SupportsPatternSelectionIndicator>true</SupportsPatternSelectionIndicator>
            <Description>Account ID</Description>
         </FieldStructure>
         <FieldStructure>
            <FieldID>ACCOUNT_NAME</FieldID>
            <DataTypeImplementationCode>CHAR</DataTypeImplementationCode>
            <LengthValue>60</LengthValue>
            <OutputLengthValue>60</OutputLengthValue>
            <IsKeyIndicator>true</IsKeyIndicator>
            <SupportsEqualSelectionIndicator>true</SupportsEqualSelectionIndicator>
            <SupportsBetweenSelectionIndicator>true</SupportsBetweenSelectionIndicator>
            <SupportsPatternSelectionIndicator>true</SupportsPatternSelectionIndicator>
            <Description>Business Partner Name</Description>
         </FieldStructure>
         <FieldStructure>
            <FieldID>BYD_0NODE_ID</FieldID>
            <DataTypeImplementationCode>CHAR</DataTypeImplementationCode>
            <LengthValue>60</LengthValue>
            <OutputLengthValue>60</OutputLengthValue>
            <IsKeyIndicator>true</IsKeyIndicator>
            <SupportsEqualSelectionIndicator>true</SupportsEqualSelectionIndicator>
            <SupportsBetweenSelectionIndicator>true</SupportsBetweenSelectionIndicator>
            <SupportsPatternSelectionIndicator>true</SupportsPatternSelectionIndicator>
            <Description>Node ID</Description>
         </FieldStructure>
         <FieldStructure>
            <FieldID>BYD_0COUNT</FieldID>
            <DataTypeImplementationCode>DEC</DataTypeImplementationCode>
            <LengthValue>17</LengthValue>
            <OutputLengthValue>18</OutputLengthValue>
            <Description>Counter</Description>
         </FieldStructure>
         <FieldStructure>
            <FieldID>SRQ_ID</FieldID>
            <DataTypeImplementationCode>CHAR</DataTypeImplementationCode>
            <LengthValue>35</LengthValue>
            <OutputLengthValue>35</OutputLengthValue>
            <IsKeyIndicator>true</IsKeyIndicator>
            <SupportsEqualSelectionIndicator>true</SupportsEqualSelectionIndicator>
            <SupportsBetweenSelectionIndicator>true</SupportsBetweenSelectionIndicator>
            <SupportsPatternSelectionIndicator>true</SupportsPatternSelectionIndicator>
            <Description>Service Request ID</Description>
         </FieldStructure>
         <FieldStructure>
            <FieldID>ODQ_CHANGEMODE</FieldID>
            <DataTypeImplementationCode>CHAR</DataTypeImplementationCode>
            <LengthValue>1</LengthValue>
            <OutputLengthValue>1</OutputLengthValue>
            <DeltaFieldCode>C</DeltaFieldCode>
            <Description>Change Mode for a Data Record in the Delta</Description>
         </FieldStructure>
         <FieldStructure>
            <FieldID>ODQ_ENTITYCNTR</FieldID>
            <DataTypeImplementationCode>DEC</DataTypeImplementationCode>
            <LengthValue>19</LengthValue>
            <OutputLengthValue>20</OutputLengthValue>
            <DeltaFieldCode>E</DeltaFieldCode>
            <Description>Number of Data Units (Data Records for Example)</Description>
         </FieldStructure>
      </nm:OperationalDataProvisioningGetDetailsResponse>
   </soap-env:Body>
</soap-env:Envelope>

The response to the GetDetails call gives a list of attributes that are offered by the Data source. The list of attributes (i.e. <FieldID>) can be used as Selection conditions (WHERE conditions) as well as Result set that needs to be retrieved from SAP Hybris Cloud for customer (C4C).

Operation FetchDataDirect

This is used to fetch the data from the exposed data source

Request Payload Example

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bw="http://sap.com/bw">
   <soapenv:Header/>
   <soapenv:Body>
      <bw:OperationalDataProvisioningFetchDataDirectRequest>
         <SubscriberTypeID>BOBJ_DS</SubscriberTypeID>
         <SubscriberNameID>SOAP_CLIENT</SubscriberNameID>
         <SubscriberProcessID>001</SubscriberProcessID>
         <SubscriberRunID>001</SubscriberRunID>
         <ContextID>BYD_MDAV</ContextID>
         <SupportXMLFormatCode>ABAP_XML</SupportXMLFormatCode>
         <OperationalDataProviderID>SEODACCOUNTSRQB01$P</OperationalDataProviderID>
      </bw:OperationalDataProvisioningFetchDataDirectRequest>
   </soapenv:Body>
</soapenv:Envelope>

Note you can get the data in the form of ABAP_XML (ABAP XML) or BAS_XML (Binary XML) í possible values for the parameter <SupportXMLFormatCode>. This example uses ABAP_XML.

  • <SubscriberNameID> => Subscribers are associated to a system name. The combination (type, name) identifies the calling system. For an SAP system the subscriber name hence would be the logical system, e.g. BRACLNT000. For Business Objects Data Services, the Repository Name could be used.
  • <SubscriberProcessID> => The subscriber within the system is identified by specifiying the process. For one system, there might be several independent subscribers, i.e. the same DataSource might be accessed in full or delta mode with different independent selection criteria. To identify the independent process, which is accessing the source, the subscriber process must be given. For Business Objects Data Services, this would be the Job or the Data Flow.
  • <SubscriberRunID> => The subscriber might want to associate the execution with a run-ID of his process. This parameter allows for storing the subscribers run-ID together with the pointer (see below) By this, the pointers can be traced to a particular run of the subscriber process. This information is optional and has no functional implication.

Response Payload

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
   <soap-env:Header/>
   <soap-env:Body>
      <nm:OperationalDataProvisioningFetchDataDirectResponse xmlns:nm="http://sap.com/bw" xmlns:prx="urn:sap.com:proxy:ABC:/1SAI/TAS5BB8743D8B6B1CBB39D1:804">
         <BinaryObject>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48YXN4OmFiYXAgdmVyc2lvbj0i
MS4wIiB4bWxuczphc3g9Imh0dHA6Ly93d3cuc2FwLmNvbS9hYmFweG1sIj48YXN4OnZhbHVlcz48
Xy0tMzAwMDE+PGl0ZW0+PFNSUV9VVUlEPjAwMTYzRTAyRTUzNDFFRTFBRkM1NTYzQzMzQTU0QzFB

..... CHUNKS OMITTED FOR SAKE OF BREVITY……

REVfSUQ+PEJZRF8wQ09VTlQ+MTwvQllEXzBDT1VOVD48U1JRX0lELz48L2l0ZW0+PC9fLS0zMDAw
MT48L2FzeDp2YWx1ZXM+PC9hc3g6YWJhcD4=</BinaryObject>
         <XMLFormatUsedCode>ABAP_XML</XMLFormatUsedCode>
      </nm:OperationalDataProvisioningFetchDataDirectResponse>
   </soap-env:Body>
</soap-env:Envelope>

Additional Comments

Note that in the Request one can also specifiy the "Selection Conditions" for fetching the data. This is done by specifying the values into the SelectionStructure given below. Multiple fields can be included for selection.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bw="http://sap.com/bw">
   <soapenv:Header/>
   <soapenv:Body>
      <bw:OperationalDataProvisioningFetchDataDirectRequest>
         <SubscriberTypeID>BOBJ_DS</SubscriberTypeID>
         <SubscriberNameID>SOAP_CLIENT</SubscriberNameID>
         <SubscriberProcessID>001</SubscriberProcessID>
         <SubscriberRunID>001</SubscriberRunID>
         <ContextID>BYD_MDAV</ContextID>
         <SupportXMLFormatCode>ABAP_XML</SupportXMLFormatCode>
         <OperationalDataProviderID>CRMSRQHB$P</OperationalDataProviderID>
          <SelectionStructure>
            <FieldID>DOC_CREATED_DT</FieldID>
            <InclusionExclusionCode>I</InclusionExclusionCode>
            <OperatorCode>GE</OperatorCode>
            <LowerBoundaryDescription>20120901</LowerBoundaryDescription>
         </SelectionStructure>
      </bw:OperationalDataProvisioningFetchDataDirectRequest>
   </soapenv:Body>
</soapenv:Envelope> 

<InclusionExclusionCode> can have values of either 'I'(nclusion) or 'E'(xclusion) <OperatorCode> can have values like 'EQ' (Equal to), 'BT' (Between) etc. <LowerBoundaryDescription> and <UpperBoundaryDescription> specify the actual value of the fields for selection conditions.

Note that the selections must be passed in SAP internal format e.g. date format must be yyyyddmm instead of dd/mm/yyyy. Different Selections on the same <FieldID> are combined with logical OR and the selections on different <FieldID> with AND.

Important

Its always better to specify one or more Selection conditions when the FetchDataDirect is invoked as this would address performance and out of memory issues which typically occurs with large data sets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment