如何记录production order 与processing order的修改记录

上一篇 / 下一篇  2007-12-28 11:47:09 / 个人分类:SAP OTHERS

查看( 152 ) / 评论( 9 )
曾几何时,有很多朋友问我,如何查找到production order的修改记录呢?因为有很多用户 "赖皮",明明自己修改过某些资料,如qty or component,可就是不承认,并且还大骂SAP大大的有问题 ,真会气死人,所以想记录下来.

HEHE,这里我就摘录一段SAP的NOTES给大家看看,如何去整这玩意.

Note 390635 - Change documents for production and process order

Summary

Symptom
You cannot activate the creation of change documents for production orders and process orders.
Customizing table T399X (parameters dependent on order type) contains field FLG_DOC but you cannot maintain it using the Customizing transactions for production or process orders.


Other terms
Production order, process order
T399X-FLG_DOC
SPRO, BADI


Reason and Prerequisites
It is not intended to use the SAP standard tool for the creation of change documents for production or process orders in the SAP standard system. The indicator in table T399X is only interpreted by maintenance orders and networks.
The reason for this is that the tool cannot determine dependencies of changes and thus would log too many changes that would have a negative effect on the runtime.

Example: A production order contains 10 operations and 1000 components

Case 1: You change the requirements quantity for a component manually.
           The system creates a change document for the changed component.

Case 2: You change the planned quantity in the order header manually.
           The change causes that the quantites are changed automatically for all operations and components. The system would create

a change document for the changed header quantity,
ten change documents for the automatically changed operation quantities (if defined) and
thousand change documents for automatically changed component quantities.


Solution
Use the SAP enhancement PPCO0007  that is processed when you save order changes. You can find the SAP enhancement in Customizing under the menu path "Shop Floor Control or Production Planning for Process Industries -> Process Order -> System Modifications -> Enhancements for Order Maintenance -> Enhancement when Saving an Order (Header Fields)".
Here you can define additional logic to decide whether or not the system creates change documents.
For this, you can access either the SAP standard tool for creating change documents or your own tool.

The call of the customer exit takes place in function module CO_ZV_ORDER_POST when you save. The current data of an order header is supplied via parameter HEADER_IMP. For collective orders the exit can be called several times - once for each order in the collective order.
Remember that a dialog box must not be accessed and a message must not be issued from the exit.

You can use the attached source code as a template for accessing the creation of change documents.
You can also see in the source code how the current and original data of the different order objects can be provided by internal tables.
The example source code uses function module ORDER_WRITE_DOCUMENT that logs - for the ORDER change document object - the changes for the tables transferred to the module.
It may be appropriate to define a separate object for change documents for orders, for example ZZORDER. If required, you can use the ORDER standard object as a template.
The following tables of the order may have to be taken into account for this type of change document object:
           Table       Description                        Production Process order

AFAB        Relationships                                        X
AFFH        Production resource/tool                  X
AFFL        Work order sequence                      X          X
AFFT        Process instructions                                X
AFFV        Process instruction values                          X
AFKO        Order header data PP                      X          X
AFPO        Order item                                X          X
AFVC        General operation                        X          X
AFVU        User-specific data operation              X          X
AFVV        Quantities/dates/values in the operation  X          X
AUFK        Order header general                      X          X
DRAD_PORDER Link: Document to order                   X
MLST        Trigger point                            X
RESB        Reservation                              X          X
RSDB        Index reservation/direct procurement      X          X

Important:
The creation of change documents using the SAP standard tool requires that the indicator for change document creation is set for the data element that defines the affected table field. For example, this indicator is not set for data element GAMNG (total order quantity) in the standard system which is the reason why changes to the planned order quantity of the order header are not logged. The reason for this is that the GAMNG field of the AFKO table is defined using data element GAMNG.

