Hi,
I have created a Relation between two entities to implement Deep Entity method as below.
Header Structure with Navigation
Item Structure with navigation:
Redefined Deep Entity and written below code :
TYPES: ty_t_mmitem TYPE STANDARD TABLE OF zcl_ztest_coolpit_mpc=>ts_model_mod_item WITH DEFAULT KEY.
TYPES: BEGIN OF ty_mod_modify.
INCLUDE TYPE zcl_ztest_coolpit_mpc=>ts_model_mod_header.
TYPES: model_mod_itemSet TYPE ty_t_mmitem,
END OF ty_mod_modify.
TYPES: cx_mgw_busi_exception TYPE REF TO /iwbep/cx_mgw_busi_exception.
DATA: ls_mmitem TYPE ty_mod_modify,
ls_mitem TYPE zcl_ztest_coolpit_mpc=>ts_model_mod_item,
lv_compare_result TYPE
/iwbep/if_mgw_odata_expand=>ty_e_compare_result.
CONSTANTS: lc_items TYPE string VALUE 'Model_Mod_ItemSet'.
lv_compare_result = io_expand->compare_to( lc_items ).
* 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_mmitem ).
ENDIF.
Error while tested in Gateway Client:
Create Entity method is not implemented:
Payload tried for 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:Matnr>1758848</d:Matnr>
</m:properties>
</atom:content>
<atom:link
rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ITEM"
type="application/atom+xml;type=feed"
title="ZTEST_COOLPIT_SRV.Model_Mod_ItemSet">
<m:inline>
<atom:feed>
<atom:entry>
<atom:content type="application/xml">
<m:properties>
<d:Matnr>1758848</d:Matnr>
<d:Matkl>13</d:Matkl>
<d:Attyp>01</d:Attyp>
<d:Char_prof>PCCOLOR</d:Char_prof>
<d:Makt_FR>TEST</d:Makt_FR>
<d:Makt_EN>TEST CIF APO</d:Makt_EN>
<d:Brand>ADID</d:Brand>
<d:For_Range>Z002</d:For_Range>
<d:TargClient/>
<d:Zdsm>000000009900000106</d:Zdsm>
<d:Zbegindate>43.2015</d:Zbegindate>
<d:Zenddate>51.2015</d:Zenddate>
<d:Maabc> </d:Maabc>
<d:Zcomment>TEST SHAIK 1</d:Zcomment>
<d:Zpc_Model>PCCOLOR</d:Zpc_Model>
</m:properties>
</atom:content>
</atom:entry>
<atom:entry>
<atom:content type="application/xml">
<m:properties>
<d:Matnr>1758848</d:Matnr>
<d:Matkl>13</d:Matkl>
<d:Attyp>01</d:Attyp>
<d:Char_prof>PCCOLOR</d:Char_prof>
<d:Makt_FR>TEST</d:Makt_FR>
<d:Makt_EN>TEST CIF APO</d:Makt_EN>
<d:Brand>ADID</d:Brand>
<d:For_Range>Z002</d:For_Range>
<d:TargClient/>
<d:Zdsm>000000009900000106</d:Zdsm>
<d:Zbegindate>43.2015</d:Zbegindate>
<d:Zenddate>51.2015</d:Zenddate>
<d:Maabc> </d:Maabc>
<d:Zcomment>TEST SHAIK 1</d:Zcomment>
<d:Zpc_Model>PCCOLOR</d:Zpc_Model>
</m:properties>
</atom:content>
</atom:entry>
</atom:feed>
</m:inline>
</atom:link>
</atom:entry>
Thanks
Shaik