BADI Copy PR item text to PO when ME21N
作者:互联网
首先,PO item text是可以通过配置实现的,
但是有时候业务顾问偷懒,或者因为某些什么原因,不能创建或者传输 Customizing request。
这个时候也就只能通过代码来实现了……
创建采购订单的时候,将参考的采购申请对应的item 文本带过来
ME_PROCESS_PO_CUST
method:item
主要代码:
*get header object
CALL METHOD im_item->get_header
RECEIVING
re_header = lo_header.
"get header data
CLEAR:ls_header.
CALL METHOD lo_header->get_data
RECEIVING
re_data = ls_header.
*get Item data
CLEAR:ls_item.
CALL METHOD im_item->get_data
RECEIVING
re_data = ls_item.
"read text
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'B02' "Item Note
language = lv_spras
name = lv_name
object = 'EBAN'
TABLES
lines = lt_line
"copy text
LOOP AT lt_line INTO ls_line.
ls_text-tdobject = 'EKPO'.
ls_text-tdid = 'F11'. "Item Note
ls_text-tdformat = ls_line-tdformat.
ls_text-tdline = ls_line-tdline .
APPEND ls_text TO lt_text.
ENDLOOP.
IF lt_text[] IS NOT INITIAL.
CALL METHOD im_item->if_longtexts_mm~set_text
EXPORTING
im_tdid = 'F11'
im_textlines = lt_text.
ENDIF.
标签:PR,item,text,get,ME21N,header,ls,data 来源: https://blog.51cto.com/15057820/2628638