‎2011 Aug 05 12:57 PM
Hi Experts,
Im doing a transaction in TCode PA30 by entering a pernr and infty as 14 and wage type.
My need is when im entering a particular wage type in PA30 with infotype 14 , for that particular wage type and infotype i need to assign a different cost centre. This requirement was doing now manually by changing the cost centre form EDIT - > Maintain Cost Assignment.
But my Client Needs to do it automatically. by comparing the wage type and infotype the cost centre needs to get automatically updated.
So i use the Enhancement EXIT_SAPFP50M_002 * INCLUDE ZXPADU02.* and wrote coding like below
CASE innnn-infty.
To check whether the record belong to pa0014
If so,check the wage type for the updation
If so update the values of cost center assignments in the table assob and asshe
when '0014'.
if innnn-subty eq '2211'.
Select the last updated sequence number in the table pdsnr
if sy-ucomm eq 'UPD' or sy-ucomm eq 'INS'.
select single * from pa0001 into wa_0001 where pernr eq INNNN-pernr and
endda eq '99991231'.
if sy-subrc = 0.
call function 'ENQUEUE_EPPRELE'
EXPORTING
MODE_PREL = 'E'
MANDT = SY-MANDT
PERNR = INNNN-pernr
INFTY = INNNN-INFTY
SUBTY = INNNN-SUBTY
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
CLEAR : lv_pdsnr.
select MAX( pdsnr ) from pdsnr into lv_pdsnr.
lv_pdsnr = lv_pdsnr + 1.
ls_assob-pdsnr = lv_pdsnr.
ls_assob-pernr = INNNN-pernr.
ls_assob-bukrs = wa_0001-bukrs. "'1001'.
ls_assob-gsber = wa_0001-gsber. "'0001'.
ls_assob-kokrs = wa_0001-kokrs. "'1000'.
ls_assob-kostl = '1-1361'.
ls_asshr-pdsnr = lv_pdsnr.
ls_asshr-pernr = INNNN-pernr.
ls_asshr-infty = innnn-infty.
ls_asshr-subty = innnn-subty.
ls_asshr-begda = sy-datum.
ls_asshr-endda = '99991231'.
ls_PDSNR-pdsnr = lv_pdsnr.
ls_PDSNR-PDGRP = '5B'.
insert into pdsnr values ls_pdsnr.
insert into asshr values ls_asshr.
insert into assob VALUES ls_assob.
call function 'DEQUEUE_EPPRELE'
EXPORTING
MODE_PREL = 'E'
MANDT = SY-MANDT
PERNR = INNNN-pernr
INFTY = INNNN-INFTY
SUBTY = INNNN-SUBTY.
ENDIF.
ENDIF.
ENDIF.
COMMIT WORK.
ENDCASE.
This is to update the three tables PDSNR, ASSOB,ASSHR.
Its getting Updated correctly, But when i goto EDIT - > Maintain Cost Assignment to do some changes and while saving the data i get the following Error Message :
You Cannot insert data in table : PDSNR.
Message no. P2715
Can Anyone please suggest me how to solve this issue.
Thanks,
Vijayan.R
‎2014 Apr 30 2:53 PM
‎2015 May 26 2:41 PM
Please check number range PD_SEQ_NR (transaction SNRO), the error occurs in the database update when you try to insert existing numbers.
‎2015 Jun 11 8:36 AM
http://scn.sap.com/docs/DOC-33611Hi Vijayan,
please search for the right point where to enhance in the transaction PA30. for each of your action there will be a BADI Triggered. check the relevant interface parameters of the BADI that helps you,
You can use it SXV_GET_CLIF_BY_NAME Function module to find the right place.
I would suggest to see the example in the document attached which might be helpful to you for finding it easily.