





























method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET.
CASE iv_entity_set_name.
WHEN 'InputHelpSet'.
* Step-01: Variable decalartions
DATA: lt_Vendor TYPE TABLE OF ZCL_ZTEST_ODATA_MPC=>TS_VendorList,
ls_Vendor TYPE ZCL_ZTEST_ODATA_MPC=>TS_VendorList,
lt_DocTyp TYPE TABLE OF ZCL_ZTEST_ODATA_MPC=>TS_DocType,
ls_DocTyp TYPE ZCL_ZTEST_ODATA_MPC=>TS_DocType,
lt_PurGrp TYPE TABLE OF ZCL_ZTEST_ODATA_MPC=>TS_PurchGrp,
ls_PurGrp TYPE ZCL_ZTEST_ODATA_MPC=>TS_PurchGrp.
DATA:
BEGIN OF struct_response.
INCLUDE TYPE ZCL_ZTEST_ODATA_MPC=>TS_InputHelp.
DATA: NAVDOCTYP TYPE STANDARD TABLE OF ZCL_ZTEST_ODATA_MPC=>TS_DocType WITH DEFAULT KEY,
NAVPURCHGRP TYPE STANDARD TABLE OF ZCL_ZTEST_ODATA_MPC=>TS_PurchGrp WITH DEFAULT KEY,
NAVVENDOR TYPE STANDARD TABLE OF ZCL_ZTEST_ODATA_MPC=>TS_VendorList WITH DEFAULT KEY,
END OF struct_response.
Data: lt_response LIKE TABLE OF struct_response,
ls_clause_DocTyp LIKE LINE OF et_expanded_tech_clauses,
ls_clause_PurchGrp LIKE LINE OF et_expanded_tech_clauses,
ls_clause_Vendor LIKE LINE OF et_expanded_tech_clauses.
* Step-02: Call RFC of backend system
CALL FUNCTION '<RfcName>' DESTINATION '<Rfc Destinations name conencting to back-end system>'
TABLES
GT_DocTyp = lt_DocTyp
GT_VEN = lt_Vendor
GT_PurGrp = lt_PurGrp.
* Step-03: Return internal output tables to Odata Service Response
* Document Type List
LOOP AT lt_DocTyp INTO ls_DocTyp.
APPEND ls_DocTyp TO struct_response-NAVDOCTYP.
Clear ls_DocTyp.
ENDLOOP.
* Vendor List
LOOP AT lt_Vendor INTO ls_Vendor.
APPEND ls_Vendor TO struct_response-NAVVENDOR.
Clear ls_Vendor.
ENDLOOP.
* Purchase Group List
LOOP AT lt_PurGrp INTO ls_PurGrp.
APPEND ls_PurGrp TO struct_response-NAVPURCHGRP.
ENDLOOP.
*Step-04: Assign the Navigation Proprties to Expanded Tech clauses
ls_clause_DocTyp = 'NAVDOCTYP'.
APPEND ls_clause_DocTyp TO et_expanded_tech_clauses.
clear ls_clause_DocTyp.
ls_clause_PurchGrp = 'NAVPURCHGRP'.
APPEND ls_clause_PurchGrp TO et_expanded_tech_clauses.
clear ls_clause_PurchGrp.
ls_clause_Vendor = 'NAVVENDOR'.
APPEND ls_clause_Vendor TO et_expanded_tech_clauses.
clear ls_clause_Vendor.
*Step-05: Append Deep Strcture Values to Final Internal Table
APPEND struct_response TO lt_response.
clear struct_response.
*Step-06: Send back Response to XML output
copy_data_to_ref(
EXPORTING
is_data = lt_response
CHANGING
cr_data = er_entityset ).
ENDCASE.
endmethod.
* Step-01.01 : Variables for ODataservice's URL-pattern's Input Parameters
Data: lt_filter_select_options TYPE /iwbep/t_mgw_select_option,
ls_filter TYPE /iwbep/s_mgw_select_option,
ls_filter_range TYPE /iwbep/s_cod_select_option,
lv_inputx TYPE C LENGTH 4, "Type as in RFC
lv_inputy TYPE C LENGTH 4, "Type as in RFC
* Step-01.02 : Get Input Parameters from OData Request Message
* ODataService url is as
* /sap/opu/odata/sap/ZTEST_ODATA_SRV/InputHelpSet?$filter=(field1 eq 'Val123' and field2 eq 'val456') &$expand=NAVDOCTYP,NAVPURCHGRP,NAVVENDOR
* Here, we read input of 'field1' and 'field2'
LOOP AT it_filter_select_options INTO ls_filter.
LOOP AT ls_filter-select_options INTO ls_filter_range.
TRANSLATE ls_filter-property TO UPPER CASE.
CASE ls_filter-property.
WHEN 'FIELD1'.
lv_inputx = ls_filter_range-low.
WHEN 'FIELD2'.
lv_inputy = ls_filter_range-low.
WHEN OTHERS.
" Log message in the application log
me->/iwbep/if_sb_dpc_comm_services~log_message(
EXPORTING
iv_msg_type = 'E'
iv_msg_id = '/IWBEP/MC_SB_DPC_ADM'
iv_msg_number = 020
iv_msg_v1 = ls_filter-property ).
" Raise Exception
RAISE EXCEPTION TYPE /iwbep/cx_mgw_tech_exception
EXPORTING
textid = /iwbep/cx_mgw_tech_exception=>internal_error.
ENDCASE.
ENDLOOP.
ENDLOOP.
* Step-02: Call RFC of backend system
CALL FUNCTION '<RfcName>' DESTINATION '<Rfc Destinations name conencting to back-end system>'
EXPORTING "While RFC call, input as Exporting parameters
IV_inputx = lv_inputx
IV_inputy = lv_inputy
TABLES
GT_DocTyp = lt_DocTyp
GT_VEN = lt_Vendor
GT_PurGrp = lt_PurGrp.

