(BADI)Copy PR header text to PO header when ME21N
作者:互联网
需求:根据采购申请创建采购订单的时候,将PR header text 带到PO header text上
spro 下找的增强点:
其实就是 ME_PROCESS_PO_CUST
Method
利用里面的一个method set_text
参考代码
FUNCTION zmm_copy_pr_text_to_po 内主要代码如下:
"get header infor
CALL METHOD im_header->get_data
RECEIVING
re_data = ls_header.
"get item_ refer object
CALL METHOD im_header->get_items
RECEIVING
re_items = lt_item_object.
"get item
"get item
CALL METHOD ls_item_object-item->get_data
RECEIVING
re_data = wa_item.
"get spras
SELECT SINGLE bsart spras INTO ( lv_bsart,lv_spras )
FROM eban WHERE banfn = wa_item-banfn.
"read PR text
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'B03' "MARKING OF TOOL
language = lv_spras
name = lv_name
object = 'EBANH'
TABLES
lines = lt_line
EXCEPTIONS
"get text
LOOP AT lt_line INTO ls_line.
ls_text-tdobject = 'EKKO'.
ls_text-tdid = 'F19'.
ls_text-tdformat = ls_line-tdformat.
ls_text-tdline = ls_line-tdline .
APPEND ls_text TO lt_text.
ENDLOOP.
" set text for PO
CALL METHOD im_header->if_longtexts_mm~set_text
EXPORTING
im_tdid = 'F19'
im_textlines = lt_text.
标签:PR,get,text,ME21N,header,lt,ls,item 来源: https://blog.51cto.com/15057820/2628642