on 2019 Jun 03 1:05 PM
Hi all,
Here's my requirement - simple but hard for me. When an order is changed - specifically when a sales rep (Partner) is changed - the Profit center is redetermined in the order. It needs to be changed in the order and in the profitablity segment.
I changed substitution. It didn't work because it wasn't triggered during save on changing the sales order. Otherwise it worked great for create.
I applied a note: 528495
I looked at notes: 35288, 199467, 79847, 579461, 329381 - and a lot of others
So then I looked at derivation and that didn't work either as it didn't start during a change to the partner.
Next I looked into ABAP changes and found: MV45AFZB / USEREXIT_MOVE_FIELD_TO_COBL
- I filled COBL with the profit center.
Just for fun - I filled xvbap with profit center during background: USEREXIT_SAVE_DOCUMENT_PREPARE
So after the ABAP changes: the profit center on the screen has changed. That however, didn't help a lot.
I got this message:
KE496 - Check the assignment to a profitability segment (Characteristic PRCTR)
After the message I can look at the profitability segment and then press continue. Then my profit center is correct in the profitability analysis. But that message doesn't happen until I go back into the order, then I have to be in the account assignment. Otherwise I would never know that it was not the same. (I was just changing the sales rep and then pressing save)
I am looking first for a configuration change. If you know of one besides substitution or derivation I'd love to hear about it.
Second I'm looking for a point in the sales order where I can trigger the profit segment to run. I would like to avoid using an enhancement point, but at this point, I'll take anything you have.
I am on Hana on-premise, we are using the universal journal (ACDOCA) We are using CE4* tables with characteristics and profit center is one of them. Sales orders are using the old screens rather than the new ones. Yes, we do use Fiori, but this needs to work in the GUI first.
At this point I don't know if I need BTC, OTC, or ABAP help.
Here is my code if needed.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = p_kunnr
IMPORTING
output = lv_kunnr.
SELECT SINGLE prctr INTO lv_prctr
FROM csks
WHERE verak = lv_kunnr.
IF sy-subrc <> 0.
CLEAR lv_prctr.
ENDIF.
ch_cobl-prctr = lv_prctr.
In the prepare to save I'm doing basically the same thing except for I'm changing xvbap-prtcr.
Note: the help I need is for getting the profit center into the profitability segment.
TIA,
Michelle
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
You could try to force the update from withing the SAVE PREPARE form
" USEREXIT_SAVE_DOCUMENT_PREPARE (MV45AFZZ):
LOOP AT XVBAP WHERE UPDKZ NE 'D'. " to be optimized (e.g. if XVBAP-PRCTR ne YVBAP-PRCTR)
SVBAP-TABIX = SY-TABIX.
PERFORM VBAP_BEARBEITEN_VORBEREITEN (SAPFV45P).
PERFORM ERGEBNISOBJEKT_AKTUALISIEREN (SAPFV45P).
PERFORM AUFTEILUNGSREGEL_AKTUALISIEREN (SAPFV45P).
PERFORM XVBAP_AENDERN (SAPFV45P).
ENDLOOP.
NB: This solution was inspired by note 504173 - Characteristic not copied to profitability segment. Check its impact, on performance also, carefully
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 22 | |
| 15 | |
| 14 | |
| 5 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.