Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Deep Insert

Former Member
0 Likes
1,948

Dear all,

I encountered status code = 501 when I tried to use deep insert. How to fix the issue ? Any idea ? Thank you.

Return message

<?xml version="1.0" encoding="UTF-8"?> -<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> <code>/IWBEP/CM_MGW_RT/021</code> <message xml:lang="en">Method 'HEADERSET_CREATE_ENTITY' not implemented in data provider class.</message> -<innererror> -<application> <component_id/> <service_namespace>/SAP/</service_namespace> <service_id>ZGW_DEEP_INSERT_SRV</service_id> <service_version>0001</service_version> </application> <transactionid>0DB39B666C760080E005DB523AADD266</transactionid> <timestamp>20191203083702.0093810</timestamp> -<Error_Resolution> <SAP_Transaction>Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details</SAP_Transaction> <SAP_Note>See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)</SAP_Note> </Error_Resolution> -<errordetails> -<errordetail> <code>/IWBEP/CX_MGW_NOT_IMPL_EXC</code> <message>Method 'HEADERSET_CREATE_ENTITY' not implemented in data provider class</message> <propertyref/> <severity>error</severity> <target/> </errordetail> </errordetails> </innererror> </error>

payload

<?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 Header1</d:Name2> </m:properties> </atom:content> <atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/HeadItemO" type="application/atom+xml;type=feed" title="ZGW_DEEP_INSERT_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/HeadItemT" type="application/atom+xml;type=feed" title="ZGW_DEEP_INSERT_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>

1 ACCEPTED SOLUTION
Read only

cdprasanna
Active Participant
0 Likes
1,488

The URL for normal post and deep post call will be same and the system will differentiate based on payload. so cross check payload

make sure you replace below text from my payload.

  1. replace Your Domain:PORT with your domain and port.
  2. ZTEST_SRV with your service name.
  3. Property1,Property2 with your property names .
  4. NAV_SAVE to your navigation name.
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry
xmlns:atom="http://www.w3.org/2005/Atom"
xml:base="http://Your Domain:PORT/sap/opu/odata/sap/ZTEST_SRV/"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<atom:content type="application/xml">
  <m:properties>
    <d:Property1>100000043</d:Property1>
   </m:properties>
</atom:content>
<atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/NAV_SAVE" type="application/atom+xml;type=feed"
title="NAV_SAVE">
  <m:inline>
   <atom:feed>
    <atom:entry>
     <atom:content type="application/xml">
      <m:properties>
          <d:Property1>100000043</d:Property1>
          <d:Property2>3900</d:Property2>
          <d:Property3>REMD</d:Property3>
          <d:Property4>MEC</d:Property4>
          <d:Property5>3926</d:Property5>
        </m:properties>
     </atom:content>
    </atom:entry>
   </atom:feed>
  </m:inline>
</atom:link>
</atom:entry>
7 REPLIES 7
Read only

maheshpalavalli
Active Contributor
0 Likes
1,488

I think even though you have redefined the create deep entity method, it is still calling the actual header_create_entity method, which is not implemented and so the error.

So what you can do is.

1. Check if you have redefined the method : /iwbep/if_mgw_appl_srv_runtime~create_deep_entity

2. Check if the payload is correct, as I can see it is in the XML format and So I didn't check it thoroughly. i would suggest you to pass it in the json format which will be lot easier to understand and validate.

Eg. header param application type should be json "Content-Type: application/json"

{
"prop1":"value1",
"navigation1": [
      {
       "prop1":"value1"
      }
    ]
}

Thanks,

Mahesh

Read only

Former Member
0 Likes
1,488

Dear Mahesh,

