cancel
Showing results for 
Search instead for 
Did you mean: 

Create_deep_entity issue

GowthamRaja
Participant
0 Kudos

Hi Experts,

I am creating a deep entity with one header and 4 items. I am using postman rest client in chrome browser. I am fetching the data by GET method and the URL for GET method is http://hostname:port/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS?$filter=SO_ID eq '0000004970' &$expand=SO_ITEMSet , i have copied the response along with x-csrf token and replacing the token with its value and content-type = application/atom+xml. Now changing the method to POST and in the request body i have paste the code as below.


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

<feed xml:base="http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_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://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS</id>

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

<updated>2015-07-21T06:46:49Z</updated>

  <author>

  <name/>

  </author>

  <link href="SO_HEADERS" rel="self" title="SO_HEADERS"/>

  <entry>

<id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS('4970')</id>

  <title type="text">SO_HEADERS('4970')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

  <link href="SO_HEADERS('4970')" rel="edit" title="SO_HEADER"/>

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

<m:inline>

<feed xml:base="http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/">

<id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS('4970')/SO_ITEMSet</id>

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

<updated>2015-07-21T06:46:49Z</updated>

<author>

<name/>

</author>

<link href="SO_HEADERS('4970')/SO_ITEMSet" rel="self" title="SO_ITEMS"/>

<entry>

  <id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000010')</id>

<title type="text">SO_ITEMS(SO_ID='4970',ITEM_NO='000010')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

<link href="SO_ITEMS(SO_ID='4970',ITEM_NO='000010')" rel="edit" title="SO_ITEM"/>

<content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:ITEM_NO>10</d:ITEM_NO>

<d:MAT_NO>100-100</d:MAT_NO>

<d:PLANT>1000</d:PLANT>

<d:TARGET_QTY>4</d:TARGET_QTY>

<d:TARGET_QU>ST</d:TARGET_QU>

<d:ITEM_CATEG>TAN</d:ITEM_CATEG>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

<d:PURCH_DATE>20150728</d:PURCH_DATE>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:SALES_UNIT>ST</d:SALES_UNIT>

<d:DIVISION>00</d:DIVISION>

<d:CURRENCY>EUR</d:CURRENCY>

</m:properties>

</content>

</entry>

<entry>

  <id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000020')</id>

<title type="text">SO_ITEMS(SO_ID='4970',ITEM_NO='000020')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

<link href="SO_ITEMS(SO_ID='4970',ITEM_NO='000020')" rel="edit" title="SO_ITEM"/>

<content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:ITEM_NO>20</d:ITEM_NO>

<d:MAT_NO>100-100</d:MAT_NO>

<d:PLANT>1000</d:PLANT>

<d:TARGET_QTY>3</d:TARGET_QTY>

<d:TARGET_QU>ST</d:TARGET_QU>

<d:ITEM_CATEG>TAN</d:ITEM_CATEG>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

<d:PURCH_DATE>20150728</d:PURCH_DATE>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:SALES_UNIT>ST</d:SALES_UNIT>

<d:DIVISION>00</d:DIVISION>

<d:CURRENCY>EUR</d:CURRENCY>

</m:properties>

</content>

</entry>

<entry>

  <id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000030')</id>

<title type="text">SO_ITEMS(SO_ID='4970',ITEM_NO='000030')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

<link href="SO_ITEMS(SO_ID='4970',ITEM_NO='000030')" rel="edit" title="SO_ITEM"/>

<content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:ITEM_NO>30</d:ITEM_NO>

<d:MAT_NO>100-100</d:MAT_NO>

<d:PLANT>1000</d:PLANT>

<d:TARGET_QTY>2</d:TARGET_QTY>

<d:TARGET_QU>ST</d:TARGET_QU>

<d:ITEM_CATEG>TAN</d:ITEM_CATEG>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

<d:PURCH_DATE>20150728</d:PURCH_DATE>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:SALES_UNIT>ST</d:SALES_UNIT>

<d:DIVISION>00</d:DIVISION>

<d:CURRENCY>EUR</d:CURRENCY>

</m:properties>

</content>

</entry>

<entry>

  <id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000040')</id>

<title type="text">SO_ITEMS(SO_ID='4970',ITEM_NO='000040')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

<link href="SO_ITEMS(SO_ID='4970',ITEM_NO='000040')" rel="edit" title="SO_ITEM"/>

<content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:ITEM_NO>40</d:ITEM_NO>

<d:MAT_NO>100-100</d:MAT_NO>

<d:PLANT>1000</d:PLANT>

<d:TARGET_QTY>1</d:TARGET_QTY>

<d:TARGET_QU>ST</d:TARGET_QU>

<d:ITEM_CATEG>TAN</d:ITEM_CATEG>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

<d:PURCH_DATE>20150728</d:PURCH_DATE>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:SALES_UNIT>ST</d:SALES_UNIT>

<d:DIVISION>00</d:DIVISION>

<d:CURRENCY>EUR</d:CURRENCY>

</m:properties>

</content>

</entry>

</feed>

</m:inline>

  </link>

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

  <content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:CURRENCY>EUR</d:CURRENCY>

<d:DOC_TYPE>OR</d:DOC_TYPE>

<d:DOC_DATE>20150721</d:DOC_DATE>

<d:SALES_ORG>1000</d:SALES_ORG>

<d:DIST_CHANNEL>10</d:DIST_CHANNEL>

<d:DIVISION>00</d:DIVISION>

<d:SALES_GRP>130</d:SALES_GRP>

<d:SALES_OFF>1030</d:SALES_OFF>

<d:REQ_DATE_H m:null="true"/>

<d:PURCH_DATE m:null="true"/>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

</m:properties>

  </content>

  </entry>

</feed>

For POST method, the URL is http://hostname:port/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS when i execute it the break point not triggered in the create_deep_entitty method and i am getting the error as


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

