cancel
Showing results for 
Search instead for 
Did you mean: 

Expand in CREATE_DEEP_ENTITY

Hvshal4u
Active Participant
0 Kudos

Hi Team ,

For my OData, service i need to pass multiple tables as input hence I redefined the CREATE_DEEP_ENTITY() method. Till now everything is OK.

But the issue is same service should return the table as output. Here I used POST method to send the data. In order to copy the output record to ER_ENTITY I used to COPY_DATA_TO_REF.

Below is the code snippet.

---------------------------------------------------

  CALL FUNCTION 'ZECC_FUNC_ORDERBOOKING_INVOICE' DESTINATION lv_destination

    EXPORTING

      iv_soldtoparty   = iv_soldtoparty

      iv_fromdate      = iv_fromdate

      iv_todate        = iv_todate

      iv_sales_org     = iv_sales_org

    IMPORTING

      ev_msg           = iv_msg

      ev_flag          = iv_flag

    TABLES

      sales_org        = lt_orderbooktosalesorg   " Input table

      sales_office     = lt_orderbooktosalesoffice " Input table

      sales_grp        = lt_orderbooktosalesgroup " Input table

      dist_channel     = lt_orderbooktodistchannel " Input table

      material_grp1    = lt_orderbooktomatgroup " Input table

     et_order_booking = lt_orderbooktoetorderbook " Output Table which has to shown in the output

    EXCEPTIONS

      system_failure   = 1000

      OTHERS           = 1002.

ls_expand-orderbooktoetorderbook[] = lt_orderbooktoetorderbook[].

copy_data_to_ref( EXPORTING is_data = ls_expand

                    CHANGING cr_data = er_deep_entity ).

Regards,

Vishal.

Accepted Solutions (0)

Answers (1)

Answers (1)

AshwinDutt
Active Contributor
0 Kudos

Hi Vishal,

Create one more entity in your GW model having the fields of et_order_booking.

Then create association and navigation between this entity and the header entity ( 1 to N cardinality ).

Generate run-time objects.

Now go to DPC_EXT class, enhance your deep structure ls_expand to hold the above output table and send back the response the way which your are already doing.

Regards,

Ashwin

Hvshal4u
Active Participant
0 Kudos

Thanks Ashwin,

I already have the additional entity along with the navigations.

Regards,

Vishal

AshwinDutt
Active Contributor
0 Kudos

Hello Vishal,

Then pass that navigation property in the payload during firing the POST.

...

<Navigation Property Name>:[{}]

...

Regards,

Ashwin

Hvshal4u
Active Participant
0 Kudos

Yes, Ashwin that is also done.I am getting the data also which I am passing in POST.

Regards,

Vishal

Hvshal4u
Active Participant
0 Kudos

Hi Ashwin ,

I read your response to the post :https://scn.sap.com/thread/3607686

And my requirement is exactly same.

But I am confused as how can I pass the NavigationProperty which is "OrderBookToETOrderBook"

in my case.

Can you please suggest how can I pass the same through XML payload.

Regards,

Vishal

AshwinDutt
Active Contributor
0 Kudos

Can you please share your already existing POST payload here ? based on that i can suggest.

Hvshal4u
Active Participant
0 Kudos

Hi Ashwin below is the xml payload

---------------------------

<?xml version="1.0" encoding="utf-8"?>

<entry xml:base="baseURL/sap/opu/odata/sap/ZGW_ECC_KD_MOBILITY_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">

<link href="OrderBookingInvoiceSet('1511')/OrderBookToSalesOrg" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/OrderBookToSalesOrg" type="application/atom+xml;type=feed" title="OrderBookToSalesOrg">

  <m:inline>

   <feed xml:base="baseURL/sap/opu/odata/sap/ZGW_ECC_KD_MOBILITY_SRV/">

    <link href="OrderBookingInvoiceSet('1511')/OrderBookToSalesOrg" rel="self" title="OrderBookingSalesOrgSet"/>

    <entry>

     <content type="application/xml">

      <m:properties>

       <d:SalesOrg>1511</d:SalesOrg>

      </m:properties>

     </content>

    </entry>

   </feed>

  </m:inline>

</link>