To be able to set the indicator for the creation of change documents without modifications and display change document data at a later stage, refer to Note 394887 (Enhancements for installing PH-ELR_100_46C) for Release 4.6C; as of Release 4.70 (SAP Enterprise), the Add-On is part of the R/3 standard system.
You can of course set the indicator for activating the creation of document changes manually for each data element using Transaction SE11, however, this changes the data element.
You can display the change documents using, for example, programs RSSCD100, RSSCD150, or RSSCD200. The display from the standard transactions of the order is not supported.
For Release 45B to 46B, you must also create function module CO_BR_AFFX_GET_TABLES_POST in function group COBR using Transaction SE37. Define the following TABLES parameters for the interface:
Parameter name        Type spec.      Reference type    Optional EXP_AFFT               LIKE            AFFTB
EXP_AFFV               LIKE            AFFVB

To be able to archive the generated change documents, you must implement the program modification from Note 508212 in your system.

TAG:

rosefish的个人空间 rosefish 发布于2007-12-28 12:08:22
用SAP standard tool或enhancement来记录修改历史是一方面,此外用户教育和培训也很重要。

如果用户知道哪些地方能改哪些不能改,知道什么时候能改什么时候不能改,知道修改某个地方之后必须做什么后续操作,那么,这样的操作失误就会大大减少。
fiona_hello发布于2008-03-26 13:55:53
Kanter, 非常感谢您提供的NOTES.
这个问题也是我们非常头痛的问题。

”仔细“ 拜读了上述文字,没有看懂

最直接的说,怎么查修改记录? 路径?T-CODE?
VagrantLee的个人空间 VagrantLee 发布于2008-05-29 08:47:26
Enhancements PPCO0007 如何使用呢?
Enhancements应该如何编写呢?
andrewliu_925发布于2008-05-29 10:00:43
使用user_exit   ppc000001 寫ABAP  代碼可以做到
andrewliu_925发布于2008-05-29 10:01:57
INCLUDE ZXCO1U01
andrewliu_925发布于2008-05-29 12:21:33
如有不明之處可以發郵件給我(0728liujx@tom.com),應該可以幫到你
sap003的个人空间 sap003 发布于2008-05-29 14:17:01
偶在05年发表的一篇,嘿嘿,宣传一下,

需求:SAP在更改生产工单时并没有提供详细的更改记录,查看SAP的Notes,如果强行开启FLG_DOC(控制往更改记录CDHDR,CDPOS里写数据)标记,在批量处理组件过多的生产工单时会导致程序运行出错,SAP建议不开启。User要求对保护字段进行更改记录,无奈只有使用SAP提供的增强功能,东西经过测试初步完成,发出来共享一下,如果大家有更好的方法,发出来讨论讨论,步骤如下:

1.CMOD新增一项目ZCO02,增加增强PPCO0001。
2.查看、Debug SAP源代码,了解数据流向,主要了解在变更工单组件和表头未保存前这些数据存放在哪里?最后查到这两数据放在调用出口函数参数表:component_table,header_table。
3.设计数据表结构:ZPCO02,记录更改,-----------------------------------------------------------------------------------------------------------------
代码通过了User测试更正已传至生产系统,改善了保存时的速度,不用拿更改后的工单组件与RESB里的一个个对比了。
*&---------------------------------------------------------------------*
*& 包括 ZXCO1U01 *
*&---------------------------------------------------------------------*
TABLES:caufv,resb.
DATA: BEGIN OF old_resb OCCURS 0,
aufnr LIKE resb-aufnr,
posnr LIKE resb-posnr,
matnr LIKE resb-matnr,
rsnum LIKE resb-rsnum,
rspos LIKE resb-rspos,
xloek LIKE resb-xloek,
bdmng LIKE resb-bdmng,
objnr LIKE resb-objnr,
END OF old_resb.

DATA: BEGIN OF new_resb OCCURS 0.
INCLUDE STRUCTURE old_resb.
DATA: END OF new_resb.
DATA: BEGIN OF obj_resb OCCURS 0.
INCLUDE STRUCTURE old_resb.
DATA: END OF obj_resb.

