Skip to Content

Overview

  • In this blog, we will come to know, how we can post multiple table input to oData Service
  • that is nothing but a case of single header table and multiple-item table input to oData Service and receiving output in 3rd table structure.
  • This method is also called as ‘oData Create method‘ where in a singe request, we input multiple ‘Entity Set’ structural data (tables).
  • This blogs is a business case example of parent blog:

Business Scenario:

  • Creating a purchase order via fiori app.
  • In this case, in back-end System, we create a RFC which can accept Single Header and multiple line item table input (as a request parameters), do the purchase order creation based on input and return creation status in a output table (as a response parameter).
  • We consume this RFC in oData Service in such a manner, so that oData Service can accept single header and multiple item table as a request (input) and in response it can return output table data of RFC.
  • Here, below explained steps is synonym to above business scenario.

Deep Insert in SAP OData service

  • To post/push Header and line items together to the back-end RFC via oData Service, we follow Create_Deep_Entity approach.
  • The ‘Create_Deep_Entity’ approach is also called as Deep Insert in SAP OData service
  • Deep insert is used to POST the nested structure of feed/collections to the back-end system.
  • By implementing this we can reduce the no.of OData calls made to the SAP Netweaver Gateway server.
  • Entity sets (Header, Item and Result) which are used should be associated, means while calling one Entity set (for e.g. say Header), we should use Item and Result Entity Sets as well, thus in a single call we are using three Entity Sets thus avoiding no.of OData calls.
  • This can be achieved by the concept of Association and Navigation properties.

 

Association and Navigation properties

  • These are two important properties available in SAP Netweaver Gateway to associate two entity types.
  • In our business example (i.e. to create Purchase Order), back-end RFC has three tables, two table (Header and Item) as a input and one table (Result) as a output.
  • Parallel, we also create three Entity Sets in oData with respective properties (i.e. as of similar RFC table structures will all fields/elements/columns),
    • Header Set       (for header level input, only single record)
    • Item Set            (for item level input, can be multiple record)
    • Result Set         (to capture output, single record)
  • These above entity types are individual and can be executed differently.
  • But here we want to push Header and Items data at a time in one call and in acknowledgement we want output in Result entity. This is can be achieved using association and navigation property

Steps:

Rfc Details

  • For reference purpose only, with help of below RFC screen of back-end system, input / output structures can be understood:
  • RFC’s input tables are ‘TBL_HEADER’ and ‘TBL_ITEM’
  • and RFC’s output table is ‘TBL_RESULT’.
  • Parallel structures we create in oData Service as Entity Sets.

oData Service Details:

  • To post/push Header and line items together to the back-end RFC via oData Service using ‘Create_Deep_Entity’ approach, following steps can be followed:
  • In Fiori-Server, go to Service Builder t-code ‘SEGW’ and expand the service to create Entities.
  • Here, we will create three Entity Sets:
    • Two for handling request in oData Service
      • Entity ‘Header’ to capture Header input
      • Entity ‘Item’ to capture Item level input
    • and One for response from oData Service
      • Entity ‘Result’ to capture output returned from back-end RFC
  • In a single call via one Entity Set (HeaderSet) URI, we will pass inputs using 1st & 2nd Entity Sets (Header & Item) and retrieve output in 3rd Entity Set (Result). This will be achieved by concept of Associations and Navigation.

[1] For header level input, create a ‘Header’ Entity

  • This is meta structure for ‘Header’ level request data. It will be one set per request.
  • Create Properties and save/re-generate OData Service. In this Entity, we create three properties (equivalent to Table columns of RFC) and checking one as key property.

 

[2] For item level input, create a ‘Item’ Entity

  • This is meta structure for ‘Item’ level request data. It can be one or multiple sets per request.
  • Create Properties and save/re-generate OData Service. In this Entity, we create three properties (equivalent to Table columns of RFC) and checking one as key property.

 

[3] To capture output, create a ‘Result’ Entity

  • This is meta structure for holding output during service response. It will be one per service call.
  • Create Properties and save/re-generate OData Service. In this Entity, we create two properties (equivalent to Table columns of RFC) and checking one as key property.
  • Thus, we have a odata meta structure as below:
  • which is parallel to below back-end RFC’s table structures

 

