赛跑网

 找回密码
 注册
查看: 3603|回复: 1

[FICO] COPA0001 in CO-PA 增强

[复制链接]
发表于 2014-3-5 15:42:25 | 显示全部楼层 |阅读模式
Enhancement of characteristic derivation
Within the characteristic derivation in Profitability Analysis, it is possible to enhance the standard derivation by individual, self-programmed derivation steps by means of the enhancement COPA0001.
The enhancements can be inserted anywhere in derivation strategy, as frequent as needed.
Before using this enhancement, make sure you can reach the desired result by proceeding appropriately under utilization of step and field attributes as well as temporary fields.
As in the other derivation types, enter the source fields and the target fields you want to use within the enhancement.
Within module EXIT_SAPLKEDRCOPA_001 in Include ZXKKEU11 you can define your own source code. The following is available there: the fields specified in the derivation step in parameters I_COPA_ITEM and I_GLOBAL, the operating concern name in I_OPERATING_CONCERN , the derivation date in I_DERIVATION_DATE and possibly a user-defined step ID in I_STEP_ID by which you can distinguish your enhancement steps if you are using several of these within one strategy.
The CO-PA characteristic values for the source fields specified in the derivation step are transferred in I_COPA_ITEM in the form of the CE0xxxx structure, where xxx is the name the operating concern. For access to the individual fields, you should first assign this parameter to a variable with the suitable structure as described in the example below.
In structure I_GLOBAL, you can store global information in addition to the temporary work fields
USERTEMP1 up to USERTEMP8. Thus, as of Release 4.5 you can for
example, control the source code depending on whether the derivation of characteristics is called for plan or actual data (field PLIKZ) or from within the realignments (field REALIGNMENT_MODE).
Note
The customer-specific source code is stored in Include files. For the function module, the following Include is provided:
EXIT_SAPLKEDRCOPA_001: Include ZXKKEU11
Components 001 and 002 of customer enhancement for the characteristic derivation COPA0001 are no longer available as of Release 4.0.
If you upgrade from a former release, however, these are still accessed and thus still operative. After an upgrade, the system automatically recognizes whether this customer enhancement was active. If this is the case, derivation steps for accessing these enhancements are automatically generated at the beginning and at the end of the derivation strategy.
Check whether the logic programmed in the enhancement is also operative in the new release.
Also refer to the documentation on the derivation of characteristics in the CO-PA online manual.
Recommendations
1. Only use enhancement steps if absolutely necessary. You can thus avoid necessary reworks to ensure compatibility after release upgrades.2. For the enhancement step only define the source and target fields which are actually defined in the enhancement. If several logically independent derivations of characteristics should be carried out by the enhancement, split them up in separate enhancement steps that you can distinguish with step IDs. As a result, the system can automatically recognize the logical dependencies mapped in the enhancement and use these for fine tuning.
Important notes
The characteristic derivation is called from anywhere in the system, from within dialog as well as in background processing. They are in part critical programs, for example the integrated data updating in FI. In the course of this, some additional requirements and/or restrictions are required for the design of the source code in the enhancement.
No database commits
In the source code, no database commits may be raised at all because the consistency of data updating between the different FI modules can be endangered. In particular, this means that you must not output error messages since commits will implicitly be transmitted in this case.No 'hard' error messages
If you recognize error situations in the enhancement, either return them via a MESSAGE ... RAISING DERIVATION_FAILED or simply set the return parameter E_FAILED to 'X'. The callup derivation processor ensures proper processing of the error in both cases. You must avoid MESSAGE E statements without RAISING due to the commit problems.
No interaction
User interactions are not allowed: for example, calling a dialog box.
Special features with source and target fields
Only specified source values are available in I_COPA_ITEM and I_GLOBAL.
The source and target fields of the enhancement are set in Customizing. Exclusively the values of the source and target fields which are stored there in the derivation steps for the enhancement are transferred to the transfer structures I_COPA_ITEM and I_GLOBAL. All other values are blank or undefined.
Enhancement is not always accessed
When you deactivate the 'Initial value allowed' characteristic for source fields of the enhancement step, the step is only accessed if all these fields contain a value.By default, all source fields of an enhancement step have been set to 'Initial value allowed'.
Example for exit
Derivation of the SOP product group in one enhancement step
The operating concern Z001 contains a self-defined characteristic WWSOP (SOP product group). You want to transfer the SOP product group into a self-defined characteristic.
,,tables: pgmi.
,,data: ce0_z001 like ce0z001.
,,data: begin of sop_work_area,
,, prgrp like pgmi-prgrp,
,, date like pgmi-datum,
,, end of sop_work_area.
Note that a created enhancement which is once activated is immediately effective in all operating concerns. It is accessed from all operating concerns. Therefore you necessarily have to implement a query for the name of the operating concern in your source code.
,,case i_operating_concern.
,, when 'Z001'.</>
Inform the calling program that you have stored user exit source code for this operating concern. This is important since otherwise the derivation processor does no longer call the user exit in that sequence (within the same transaction/report)
,,e_exit_is_active = 'X'.</>
Assignment of the non-structured data field to a field of structure CE0xxxx. Then the fields of the operating concern can be activated individually.
,,ce0_z001 = i_copa_item.</>
User-specific source code: Transfer of the SOP product group into the user-defined characteristic WWSOP.
,,case i_step_id.
,, when 'SOP'.</>
The step ID is 'SOP'. In this case, the SOP group is supposed to be read.
,, select prgrp min( datum ) up to 1 rows
,, into sop_work_area
,, from pgmi
,, where nrmit = ce0_z001-artnr
,, and wemit = ce0_z001-werks
,, and datum >= i_derivation_date
,, group by prgrp.
,, ce0_z001 = sop_work_area-prgrp.
,, endselect.
If no value is found in table PGMI, the derivation of characteristics fails. The calling program is informed by entering 'X' in e_failed.
,, if sy-subrc <> 0.
*,, to output standard error message K/113, it suffices to
*,, set flag E_failed
,, e_failed = 'X'.* As an alternative, a separate message can be sent, which
* must necessarily have exception DERIVATION_FAILED
* 'No SOP group found for & in plant &' ,, message e900(zz) with ce0_z001-artnr ce0_z001-werks
,, raising derivation_failed.
*,, for Release 4.0B up to Hot Package 20, also refer to Note
*,, 157312
,, endif.
,, endcase. </>
Keep in mind to return the results of the derivation step to the calling program.
,, e_copa_item = ce0_z001.
,,endcase.</>

