Ver Mensaje Individual
  #3  
Viejo 08/08/08, 17:50:02
Avatar de guessinny
guessinny guessinny is offline
Junior Member
 
Fecha de Ingreso: feb 2007
Localización: Mexico
Mensajes: 8
Encontré una nota en el Marketplace de SAP (141009) la cual habla precisamente del tema, la solución se realiza por la via de la programación (ABAP), pero al menos esta soportado por SAP, ya lo probe y "jala" bien, si te actualiza correctamente la EKPO con el CeBe nuevo que ya tiene el material.

Aqui les dejo la nota por si alguno de uds. no tiene acceso al marketplace.

***********************************
Summary
Symptom
If you changed the profit center assignment in material master, this new assignment is not taken into account for those purchase orders or scheduling agreements created before the change. As a result the old profit center is used instead of the new profit center.
Other terms
EKPO Profit Center Assignment
Reason and Prerequisites
Missing functionality.
Solution
Execute the attached program ZECPCAEK for the affected purchase orders or scheduling agreements. This will change the profit center of the document to the profit center of the material master.
Attention: you can use report ZECPCAEK only for purchase orders without account assignment objects. If you have purchase order with accounts assignments you have to change the purchase orders manually.

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

y obviamente el codigo del programa, que por comentarios de nuestro "Abaper" dice que es un contundente "martillazo" (entiendase Update directo a la tabla EKPO).


**********************************************************************
* Report to correct purchase orders (table EKPO)
* relevant:
* - after a reorganisation of profit center assignments to materials
* - purchase orders from release 2.2 don't have a profit center
**********************************************************************


REPORT ZECPCAEK.

TABLES: EKPO.

DATA: BEGIN OF EKPO_STRUCTURE,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
MATNR LIKE EKPO-MATNR,
WERKS LIKE EKPO-WERKS,
KO_PRCTR LIKE EKPO-KO_PRCTR,
END OF EKPO_STRUCTURE.

DATA L_EKPO LIKE EKPO_STRUCTURE OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF L_MARC.
INCLUDE STRUCTURE MARC.
DATA: END OF L_MARC.

DATA: COUNTER LIKE SY-TABIX.

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

SELECT-OPTIONS: EBELN FOR EKPO-EBELN OBLIGATORY.
PARAMETERS: TEST AS CHECKBOX DEFAULT 'X'.

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

START-OF-SELECTION.

* Selection of purchase orders

SELECT EBELN EBELP MATNR WERKS KO_PRCTR
INTO L_EKPO FROM EKPO
WHERE EBELN IN EBELN.

APPEND L_EKPO.
ENDSELECT.


CLEAR COUNTER.

LOOP AT L_EKPO.

* Read Material data
CALL FUNCTION 'MARC_SINGLE_READ'
EXPORTING
MATNR = L_EKPO-MATNR
WERKS = L_EKPO-WERKS
IMPORTING
WMARC = L_MARC
EXCEPTIONS
LOCK_ON_MARC = 1
LOCK_SYSTEM_ERROR = 2
WRONG_CALL = 3
NOT_FOUND = 4
OTHERS = 5.

IF SY-SUBRC = 0.

* Has the profit center changed?
IF L_MARC-PRCTR <> L_EKPO-KO_PRCTR.

IF TEST = SPACE.
UPDATE EKPO
SET KO_PRCTR = L_MARC-PRCTR
WHERE EBELN = L_EKPO-EBELN
AND EBELP = L_EKPO-EBELP.
ENDIF.
COUNTER = COUNTER + 1.

* Protocoll
IF COUNTER = 1.
WRITE /.
WRITE AT 5 'Purchase Order'.
WRITE AT 20 'Position'.
WRITE AT 30 'Material no.'.
WRITE AT 60 'Old PrCtr'.
WRITE AT 75 'New Prctr'.
ENDIF.

WRITE /.
WRITE AT 5 L_EKPO-EBELN.
WRITE AT 20 L_EKPO-EBELP.
WRITE AT 30 L_EKPO-MATNR.
WRITE AT 60 L_EKPO-KO_PRCTR.
WRITE AT 75 L_MARC-PRCTR.
ENDIF.
ENDIF.

ENDLOOP.
WRITE: /, /, COUNTER, 'entries'.


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

SUERTE....!!!
__________________
Saludos.

Guessinny

Responder Con Cita