10-15-2020 11:58 AM
Hi ,
In the Service Purchase order, I want to copy the Material Group(MATKL) from Item to Service Item .
method IF_EX_ME_PROCESS_PO_CUST~CHECK.
*{ INSERT QASK900456 1
DATA: ls_poheader TYPE mepoheader,
* Table Interface with PO Item External View
lt_poitem TYPE purchase_order_items, " Table IF_PURCHASE_ORDER_ITEM_MM
* Line Interface PO Item External View
ls_items TYPE purchase_order_item, " Line IF_PURCHASE_ORDER_ITEM_MM
lt_esll TYPE mmsrv_esll,
ls_item_data TYPE mepoitem,
* Handle for Item of a Purchasing Document
lr_item TYPE REF TO cl_po_item_handle_mm.
* Get PO Header data in structure
ls_poheader = im_header->get_data( ).
* Ref Table with PO Items
lt_poitem = im_header->get_items( ).
* Loop through interface
LOOP AT lt_poitem INTO ls_items.
*
** PO Item data in strucrue
ls_item_data = ls_items-item->get_data( ).
*
** Macro to get item
mmpur_dynamic_cast lr_item ls_items-item. " cl_po_item_handle_mm
* lr_item ?= ls_items.
*
** Use method of IF_SERVICES_MM interface to fetch Service data
CALL METHOD lr_item->if_services_mm~get_srv_data
EXPORTING
im_packno = ls_item_data-packno
IMPORTING
ex_esll = lt_esll.
BREAK-POINT .
**--------Get Service Table
CALL METHOD lr_item->if_services_mm~GET_DATA
* EXPORTING
* IM_LIMIT = 'X' " Limit.s
IMPORTING
EX_COMSRV = DATA(LS_COMSRV) " Structure MEPOCOMSRV
EX_ACC_TAB = DATA(LS_ACC_TAB) " ACC_TAB
EXCEPTIONS
FAILURE = 1 " Error
ILLEGAL_DATA = 2 " Problem in Data Area
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE .
CALL METHOD lr_item->if_services_mm~SET_DATA
EXPORTING
IM_COMSRV = LS_COMSRV " COMSRV
IM_ACC_TAB = LS_ACC_TAB " ACC_TAB
.
ENDIF.
ENDLOOP.
*} INSERT
endmethod.
-----------------------------------------
I am failed to update the same . Please anyone help me out .
Thanks ,
Om
10-15-2020 12:06 PM
coolomi1,
Kindly use the CODE option for your code. Your chances of getting answer is high when you use it.
Regards!
10-15-2020 12:43 PM
You might want to start with passing the purchase document number to GET_SRV_DATA. In your debug is t_esll filled? Is LS_COMSRV and LS_ACC_TAB filled?
I don't see where you changed any values in ls_comsrv or ls_acct_tab.
CALL METHOD lr_item->if_services_mm~SET_DATA
EXPORTING
IM_COMSRV = LS_COMSRV " COMSRV
IM_ACC_TAB = LS_ACC_TAB " ACC_TAB
10-15-2020 3:16 PM
Yes ,t_sell ,LS_COMSRV ,LS_ACC_TAB having Data .Moreover have also added
LS_COMSRV-MATKL = ls_item_data-maTKL .Just before Set_data Called .
Please give some suggestions .
Thanks .
10-16-2020 7:42 AM
Thanks , Finally use User Exiit EXIT_SAPLMLSP_030 / 031 . served my problem .