DATA: i_zpco02 LIKE zpco02 OCCURS 0 WITH HEADER LINE.
DATA: i_temp LIKE zpco02 OCCURS 0 WITH HEADER LINE.

DATA: iporg LIKE msxxlist-hostadr,
ipdec(16) TYPE c,
host(18) TYPE c.
DATA: char1(20) TYPE c,
char2(20) TYPE c.

DATA: inst_flg TYPE c VALUE 'N',
chan_had TYPE c VALUE 'N'.
* teco_flg TYPE c VALUE 'N',
* read_flg TYPE c .

*BREAK-POINT.

CHECK sy-tcode EQ 'CO02'.
** Get user IP,hostname
CALL FUNCTION 'TH_USER_INFO' " Get user IP,hostname
EXPORTING
client = sy-mandt
user = sy-uname
IMPORTING
hostaddr = iporg
terminal = host
EXCEPTIONS
OTHERS = 1.
**"Conv.IP addr to format 'xxx.xxx.xxx.xxx'
CALL FUNCTION 'GWY_IPADR2STRING' "Conv.IP addr
EXPORTING
ipadr = iporg
IMPORTING
string = ipdec.
***Common var.
MOVE: sy-mandt TO i_temp-mandt,
sy-uname TO i_temp-aenam,
sy-datum TO i_temp-laeda,
sy-uzeit TO i_temp-times,
sy-tcode TO i_temp-tcode,
ipdec TO i_temp-hostip,
host TO i_temp-host,
header_table-aufnr TO i_temp-aufnr.
***Check M/O header
**check if status eq 'TECO'.
*LOOP AT status_table WHERE objnr EQ header_table-objnr
* AND stat EQ 'I0045'.
*
* MOVE: 'Y' TO teco_flg.
*ENDLOOP.

*CHECK teco_flg NE 'Y'.
*CHECK read_flg NE 'Y'.

SELECT SINGLE gamng gltrp INTO (caufv-gamng, caufv-gltrp)
FROM caufv WHERE aufnr EQ header_table-aufnr.
**qty
IF header_table-gamng NE caufv-gamng.
MOVE: caufv-gamng TO char1, header_table-gamng TO char2.
MOVE-CORRESPONDING i_temp TO i_zpco02.
MOVE: '更改工单总数' TO i_zpco02-filed,
'U' TO i_zpco02-chnid,
char1 TO i_zpco02-value_old,
char2 TO i_zpco02-value_new.
APPEND i_zpco02.
inst_flg = 'Y'.
chan_had = 'Y'.
ENDIF.
**date
IF header_table-gltrp NE caufv-gltrp.
MOVE-CORRESPONDING i_temp TO i_zpco02.
MOVE: '更改完成时间' TO i_zpco02-filed,
'U' TO i_zpco02-chnid,
caufv-gltrp TO i_zpco02-value_old,
header_table-gltrp TO i_zpco02-value_new.
APPEND i_zpco02.
inst_flg = 'Y'.
ENDIF.

IF inst_flg = 'Y'.
INSERT zpco02 FROM TABLE i_zpco02 ACCEPTING DUPLICATE KEYS.
inst_flg = 'N'.
ENDIF.
*DELETE component_table WHERE vbkz EQ 'I'.
LOOP AT component_table WHERE vbkz EQ 'U'
OR vbkz EQ 'I'
OR vbkz EQ 'D'.
CASE component_table-vbkz.
WHEN '*'.
MOVE-CORRESPONDING i_temp TO i_zpco02.
MOVE: '**组件' TO i_zpco02-filed,
'I' TO i_zpco02-chnid,
'' TO i_zpco02-value_old, "old_resb-matnr
component_table-matnr TO i_zpco02-value_new,
'**组件' TO i_zpco02-matnr,
* read_flg TO i_zpco02-readf,
component_table-alpos TO i_zpco02-alpos,
sy-tabix TO i_zpco02-loopid.
APPEND i_zpco02.
inst_flg = 'Y'.

