Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PA70 Payroll Identifier Modification

Former Member
0 Likes
3,202

Dear Experts,

I want to use userexit EXIT_SAPFP50M_002 to assign default value to payroll identifier field.

All i want is when i press next screen the payroll identifier field is automatically filled according to the following query:

SELECT MAX(PAYID) from PA0267 into max_pay where BEGDA = Payment Date.

and assign max_pay + 1 to payroll identifier.

Here are the steps.

1- Run transaction PA70:

2- check Additional off-cycle Payments and Preselect using report, the with proposal

3- choose multiple personnel numbers

4- check with proposal

5- Here i change the payment date and add the wage type then press next screen,

all what i need is to automatically fill payroll identifier according to this query:

SELECT MAX(PAYID) from PA0267 into max_pay where BEGDA = Payment Date.

and assign max_pay + 1 to payroll identifier.

So for all these employee the payroll identifier will be assigned.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,030

Hi Ahmed,

As discussed earlier to your previous thread

http://scn.sap.com/message/14423654#14423654

Write the same logic inside the USER EXIT.

EXIT_SAPFP50M_001

DATA          : lx_0267  TYPE p0267.

Constant     : lc_0267   type  infty  value '0267'.    


* Check the Infotypes...
CLEAR lx_0267.
IF sy-tcode NE 'PA20' AND ( ipsyst-ioper EQ 'INS' OR ipsyst-ioper EQ 'MOD' ).
   CASE innnn-infty.
     WHEN lc_0267.
*** Importing data from innnn to the structure lx_0267
       CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
         EXPORTING
           prelp = innnn
         IMPORTING
           pnnnn = lx_0267.
     

Here you can write the logic... Like... Validations or pass default values to the screen elements..

           CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
             EXPORTING
               pnnnn = lx_0267
             IMPORTING
               prelp = innnn.
         WHEN OTHERS.
       ENDCASE.
     WHEN OTHERS.
   ENDCASE.
ENDIF.

http://www.slideshare.net/RingelJen/user-exit-training

With regards,

SuDEESH


Dear Experts,

I want to use userexit EXIT_SAPFP50M_002 to assign default value to payroll identifier field.

All i want is when i press next screen the payroll identifier field is automatically filled according to the following query:

SELECT MAX(PAYID) from PA0267 into max_pay where BEGDA = Payment Date.

and assign max_pay + 1 to payroll identifier.

Here are the steps.

1- Run transaction PA70:

2- check Additional off-cycle Payments and Preselect using report, the with proposal

3- choose multiple personnel numbers

4- check with proposal

5- Here i change the payment date and add the wage type then press next screen,

all what i need is to automatically fill payroll identifier according to this query:

SELECT MAX(PAYID) from PA0267 into max_pay where BEGDA = Payment Date.

and assign max_pay + 1 to payroll identifier.

So for all these employee the payroll identifier will be assigned.

16 REPLIES 16
Read only

Former Member
0 Likes
3,031

Hi Ahmed,

As discussed earlier to your previous thread

http://scn.sap.com/message/14423654#14423654

Write the same logic inside the USER EXIT.

EXIT_SAPFP50M_001

DATA          : lx_0267  TYPE p0267.

Constant     : lc_0267   type  infty  value '0267'.    


* Check the Infotypes...
CLEAR lx_0267.
IF sy-tcode NE 'PA20' AND ( ipsyst-ioper EQ 'INS' OR ipsyst-ioper EQ 'MOD' ).
   CASE innnn-infty.
     WHEN lc_0267.
*** Importing data from innnn to the structure lx_0267
       CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
         EXPORTING
           prelp = innnn
         IMPORTING
           pnnnn = lx_0267.
     

Here you can write the logic... Like... Validations or pass default values to the screen elements..

           CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp
             EXPORTING
               pnnnn = lx_0267
             IMPORTING
               prelp = innnn.
         WHEN OTHERS.
       ENDCASE.
     WHEN OTHERS.
   ENDCASE.
