cancel
Showing results for 
Search instead for 
Did you mean: 

OData input is not passing to sap gateway deep entity method?

sivakumar_mobility
Active Participant
0 Kudos

Dear scn members,

I have created create deep entity set method to create PO but item values are not passing. I put break point also. but only passing header item is not passing.

My Input request is like below.

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

<entry xml:base="http://DNMECQ.DANAMCONSULTING.COM:8000/sap/opu/odata/sap/ZPO_SAMPLE_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://DNMECQ.DANAMCONSULTING.COM:8000/sap/opu/odata/sap/ZPO_SAMPLE_SRV/PurchaseOrderSet('4500017736')</id>

  <title type="text">PurchaseOrderSet('4500017736')</title>

  <updated>2016-06-06T10:32:24Z</updated>

  <category term="ZPO_SAMPLE_SRV.PurchaseOrder" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

  <link href="PurchaseOrderSet('4500017736')" rel="edit" title="PurchaseOrder"/>

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

   <m:inline>

    <feed xml:base="http://DNMECQ.DANAMCONSULTING.COM:8000/sap/opu/odata/sap/ZPO_SAMPLE_SRV/">

     <id>http://DNMECQ.DANAMCONSULTING.COM:8000/sap/opu/odata/sap/ZPO_SAMPLE_SRV/PurchaseOrderSet('4500017736')/PurchaseOrderItemSet</id>

     <title type="text">PurchaseOrderItemSet</title>

     <updated>2016-06-06T10:32:24Z</updated>

     <author>

      <name/>

     </author>

     <link href="PurchaseOrderSet('4500017736')/PurchaseOrderItemSet" rel="self" title="PurchaseOrderItemSet"/>

     <entry>

      <id>http://DNMECQ.DANAMCONSULTING.COM:8000/sap/opu/odata/sap/ZPO_SAMPLE_SRV/PurchaseOrderItemSet(PoItem='00002',PoNumber='4500017736')</id>

      <title type="text">PurchaseOrderItemSet(PoItem='00002',PoNumber='4500017736')</title>

      <updated>2016-06-06T10:32:24Z</updated>

      <category term="ZPO_SAMPLE_SRV.PurchaseOrderItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

      <link href="PurchaseOrderItemSet(PoItem='00002',PoNumber='4500017736')" rel="edit" title="PurchaseOrderItem"/>

      <content type="application/xml">

       <m:properties>

        <d:DispQuan>34.000</d:DispQuan>

        <d:Material>1157</d:Material>

        <d:PoItem>1</d:PoItem>

        <d:PoNumber>4500017736</d:PoNumber>

       </m:properties>

      </content>

     </entry>

     <entry>

      <id>http://DNMECQ.DANAMCONSULTING.COM:8000/sap/opu/odata/sap/ZPO_SAMPLE_SRV/PurchaseOrderItemSet(PoItem='00010',PoNumber='4500017736')</id>

      <title type="text">PurchaseOrderItemSet(PoItem='00010',PoNumber='4500017736')</title>

      <updated>2016-06-06T10:32:24Z</updated>

      <category term="ZPO_SAMPLE_SRV.PurchaseOrderItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/>

      <link href="PurchaseOrderItemSet(PoItem='00010',PoNumber='4500017736')" rel="edit" title="PurchaseOrderItem"/>

      <content type="application/xml">

       <m:properties>

        <d:DispQuan>34.000</d:DispQuan>

        <d:Material>1157</d:Material>

        <d:PoItem>2</d:PoItem>

        <d:PoNumber></d:PoNumber>

       </m:properties>

      </content>

     </entry>

    </feed>

   </m:inline>

  </link>

  <link href="PurchaseOrderSet('4500017736')/$links/PurchaseOrderItemSet" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/relatedlinks/PurchaseOrderItemSet" type="application/xml" title="PurchaseOrderItemSet"/>

  <content type="application/xml">

   <m:properties>

    <d:PoNumber></d:PoNumber>

    <d:CoCode>3000</d:CoCode>

    <d:DocType>EUB</d:DocType>

    <d:PurchOrg>3000</d:PurchOrg>

    <d:PurGroup>000</d:PurGroup>

    <d:Currency>EUR</d:Currency>

   </m:properties>

  </content>

</entry>

IN ls_data  Item value is not passing only header only passing.

create deep entity code structure is give below

TYPES: ty_t_pr_items TYPE TABLE OF ZCL_ZPO_SAMPLE_MPC=>ts_purchaseorderitem WITH DEFAULT KEY.

TYPES: BEGIN OF ts_purchaseorderitems.

            INCLUDE TYPE ZCL_ZPO_SAMPLE_MPC=>ts_purchaseorder.

TYPES: PrItemCollection TYPE ty_t_pr_items,

           END OF ts_purchaseorderitems.

DATA: ls_data TYPE  ts_purchaseorderitems.

io_data_provider->read_entry_data( IMPORTING es_data = ls_data ).

*    ls_item-PRItemCollection  = ls_data-PrItemCollection.

lt1_items  = ls_data-PrItemCollection.

please help me on this but  in odata create deep entity is created successfully but Po is not created because in ITem table is passing empty value.

Accepted Solutions (1)

Accepted Solutions (1)

JyotiD
Active Participant
0 Kudos

Siva,

For data declaration of internal tables in case of data provider expand use navigation property name to address dependent entity structure.


TYPES: BEGIN OF ts_purchaseorderitems.

            INCLUDE TYPE ZCL_ZPO_SAMPLE_MPC=>ts_purchaseorder.

TYPES: PrItemCollection TYPE ty_t_pr_items,

           END OF ts_purchaseorderitems.

Check after replacing PrItemCollection with navigation name.

Please check this document.

Regards,

Tarun

sivakumar_mobility
Active Participant
0 Kudos

Hi Tarun,

Thank you for your help.

Can you know how to do same operation from sap ui5?

I have designed table .From that table How to fetch line items and  and how to pass to URl and how to create it from sapui5.

If you help on this it will be great.

Answers (1)

Answers (1)

k_sood
Active Participant
0 Kudos

I had the same issue and resolved it following your answer.

Thanks a lot

Ketan