User Exits in Characteristic Relationships

Question: Hello,

Has anybody worked with user exits in the Characteristic Relationship functionality?

I need help when using multiple characteristics to derive a target value. We are able to get the user exits working correctly as long as I have only one source characteristic, however when I try to use multiple source characteristics the user exit does not work correctly.

Regards

Sunil

Answer:
Sunil,

Have you put a break point in your function module ( BREAK <user-id> ) to see if your function module is being executed? Can you post some of your function module code so we can help debug?

MFWSTCAHS

Answer:
Ensure that the characteristic to be derived is not a part of the Planning Level.
_________________
boonchai

Answer:
I have been able to get the function module to work, if there is only one source characteristic, however, when I try to add an other characteristic the function module, does not read the second value.


This is what we are attempting:

We have an input layout, where in the users would enter their data. Depending on the need, they would assign a WBS. Our requirement is to derive the Partner Profit Center, based on the following logic:

If a WBS is assigned,
Partner Profit Center = Profit Center in WBS Master data

If WBS is not assigned
Partner Profit Center = Profit Center in Cost Center Master data

Hope this clarifies my question.

***************************
Here is the code of the function module:

Characteristic Relationship (Derive)
Chars Involved Source Chars
3 Exit Cost center Cost center
WBS element WBS element
Partner profit ctr

Parameters:

I_AREA TYPE UPC_Y_AREA Planning Area
ITO_CHA TYPE UPC_YTO_CHA Characteristics
ITO_SOURCE TYPE UPC_YTO_CHA Characteristics
ITO_TARGET TYPE UPC_YTO_CHA Characteristics



FUNCTION Z_DER_PRFTCNTR_FROM_WBS.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(I_AREA) TYPE UPC_Y_AREA
*" REFERENCE(ITO_CHA) TYPE UPC_YTO_CHA
*" REFERENCE(ITO_SOURCE) TYPE UPC_YTO_CHA
*" REFERENCE(ITO_TARGET) TYPE UPC_YTO_CHA
*" EXPORTING
*" REFERENCE(ET_MESG) TYPE UPC_YT_MESG
*" CHANGING
*" REFERENCE(XS_CHAS) TYPE ANY
*" EXCEPTIONS
*" FAILED
*"----------------------------------------------------------------------
* tables: /BI0/MWBS_ELEMT.
DATA: l_wbs like /BI0/MWBS_ELEMT-WBS_ELEMT,
l_profitctr like /BI0/MWBS_ELEMT-PROFIT_CTR.
DATA: l_costcenter like /BI0/MCOSTCENTER-COSTCENTER.
DATA: ls_mesg TYPE upc_ys_mesg.

* ==== DEBUGGING ====
* Break-Point.


FIELD-SYMBOLS: <costcenter>,<wbselement>, <profitcenter>, <fiscper3>.

ASSIGN COMPONENT '0WBS_ELEMT' OF STRUCTURE xs_chas TO <wbselement>.
ASSIGN COMPONENT '0PART_PRCTR' OF STRUCTURE xs_chas TO <profitcenter>.
ASSIGN COMPONENT '0FISCPER3' OF STRUCTURE xs_chas TO <fiscper3>.
READ TABLE ito_cha TRANSPORTING NO FIELDS
WITH KEY chanm = '0WBS_ELEMT'.
IF sy-subrc = 0.
l_wbs = <wbselement>.
* If there is wbs element, search from wbs element master table
* otherwise, search from costcenter master table.
if not l_wbs is initial.
select single * from /bi0/mwbs_elemt where wbs_elemt = l_wbs.
<profitcenter> = /bi0/mwbs_elemt-profit_ctr.
else.
ASSIGN COMPONENT '0COSTCENTER' OF STRUCTURE xs_chas TO
<costcenter>.
READ TABLE ito_cha TRANSPORTING NO FIELDS
WITH KEY chanm = '0COSTCENTER'.
IF sy-subrc = 0.
l_costcenter = <costcenter>.
select single * from /bi0/mcostcenter where costcenter =
l_costcenter.
<profitcenter> = /bi0/mcostcenter-profit_ctr.

else.

ls_mesg-msgty = 'E'.
ls_mesg-msgid = 'zbp'.
ls_mesg-msgno = '001'.
ls_mesg-msgv1 = 'No Cost Center - NSK.'. "#EC NOTEXT
APPEND ls_mesg TO et_mesg.
exit.


ENDIF.

endif.
ENDIF.
ENDFUNCTION.

******************

The errror message also does not get triggered.

Will really appreciate any help.

Thanks

Sunil

Answer:
Sunil,
I think if the WBS element is unassigned it won't access the Function Module.
_________________
boonchai
Copyright ?2007 - 2008 www.jt77.com