<error 
    xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
    <code>CX_ST_MATCH_ELEMENT/544FAE4641562346A1372144E7396586</code>
    <message xml:lang="en">System expected the element '{http://www.w3.org/2005/Atom}entry'</message>
    <innererror>
        <transactionid>5A7D2FE5FAE1F1609A3F005056BE7049</transactionid>
        <errordetails/>
    </innererror>
</error>

Please help me to resolve this issue.

Thanks,

Gowtham

Accepted Solutions (0)

Answers (5)

Answers (5)

GowthamRaja
Participant
0 Kudos

Hi Experts,

The issue not yet resolved. The input in postman rest client is in json format as

{

                "SO_ID": "0",

                "CURRENCY": "EUR",

                "DOC_TYPE": "TA",

                "DOC_DATE": "2015-07-23T00:00:00",

                "SALES_ORG": "1000",

                "DIST_CHANNEL": "10",

                "DIVISION": "00",

                "SALES_GRP": "130",

                "SALES_OFF": "1030",

                "REQ_DATE_H": null,

                "PURCH_DATE": null,

                "INCOTERMS1": "CIP",

                "INCOTERMS2": "Nürnberg",

                "PMNTTRMS": "ZB01",

                "PRICE_DATE": "2015-07-23T00:00:00",

                "PURCH_NO_C": "TEST ORDER",

"SO_ITEMSet":[{

                            "SO_ID": "0",

                            "ITEM_NO": "000010",

                            "MAT_NO": "100-100",

                            "PLANT": "1000",

                            "TARGET_QTY": "4",

                            "TARGET_QU": "ST",

                            "ITEM_CATEG": "TAN",

                            "PURCH_NO_C": "TEST ORDER",

                            "PURCH_DATE": "2015-07-23T00:00:00",

                            "INCOTERMS1": "CIP",

                            "INCOTERMS2": "Nürnberg",

                            "PMNTTRMS": "ZB01",

                            "PRICE_DATE": "2015-07-23T00:00:00",

                            "SALES_UNIT": "ST",

                            "DIVISION": "00",

                            "CURRENCY": "EUR"

}]

}

When i start debugging, the header data alone displaying in its structure but the item details are empty as shown below

My structure for ls_so is

TYPES: ty_t_soitem TYPE STANDARD TABLE OF zcl_zsalesorder_mpc=>ts_so_item WITH DEFAULT KEY.

* Represents full Sales Order structure - header with one of more items

TYPES:  BEGIN OF ty_s_so.

                 INCLUDE TYPE zcl_zsalesorder_mpc=>ts_so_header.

                 TYPES: SO_ITEMSet TYPE ty_t_soitem,

              END OF ty_s_so.

DATA: ls_so type ty_s_so.

My doubt is am i giving the correct json format for items in the browser input. if it is correct i dont why the item details alone is empty in the structure so_itemset.

Please help me

Thanks,

Gowtham

AshwinDutt
Active Contributor
0 Kudos

can you please share the screen shot of item properties defined in the GW model in SEGW and also their ABAP field names ?

GowthamRaja
Participant
0 Kudos
AshwinDutt
Active Contributor
0 Kudos

Can you cross check once if the ABAP fields names of the structure ts_so_item inside GW MPC class ( zcl_zsalesorder_mpc ) is exactly same as the names of the ABAP fields defined in the GW Model in SEGW  ?

GowthamRaja
Participant
0 Kudos

Hi Ashwin,

I have cross checked its same as shown below

Thanks,

Gowtham

AshwinDutt
Active Contributor
0 Kudos

Everything looks fine but still not sure why Item details are not read from payload.

Can you regenerate objects again and clear cache and test one more time ?

You can just try creating the whole thing again freshly ( Entities, Association and Navigation ) in a different project and add code and test again.

GowthamRaja
Participant
0 Kudos

Okay i will do it, meanwhile can you please tell how the xml format should be instead of using json format.

Former Member
0 Kudos

Hi Gowtham,

Can you try defining the deep structure in a different manner like this-

*TYPES: ty_t_soitem TYPE STANDARD TABLE OF zcl_zsalesorder_mpc=>ts_so_item WITH DEFAULT KEY.

* Represents full Sales Order structure - header with one of more items

DATA:  BEGIN OF ty_s_so.

                 INCLUDE TYPE zcl_zsalesorder_mpc=>ts_so_header.

                 DATA: SO_ITEMSet TYPE TABLE OF zcl_zsalesorder_mpc=>ts_so_item WITH DEFAULT KEY,

              END OF ty_s_so.

DATA: ls_so TYPE ty_s_so.

It is not the best approach to declare structures, but it works for me. Also, try changing the cardinality of the header-to-item to 1-to-M.

Let me know if it still doesn't work.

Cheers,

-NK

GowthamRaja
Participant
0 Kudos

Hi Nirmish,

I have tried with your code. it not worked. The SO_ITEMSet is empty.

Former Member
0 Kudos

Hi Gowtham,

This is probably a silly solution. Have you tried running your BAPI with the same inputs that you are passing? Check if the item table has the data. Because it seems that your code is correct.

Cheers,

-NK

GowthamRaja
Participant
0 Kudos

Hi Nimish,

Intially i tried with the program for bapi input which works fine and then only i have started creating project.

Thanks,

Gowtham

former_member206574
Active Participant
0 Kudos

Hi Gowtham,

Can you provide the navigation property screen shot from data modeling by double clicking on navigation property.

Regards,

Venu

Former Member
0 Kudos

Hi Gowtham,

Can you set an external debugger at the line

io_data_provider->read_entry_data( IMPORTING es_data = ls_so ). in your method?

Check if ls_so-SO_ITEMSet has data in it. If it does, check if it proceeds to ls_soitem.

If it doesnt proceed to ls_soitem, declare ls_item of type ty_s_so.

Let me know if this works,

-NK

GowthamRaja
Participant
0 Kudos

Hi Venu,

This is my navigation property snapshot,

Thanks,