<feed 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" xml:base="http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/"><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/InputHelpSet</id><title type="text">InputHelpSet</title><updated>2018-04-04T14:38:55Z</updated><author><name/></author><link href="InputHelpSet" rel="self" title="InputHelpSet"/><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/InputHelpSet('')</id><title type="text">InputHelpSet('')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.InputHelp" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="InputHelpSet('')" rel="self" title="InputHelp"/><link href="InputHelpSet('')/NAVDOCTYP" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/NAVDOCTYP" type="application/atom+xml;type=feed" title="NAVDOCTYP"><m:inline><feed 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" xml:base="http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/"><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/InputHelpSet('')/NAVDOCTYP</id><title type="text">DocTypeSet</title><updated>2018-04-04T14:38:55Z</updated><author><name/></author><link href="InputHelpSet('')/NAVDOCTYP" rel="self" title="DocTypeSet"/><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/DocTypeSet('TP')</id><title type="text">DocTypeSet('TP')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.DocType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="DocTypeSet('TP')" rel="self" title="DocType"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:von>TP</d:von><d:bis>STO MM route</d:bis></m:properties></content></entry><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/DocTypeSet('EUB')</id><title type="text">DocTypeSet('EUB')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.DocType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="DocTypeSet('EUB')" rel="self" title="DocType"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:von>EUB</d:von><d:bis>DFPS Int. Ord. Type</d:bis></m:properties></content></entry><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/DocTypeSet('ZJ2')</id><title type="text">DocTypeSet('ZJ2')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.DocType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="DocTypeSet('ZJ2')" rel="self" title="DocType"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:von>ZJ2</d:von><d:bis>Stock transport ord.</d:bis></m:properties></content></entry></feed></m:inline></link><link href="InputHelpSet('')/NAVVENDOR" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/NAVVENDOR" type="application/atom+xml;type=feed" title="NAVVENDOR"><m:inline><feed 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" xml:base="http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/"><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/InputHelpSet('')/NAVVENDOR</id><title type="text">VendorListSet</title><updated>2018-04-04T14:38:55Z</updated><author><name/></author><link href="InputHelpSet('')/NAVVENDOR" rel="self" title="VendorListSet"/><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/VendorListSet('V01')</id><title type="text">VendorListSet('V01')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.VendorList" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="VendorListSet('V01')" rel="self" title="VendorList"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:LIFNR>V01</d:LIFNR><d:NAME>NOVODIGM Ltd</d:NAME></m:properties></content></entry><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/VendorListSet('V02')</id><title type="text">VendorListSet('V02')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.VendorList" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="VendorListSet('V02')" rel="self" title="VendorList"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:LIFNR>V02</d:LIFNR><d:NAME>Ambrisha Ltd</d:NAME></m:properties></content></entry><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/VendorListSet('V03')</id><title type="text">VendorListSet('V03')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.VendorList" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="VendorListSet('V03')" rel="self" title="VendorList"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:LIFNR>V03</d:LIFNR><d:NAME>Ghankyou Pv.t Ltd</d:NAME></m:properties></content></entry></feed></m:inline></link><link href="InputHelpSet('')/NAVPURCHGRP" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/NAVPURCHGRP" type="application/atom+xml;type=feed" title="NAVPURCHGRP"><m:inline><feed 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" xml:base="http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/"><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/InputHelpSet('')/NAVPURCHGRP</id><title type="text">PurchGrpSet</title><updated>2018-04-04T14:38:55Z</updated><author><name/></author><link href="InputHelpSet('')/NAVPURCHGRP" rel="self" title="PurchGrpSet"/><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/PurchGrpSet('D11')</id><title type="text">PurchGrpSet('D11')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.PurchGrp" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="PurchGrpSet('D11')" rel="self" title="PurchGrp"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:EKGRP>D11</d:EKGRP><d:EKNAM>DB -QC SER REG</d:EKNAM></m:properties></content></entry><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/PurchGrpSet('H45')</id><title type="text">PurchGrpSet('H45')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.PurchGrp" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="PurchGrpSet('H45')" rel="self" title="PurchGrp"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:EKGRP>H45</d:EKGRP><d:EKNAM>HO Distribution</d:EKNAM></m:properties></content></entry><entry><id>http://fiori:8000/sap/opu/odata/sap/ZTEST_ODATA_SRV/PurchGrpSet('T06')</id><title type="text">PurchGrpSet('T06')</title><updated>2018-04-04T14:38:55Z</updated><category term="ZTEST_ODATA_SRV.PurchGrp" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme"/><link href="PurchGrpSet('T06')" rel="self" title="PurchGrp"/><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:EKGRP>T06</d:EKGRP><d:EKNAM>TRP -QC CONS</d:EKNAM></m:properties></content></entry></feed></m:inline></link><content type="application/xml"><m:properties xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"><d:field1></d:field1></m:properties></content></entry></feed>











You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 3143 | |
| 1916 | |
| 1916 | |
| 1213 | |
| 1079 | |
| 757 | |
| 755 | |
| 742 |