[4] Creating Associations & Navigaions

  • If, we want in one oData service call, to post both (Header/Item Entity) request and to get output in 3rd Entity (i.e. Result), this is can be achieved using association and navigation property.
  • Go to oData Service project in t-code ‘SEGW’ -> select ‘Associations’ -> right click -> ‘Create’
  • Here we create two association & Navigation:
  • [A]  Association & Navigation between Header and Item Entity
    • This is required when we want to post both Entity Set input (Header and Item) on call of ‘Header’ Entity Set.
    • Association Name:   HEADER_ITEM
    • Navigation Name:     ItemSet 
    • Creation steps can be refereed as below:
    • While Creating Associations, in next window, enter below details
      • Principal Entity        – To which you want to build the association
      • Dependent Entity    – From which you want to get the data based on association
      • Cardinality               – What the occurrence of no records
      • Navigation Property– Name of the navigation property for the Entity Type
    • In the next windows, provide the common field among two entity sets (Header and Item) and click on Next
    • In next window. verify the entries and Click on Finish.
    • This creates a navigation and association property for “Header” Entity Type.
    • Thus, we can understand that ‘Item’ entity is associated to ‘Header’ Entity.
    • Check/Verify Navigations:
    • Thus, when we call ‘Header’ Entity set, it will also navigate to ‘Item’ entity, means while calling entity set ‘Header’ , we will get meta structure access of ‘Item’ entity set too.
  • [B]  Association & Navigation between Header and Item Entity
    • This is required when we want to get output in 3rd Entity Set ‘Result’ on call of 1st ‘Header’ Entity Set.
    • Association Name:   HEADER_RESULT
    • Navigation Name:    NAVRESULT 
    • Creation steps can be refereed as below:
    • Enter details in next window i.e. Entity info related to ‘Header’ and ‘Result’, here give Navigation Property name as ‘NAVRESULT
    • Click next, here select one field (MSG1) from ‘Result’ entity
    • Click Next, here Association and respective Entity Sets info can be seen.
    • Click finish. and verify the Association details
    • and verify Navigation details too, post that save and re-run ‘Generate Runtime object’ of project.

 

[5] Re-definitions in MPC & DPC of oData

  • MPC (Model Provider class) – This is used to define model. we can use the method Define to create entity, properties etc using code based implementation. we rarely use MPC extension class.
  • DPC (Data provider class) – used to code our ‘CRUDQ’ methods as well as function import methods. we write all our logic in redefined methods of DPC extension class.
  • The ‘CRUDQ’ methods:
    • This is nothing but Create, Read, Update, Delete and Query operations which we can do in oData Service.
  • This blog’s example is of  ‘Create’ operation in oData Service.

[5.1] Re-define MPC

  • Go to oData Service project in t-code ‘SEGW’ -> Runtime Artifacts -> select and double click on oData’s ‘_MPC_EXT’ as shown in below screen
  • In next window of oData’s ‘_MPC_EXT’, select class folder ‘ZCL_ZTEST_ODATA_MPC_EXT’
  • Double click on it.
  • Edit code and here define custom data Type ‘TS_DEEP_ENTITY‘ after PUBLIC SECTION.
  • This type is required to club all three (Header/Item/Result) Entity Set structure to single structure.
  • Here, for structure creation of Entity ‘Item’ and ‘Result’, variable names should be same as of ‘Navigation Property‘ name created in Entity ‘Header’ else structure can not be referred in code. Below Screen of Navigation definition can be seen for reference
  • Custom data Type ‘TS_DEEP_ENTITY‘ has reference of all three structures (Header/Item and Result).
    • For Entity ‘Header’:  FIELD1, FIELD12, FIELD13
    • For Entity ‘Item’:       ItemSet                 (same name as of ‘Navigation Property‘)
    • For Entity ‘Result’:    NAVRESULT        (same name as of ‘Navigation Property‘)
  • class ZCL_ZTEST_ODATA_MPC_EXT definition
      public
      inheriting from ZCL_ZTEST_ODATA_MPC
      create public .
    
    public section.
    
      types:
        BEGIN OF TS_DEEP_ENTITY,
            FIELD1 TYPE STRING,
            FIELD2 TYPE STRING,
            FIELD3 TYPE STRING,
            ItemSet TYPE STANDARD TABLE OF TS_ITEM WITH DEFAULT KEY,      "var name should be same as of navigation property name
            NAVRESULT  TYPE STANDARD TABLE OF TS_RESULT WITH DEFAULT KEY, "var name should be same as of navigation property name
           END OF TS_DEEP_ENTITY .
    
      methods DEFINE
        redefinition .
  • Save and activate
  • Now next is to refine ‘DEFINE‘ METHOD. For same goto folder ‘Methods’ -> ‘Inherited Method’ -> ‘DEFINE’ -> right click -> select ‘Redefine’
  • Write below code in ‘DEFINE’ method:
  • DATA:
     lo_annotation     TYPE REF TO /iwbep/if_mgw_odata_annotation,
     lo_entity_type    TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
     lo_complex_type   TYPE REF TO /iwbep/if_mgw_odata_cmplx_type,
     lo_property       TYPE REF TO /iwbep/if_mgw_odata_property,
     lo_entity_set     TYPE REF TO /iwbep/if_mgw_odata_entity_set.
    
     super->define( ).
     lo_entity_type = model->get_entity_type( iv_entity_name = 'Header' ).
     lo_entity_type->bind_structure( iv_structure_name  = 'ZCL_ZTEST_ODATA_MPC_EXT=>TS_DEEP_ENTITY' ).
    
  • save and activate.

 