Gowtham

GowthamRaja
Participant
0 Kudos

Hi Nimish,

I have kept breakpoint and debugged at the line

io_data_provider->read_entry_data( IMPORTING es_data =ls_so ). but ls_so-so_itemset is still empty



Former Member
0 Kudos

Hi Gowtham,

Like i said, declare ls_item of type ls_s_so.

That will solve your issue.

Regards,

-NK

GowthamRaja
Participant
0 Kudos

Hi Nimesh,

Please correct me if i am wrong. If my ls_so-so_itemset contains data, then only i could move the data to ls_item. I am saying my ls_so-so_itemset itself empty then how do i proceed further.

Former Member
0 Kudos

Hi Gowtham,

Apologies for overlooking that, and for the delay in replying as well.

In case you don't get data in the SO_ITEMSet, You probably catch an exception while debugging. Can you drill down the exception and see what the error message is caught?

Also, can you check what io_expand contains?

Post both screenshots for that.

Cheers,

-NK

GowthamRaja
Participant
0 Kudos

Hi Nimish,

Thanks for your response. I have attached the snapshots.

Thanks,

Gowtham

Former Member
0 Kudos

Hi Gowtham,

Can you comment the line

if lv_compare_result EQ /iwbep/if_mgw_odata_expand=>gcs_compare_result-match_equals.


and keep this as uncommented

io_data_provider->read_entry_data( IMPORTING es_data = ls_so ).


after the line

lv_compare_result = io_expand->compare_to( lc_soitems ).


I want to see what exception is caught in your io_expand, over where there should be something related to your child-set SO_ITEMSet and where the data goes exactly.


Post the screenshot of the error message which you get when you press f5 after you catch the exception, and go inside it.


Cheers,

-NK

GowthamRaja
Participant
0 Kudos

Hi Nimish,

I have altered coding as u said,

when i click f5 at line no.60, it went to exception screen,

clicking the lo_exception structure in deep

the output finally i got,

Error log of the output,

Former Member
0 Kudos

Hi Gowtham,

This is a wierd error. Looks like some BSP dump. Don't try to go around it by commenting the compare line, instead post this question separately.

Meanwhile, can you double click on io_expand after the execution of the line

lv_compare_result = io_expand->compare_to( lc_soitems ).

Post what happens inside the io_expand's mt_children, lets see if the item data is there or not.

Cheers,

-NK

former_member206574
Active Participant
0 Kudos

Hi Gowtham,

in data declaration part for header and line items.

DATA:  BEGIN OF ty_s_so.

                 INCLUDE TYPE zcl_zsalesorder_mpc=>ts_so_header.

                 DATA: SO_ITEMSET TYPE TABLE OFzcl_zsalesorder_mpc=>ts_so_item WITH DEFAULT KEY,

              END OF ty_s_so.

In constants declaration:

constants: lc_soitems type string value 'SO_ITEMSET'.

Provide navigation name completely in capital letters.

Now keep debugging point and check whether u r able to get the line items into SO_ITEMSET.

Regards,

Venu

GowthamRaja
Participant
0 Kudos

Hi Venu,

Sorry for the delayed response. Although i tried with what you have said it haven't worked.

former_member206574
Active Participant
0 Kudos

Hi Gowtham,

in data declaration part for header and line items.

DATA:  BEGIN OF ty_s_so.

                 INCLUDE TYPE zcl_zsalesorder_mpc=>ts_so_header.

                 DATA: SO_ITEM TYPE TABLEOFzcl_zsalesorder_mpc=>ts_so_item WITH DEFAULTKEY,

              END OF ty_s_so.

In constants declaration:

constants: lc_soitems type string value 'SO_ITEM'.

Provide navigation name completely in capital letters.

Change your navigation property name as item property name as shown in below screen shot.

Now keep debugging point and check whether u r able to get the line items into SO_ITEMSET.



Regards,

Venu

GowthamRaja
Participant
0 Kudos

Hi Venu,

This fails. The item internal table is still empty. Shall we go for option 2 we as discussed?

GowthamRaja
Participant
0 Kudos

Hi Venu,

Tried from scratch but it failed. It seems that we should go for method 2 redeifinition. Please suggest

GowthamRaja
Participant
0 Kudos

Hi,

I could able to create the header now but not item details. Please refer the below snap shots.

I dont know why this deep structue so_items is empty or am i lagging anywhere?

AshwinDutt
Active Contributor
0 Kudos

Hello Raja,

SO_ITEMSet ( Navigation Property ) to be used as the name to define the item table in Deep Structure ( ty_s_so ).

....

types: SO_ITEMSet type ty_t_soitem,

......

Constant value for lc_soitems which is maintained in code is SO_ITEMS.


Value to be maintained is 'SO_ITEMSet'.


Please check this.


Regards,

Ashwin

GowthamRaja
Participant
0 Kudos

Oh i c!!!! thanks for this information Ashwin, its giving me the value E as shown in the snap shot below,

but i couldn't able execute the line no.52 (io_data_provider) the debugger is closing suddenly and i am getting the error in the browser as

{

    "error": {

        "code": "005056A509B11ED1B9BF9F46AA8E82ED",

        "message": {

            "lang": "en",

            "value": "In the context of Data Services an unknown internal server error occured"

        }

    }

}

AshwinDutt
Active Contributor
0 Kudos

Can you please share the code for Declaring the Deep Structure here?

GowthamRaja
Participant
0 Kudos

TYPES: ty_t_soitem TYPE STANDARD TABLE OF zcl_zsalesorder_mpc=>ts_so_item WITH DEFAULT KEY.

* Represents full Sales Order structure - header with one of more items

TYPESBEGIN OF ty_s_so.

         INCLUDE TYPE zcl_zsalesorder_mpc=>ts_so_header.

         TYPES: SO_ITEMSet TYPE ty_t_soitem,

         END OF ty_s_so.

GowthamRaja
Participant
0 Kudos