Allowed source fields
All user-defined characteristics
All characteristics taken from SAP tables
Child number                  (KNDNR)
Product number                (ARTNR)
Billing type                  (FKART)
Sales order number            (KDAUF)
Item number in sales order    (KDPOS)
Company code                  (BUKRS)
Controlling area              (KOKRS)
Business area                 (GSBER)
Profit center                 (PRCTR)
Sales organization            (VKORG)
Distribution channel          (VTWEG)
Division                      (SPART)
Cost object                   (KSTRG)
Work breakdown structure element (PSPNR)
Plant                        (WERKS)
All quantity unit fields
All fields of GLOBAL
Allowed target fields
All user-defined characteristics
All characteristics taken from SAP tables
Child number                  (KNDNR)
Product number                (ARTNR)
Business area                 (GSBER)
Profit center                 (PRCTR)
Sales organization            (VKORG)
Sales organization            (VKORG)
Distribution channe         l (VTWEG)
Division                      (SPART)
Cost object                   (KSTRG)
Work breakdown structure element (PSPNR)
Plant                        (WERKS)
All quantity unit fields
All fields of GLOBAL
Allowed target fields
All user-





上一篇:实战三期--FI月结 简介
下一篇:阿梅FICO面试题连载3
本楼点评(0) 收起
发表于 2014-3-5 16:08:34 | 显示全部楼层
支持你哈................
本楼点评(0) 收起
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|联系我们|赛跑网 ( 苏ICP备14021163号-4QQfsq

GMT+8, 2026-8-3 18:20 , Processed in 0.507455 second(s), 31 queries .

Powered by 91SAP X3.4

© 2001-2023 91sap Team.

快速回复 返回顶部 返回列表