cancel
Showing results for 
Search instead for 
Did you mean: 

Copying the old record fiels value to a new record

Former Member
0 Kudos

I am trying to get a field value from IT0001 old record to a new

record as part of Position Change Action. In the Infogroup, I

have "INSS" for the IT0001 so that it creates a new record with

new Payroll Area, as required. Also this is a required field as

the users would enter the value as part of action. I have given

the code as below as I need SACHP field to bring the value from

previous IT0001 record:

0000 00 01 P P0000-MASSN='A4'

0000 00 03 P PSPAR-SACHP SPACE

0000 00 05 W PSAVE-SACHP=P0001-SACHP

I am not able to get the desired value in the field and on saving

IT0000, this field is coming-up as blank in IT0001.

Am I missing something here? I tried doing with an 'I' Statement also but no use!

Any help is appreciated!

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

@ SAP_HRfuncional,

As <b>Manoj</b> said, you have to use enhancement <b>PBAS0001</b>; within <b>EXIT_SAPFP50M_001</b> write the following code:

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


data i0001 like p0001.
data v_sachp like sachp.

if	
   ipsyst-ioper EQ 'INS' AND " Creating infotype
   innnn-infty = '0001'  AND " Infotype 0001
   sy-tcode = 'PA40'     AND " You are in PA40
   ipsyst-massn = 'A4'.      " You are in A4 action
"  Add the molga condition if necessary

"  Get SACHP   
   SELECT SACHP
   FROM PA0001
   INTO v_sachp
   WHERE PERNR EQ innnn-pernr 
     AND SPRPS NE 'X'
     AND BEGDA <= innnn-begda "or sy-datum?
     AND ENDDA >= innnn-begda "or sy-datum?.
  
   if sy-subrc eq 0.
      MOVE innnn TO i0001.
      MOVE v_sachp to i0001-sachp.
      MOVE i0001 TO innnn.
   endif.

endif.

Really hope that helps,

Let us know if you could solve your issue,

Christian.

Former Member
0 Kudos

Thanks, Manoj and Christian.. So, do we need to go the ABAPer/Developer for this user exit? Can't we do without any customization or going to the ABAPer?

Former Member
0 Kudos

@ SAP_HRfunciontal,

As far as I know you wont be able to achieve it by customizing, so I think that yes you have to go to your abaper, just tell him/her to copy paste the above snippet of code in the user exit.

Let me know if you could solve it

Regards,

Christian.

Former Member
0 Kudos

Hi,

try the following:

<b>0000 00 05 W P0001-SACHP=PSAVE-SACHP</b>

instead of

0000 00 05 W PSAVE-SACHP=P0001-SACHP

Regards

Bernd

Former Member
0 Kudos

I am still not able to copy the field value from old record to new record during the position change action! Am I supposed to have an "I" statement also?

Former Member
0 Kudos

Hi ,

try to use the enhancement - PBAS0001 .

Pass the default value in Exit -EXIT_SAPFP50M_001 or EXIT_SAPFP50M_002 .

Regards,

Manoj.

Former Member
0 Kudos

Ask your abaper to write a badi/Exit for that if you want to default value

when in PA40 action.

reward point if helpful