METHOD /iwbep/if_mgw_appl_srv_runtime~create_deep_entity.

**TRY.

*CALL METHOD SUPER->/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_DEEP_ENTITY

*  EXPORTING

*    IV_ENTITY_NAME          =

*    IV_ENTITY_SET_NAME      =

*    IV_SOURCE_NAME          =

*    IO_DATA_PROVIDER        =

*    IT_KEY_TAB              =

*    IT_NAVIGATION_PATH      =

*    IO_EXPAND               =

**    io_tech_request_context =

**  IMPORTING

**    er_deep_entity          =

*    .

** CATCH /iwbep/cx_mgw_busi_exception .

** CATCH /iwbep/cx_mgw_tech_exception .

**ENDTRY.

TYPES: ty_t_soitem TYPE STANDARD TABLE OF zcl_zsalesorder_mpc=>ts_so_item WITH DEFAULT KEY.

* Represents full Sales Order structure - header with one of more items

TYPESBEGIN OF ty_s_so.

         INCLUDE TYPE zcl_zsalesorder_mpc=>ts_so_header.

         TYPES: SO_ITEMSet TYPE ty_t_soitem,

         END OF ty_s_so.

TYPES: cx_mgw_busi_exception TYPE REF TO /iwbep/cx_mgw_busi_exception.

DATA: ls_so TYPE ty_s_so,

       ls_item TYPE zcl_zsalesorder_mpc=>ts_so_item,

       lv_compare_result TYPE /iwbep/if_mgw_odata_expand=>ty_e_compare_result.

DATA: lv_soid TYPE bapivbeln-vbeln,

       ls_sohdr TYPE bapisdhd1,

       ls_soitem TYPE bapisditm,

       lt_soitem TYPE STANDARD TABLE OF bapisditm,

       ls_partner TYPE bapiparnr,

       lt_partner TYPE STANDARD TABLE OF bapiparnr,

       lt_return TYPE bapirettab,

       lr_return TYPE REF TO bapiret2,

       lx_busi_exc TYPE cx_mgw_busi_exception,

       lo_meco TYPE REF TO /iwbep/if_message_container.

constants: lc_soitems TYPE string VALUE 'SO_ITEMSet'.

* Validate whether the current request including the inline SOItem data matches

lv_compare_result = io_expand->compare_to( lc_soitems ).

* Upon match, access data from IO_DATA_PROVIDER

if lv_compare_result EQ /iwbep/if_mgw_odata_expand=>gcs_compare_result-match_equals.

io_data_provider->read_entry_data( IMPORTING es_data = ls_so ).

* Move data into BAPI structure

" Header data

ls_sohdr-CURRENCY = ls_so-CURRENCY.

ls_sohdr-DOC_TYPE = ls_so-DOC_TYPE.

ls_sohdr-DOC_DATE = ls_so-DOC_DATE.

ls_sohdr-SALES_ORG = ls_so-SALES_ORG.

ls_sohdr-DISTR_CHAN = ls_so-DIST_CHANNEL.

ls_sohdr-DIVISION = ls_so-DIVISION.

ls_sohdr-SALES_GRP = ls_so-SALES_GRP.

ls_sohdr-SALES_OFF = ls_so-SALES_OFF.

ls_sohdr-REQ_DATE_H = ls_so-REQ_DATE_H.

ls_sohdr-PURCH_DATE = ls_so-PURCH_DATE.

ls_sohdr-INCOTERMS1 = ls_so-INCOTERMS1.

ls_sohdr-INCOTERMS2 = ls_so-INCOTERMS2.

ls_sohdr-PMNTTRMS = ls_so-PMNTTRMS.

ls_sohdr-PRICE_DATE = ls_so-PRICE_DATE.

ls_sohdr-PURCH_NO_C = ls_so-PURCH_NO_C.

" Item data

loop at ls_so-SO_ITEMSet into ls_item.

ls_soitem-itm_number = ls_item-ITEM_NO.

ls_soitem-material = ls_item-MAT_NO.

ls_soitem-plant = ls_item-Plant.

ls_soitem-TARGET_QTY = ls_item-Quantity.

ls_soitem-TARGET_QU = ls_item-TARGET_QU.

ls_soitem-ITEM_CATEG = ls_item-ITEM_CATEG.

ls_soitem-PURCH_NO_C = ls_item-PURCH_NO_C.

ls_soitem-PURCH_DATE = ls_item-PURCH_DATE.

ls_soitem-INCOTERMS1 = ls_item-INCOTERMS1.

ls_soitem-INCOTERMS2 = ls_item-INCOTERMS2.

ls_soitem-PMNTTRMS = ls_item-PMNTTRMS.

ls_soitem-PRICE_DATE = ls_item-PRICE_DATE.

ls_soitem-SALES_UNIT = ls_item-SALES_UNIT.

ls_soitem-DIVISION = ls_item-DIVISION.

ls_soitem-CURRENCY = ls_item-CURRENCY.

append ls_soitem to lt_soitem.

endloop.

" Fill Partner table with one entry - Sold-to Party

ls_partner-partn_role = 'AG'.

ls_partner-partn_numb = '0000001111'.

append ls_partner to lt_partner.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

   EXPORTING

*   SALESDOCUMENTIN               =

     order_header_in               = ls_sohdr

*   ORDER_HEADER_INX              =

*   SENDER                        =

*   BINARY_RELATIONSHIPTYPE       =

*   INT_NUMBER_ASSIGNMENT         =

*   BEHAVE_WHEN_ERROR             =

*   LOGIC_SWITCH                  =

*   TESTRUN                       =

*   CONVERT                       = ' '

  IMPORTING

    SALESDOCUMENT                 = lv_soid

   tables

    RETURN                        = lt_return

    ORDER_ITEMS_IN                = lt_soitem

*   ORDER_ITEMS_INX               =

     order_partners                = lt_partner

*   ORDER_SCHEDULES_IN            =

