cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Deep Insert ...

former_member192971
Participant
0 Kudos

Hello Experts,

I am using DeepInsert Method for Creating Return Order Header and Items Creation(Parent and Child) relation that too based on a Existing Return order creation RFC. I am getting 500 internal server error as "No valid source context supplied" and In gateway error log "DeSerialization of XML Failed via transformation 'ID'" . Also I tried to keep the edm core type abap field for date as Nullable & Internal type as Date , decimal values with Packed but it's not accepting to change the datatype as it is different from Abap Type.

In Detail:-

I have 5 Entitysets for Header,Partner,Items,Conditions,Schedues.

Out of them I am using Header Entityset in the POST URL(http://host:port/sap/opu/odata/ZRETURNS_SRV/HeaderCollection)

and passing Header, Items,Partners,conditions,schedules inline entries via rest client based on http://scn.sap.com/docs/DOC-22305 .

Is that approach correct of having 5entity sets and passing only HeaderSet in URL ? The below Request Body shows the Inline entries belonging to all the Entitysets. So here the doubt arise , the way of passing the Inline entries is correct or any other approach for different entitysets.

URL:-http://host:port/sap/opu/odata/ZRETURNS_SRV/HeaderCollection

RequestBody:-

<?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:DocType>RE</d:DocType>

<d:SalesOrg>1000</d:SalesOrg>

<d:DistrChan>10</d:DistrChan>

<d:Division>10</d:Division>

<d:DateType>1</d:DateType>

<d:OrdReason>101</d:OrdReason>

<d:PartnRole>AG</d:PartnRole>

<d:PartnNumb>0000000011</d:PartnNumb>

</m:properties>

</atom:content>

<atom:link

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

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

title="Header_Items">

<m:inline>

<atom:feed>

<atom:entry>

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

<m:properties>

<d:ItmNumber>000010</d:ItmNumber>

<d:Material>P500042</d:Material>

<d:Plant>1000</d:Plant>

<d:StoreLoc>1000</d:StoreLoc>

<d:TargetQty>5.000</d:TargetQty>

<d:TargetQu>EA</d:TargetQu>

<d:ShortText>JACK DANIELS WHISKEY</d:ShortText>

<d:MatlGroup>50200000</d:MatlGroup>

<d:CondStNo>011</d:CondStNo>

<d:CondCount>01</d:CondCount>

<d:CondType>PR00</d:CondType>

<d:Currency>USD</d:Currency>

<d:ReqDate>11-11-2013</d:ReqDate>

<d:ReqQty>5.000</d:ReqQty>

</m:properties>

</atom:content>

</atom:entry>

<atom:entry>

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

<m:properties>

<d:ItmNumber>000020</d:ItmNumber>

<d:Material>P500042</d:Material>

<d:Plant>1000</d:Plant>

<d:StoreLoc>1000</d:StoreLoc>

<d:TargetQty>5.000</d:TargetQty>

<d:TargetQu>EA</d:TargetQu>

<d:ShortText>BRANDY</d:ShortText>

<d:MatlGroup>50200000</d:MatlGroup>

<d:CondStNo>011</d:CondStNo>

<d:CondCount>01</d:CondCount>

<d:CondType>PR00</d:CondType>

<d:Currency>USD</d:Currency>

<d:ReqDate>11-11-2013</d:ReqDate>

<d:ReqQty>5.000</d:ReqQty>

</m:properties>

</atom:content>

</atom:entry>

</atom:feed>

</m:inline>

</atom:link>

</atom:entry>

Appreciate your help.

Thanks,

Uday.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184867
Active Contributor
0 Kudos

Hi Uday,

Here I attach a sample request body for post request

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

<entry xml:base="https://xxxxxxx/sap/opu/odata/sap/ZTEST_DI_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">

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

<link href="Ent1Set(Name='Atanu',Id='1')/ENT2SET" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ENT2SET" type="application/atom+xml;type=feed" title="ENT2SET">

  <m:inline>

   <feed xml:base="XXXXX/sap/opu/odata/sap/ZTEST_DI_SRV/">

    <link href="Ent1Set(Name='Atanu',Id='1')/ENT2SET" rel="self" title="Ent2Set"/>

    <entry>

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

     <content type="application/xml">

      <m:properties>

       <d:Desc>Atanu Mallik</d:Desc>

       <d:Id>1</d:Id>

      </m:properties>

     </content>

    </entry>

    <entry>

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

     <content type="application/xml">

      <m:properties>

       <d:Desc>Atanu Mallik2</d:Desc>

       <d:Id>1</d:Id>

      </m:properties>

     </content>

    </entry>

   </feed>

  </m:inline>

</link>

<content type="application/xml">

  <m:properties>

   <d:Name>Atanu</d:Name>

   <d:Id>1</d:Id>

  </m:properties>

</content>

</entry>

JSON format would be even simpler

{d:{"Name":"Atanu", "Id" : "1" , "ENT2SET" : [{"Id":"1" , "Desc" :"Atanu 2"}]}}

Regards,

Atanu

kammaje_cis
Active Contributor
0 Kudos

Uday,

The URI used is right,

Coming to the body,

Did you get it from output of $expand? or hand coded it?

I am doubting the format of Date. That might be the issue. In /IWFND/ERROR_LOG it might tell exact property that is causing the problem. Can you send it as empty and check?

Thanks

Krishna

former_member192971
Participant
0 Kudos

Krishna,

I Checked by Passing empty date and still it's throwing error as "No valid source context supplied" and In gateway Error log  as "DeSerialization of XML failed via transformation ID". Also when I put external break point in CREATE_DEEP_ENTITY it's not getting triggered, Instead it is calling CREATE_ENTITY method .

Body:-

<?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:DocType>RE</d:DocType>

<d:SalesOrg>1000</d:SalesOrg>

<d:DistrChan>10</d:DistrChan>

<d:Division>10</d:Division>

<d:DateType>1</d:DateType>

<d:OrdReason>101</d:OrdReason>

</m:properties>

</atom:content>

<atom:link

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

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

title="Z_RETURN_ORDER_SRV.Header_Items">

<m:inline>

<atom:feed>

<atom:entry>

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

<m:properties>

<d:ItmNumber>000010</d:ItmNumber>

<d:Material>P500042</d:Material>

<d:Plant>1000</d:Plant>

<d:StoreLoc>1000</d:StoreLoc>

<d:TargetQty>5.000</d:TargetQty>

<d:TargetQu>EA</d:TargetQu>

<d:ShortText>Laptop</d:ShortText>

<d:MatlGroup>50200000</d:MatlGroup>

<d:CondStNo>011</d:CondStNo>

<d:CondCount>01</d:CondCount>

<d:CondType>PR00</d:CondType>

<d:Currency>USD</d:Currency>

<d:ReqDate></d:ReqDate>

<d:ReqQty>5.000</d:ReqQty>

</m:properties>

</atom:content>

</atom:entry>

</atom:feed>

</m:inline>

</atom:link>

</atom:entry>

In Above code Header_Items is the Association Name and Items refers to types in MPC. Is that the way of declaration correct else do i need to change any thing ...

Appreciate your help.

Thanks,

Uday.

kammaje_cis
Active Contributor
0 Kudos

Coming to the request body,

Did you get it from output of $expand? or hand coded it?

I would suggest using $expand for the request body.

Thanks

Krishna

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Uday,

Did you solve the problem - DeSerialization of XML Failed via transformation 'ID'?

I also get this error, although I have used $expand output to create request body for Deep Insert.

Thanks,

Maja

kammaje_cis
Active Contributor
0 Kudos

Hi Maja,

Can you check if the solution given here helps?

http://scn.sap.com/community/netweaver-gateway/blog/2013/08/09/frequent-problems-encountered-in-netw...

Search for your error message.

Krishna

Former Member
0 Kudos

Hi Krishna,

I solved the problem, thank you very much!

Maja

Former Member
0 Kudos

Hello Maja,

Can you share us how did you solve this issue?

Regards,

Daniel

Former Member
0 Kudos

Hi Daniel,

I think the problem was I was missing the return value in create_deep_entity method (er_deep_entity).

Can you check that?

Let me know if you still have the same problem.

Regards,
Maja