<link href="OrderBookingInvoiceSet('1511')/OrderBookToDistChannel" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/OrderBookToDistChannel" type="application/atom+xml;type=feed" title="OrderBookToDistChannel">

  <m:inline>

   <feed xml:base="baseURL/sap/opu/odata/sap/ZGW_ECC_KD_MOBILITY_SRV/">

    <entry>

     <content type="application/xml">

      <m:properties>

       <d:SalesOrg></d:SalesOrg>

       <d:DistChannel></d:DistChannel>

      </m:properties>

     </content>

    </entry>

   </feed>

  </m:inline>

</link>

<link href="OrderBookingInvoiceSet('1511')/OrderBookToSalesOffice" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/OrderBookToSalesOffice" type="application/atom+xml;type=feed" title="OrderBookToSalesOffice">

  <m:inline>

   <feed xml:base="baseURL/sap/opu/odata/sap/ZGW_ECC_KD_MOBILITY_SRV/">

    <entry>

     <content type="application/xml">

      <m:properties>

       <d:SalesOffice>DEL</d:SalesOffice>

       <d:SalesOrg></d:SalesOrg>

      </m:properties>

     </content>

    </entry>

   </feed>

  </m:inline>

</link>

<link href="OrderBookingInvoiceSet('1511')/OrderBookToSalesGroup" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/OrderBookToSalesGroup" type="application/atom+xml;type=feed" title="OrderBookToSalesGroup">

  <m:inline>

   <feed xml:base="baseURL/sap/opu/odata/sap/ZGW_ECC_KD_MOBILITY_SRV/">

    <entry>

     <content type="application/xml">

      <m:properties>

       <d:SalesOrg></d:SalesOrg>

       <d:SalesGrp></d:SalesGrp>

      </m:properties>

     </content>

    </entry>

   </feed>

  </m:inline>

</link>

<link href="OrderBookingInvoiceSet('1511')/OrderBookToMatGroup" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/OrderBookToMatGroup" type="application/atom+xml;type=feed" title="OrderBookToMatGroup">

  <m:inline>

   <feed xml:base="baseURL/sap/opu/odata/sap/ZGW_ECC_KD_MOBILITY_SRV/">

    <entry>

     <content type="application/xml">

      <m:properties>

       <d:SalesOrg></d:SalesOrg>

       <d:MaterialGroup1></d:MaterialGroup1>

      </m:properties>

     </content>

    </entry>

   </feed>

  </m:inline>

</link>

<content type="application/xml">

  <m:properties>

   <d:EvMsg></d:EvMsg>

   <d:EvFlag/>

   <d:IvTodate>201606</d:IvTodate>

   <d:IvSoldtoparty/>

   <d:IvSalesOrg>1511</d:IvSalesOrg>

   <d:IvFromdate>201501</d:IvFromdate>

  </m:properties>

</content>

  <link>

  <m:inline>

   <feed xml:base="baseURL/sap/opu/odata/sap/ZGW_ECC_KD_MOBILITY_SRV/">

    <entry>

     <content type="application/xml">

      <m:properties>

       <d:Salesorg>02</d:Salesorg>

       <d:SalesDistTxt>Ah3</d:SalesDistTxt>

       <d:SalesDist>444</d:SalesDist>

       <d:MaterialGp1Txt>02</d:MaterialGp1Txt>

       <d:MaterialGp1>02</d:MaterialGp1>

       <d:SoldtopartyTxt>02</d:SoldtopartyTxt>

       <d:Soldtoparty>02</d:Soldtoparty>

       <d:DistChannelTxt>test text</d:DistChannelTxt>

       <d:DistChannel>02</d:DistChannel>

       <d:SalesGrpTxt>02</d:SalesGrpTxt>

       <d:SalesGrp>02</d:SalesGrp>

       <d:SalesOfficeTxt>02</d:SalesOfficeTxt>

       <d:SalesOffice>02</d:SalesOffice>

       <d:SalesOrgTxt>02</d:SalesOrgTxt>

       <d:NetInvoicSales>123</d:NetInvoicSales>

       <d:NetOrder>99.00</d:NetOrder>

       <d:ItemNo>02</d:ItemNo>

       <d:SalesDocno>02</d:SalesDocno>

      </m:properties>

     </content>

    </entry>

   </feed>

  </m:inline>

</link>

</entry>