[5.2] Re-define DPC

  • Now Go to ZCL_ZTEST_ODATA_DPC_EXT
  • double click
  • Here we need to work in two methods
  • [1]  CREATE_DEEP_ENTITY                         (need to re-define)
  • [2]  CUSTOME_CREATE_DEEP_ENTITY     (need to create)
  • Steps to Re-define method ‘CREATE_DEEP_ENTITY’:
    • to Redefine the method ‘CREATE_DEEP_ENTITY’
    • Go to project’s ‘_DPC_EXT’ -> folder ‘Methods’ -> folder ‘Inherited Methods’ -> select folder /IWBEP/IF_MGW_APPL_SRV_RUNTIME -> select ‘CREATE_DEEP_ENTITY’
    • right click -> ReDefine
    • Post redefinetion, it can be seen as /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY
    • double click on it -> Edit it
    • and write below code in CREATE_DEEP_ENTITY to define deep entity
  • method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY.
    
    DATA: IR_DEEP_ENTITY  TYPE ZCL_ZTEST_ODATA_MPC_EXT=>TS_DEEP_ENTITY.
    CASE iv_entity_set_name.
    *-------------------------------------------------------------------------*
    *  When EntitySet 'HeaderSet' is been invoked via service Url
    *-------------------------------------------------------------------------*
    WHEN 'HeaderSet'.
    
    CALL METHOD me->custome_create_deep_entity
      EXPORTING
        IV_ENTITY_NAME          = iv_entity_name
        IV_ENTITY_SET_NAME      = iv_entity_set_name
        IV_SOURCE_NAME          = iv_source_name
        IT_KEY_TAB              = it_key_tab
        IT_NAVIGATION_PATH      = it_navigation_path
        IO_EXPAND               = IO_EXPAND
        IO_TECH_REQUEST_CONTEXT = io_tech_request_context
        IO_DATA_PROVIDER        = io_data_provider
    IMPORTING
        ER_DEEP_ENTITY          = IR_DEEP_ENTITY
    .
    
    copy_data_to_ref(
    EXPORTING
     is_data = IR_DEEP_ENTITY
    CHANGING
     cr_data = er_deep_entity
    ).
    
    ENDCASE.
    
    
      endmethod.
    
    • save and activate.
  • Steps to Create method ‘CUSTOME_CREATE_DEEP_ENTITY’
    • In ‘_DPC_EXT’ -> Go to folder ‘Methods’ -> Enter new method name ‘CUSTOME_CREATE_DEEP_ENTITY‘  in center column as shown in below screen
    • To define parameter, click on “Parameter” button
  • 'PARAMETER LIST:
    IV_ENTITY_NAME              Importing      Type      STRING
    IV_ENTITY_SET_NAME          Importing      Type      STRING
    IV_SOURCE_NAME              Importing      Type      STRING
    IT_KEY_TAB                  Importing      Type      /IWBEP/T_MGW_NAME_VALUE_PAIR
    IT_NAVIGATION_PATH          Importing      Type      /IWBEP/T_MGW_NAVIGATION_PATH
    IO_EXPAND                   Importing      Type Ref To        /IWBEP/IF_MGW_ODATA_EXPAND
    IO_TECH_REQUEST_CONTEXT     Importing      Type Ref To        /IWBEP/IF_MGW_REQ_ENTITY_C
    IO_DATA_PROVIDER            Importing      Type Ref To        /IWBEP/IF_MGW_ENTRY_PROVIDER
    ER_DEEP_ENTITY              Exporting      Type     ZCL_ZTEST_ODATA_MPC_EXT=>TS_DEEP_ENTITY
    
    • Note: ‘ER_DEEP_ENTITY‘  is EXPORTING parameter
    • To define exception, click on “Exception” button
  • /IWBEP/CX_MGW_BUSI_EXCEPTION
    /IWBEP/CX_MGW_TECH_EXCEPTION
    • Save and Activate.
    • Next write code in method ‘Custome_Create Deep Entity’
  •   method CUSTOME_CREATE_DEEP_ENTITY.
    
    Types:
      begin of TYP_HEADER,
         FLD_1  type C length 4,
         FLD_2  type C length 4,
         FLD_3  type C length 10,
      end of TYP_HEADER .
    
    Types:
      begin of TYP_ITEM,
         IFLD_1  type C length 4,
         IFLD_2  type C length 4,
         IFLD_3  type C length 10,
      end of TYP_ITEM .
    
    Types:
      begin of TYP_RESULT,
         MSG_1  type STRING,
         MSG_2  type STRING,
      end of TYP_RESULT .
    
    DATA: IR_DEEP_ENTITY  TYPE                    ZCL_ZTEST_ODATA_MPC_EXT=>TS_DEEP_ENTITY,
          IT_RFC_HEADER   TYPE STANDARD TABLE OF  TYP_HEADER,
          WA_RFC_HEADER   TYPE                    TYP_HEADER,
          IT_RFC_ITEM     TYPE TABLE OF           TYP_ITEM,
          WA_RFC_ITEM     TYPE                    TYP_ITEM,
          IT_RFC_RESULT   TYPE STANDARD TABLE OF  TYP_RESULT,
          WA_RFC_RESULT   TYPE                    TYP_RESULT,
          WA_RESULTSET    TYPE                    ZCL_ZTEST_ODATA_MPC_EXT=>TS_RESULT,
          WA_ITEM         TYPE                    ZCL_ZTEST_ODATA_MPC_EXT=>TS_ITEM.
    
    FIELD-SYMBOLS: <WA_ITEM>   TYPE ZCL_ZTEST_ODATA_MPC_EXT=>TS_ITEM.
    FIELD-SYMBOLS: <WA_RESULT> TYPE ZCL_ZTEST_ODATA_MPC_EXT=>TS_RESULT.
    
    *Transform INPUT REQUEST FROM ODATA-SERVICE into the internal structure
    io_data_provider->read_entry_data(
    IMPORTING
     es_data = IR_DEEP_ENTITY ).
    
    * extract Header details from Entity 'Header'
    WA_RFC_HEADER-FLD_1     = IR_DEEP_ENTITY-FIELD1.
    WA_RFC_HEADER-FLD_2     = IR_DEEP_ENTITY-FIELD2.
    WA_RFC_HEADER-FLD_3     = IR_DEEP_ENTITY-FIELD3.
    APPEND WA_RFC_HEADER TO IT_RFC_HEADER.
    Clear  WA_RFC_HEADER.
    
    * extract Item details from Entity 'Item' (tabulabr input fields)
    LOOP AT IR_DEEP_ENTITY-ItemSet ASSIGNING <WA_ITEM>.
     WA_RFC_ITEM-IFLD_1      = <WA_ITEM>-IFLD1.
     WA_RFC_ITEM-IFLD_2      = <WA_ITEM>-IFLD2.
     WA_RFC_ITEM-IFLD_3      = <WA_ITEM>-IFLD3.
    APPEND WA_RFC_ITEM TO IT_RFC_ITEM.
    CLEAR  WA_RFC_ITEM.
    ENDLOOP.
    
    * Calling SAP R3's RFC via RFCDestination
    Call FUNCTION 'ZTEST_RFC_FIORI' DESTINATION '<RfcDestinationName of BackendSystem>'
    TABLES
      TBL_HEADER  = IT_RFC_HEADER
      TBL_ITEM    = IT_RFC_ITEM
      TBL_RESULT  = IT_RFC_RESULT.
    
    
    *EXPORTING OUTPUT TO oData EntitySet 'ResultSet'
    LOOP AT IT_RFC_RESULT INTO WA_RFC_RESULT.
      "Return output into Entity 'RESULT' via 'NavigationProperty=NAVRESULT'
      WA_RESULTSET-MSG1 = WA_RFC_RESULT-MSG_1.
      WA_RESULTSET-MSG2 = WA_RFC_RESULT-MSG_2.
      APPEND WA_RESULTSET TO ER_DEEP_ENTITY-NAVRESULT.
      CLEAR WA_RESULTSET.
    ENDLOOP.
    COMMIT WORK.
    
      endmethod.
    • Save and activate.