*   ORDER_SCHEDULES_INX           =

*   ORDER_CONDITIONS_IN           =

*   ORDER_CONDITIONS_INX          =

*   ORDER_CFGS_REF                =

*   ORDER_CFGS_INST               =

*   ORDER_CFGS_PART_OF            =

*   ORDER_CFGS_VALUE              =

*   ORDER_CFGS_BLOB               =

*   ORDER_CFGS_VK                 =

*   ORDER_CFGS_REFINST            =

*   ORDER_CCARD                   =

*   ORDER_TEXT                    =

*   ORDER_KEYS                    =

*   EXTENSIONIN                   =

*   PARTNERADDRESSES              =

*   NFMETALLITMS                  =

           .

   READ TABLE lt_return INDEX 1 REFERENCE INTO lr_return.

     IF lr_return->*-type NE 'S'.

     lo_meco = mo_context->get_message_container( ).

     lo_meco->add_messages_from_bapi(

     it_bapi_messages = lt_return

     iv_determine_leading_msg = /iwbep/if_message_container=>gcs_leading_msg_search_option-first

     ).

     CREATE OBJECT lx_busi_exc

     EXPORTING

     message_container = lo_meco.

     RAISE EXCEPTION lx_busi_exc.

     ELSE.

     COMMIT WORK.

     ls_so-so_id = lv_soid.

     ENDIF.

   copy_data_to_ref(

   EXPORTING

   is_data = ls_so

   CHANGING

   cr_data = er_deep_entity

   ).

ENDIF.

ENDMETHOD.

AshwinDutt
Active Contributor
0 Kudos

Declare Deep Structure as below and check again please ->

DATA: BEGIN OF  ty_s_so.

   INCLUDE                 TYPE zcl_zsalesorder_mpc=>ts_so_header.

   DATA: SO_ITEMSet TYPE STANDARD TABLE OF zcl_zsalesorder_mpc=>ts_so_item WITH DEFAULT KEY,

END OF ty_s_so.

DATA: ls_so like ty_s_so.

GowthamRaja
Participant
0 Kudos

This coding is also not working. after io_data_provider line shows me this screen

GowthamRaja
Participant
0 Kudos

Ashwin,

FYI...

To skip the cx_no_check into lo_exception error i have also tried the coding as

lv_compare_result = io_expand->compare_to( lc_soitems ).

* Upon match, access data from IO_DATA_PROVIDER

if lv_compare_result EQ /iwbep/if_mgw_odata_expand=>gcs_compare_result-match_equals.

TRY .

io_data_provider->read_entry_data( IMPORTING es_data = ls_so ).

CATCH cx_no_check.

ENDTRY.


Where i could proceed with io_data_provider now but now also i am getting the header details and my item deep structure remains empty as




AshwinDutt
Active Contributor
0 Kudos

In screen shot i still see ls_so has SO_ITEMS as the name for Item Table.

It should be SO_ITEMSet which is a navigation property defined by you in GW Model.

Please correct this and check again.

GowthamRaja
Participant
0 Kudos

Sorry this is old snap shot. After correction also getting the same

AshwinDutt
Active Contributor
0 Kudos

No code is written in any of the methods of MPC_EXT class is it ?

AshwinDutt
Active Contributor
0 Kudos

What is the cardinality between Header and Item ?

GowthamRaja
Participant
0 Kudos

Yes no code in MPC_EXT method in any of the methods.

GowthamRaja
Participant
0 Kudos

The cardinality is 1 to N

AshwinDutt
Active Contributor
0 Kudos

Can you remove the referential constraint SO_ID from GW Model , Regenerate Objects and clear /iwfnd/cache_cleanup and check again ?

GowthamRaja
Participant
0 Kudos

Sorry it not worked

kammaje_cis
Active Contributor
0 Kudos

Gowtham,

Gateway is failing to parse the XML. I would suggest to try with Json as it is very simple. Once you copy the $expand json response as request body, remove all the unnecessary  entries like associations, navigations etc.

Pavan_Golesar
Active Participant
0 Kudos

Hello Krishna,

     As mentioned, can we have any other way than the manual removal of the unnecessary entries like associations, navigations etc from the HTTP REQUEST...???

so that when the Fiori app uses this OData service, then this unnecessary entries already removed...



Best Regards,

Pavan Golesar.

GowthamRaja
Participant
0 Kudos

Hi Krishna,

I have tried with json format and deleting navigation and association properties, but it failed which gives me error as

{

    "error": {

        "code": "/IWCOR/CX_DS_EP_PROPERTY_ERROR/005056A509B11ED1BF822D2D09171A04",

        "message": {

            "lang": "en",

            "value": "Property 'results' is invalid"

        },

        "innererror": {

            "transactionid": "42932FE53A76F1069A3F005056BE7049",

            "errordetails": []

        }

    }

}

Request body input:

{

    "d": {

        "results": [

            {

                "__metadata": {

                    "id": "http://hostname:port/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS('4970')",

                    "uri": "http://hostname:port/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS('4970')",

                    "type": "ZSALESORDER_SRV.SO_HEADER",

                    },

                "SO_ID": "0",

                "CURRENCY": "EUR",

                "DOC_TYPE": "OR",

                "DOC_DATE": "20150721",

                "SALES_ORG": "1000",

                "DIST_CHANNEL": "10",

                "DIVISION": "00",

                "SALES_GRP": "130",

                "SALES_OFF": "1030",

                "REQ_DATE_H": null,

                "PURCH_DATE": null,

                "INCOTERMS1": "CIP",

                "INCOTERMS2": "Nürnberg",

                "PMNTTRMS": "ZB01",

                "PRICE_DATE": "20150721",

                "PURCH_NO_C": "TEST ORDER",

                "SO_ITEMSet": {

                    "results": [

                        {

                            "__metadata": {

                                "id": "http://hostname:port/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000010')",

                                "uri": "http://hostname:port/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000010')",

                                "type": "ZSALESORDER_SRV.SO_ITEM"

                            },

                            "SO_ID": "0",

                            "ITEM_NO": "000010",

                            "MAT_NO": "100-100",

                            "PLANT": "1000",

                            "TARGET_QTY": "4",

                            "TARGET_QU": "ST",

                            "ITEM_CATEG": "TAN",

                            "PURCH_NO_C": "TEST ORDER",

                            "PURCH_DATE": "20150721",

                            "INCOTERMS1": "CIP",

                            "INCOTERMS2": "Nürnberg",

                            "PMNTTRMS": "ZB01",

                            "PRICE_DATE": "20150721",

                            "SALES_UNIT": "ST",

                            "DIVISION": "00",

                            "CURRENCY": "EUR"

                        }

                    ]

                }

            }

        ]

    }

}

