PP生产订单的BADI增强 WORKORDER_UPDATE

METHOD if_ex_workorder_update~before_update.

*---------------------->增强1 开始
* "当生产订单类型为PP01时,如果该生产订单有参考相关的销售订单,
* "那么在此生产订单存盘时,就需要判断该生产订单是否已经维护了相关的长文本数据,如果没有长文本数据,就需要查看
* "所对应的销售订单行项目上是否有长文本数据,如果有则将销售订单行项目的长文本带到该生产订单长文本中。
* "反之,如果此生产订单已经维护有相关的长文本数据,则不需要再去考虑销售订单行项目中的长文本

FIELD-SYMBOLS: <f1> TYPE cobai_t_header,
<f2> TYPE LINE OF cobai_t_header.

DATA v_program(50) TYPE c VALUE ‘(SAPLCOBT)CAUFV_BT[]‘.

DATA: wa_header TYPE LINE OF cobai_t_header,
v_flag.

DATA: v_tdname TYPE thead-tdname,
lt_lines TYPE STANDARD TABLE OF tline,
lt_lines0 TYPE STANDARD TABLE OF tline,
lt_lines1 TYPE STANDARD TABLE OF tline,
lt_lines2 TYPE STANDARD TABLE OF tline,
lt_lines3 TYPE STANDARD TABLE OF tline,
ls_line TYPE tline,
ls_line1 TYPE tline.

CLEAR: v_tdname, lt_lines0, lt_lines1, lt_lines2, lt_lines3,
lt_lines, ls_line, ls_line1.

CASE sy-tcode.

WHEN ‘CO40‘ OR ‘CO08‘ OR ‘CO01‘ OR ‘CO41‘.

READ TABLE it_header INTO wa_header INDEX 1.

"AUART订单类型、LTEXT长文本标识、KDAUF_AUFK参考销售订单号、KDPOS_AUFK参考销售订单行项目号
IF wa_header-auart EQ ‘PP01‘ AND wa_header-ltext EQ space AND wa_header-kdauf_aufk IS NOT INITIAL
AND wa_header-kdpos_aufk IS NOT INITIAL.

CONCATENATE wa_header-kdauf_aufk wa_header-kdpos_aufk INTO v_tdname. "销售订单行项目长文本的Name

"读取参考的销售订单行项目长文本
CALL FUNCTION ‘READ_TEXT‘
EXPORTING
id = ‘Z002‘
language = sy-langu
name = v_tdname
object = ‘VBBP‘
TABLES
lines = lt_lines0
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.

v_tdname = wa_header-kdauf_aufk.
"读取参考的销售订单行项目长文本
CALL FUNCTION ‘READ_TEXT‘
EXPORTING
id = ‘ZV06‘
language = sy-langu
name = v_tdname
object = ‘VBBK‘
TABLES
lines = lt_lines1
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.

CONCATENATE wa_header-kdauf_aufk wa_header-kdpos_aufk INTO v_tdname. "销售订单行项目长文本的Name
"读取参考的销售订单行项目长文本
CALL FUNCTION ‘READ_TEXT‘
EXPORTING
id = ‘Z001‘
language = sy-langu
name = v_tdname
object = ‘VBBP‘
TABLES
lines = lt_lines2
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.

* CONCATENATE wa_header-kdauf_aufk wa_header-kdpos_aufk INTO v_tdname. "销售订单行项目长文本的Name
* "读取参考的销售订单行项目长文本
* CALL FUNCTION ‘READ_TEXT‘
* EXPORTING
* id = ‘Z002‘
* language = sy-langu
* name = v_tdname
* object = ‘VBBP‘
* TABLES
* lines = lt_lines3
* EXCEPTIONS
* id = 1
* language = 2
* name = 3
* not_found = 4
* object = 5
* reference_check = 6
* wrong_access_to_archive = 7
* OTHERS = 8.

ls_line1-tdline = ‘行项目备注:‘.
INSERT ls_line1 INTO lt_lines0 INDEX 1.

ls_line1-tdline = ‘此单特殊要求:‘.
INSERT ls_line1 INTO lt_lines1 INDEX 1.

ls_line1-tdline = ‘开模信息:‘.
INSERT ls_line1 INTO lt_lines2 INDEX 1.
*
* ls_line1-tdline = ‘行项目备注:‘.
* INSERT ls_line1 INTO lt_lines3 INDEX 1.

LOOP AT lt_lines0 INTO ls_line.
APPEND ls_line TO lt_lines.
ENDLOOP.

LOOP AT lt_lines1 INTO ls_line.
APPEND ls_line TO lt_lines.
ENDLOOP.

LOOP AT lt_lines2 INTO ls_line.
APPEND ls_line TO lt_lines.
ENDLOOP.

* LOOP AT lt_lines3 INTO ls_line.
* APPEND ls_line TO lt_lines.
* ENDLOOP.

IF lt_lines IS NOT INITIAL.
CONCATENATE sy-mandt wa_header-aufnr INTO v_tdname."生产订单行项目长文本的Name

CALL FUNCTION ‘CREATE_TEXT‘
EXPORTING
fid = ‘KOPF‘
flanguage = sy-langu
fname = v_tdname
fobject = ‘AUFK‘
TABLES
flines = lt_lines
EXCEPTIONS
no_init = 1
no_save = 2
OTHERS = 3.