ENDIF.

http://www.slideshare.net/RingelJen/user-exit-training

With regards,

SuDEESH


Read only

0 Likes
3,030

Dear Sudeesh,

I have here a different case, In PA30 it was a single employee only.

My logic is to search for the max payroll identifier in table PA0267 and increment this value and assign it to the employee.

as follows:

CASE innnn-infty.

      WHEN lc_0267.

        CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn

          EXPORTING

            prelp = innnn

          IMPORTING

            pnnnn = lx_0267.

           SELECT max( PAYID ) FROM PA0267 INTO SERIAL WHERE BEGDA = IPSYST-DDATE.

           lx_0267-PAYID = SERIAL + '1'.

               CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp

              EXPORTING

                pnnnn = lx_0267

              IMPORTING

                prelp = innnn.

          WHEN OTHERS.

    ENDCASE.

For transaction PA70, i have multiple employees.

If i use the same logic for multiple employees, every employee will be incremented by one.

I want to increment the payid only once.

In other words:

I want to change the value of payid of all the employees at the same time


Read only

0 Likes
3,030

For this purpose why you want to write logic in EXIT.

Better try to create a custom program using the FM HR_INFOTYPE_OPERATION.

And update the same in the infotype 0267.

With regards.

SuDEESH

Read only

0 Likes
3,030

Can i create global variable that is incremented every time the exit is called?

Read only

0 Likes
3,030

Is this an one time job?

Read only

0 Likes
3,030

CASE innnn-infty.

      WHEN lc_0267.

        CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn

          EXPORTING

            prelp = innnn

          IMPORTING

            pnnnn = lx_0267.

          GLOBVAR = GLOBVAR + 1.

               CALL METHOD cl_hr_pnnnn_type_cast=>pnnnn_to_prelp

              EXPORTING

                pnnnn = lx_0267

              IMPORTING

                prelp = innnn.

          WHEN OTHERS.

    ENDCASE.

I want to get number of employees in the table and store it in global variable.



Read only

0 Likes
3,030

But where will you declare that global variable?

in user exit? if it so, whether it won't get be initial? when control passes for every employees?

Read only

Former Member
0 Likes
3,030

Dear Ahmed,

You can use memory id as well.

import from memory id 'ZZPAYID'.


  lx_0267-PAYID = SERIAL + '1'.

export to memory id 'ZZPAYID'.


Read only

Former Member
0 Likes
3,030

This case doesnt work out like pa30 because they are multiple employees.

for example:

Higher payid in pa0267 is 4.

then personnal number 00999201 will have payid = 5.

and post it in pa0267.

for the next personnal number,

Higher payid in pa0267 will be 5.

then personnal number 00999203 will have payid = 6.

and post it in pa0267.

Higher payid in pa0267 will be 6.

then personnal number 00999333 will have payid = 7.

and post it in pa0267.

what i actually want is:

I want to look for the higher payid in pa0267.

and increment it and assign it to all the employees.

for example:

Higher payid in pa0267 is 4.

then personnal number 00999201 will have payid = 5.

for the next personnal number,

Higher payid in pa0267 will be 4.

then personnal number 00999203 will have payid = 5.

Higher payid in pa0267 will be 4.

then personnal number 00999333 will have payid = 5.

Then post post it in pa0267.

Read only

0 Likes
3,030

Try to create a custom program and update the same using the HR_INFOTYPE_OPERATION.

This will really help you!!

Read only

0 Likes
3,030

But i want this to be executed when the user create additional offcyle in pa70

Read only

0 Likes
3,030

Then for all employees, Get payid and increment it by 1.

l_payid = payid + 1.

Read only

0 Likes
3,030

how to access all the employees at the same time?!

Read only

0 Likes
3,030

it cannot be done by userexit EXIT_SAPFP50M_002 ??

Read only

0 Likes
3,030

You can write logic in EXIT_SAPFP50M_002. But Compare with your requirement.