kammaje_cis
Active Contributor
0 Kudos

I meant like this.


    {

      "SO_ID": "0",

      "CURRENCY": "EUR",

      "DOC_TYPE": "OR",

      "DOC_DATE": "20150721",

      "SALES_ORG": "1000",

      "DIST_CHANNEL": "10",

      "DIVISION": "00",

      "SALES_GRP": "130",

      "SALES_OFF": "1030",

      "REQ_DATE_H": null,

      "PURCH_DATE": null,

      "INCOTERMS1": "CIP",

      "INCOTERMS2": "Nürnberg",

      "PMNTTRMS": "ZB01",

      "PRICE_DATE": "20150721",

      "PURCH_NO_C": "TEST ORDER",

      "SO_ITEMSet": [

        {

          "SO_ID": "0",

          "ITEM_NO": "000010",

          "MAT_NO": "100-100",

          "PLANT": "1000",

          "TARGET_QTY": "4",

          "TARGET_QU": "ST",

          "ITEM_CATEG": "TAN",

          "PURCH_NO_C": "TEST ORDER",

          "PURCH_DATE": "20150721",

          "INCOTERMS1": "CIP",

          "INCOTERMS2": "Nürnberg",

          "PMNTTRMS": "ZB01",

          "PRICE_DATE": "20150721",

          "SALES_UNIT": "ST",

          "DIVISION": "00",

          "CURRENCY": "EUR"

        }

      ]

    }

AshwinDutt
Active Contributor
0 Kudos

Below should work. Check ->

{

                "SO_ID": "0",

                "CURRENCY": "EUR",

                "DOC_TYPE": "OR",

                "DOC_DATE": "20150721",

                "SALES_ORG": "1000",

                "DIST_CHANNEL": "10",

                "DIVISION": "00",

                "SALES_GRP": "130",

                "SALES_OFF": "1030",

                "REQ_DATE_H": null,

                "PURCH_DATE": null,

                "INCOTERMS1": "CIP",

                "INCOTERMS2": "Nürnberg",

                "PMNTTRMS": "ZB01",

                "PRICE_DATE": "20150721",

                "PURCH_NO_C": "TEST ORDER",

"SO_ITEMSet":[{

                            "SO_ID": "0",

                            "ITEM_NO": "000010",

                            "MAT_NO": "100-100",

                            "PLANT": "1000",

                            "TARGET_QTY": "4",

                            "TARGET_QU": "ST",

                            "ITEM_CATEG": "TAN",

                            "PURCH_NO_C": "TEST ORDER",

                            "PURCH_DATE": "20150721",

                            "INCOTERMS1": "CIP",

                            "INCOTERMS2": "Nürnberg",

                            "PMNTTRMS": "ZB01",

                            "PRICE_DATE": "20150721",

                            "SALES_UNIT": "ST",

                            "DIVISION": "00",

                            "CURRENCY": "EUR"

}]

}

GowthamRaja
Participant
0 Kudos

Hi Ashwin,

Ya think its partially working. it gives an error

{

    "error": {

        "code": "CX_SY_CONVERSION_NO_DATE_TIME/67AA6842BAA80B7DE10000000A15523C",

        "message": {

            "lang": "en",

            "value": "Value 21/07/2015 does not represent a valid date/time"

        },

        "innererror": {

            "transactionid": "89962FE52DD0F1259A3F005056BE7049",

            "errordetails": []

        }

    }

}

I have tried the date with 20150721 , 20072015, 20.07.2015, 20/07/2015... but its still the same

AshwinDutt
Active Contributor
0 Kudos

Use the below and check please ->

{

                "SO_ID": "0",

                "CURRENCY": "EUR",

                "DOC_TYPE": "OR",

                "DOC_DATE": "2014-08-21T00:00:00",

                "SALES_ORG": "1000",

                "DIST_CHANNEL": "10",

                "DIVISION": "00",

                "SALES_GRP": "130",

                "SALES_OFF": "1030",

                "REQ_DATE_H": null,

                "PURCH_DATE": null,

                "INCOTERMS1": "CIP",

                "INCOTERMS2": "Nürnberg",

                "PMNTTRMS": "ZB01",

                "PRICE_DATE": "2014-08-21T00:00:00",

                "PURCH_NO_C": "TEST ORDER",

"SO_ITEMSet":[{

                            "SO_ID": "0",

                            "ITEM_NO": "000010",

                            "MAT_NO": "100-100",

                            "PLANT": "1000",

                            "TARGET_QTY": "4",

                            "TARGET_QU": "ST",

                            "ITEM_CATEG": "TAN",

                            "PURCH_NO_C": "TEST ORDER",

                            "PURCH_DATE": "2014-08-21T00:00:00",

                            "INCOTERMS1": "CIP",

                            "INCOTERMS2": "Nürnberg",

                            "PMNTTRMS": "ZB01",

                            "PRICE_DATE": "2014-08-21T00:00:00",

                            "SALES_UNIT": "ST",

                            "DIVISION": "00",

                            "CURRENCY": "EUR"

}]

}

GowthamRaja
Participant
0 Kudos

