CO--关于KOMKAKE和KOMPAKE结构的字段创建的说明

KOMKAKE和KOMPAKE结构是和经营范围(Operating Concern)的获利能力分析(CO-PA)的激活相关。

在SAP未配置和激活经营范围的获利能力分析时,这两个结构都只含有一个哑元字段(KDUMMY_KE),如下图:

CO--关于KOMKAKE和KOMPAKE结构的字段创建的说明

当用户配置和激活自己经营范围时(TCODE:KEA0/KEA5),sap系统就会根据用户设置的特性(Characteristic)扩展这两个结构,其中特性来自VBKD,VBAK,PAPARTNER,KNB1,KNVV和KNA1的字段会添加到KOMKAKE中,其他添加到KOMPAKE中。

注意:

扩展到这两个结构的字段SAP系统是不会删除,也就是说只增不减。SD的顾问得注意这些字段在定价的字段选择里就可能会使用,在以前一个项目中CO的顾问激活了一个无用的CO-pA的模板,也就添加了一些无用的字段,sd顾问恰恰用了这个字段,导致定价的条件表无法传输到TST和PRD机器,引起许多的麻烦。

扩展后的结构参加下图示例:

CO--关于KOMKAKE和KOMPAKE结构的字段创建的说明

扩展两个结构的SAP相关代码:

代码单元:LKEABF11

代码摘录:

*&---------------------------------------------------------------------*
*& Form APPEND_STRUCTURE
*&---------------------------------------------------------------------*
* Einf黦en neue Felder in KOMKAKE bzw. KOMPAKE
*----------------------------------------------------------------------*
* --> it_fieldtab: Contains all CO-PA characteristics that
* should be included either in structure KOMKAKE
* or in structure KOMPAKE
* <-- et_dd03p_komk : Contains all fields that have not yet been
* included to structure KOMKAKE; these fields
* will have to be added to structure KOMKAKE
* <-- et_dd03p_komp : Contains all fields that have not yet been
* included to structure KOMPAKE; these fields
* will have to be added to structure KOMKAKE
*----------------------------------------------------------------------*
form append_structure
tables it_fieldtab structure fieldtab
et_dd03p_komk structure dd03p
et_dd03p_komp structure dd03p
changing value(e_subrc) like sy-subrc
value(e_update_komkake) type c
value(e_update_kompake) type c.

data: lt_dfies_komk like dfies occurs 0 with header line,
lt_dfies_komp like dfies occurs 0 with header line.

data: ls_fieldtab type rkea1_fieldtab_entry,
ls_dd03p like dd03p,
l_subrc like sy-subrc.

clear: e_update_komkake,
e_update_kompake.

* Einlesen KOMKAKE

perform read_nametab tables lt_dfies_komk
using 'KOMKAKE'
changing e_subrc.

check e_subrc = 0.

* Einlesen KOMPAKE

perform read_nametab tables lt_dfies_komp
using 'KOMPAKE'
changing e_subrc.

check e_subrc = 0.

loop at it_fieldtab into ls_fieldtab.
* check fieldtab-hktab ne 'PAPARTNER'.
if ls_fieldtab-hktab = 'KNA1' or
ls_fieldtab-hktab = 'KNVV' or
ls_fieldtab-hktab = 'KNB1' or
ls_fieldtab-hktab = 'PAPARTNER' or
ls_fieldtab-hktab = 'VBAK' or
ls_fieldtab-hktab = 'VBKD'.
*-
* Check if field has already been included in structure KOMKAKE
*-
perform look_for_field tables lt_dfies_komk
using 'KOMKAKE'
ls_fieldtab-kfldn
l_subrc.
*
if l_subrc <> 0.
* Field has to be added to structure KOMKAKE
clear ls_dd03p.
move-corresponding ls_fieldtab to ls_dd03p.
ls_dd03p-fieldname = ls_fieldtab-kfldn.
append ls_dd03p to et_dd03p_komk.
e_update_komkake = 'X'.
endif.
*
else.
*-
* Check if field has already been included in structure KOMPAKE
*-
perform look_for_field tables lt_dfies_komp
using 'KOMPAKE'
ls_fieldtab-kfldn
l_subrc.
*
if l_subrc <> 0.
* Field has to be added to structure KOMKAKE
clear ls_dd03p.
move-corresponding ls_fieldtab to ls_dd03p.
ls_dd03p-fieldname = ls_fieldtab-kfldn.
append ls_dd03p to et_dd03p_komp.
e_update_kompake = 'X'.
endif.

endif.

endloop.

endform. " APPEND_STRUCTURE

相关Note和链接:

Note 353257 - Error message K6431 w/ deleting characteristic

Note 127341 - Valuation for products valued separately

http://forums.sdn.sap.com/thread.jspa?threadID=1582108

你可能感兴趣的:(thread,C++,c,C#)