on 01-23-2016 12:18 PM
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
Hello Shaik,
You need to pass Navigation Property defined between Header and Item in the payload to trigger Create_Deep_EntitySet.
In your Payload its mentioned as ' ITEM ' as below instead of ' Model_Mod_ItemSet '
rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ITEM"
Please maintain as below.
rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Model_Mod_ItemSet"
For the same payload use the above line and check again.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Create one more Entity and associate it with Header with another Navigation Property.
Enhance the existing Deep Structure at the back end with the above Navigation Property to define the table.
Finally fill the error details of each line item and sent back your deep structure as response which had all information.
This way you can get GW response having error/success for each line item along with the input which sent as part of Deep Entity Creation.
You can raise exception with that message as below.
/IWBEP/CX_MGW_BUSI_EXCEPTION - SAP Gateway Foundation (SAP_GWFND) - SAP Library
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.