Thanks Ashwin it works fine and now the debugger is triggered.

GowthamRaja
Participant
0 Kudos

Thanks Krishna. Now the debugger triggers

GowthamRaja
Participant
0 Kudos

Hi Krishna,

I could able to create the header now but not item details. Please refer the below snap shots.

I dont know why this deep structue so_items is empty or am i lagging anywhere?

GowthamRaja
Participant
0 Kudos

Krishna,

I have gone to the blog written by you

i have changed all the date field into abap internal type 'date', regenerated objects and clear cache... but i could not able to get the items data saved in to its deep structure ls_so-SO_Itemset......

i not sure whether the request body is correct or not... but form the request body header details are working fine.

{

         "SO_ID" : "0",

         "CURRENCY" : "EUR",

         "DOC_TYPE" : "TA",

         "DOC_DATE" : "2015-07-24T00:00:00",

         "SALES_ORG" : "1000",

         "DIST_CHANNEL" : "10",

         "DIVISION" : "00",

         "SALES_GRP" : "130",

         "SALES_OFF" : "1030",

         "REQ_DATE_H" : null,

         "PURCH_DATE" : null,

         "INCOTERMS1" : "CIP",

         "INCOTERMS2" : "Nürnberg",

         "PMNTTRMS" : "ZB01",

         "PRICE_DATE" : "2015-07-24T00:00:00",

         "PURCH_NO_C" : "test order",

         "SO_ITEMSet" : [

             {

               "SO_ID" : "0",

               "ITEM_NO" : "000010",

               "MAT_NO" : "100-100",

               "PLANT" : "1000",

               "TARGET_QTY" : "1",

               "TARGET_QU" : "ST",

               "ITEM_CATEG" : "TAN",

               "PURCH_NO_C" : "test order",

               "PURCH_DATE" : null,

               "INCOTERMS1" : "CIP",

               "INCOTERMS2" : "Nürnberg",

               "PMNTTRMS" : "ZB01",

               "PRICE_DATE" : "2015-07-24T00:00:00",

               "SALES_UNIT" : "ST",

               "DIVISION" : "00",

               "CURRENCY" : "EUR"

             }

           ]

         }

Please help.

Pavan_Golesar
Active Participant
0 Kudos

Hello Gowtham,

    Looking at the Payload, it seem the Sales Order Document Number is Empty on HTTP Response..

please verify the Mapping (As you are getting the item data, so it might be a issue of Mapping in SEGW..)

Best Regards,

Pavan Golesar

GowthamRaja
Participant
0 Kudos

Hi Pavan,

The sale order no i am getting from my header entity model so that i will be giving the value as 0 since it will generate newly as per input in above coding.

AshwinDutt
Active Contributor
0 Kudos

Hello Raja,

Problem with the Payload. Please check.

Refer the below sample for your reference ->

<?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:Id>100</d:Id>

<d:Name>Test</d:Name>

<d:Name2>Test Header2</d:Name2>

</m:properties>

</atom:content>

<atom:link

rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/HeaderItemO"

type="application/atom+xml;type=feed"

title="ZASH_TEST_FOR_PREP_DEMO_SRV.Header_ItemO">

<m:inline>

<atom:feed>

<atom:entry>

<atom:content type="application/xml">

<m:properties>

<d:IdO>10</d:IdO>

<d:NameO>Test Item11</d:NameO>

</m:properties>

</atom:content>

</atom:entry>

<atom:entry>

<atom:content type="application/xml">

<m:properties>

<d:IdO>20</d:IdO>

<d:NameO>Test Item12</d:NameO>

</m:properties>

</atom:content>

</atom:entry>

</atom:feed>

</m:inline>

</atom:link>

<atom:link

rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/HeaderItemT"

type="application/atom+xml;type=feed"

title="ZASH_TEST_FOR_PREP_DEMO_SRV.Header_ItemT">

<m:inline>

<atom:feed>

<atom:entry>

<atom:content type="application/xml">

<m:properties>

<d:IdT>10</d:IdT>

<d:NameT>Test Item21</d:NameT>

</m:properties>

</atom:content>

</atom:entry>

<atom:entry>

<atom:content type="application/xml">

<m:properties>

<d:IdT>20</d:IdT>

<d:NameT>Test Item22</d:NameT>

</m:properties>

</atom:content>

</atom:entry>

</atom:feed>

</m:inline>

</atom:link>

</atom:entry>

You can have JSON payload as well ->

{

"Id":"01",

"Name":"Ashwin",

"Name2":"Dutt",

"HeaderItemO":[{"IdO":"10","NameO":"TestO1"},

{"IdO":"20","NameO":"TestO2"}],

"HeaderItemT":[{"IdT":"10","NameT":"TestT1"},

{"IdT":"20","NameT":"TestT2"}]

}

Where HeaderItemO and HeaderItemT are the navigation properties defined in GW Model.

Regards,

Ashwin

GowthamRaja
Participant
0 Kudos

Hi Pavan,

I tried adding this line in the payload starting but it failed.

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

<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"

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://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS</id>

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

<updated>2015-07-21T06:46:49Z</updated>

  <author>

  <name/>

  </author>

  <link href="SO_HEADERS" rel="self" title="SO_HEADERS"/>

  <entry>

<id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS('4970')</id>

  <title type="text">SO_HEADERS('4970')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

  <link href="SO_HEADERS('4970')" rel="edit" title="SO_HEADER"/>

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

<m:inline>

<feed xml:base="http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/">

<id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_HEADERS('4970')/SO_ITEMSet</id>

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

<updated>2015-07-21T06:46:49Z</updated>

<author>

<name/>

</author>

<link href="SO_HEADERS('4970')/SO_ITEMSet" rel="self" title="SO_ITEMS"/>

<entry>

  <id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000010')</id>

<title type="text">SO_ITEMS(SO_ID='4970',ITEM_NO='000010')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

