Hi Ekansh,
Hope you are doing good.
I tried the data expand framework, and implemented the Expanded_entity_set method. However I am not getting the Item (depdenet Entities) data.. through debug I found that data from header and the 2 depedent entities (ITEM, and ACCOUNT) data is moved properly to er_entityset.. but in the browser.. only header data is visible...
I checked my data declartion for the deep entity and it looks Ok.. Could you please help me further..
Please find the Expanded_entitySet Code Snippet below:
*-------------------------------------------------------------------------*
* Deep Structure
*-------------------------------------------------------------------------*
DATA: BEGIN OF ls_vendor_details.
INCLUDE TYPE ZCL_Z_FI_VENDOR_INV_01_MPC=>ts_invlist.
DATA: vendoritemdetails TYPE ZCL_Z_FI_VENDOR_INV_01_MPC=>TT_ITEMDATA. " WITH DEFAULT KEY.
DATA: vendoraccountdetails TYPE ZCL_Z_FI_VENDOR_INV_01_MPC=>TT_ACCOUNT_DATA, " WITH DEFAULT KEY,
END OF ls_vendor_details.
DATA: ls_item1 TYPE ZCL_Z_FI_VENDOR_INV_01_MPC=>TS_ITEMDATA,
ls_account1 TYPE ZCL_Z_FI_VENDOR_INV_01_MPC=>TS_ACCOUNT_DATA.
DATA ls_keys TYPE /iwbep/s_mgw_name_value_pair.
data: lv_INVOICEDOCNUMBER type BAPI_INCINV_FLD-INV_DOC_NO.
data: lt_ITEMDATA type table of BAPI_INCINV_DETAIL_ITEM,
ls_ITEMDATA type BAPI_INCINV_DETAIL_ITEM,
lt_return type STANDARD TABLE OF bapiret2,
lv_docno TYPE BAPI_INCINV_FLD-INV_DOC_NO.
*-------------------------------------------------------------------------*
* Data Declarations
*-------------------------------------------------------------------------*
DATA : ls_item TYPE ZCL_Z_FI_VENDOR_INV_01_MPC=>TS_ITEMDATA,
lt_item TYPE TABLE OF ZCL_Z_FI_VENDOR_INV_01_MPC=>TS_ITEMDATA,
ls_account2 TYPE ZCL_Z_FI_VENDOR_INV_01_MPC=>TS_ACCOUNT_DATA,
lt_account2 TYPE TABLE OF ZCL_Z_FI_VENDOR_INV_01_MPC=>TS_ACCOUNT_DATA,
ls_header TYPE ZCL_Z_FI_VENDOR_INV_01_MPC=>ts_invlist,
lv_filter_str TYPE string,
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,
ls_expanded_clause1 LIKE LINE OF et_expanded_tech_clauses,
ls_expanded_clause2 LIKE LINE OF et_expanded_tech_clauses,
lv_ebeln TYPE ebeln,
lt_vendor_details LIKE TABLE OF ls_vendor_details.
data: lt_account type STANDARD TABLE OF BAPI_INCINV_DETAIL_ACCOUNT,
lt_gl_account type STANDARD TABLE OF BAPI_INCINV_DETAIL_GL_ACCOUNT,
lt_material type STANDARD TABLE OF BAPI_INCINV_DETAIL_MATERIAL,
lt_tax type STANDARD TABLE OF BAPI_INCINV_DETAIL_TAX,
ls_account type BAPI_INCINV_DETAIL_ACCOUNT,
ls_gl_account type BAPI_INCINV_DETAIL_GL_ACCOUNT,
ls_material type BAPI_INCINV_DETAIL_MATERIAL,
ls_tax type BAPI_INCINV_DETAIL_TAX.
*Get the key property values
READ TABLE it_key_tab WITH KEY name = 'InvDocNo' INTO ls_keys.
* if sy-subrc eq 0.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ls_keys-value
IMPORTING
output = lv_docno.
data: ls_year type BAPI_INCINV_FLD-FISC_YEAR.
clear: ls_keys.
READ TABLE it_key_tab WITH KEY name = 'FiscYear' INTO ls_keys.
if sy-subrc eq 0.
ls_year = ls_keys-value.
else.
ls_year = '2004'.
endif.
data: ls_header_detail TYPE BAPI_INCINV_DETAIL_HEADER.
if not lv_docno is INITIAL and ls_year is not INITIAL.
*Call the BAPI to get the Vendor invoice details..
CALL FUNCTION 'BAPI_INCOMINGINVOICE_GETDETAIL'
EXPORTING
INVOICEDOCNUMBER = lv_docno
FISCALYEAR = ls_year
IMPORTING
HEADERDATA = ls_header_detail
* ADDRESSDATA =
TABLES
ITEMDATA = lt_ITEMDATA
ACCOUNTINGDATA = lt_account
GLACCOUNTDATA = lt_gl_account
MATERIALDATA = lt_material
TAXDATA = lt_tax
* WITHTAXDATA =
* VENDORITEMSPLITDATA =
RETURN = lt_return .
* EXTENSIONOUT =
* TMDATA = .
IF sy-subrc eq 0.
* move the details to result set...
*-------------------------------------------------------------------------*
* Fill Header Values to Deep Structure
*-------------------------------------------------------------------------*
MOVE-CORRESPONDING ls_header_detail to ls_vendor_details.
*-------------------------------------------------------------------------*
* Fill Item values to Deep Structure
*-------------------------------------------------------------------------*
LOOP AT lt_ITEMDATA INTO ls_itemdata.
CLEAR ls_item1.
MOVE-CORRESPONDING ls_itemdata to ls_item1.
APPEND ls_item1 To ls_vendor_details-vendoritemdetails.
ENDLOOP.
LOOP AT lt_account INTO ls_account.
CLEAR ls_account1.
MOVE-CORRESPONDING ls_account to ls_account1.
APPEND ls_account1 To ls_vendor_details-vendoraccountdetails.
ENDLOOP.
*-------------------------------------------------------------------------*
* Assign the Navigation Proprties name to Expanded Tech clauses
*-------------------------------------------------------------------------*
ls_expanded_clause1 = 'VENDORITEMDETAILS'.
ls_expanded_clause2 = 'VENDORACCOUNTDETAILS'.
APPEND ls_expanded_clause1 TO et_expanded_tech_clauses.
APPEND ls_expanded_clause2 TO et_expanded_tech_clauses.
*-------------------------------------------------------------------------*
* Append Deep Strcture Values to Final Internal Table
*-------------------------------------------------------------------------*
APPEND ls_vendor_details TO lt_vendor_details.
*-------------------------------------------------------------------------*
* Send back Response to Consumer
*-------------------------------------------------------------------------*
copy_data_to_ref(
EXPORTING
is_data = lt_vendor_details
CHANGING
cr_data = er_entityset ).
ENDIF.
endif.