IF sy-subrc = 0.
ASSIGN (v_program) TO <f1>.
READ TABLE <f1> ASSIGNING <f2> INDEX 1.
<f2>-ltext = ‘1‘.

ENDIF.

ENDIF.

ENDIF.

ENDCASE.
*--------------------------->增强1结束
ENDMETHOD. "if_ex_workorder_update~before_update

PP生产订单的BADI增强 WORKORDER_UPDATE

时间: 2024-10-23 00:35:50

PP生产订单的BADI增强 WORKORDER_UPDATE的相关文章

SD 销售订单的BADI增强SD_BADI_PRICE_CHECK

METHOD if_ex_badi_sd_sales~save_document.* CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'* EXPORTING* titel = '庆祝'* textline1 = '系统成功上线!'* textline2 = '热烈庆祝!'* start_column = 25* start_row = 6. ENDMETHOD. SD 销售订单的BADI增强SD_BADI_PRICE_CHECK

S/4HANA生产订单增强WORKORDER_UPDATE方法BEFORE_UPDATE参数分析

题目这个增强的输入参数很恐怖,长长的一串: CALL BADI l_badi->BEFORE_UPDATE EXPORTING IT_PIINSTRUCTIONVALUE = IT_PIINSTRUCTIONVALUE IT_PIINSTRUCTION = IT_PIINSTRUCTION IT_PMPARTNER_OLD = IT_PMPARTNER_OLD IT_PMPARTNER = IT_PMPARTNER IT_PRT_ALLOCATION_OLD = IT_PRT_ALLOCATIO

增强篇2 生产订单屏幕增强

TCODE:CO02 效果如下: 生产订单屏幕增强 原文地址:https://www.cnblogs.com/rainysblog/p/11973772.html

ME21N,ME22N,ME23N之BADI增强ME_PROCESS_PO_CUST

一.需求背景:采购订单创建.修改时,根据所选订单类型不同,给抬头附加数据里的字段赋默认值.如下图所示: 二.实现方式:实现的方式可以有很多种,这里讲一下用BADI增强ME_PROCESS_PO_CUST实现的方式 第一步:执行事务码se19,在BAdI Name处输入:ME_PROCESS_PO_CUST,然后点"Create Impl"按钮 第二步:在Implementation Name输入ZME_PROCESS_PO_CUST,点OK按钮. 第三步:双击"PROCESS

为什么S/4HANA的销售订单创建会触发生产订单的创建

调用S/4HANA销售订单创建函数SD_SALES_DOCU_MAINTAIN创建一个销售订单时,会触发生产订单的创建. 销售订单的每个行项目对应一个独立的生产订单,SD_SALES_DOCU_MAINTAIN相当于CRM里的CRM_ORDER_MAINTAIN,在LOOP里处理每一个行项目: 观察这个函数内部的调用栈,发现一个subroutine EIGENFERTIGUNG_BEARBEITEN.: EIGENFERTIGUNG的意思是Own production: BEARBEITEN的意

ME_PROCESS_PO_CUST 实现采购订单行项目增强

转自:https://www.cnblogs.com/jinyin/p/10598124.html 用户希望创建采购订单时,输入行项目时,能根据采购订单类型,自动带出科目分类类别. 业务顾问看了一下配置,不能实现这个功能,所以用增强实现. 采购订单BADI增强:ME_PROCESS_PO_CUST.SE19创建BADI实现,进入实施类方法: IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM ,添加代码. DATA: ls_item TYPE mepoitem, " 行项

20170520 BADI增强学习

一.要求:Tcode:FF_5 导入数据运行时,产生财务凭证之前修改某些字段值.Exmp:FEBRE-VWEZWBKPF-XBLNRFEBEP-CHECTBSEG-ZUONR there is a business Add-in(BADI) with the definition name FEB_BADI thatis called immediately before the standart posting in program RFEBBU00.In the case, you can

智邦国际ERP如何提高生产订单管理效率

  在生产制造业企业中,生产订单管理难是常见问题,它包含在生产管理流程中,如生产订单管理不当,会造成企业生产流程混乱.员工盲目生产,效率低.品质差.生产成本高等现象.要想解决生产订单管理问题不妨尝试一下用信息化手段来进行管理,下面以智邦国际ERP系统为例,详细了解一下如何在信息化时代加强公司生产订单流程管理,实现产品生产过程安全.高效.低耗.按期交货的. 第一步:生产订单添加 打开着智邦国际ERP系统-生产模块-生产订单-生产订单添加,填写订单主题后选择生产计划单,产品清单会自动关联,由此便可生

物料BOM和生产订单BOM的区别

物料BOM和生产订单BOM的区别[@[email protected]] 一般企业生产部在SAP创建生产订单的时候,就会产生一个生产订单BOM,这里的生产订单BOM是读取的物料BOM. 由于其它原因,需要修改成品的某几个零部件,在创建订单的时候,就可以修改订单BOM,物料BOM不会受任何的影响. 其实在生产订单的BOM读取完物料BOM之后就与物料BOM没有任何的关系了,下达订单之后,物料BOM订单BOM已经没有任何联系了,所以生产过程当中的物料消耗都与订单BOM有关系了.