Testing the oData Service:

[1] Testing in Fiori-Server using t-code ‘/n/iwfnd/gw_client’:

  • [A] Check meta structure [GET Method]:
    • URL: ‘/sap/opu/odata/sap/ZTEST_ODATA_SRV/$metadata’
  • [B] Multiple Entity Request [POST Method]: 
    • As we know oData Service supports both JSON as well XML formats.
    • First lets test using XML format
    • Here we try to POST single header and multiple-item table to oData Service
    • i.e. posting one ‘Header’ Entity Data and multiple ‘Item’ Entity Data. This type of request should be framed in following XML format.
    • Request-XML format:
  • <?xml version="1.0" encoding="UTF-8"?>
    <atom:entry
      xmlns:atom="http://www.w3.org/2005/Atom"
      xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
      xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
      <atom:content type="application/xml">
        <m:properties>
          <d:Field1>hvl1</d:Field1>
          <d:Field2>hvl2</d:Field2>
          <d:Field3>hvl3</d:Field3>
        </m:properties>
      </atom:content>
      <atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ItemSet"
     type="application/atom+xml;type=feed"
     title="ZTEST_ODATA_SRV.HEADER_ITEM">
        <m:inline>
          <atom:feed>
            <atom:entry>
              <atom:content type="application/xml">
                <m:properties>
                  <!--<d:Row>1</d:Row>-->
                  <d:IFLD1>rv11</d:IFLD1>
                  <d:IFLD2>rv12</d:IFLD2>
                  <d:IFLD3>rv13</d:IFLD3>
                </m:properties>
              </atom:content>
            </atom:entry>
            <atom:entry>
              <atom:content type="application/xml">
                <m:properties>
                  <!--<d:Row>2</d:Row>-->
                  <d:IFLD1>rv21</d:IFLD1>
                  <d:IFLD2>rv22</d:IFLD2>
                  <d:IFLD3>rv23</d:IFLD3>
                </m:properties>
              </atom:content>
            </atom:entry>
          </atom:feed>
        </m:inline>
      </atom:link>
      <atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/NAVRESULT"
     type="application/atom+xml;type=feed"
     title="ZTEST_ODATA_SRV.HEADER_RESULT">
        <m:inline>
          <atom:feed>
            <atom:entry>
              <atom:content type="application/xml">
                <m:properties>
                  <!--<d:Row>1</d:Row>-->
                  <d:MSG1></d:MSG1>
                  <d:MSG2></d:MSG2>
                </m:properties>
              </atom:content>
            </atom:entry>
           </atom:feed>
        </m:inline>
      </atom:link>
    </atom:entry>
    • In JSON-Format, above request structure will look like as below:
  • {
      "Field1": "hvl1",
      "Field2": "hvl2",
      "Field3": "hvl3",
      "ItemSet": [
        {
          "IFLD1": "rv11",
          "IFLD2": "rv12",
          "IFLD3": "rv13"
        },
        {
          "IFLD1": "rv21",
          "IFLD2": "rv22",
          "IFLD3": "rv23"
        }
      ],
      "NAVRESULT": [
        {
          "MSG1": "",
          "MSG2": ""
        }
      ]
    }​
    • if we see above request XML, we are passing inputs as below:
      • Entity ‘Header’: At header level one row input (Field1,Field2,Field3)
      • Entity ‘Item’:      At Item level two row input      (ItemSet)
      • Entity ‘Result’:   one blank row, this is required to get output (NAVRESULT)
    • POST above request to Entity set of ‘Header’ from fiori t-code ‘/n/iwfnd/gw_client‘ using below details:
  • URL:	      /sap/opu/odata/sap/ZTEST_ODATA_SRV/HeaderSet
    Method:       POST
    
    In above Request-XML payload, below details been used:
    [1] For Request (input of Two Entity 'Header' and 'Item')
        Associations: "ZTEST_ODATA_SRV.HEADER_ITEM"
        Navigation:   "http://schemas.microsoft.com/ado/2007/08/dataservices/related/ItemSet"
    
    
    [2] For Response (output in Enity 'Result')
        Associations: "ZTEST_ODATA_SRV.HEADER_ITEM"
        Navigation:   "http://schemas.microsoft.com/ado/2007/08/dataservices/related/NAVRESULT"
    
    • The oData Service Request Screen in Fiori’s t-code ‘/n/iwfnd/GW_Client’
    • The oData Service Response received as below:
    • Below xml output received where we can see Entity Set ‘ResultSet’ has output
    • <?xml version="1.0" encoding="utf-8"?>
      <entry xml:base="http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/"
      	xmlns="http://www.w3.org/2005/Atom"
      	xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
      	xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
      	<id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/HeaderSet('')</id>
      	<title type="text">HeaderSet('')</title>
      	<updated>2018-03-29T11:04:19Z</updated>
      	<category term="ZTEST_ODATA_SRV.Header" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
      	<link href="HeaderSet('')" rel="self" title="Header"/>
      	<link href="HeaderSet('')/ItemSet" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ItemSet" type="application/atom+xml;type=feed" title="ItemSet">
      		<m:inline/>
      	</link>
      	<link href="HeaderSet('')/NAVRESULT" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/NAVRESULT" type="application/atom+xml;type=feed" title="NAVRESULT">
      		<m:inline>
      			<feed xml:base="http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/">
      				<id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/HeaderSet('')/NAVRESULT</id>
      				<title type="text">ResultSet</title>
      				<updated>2018-03-29T11:04:19Z</updated>
      				<author>
      					<name/>
      				</author>
      				<link href="HeaderSet('')/NAVRESULT" rel="self" title="ResultSet"/>
      				<entry>
      					<id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/ResultSet('hvl1')</id>
      					<title type="text">ResultSet('hvl1')</title>
      					<updated>2018-03-29T11:04:19Z</updated>
      					<category term="ZTEST_ODATA_SRV.Result" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>
      					<link href="ResultSet('hvl1')" rel="self" title="Result"/>
      					<content type="application/xml">
      						<m:properties>
      							<d:MSG1>hvl1</d:MSG1>
      							<d:MSG2>Data Receievd</d:MSG2>
      						</m:properties>
      					</content>
      				</entry>
      			</feed>
      		</m:inline>
      	</link>
      	<content type="application/xml">
      		<m:properties>
      			<d:Field1/>
      			<d:Field2/>
      			<d:Field3/>
      		</m:properties>
      	</content>
      </entry>
  • Debugging-Screen to understand how input and output is flowing:
  • [a] Input from oData Service request-Xml payload
    • Structure ‘IR_DEEP_ENTITY’
    • Structure ‘IR_DEEP_ENTITY’ -> ITEMSET        (which is Item level input)
    • Structure ‘IR_DEEP_ENTITY’ -> NAVRESULT   (which is blank)
  • [b] Back-end RFC call
    • Above two table input will be provided to RFC, post RFC call, it returns output in new table which will be mapped to Entity Set ‘Result’
  • [c] Returning output of RFC table to oData Service as a response
    • Out from RFC received in table ‘IT_RFC_RESULT’
    • Data of table  ‘IT_RFC_RESULT’ is been mapped to ‘ER_DEEP_ENTITY-NAVRESULT’ which is oData Service’s Entity Set ‘RESULT’ strcture reference

[2] Testing in Fiori-App using Eclipse:

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

    1. Dilip Kumar KrishnaDeo Pandey Post author

      Hi suman kumar,

      Please find following comments w.r.t. your query, for more clarity:

      • MPC (Model Provider class) – This is used to define model. we can use the method Define to create entity, properties etc using code based implementation. we rarely use MPC extension class.
      • DEFINE () Method: The content of the Define () method depends on the OData artifacts which are created for a model in SEGW (such as, entity types, associations, function imports, complex types, and more). For each of the artifacts created, one method will be generated and called inside this Define () method. Link ref:  https://help.sap.com/saphelp_gateway20sp12/helpdata/en/a9/40f8de079646369038a63b29ce1f97/frameset.htm
      • In Simple words: here, objective is to set reference of structure ‘TS_DEEP_Entity’ to Entity ‘Header’.
      • The structure ‘TS_DEEP_Entity’ has all properties of Header/Item/Result Entity.

      Thanks & Regards,

      Dilip

       

       

      (0) 
    1. Dilip Kumar KrishnaDeo Pandey Post author

      Hi Dubra,

       

      Regards,

      Dilip

      (0) 

Leave a Reply