on 06-14-2015 3:11 PM
Hi I am facing a small issue can any1 help me out.. (Urgent). Error says "The data object "LS_ORDER_ITEMS" does not have a component called "PONUMBER" I have tryed checking it , but still not resolved..
I am following this doc for reference....
http://scn.sap.com/community/gateway/blog/2014/07/18/implementing-expand-entityentity-set
I have reached the coding part... and stuck ..
code is :
method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_EXPANDED_ENTITYSET.
* Deep Structure
*-------------------------------------------------------------------------*
DATA: BEGIN OF ls_order_items,
INCLUDE TYPE ZCL_ZPO_EXPAND_mpc=>ts_header,
navitem TYPE STANDARD TABLE OF ZCL_ZPO_EXPAND_mpc=>ts_item WITH DEFAULT KEY,
navschedule TYPE STANDARD TABLE OF ZCL_ZPO_EXPAND_mpc=>ts_schedule WITH DEFAULT KEY,
END OF ls_order_items,
ls_item1 TYPE ZCL_ZPO_EXPAND_mpc=>ts_item,
ls_schedle1 TYPE ZCL_ZPO_EXPAND_mpc=>ts_schedule.
*-------------------------------------------------------------------------*
* Data Declarations
*-------------------------------------------------------------------------*
DATA : ls_item TYPE ZCL_ZPO_EXPAND_mpc_ext=>ts_item,
lt_item TYPE TABLE OF ZCL_ZPO_EXPAND_mpc_ext=>ts_item,
ls_sch TYPE ZCL_ZPO_EXPAND_mpc_ext=>ts_schedule,
lt_sch TYPE TABLE OF ZCL_ZPO_EXPAND_mpc_ext=>ts_schedule,
ls_header TYPE ZCL_ZPO_EXPAND_mpc_ext=>ts_header, " Changed ty to ts
lthead TYPE STANDARD TABLE OF bapiekkol,
lshead TYPE bapiekkol,
lsitem TYPE bapiekpo,
ltitem TYPE STANDARD TABLE OF bapiekpo,
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_order_items LIKE TABLE OF ls_order_items,
ltsch TYPE STANDARD TABLE OF bapieket,
lssch TYPE bapieket.
*-------------------------------------------------------------------------*
* Entity Set - HeaderSet
*-------------------------------------------------------------------------*
CASE iv_entity_set_name.
WHEN 'HeaderSet'.
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 'PONUMBER'.
lv_ebeln = 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.
*-------------------------------------------------------------------------*
* Call Method-BAPI_PO_GETDETAIL
*-------------------------------------------------------------------------*
CALL FUNCTION 'BAPI_PO_GETDETAIL'
EXPORTING
purchaseorder = lv_ebeln
items = 'X'
schedules = 'X'
IMPORTING
po_header = lshead
* PO_ADDRESS =
TABLES
* PO_HEADER_TEXTS =
po_items = ltitem
po_item_schedules = ltsch.
*-------------------------------------------------------------------------*
* Fill Header Values to Deep Structure
*-------------------------------------------------------------------------*
ls_order_items-ponumber = lshead-po_number.
ls_order_items-ccode = lshead-co_code.
ls_order_items-doctype = lshead-doc_type.
*-------------------------------------------------------------------------*
* Fill Item values to Deep Structure
*-------------------------------------------------------------------------*
LOOP AT ltitem INTO lsitem.
CLEAR ls_item1.
ls_item1-ponumber = lsitem-po_number.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = ls_item1-ponumber
IMPORTING
output = ls_item1-ponumber.
ls_item1-poitem = lsitem-po_item.
ls_item1-material = lsitem-material.
APPEND ls_item1 TO ls_order_items-navitem.
ENDLOOP.
*-------------------------------------------------------------------------*
* Fill Schedule values to Deep Strcture
*-------------------------------------------------------------------------*
LOOP AT ltsch INTO lssch.
CLEAR ls_item1.
ls_item1-ponumber = lsitem-po_number.
ls_schedle1-poitem = lssch-po_item.
ls_schedle1-serial = lssch-serial_no.
APPEND ls_schedle1 TO ls_order_items-navschedule.
ENDLOOP.
*-------------------------------------------------------------------------*
* Assign the Navigation Proprties name to Expanded Tech clauses
*-------------------------------------------------------------------------*
ls_expanded_clause1 = 'NAVITEM'.
ls_expanded_clause2 = 'NAVSCHEDULE'.
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_order_items TO lt_order_items.
*-------------------------------------------------------------------------*
* Send back Response to Consumer
*-------------------------------------------------------------------------*
copy_data_to_ref(
EXPORTING
is_data = lt_order_items
CHANGING
cr_data = er_entityset ).
WHEN OTHERS.
ENDCASE.
ENDMETHOD.
* endmethod.
Regards,
pavan Golesar
Hello Pavan,
Please check the declaration of the deep structure.
Use below :
DATA: BEGIN OF ls_order_items .
INCLUDE TYPE ZCL_ZPO_EXPAND_mpc=>ts_header .
data : navitem TYPE STANDARD TABLE OF ZCL_ZPO_EXPAND_mpc=>ts_item WITH DEFAULTKEY .
data : navschedule TYPE STANDARD TABLE OF ZCL_ZPO_EXPAND_mpc=>ts_schedule WITHDEFAULT KEY,
END OF ls_order_items,
ls_item1 TYPE ZCL_ZPO_EXPAND_mpc=>ts_item,
ls_schedle1 TYPE ZCL_ZPO_EXPAND_mpc=>ts_schedule.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.