<link href="SO_ITEMS(SO_ID='4970',ITEM_NO='000010')" rel="edit" title="SO_ITEM"/>

<content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:ITEM_NO>10</d:ITEM_NO>

<d:MAT_NO>100-100</d:MAT_NO>

<d:PLANT>1000</d:PLANT>

<d:TARGET_QTY>4</d:TARGET_QTY>

<d:TARGET_QU>ST</d:TARGET_QU>

<d:ITEM_CATEG>TAN</d:ITEM_CATEG>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

<d:PURCH_DATE>20150728</d:PURCH_DATE>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:SALES_UNIT>ST</d:SALES_UNIT>

<d:DIVISION>00</d:DIVISION>

<d:CURRENCY>EUR</d:CURRENCY>

</m:properties>

</content>

</entry>

<entry>

  <id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000020')</id>

<title type="text">SO_ITEMS(SO_ID='4970',ITEM_NO='000020')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

<link href="SO_ITEMS(SO_ID='4970',ITEM_NO='000020')" rel="edit" title="SO_ITEM"/>

<content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:ITEM_NO>20</d:ITEM_NO>

<d:MAT_NO>100-100</d:MAT_NO>

<d:PLANT>1000</d:PLANT>

<d:TARGET_QTY>3</d:TARGET_QTY>

<d:TARGET_QU>ST</d:TARGET_QU>

<d:ITEM_CATEG>TAN</d:ITEM_CATEG>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

<d:PURCH_DATE>20150728</d:PURCH_DATE>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:SALES_UNIT>ST</d:SALES_UNIT>

<d:DIVISION>00</d:DIVISION>

<d:CURRENCY>EUR</d:CURRENCY>

</m:properties>

</content>

</entry>

<entry>

  <id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000030')</id>

<title type="text">SO_ITEMS(SO_ID='4970',ITEM_NO='000030')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

<link href="SO_ITEMS(SO_ID='4970',ITEM_NO='000030')" rel="edit" title="SO_ITEM"/>

<content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:ITEM_NO>30</d:ITEM_NO>

<d:MAT_NO>100-100</d:MAT_NO>

<d:PLANT>1000</d:PLANT>

<d:TARGET_QTY>2</d:TARGET_QTY>

<d:TARGET_QU>ST</d:TARGET_QU>

<d:ITEM_CATEG>TAN</d:ITEM_CATEG>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

<d:PURCH_DATE>20150728</d:PURCH_DATE>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:SALES_UNIT>ST</d:SALES_UNIT>

<d:DIVISION>00</d:DIVISION>

<d:CURRENCY>EUR</d:CURRENCY>

</m:properties>

</content>

</entry>

<entry>

  <id>http://hostname:portname/sap/opu/odata/sap/ZSALESORDER_SRV/SO_ITEMS(SO_ID='4970',ITEM_NO='000040')</id>

<title type="text">SO_ITEMS(SO_ID='4970',ITEM_NO='000040')</title>

<updated>2015-07-21T06:46:49Z</updated>

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

<link href="SO_ITEMS(SO_ID='4970',ITEM_NO='000040')" rel="edit" title="SO_ITEM"/>

<content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:ITEM_NO>40</d:ITEM_NO>

<d:MAT_NO>100-100</d:MAT_NO>

<d:PLANT>1000</d:PLANT>

<d:TARGET_QTY>1</d:TARGET_QTY>

<d:TARGET_QU>ST</d:TARGET_QU>

<d:ITEM_CATEG>TAN</d:ITEM_CATEG>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

<d:PURCH_DATE>20150728</d:PURCH_DATE>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:SALES_UNIT>ST</d:SALES_UNIT>

<d:DIVISION>00</d:DIVISION>

<d:CURRENCY>EUR</d:CURRENCY>

</m:properties>

</content>

</entry>

</feed>

</m:inline>

  </link>

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

  <content type="application/xml">

<m:properties>

<d:SO_ID>0</d:SO_ID>

<d:CURRENCY>EUR</d:CURRENCY>

<d:DOC_TYPE>OR</d:DOC_TYPE>

<d:DOC_DATE>20150721</d:DOC_DATE>

<d:SALES_ORG>1000</d:SALES_ORG>

<d:DIST_CHANNEL>10</d:DIST_CHANNEL>

<d:DIVISION>00</d:DIVISION>

<d:SALES_GRP>130</d:SALES_GRP>

<d:SALES_OFF>1030</d:SALES_OFF>

<d:REQ_DATE_H m:null="true"/>

<d:PURCH_DATE m:null="true"/>

<d:INCOTERMS1>CIP</d:INCOTERMS1>

<d:INCOTERMS2>Nürnberg</d:INCOTERMS2>

<d:PMNTTRMS>ZB01</d:PMNTTRMS>

<d:PRICE_DATE>20150721</d:PRICE_DATE>

<d:PURCH_NO_C>TEST ORDER</d:PURCH_NO_C>

</m:properties>

  </content>

  </entry>

</atom:entry>

AshwinDutt
Active Contributor
0 Kudos

Hello Raja,

You need to carefully add at all the required places.

Please have a look at the sample which i have shared and construct your payload in XML same as that with your data. This should resolve the issue.

Trouble shoot as below. Do it one by one.

First construct Payload for Header and one item and check if its hitting and able to read data inside Create_Deep_Entity.

Next add 2nd item to the existing payload now and check. Next again add 3rd item to the existing payload and check.

Construct the JSON payload which is easy as shown in the sample and is fast and less prone to errors.

Regards,

Ashwin

Pavan_Golesar
Active Participant
0 Kudos

Hello Gowtham,

               OK, I PREASSUMED THAT THE PAYLOAD YOU HAD SHOWN IS A HTTP RESPONSE, SO I SUGGESTED FOR THE SAME ,


ANYWAYS, DEAR PLEASE TRY FOR JSON ...



Best Regards,

Pavan Golesar

Message was edited by: Pavan Golesar