At first, thanks for your prompt reply and help ! I have converted the xml to json as below. I didn't change codes yet but encountered the different return code 400 ... the redefine is also listed as below. Thank you.

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S31 { font-style: italic; color: #808080; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }

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.

DATA custome_create_deep_entity TYPE
ZCL_ZGW_DEEP_INSERT_MPC_EXT=>ts_deep_entity.

CASE iv_entity_set_name.
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 = custome_create_deep_entity.

copy_data_to_ref( EXPORTING is_data = custome_create_deep_entity
CHANGING cr_data = er_deep_entity ).
ENDCASE.
endmethod.

SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L1S33 { color: #009300; }

{
"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:Name": "Test",
"d:Name2": "Test Header1"
}
},
"atom:link": [
{
"-rel": "http://schemas.microsoft.com/ado/2007/08/dataservices/related/HeadItemO",
"-type": "application/atom+xml;type=feed",
"-title": "ZGW_DEEP_INSERT_SRV.Header_ItemO",
"m:inline": {
"atom:feed": {
"atom:entry": [
{
"atom:content": {
"-type": "application/xml",
"m:properties": {
"d:IdO": "10",
"d:NameO": "Test Item11"
}
}
},
{
"atom:content": {
"-type": "application/xml",
"m:properties": {
"d:IdO": "20",
"d:NameO": "Test Item12"
}
}
}
]
}
}
},
{
"-rel": "http://schemas.microsoft.com/ado/2007/08/dataservices/related/HeadItemT",
"-type": "application/atom+xml;type=feed",
"-title": "ZGW_DEEP_INSERT_SRV.Header_ItemT",
"m:inline": {
"atom:feed": {
"atom:entry": [
{
"atom:content": {
"-type": "application/xml",
"m:properties": {
"d:IdT": "10",
"d:NameT": "Test Item21"
}
}
},
{
"atom:content": {
"-type": "application/xml",
"m:properties": {
"d:IdT": "20",
"d:NameT": "Test Item22"
}
}
}
]
}
}
}
]
}
}

Read only

0 Likes
1,488

Dont pass like that, Just pass the data the way I mentioned, like replace prop1 name with ur property and navigation1 with your navigation name and test.

Small tip: You can click on "Comment" for providing more information(That way I will get notification as well). and "Answer" is only dedicated to post solutions.

Thanks,

Mahesh

Read only

Former Member
0 Likes
1,488

return message is

<?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> -<application> <component_id/> <service_namespace>/SAP/</service_namespace> <service_id>ZGW_DEEP_INSERT_SRV</service_id> <service_version>0001</service_version> </application> <transactionid>0DB39B666C760080E005DB523AADD4A9</transactionid> <timestamp>20191203092932.2550520</timestamp> -<Error_Resolution> <SAP_Transaction>Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details</SAP_Transaction> <SAP_Note>See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)</SAP_Note> </Error_Resolution> <errordetails/> </innererror> </error>

Read only

Former Member
0 Likes
1,488

Actually, I followed the following information but encountered the above error ...

https://blogs.sap.com/2014/04/27/step-by-step-development-guide-for-createdeepentity-operation/

Read only

cdprasanna
Active Participant
0 Likes
1,489

The URL for normal post and deep post call will be same and the system will differentiate based on payload. so cross check payload

make sure you replace below text from my payload.

  1. replace Your Domain:PORT with your domain and port.
  2. ZTEST_SRV with your service name.
  3. Property1,Property2 with your property names .
  4. NAV_SAVE to your navigation name.
<?xml version="1.0" encoding="UTF-8"?>
<atom:entry
xmlns:atom="http://www.w3.org/2005/Atom"
xml:base="http://Your Domain:PORT/sap/opu/odata/sap/ZTEST_SRV/"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
<atom:content type="application/xml">
  <m:properties>
    <d:Property1>100000043</d:Property1>
   </m:properties>
</atom:content>
<atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/NAV_SAVE" type="application/atom+xml;type=feed"
title="NAV_SAVE">
  <m:inline>
   <atom:feed>
    <atom:entry>
     <atom:content type="application/xml">
      <m:properties>
          <d:Property1>100000043</d:Property1>
          <d:Property2>3900</d:Property2>
          <d:Property3>REMD</d:Property3>
          <d:Property4>MEC</d:Property4>
          <d:Property5>3926</d:Property5>
        </m:properties>
     </atom:content>
    </atom:entry>
   </atom:feed>
  </m:inline>
</atom:link>
</atom:entry>
Read only

Former Member
0 Likes
1,488

Dear Prasanna,

I have solved the previous error using your suggestion. Thank you so much !