WHEN '*'.
MOVE-CORRESPONDING i_temp TO i_zpco02.
MOVE: '**组件' TO i_zpco02-filed,
'D' TO i_zpco02-chnid,
resb-xloek TO i_zpco02-value_old,
component_table-xloek TO i_zpco02-value_new,
component_table-matnr TO i_zpco02-matnr,
* read_flg TO i_zpco02-readf,
component_table-alpos TO i_zpco02-alpos,
sy-tabix TO i_zpco02-loopid.
APPEND i_zpco02.
inst_flg = 'Y'.
WHEN '*'.
SELECT SINGLE matnr bdmng INTO (resb-matnr, resb-bdmng)
FROM resb WHERE aufnr EQ component_table-aufnr
AND posnr EQ component_table-posnr
AND matnr EQ component_table-matnr
AND rsnum EQ component_table-rsnum
AND rspos EQ component_table-rspos.
IF component_table-matnr NE resb-matnr.
MOVE-CORRESPONDING i_temp TO i_zpco02.
MOVE: '更改组件' TO i_zpco02-filed,
'*' TO i_zpco02-chnid,
resb-matnr TO i_zpco02-value_old,
component_table-matnr TO i_zpco02-value_new,
'更改的工单组件' TO i_zpco02-matnr,
* read_flg TO i_zpco02-readf,
component_table-alpos TO i_zpco02-alpos,
sy-tabix TO i_zpco02-loopid.
APPEND i_zpco02.
inst_flg = 'Y'.

ELSEIF component_table-bdmng NE resb-bdmng.
CHECK chan_had NE 'Y'.
MOVE: component_table-bdmng TO char1, resb-bdmng TO char2.
MOVE-CORRESPONDING i_temp TO i_zpco02.
MOVE: '需求数量' TO i_zpco02-filed,
'U' TO i_zpco02-chnid,
char2 TO i_zpco02-value_old,
char1 TO i_zpco02-value_new,
component_table-matnr TO i_zpco02-matnr,
* read_flg TO i_zpco02-readf,
component_table-alpos TO i_zpco02-alpos,
sy-tabix TO i_zpco02-loopid.
APPEND i_zpco02.
inst_flg = 'Y'.
ENDIF.

ENDCASE.
ENDLOOP.

IF inst_flg = 'Y'.
INSERT zpco02 FROM TABLE i_zpco02 ACCEPTING DUPLICATE KEYS.
IF sy-subrc EQ 0.
inst_flg = 'N'.
chan_had = 'N'.
* MESSAGE ID 'ZX' TYPE 'W'
* NUMBER '000' WITH 'SAP系统已记录您的更改!'.
ENDIF.
ENDIF.

--------------------------------------------------------------------------------------------------------
5.更改记录:
集团 400
订单 400000063
物料 5017000533A
字段名 删除标记
更改者 SAP003
上一次修改 2005.09.12
事务代码 CO02
修改标识符 D
字符20 (HOSTIP) 192.168.4.95
Host Name SAP-8
字符20 (VALUE OLD)
字符20 (VALUE NEW) X

时间 14:53:27

其他的关于生产订单的增强在IMG->SFC->系统修正那都可以找得到,如PPCO0007 保存生产订单时,PPCO0008 在增加和改变组件时的增强(这里就写数据到ZPCO02一但用户没保存.....所以只有放在PPCO0001里了),大家多研究研究。
VagrantLee的个人空间 VagrantLee 发布于2008-06-03 08:56:23
代码写在哪里,
在SE38中新建一个程序ZXCO1U01,然后写代码进去吗?
seantu发布于2008-07-16 14:50:28
我正在做
我来说两句

(可选)

我的栏目

日历

« 2008-07-25  
  12345
6789101112
13141516171819
20212223242526
2728293031  

我的存档

数据统计

  • 访问量: 1720
  • 日志数: 22
  • 建立时间: 2007-12-17
  • 更新时间: 2007-12-20

RSS订阅

Open Toolbar