HR Forms

37
Printing remuneration statement (Pay slips) using HR Forms Purpose An HR-Form often functions as an enterprise's business card, which means it requires an attractive graphical design. The HR Forms will enable you in future to create flexible reports with an attractive layout for HR master data, personnel time data, and payroll results. Therefore, it will be a central Human Resource tool that enables you to select data from various sources in a uniform manner, which you can then design and print. Tasks involved: Selecting data for HR forms Designing the layout of HR forms Activating HR forms Testing and correcting form printing Starting form printing Example: The requirement of our client is to print a Remuneration Statement (Pay slip) using HR Forms, which looks like the screen shot below:

Transcript of HR Forms

Page 1: HR Forms

Printing remuneration statement (Pay slips) using HR Forms

Purpose

An HR-Form often functions as an enterprise's business card, which means it requires an attractive graphical design. The HR Forms will enable you in future to create flexible reports with an attractive layout for HR master data, personnel time data, and payroll results. Therefore, it will be a central Human Resource tool that enables you to select data from various sources in a uniform manner, which you can then design and print. 

Tasks involved:

Selecting data for HR forms Designing the layout of HR forms Activating HR forms Testing and correcting form printing Starting form printing

Example:

The requirement of our client is to print a Remuneration Statement (Pay slip) using HR Forms, which looks like the screen shot below: 

Page 2: HR Forms

 

Go to the transaction PE51. The initial screen appears as the one below:

Page 3: HR Forms

 

In the above screen shot the country grouping is a unique indicator for a country that is used in the Human Resources components of the R/3 System. The form name is the HR form which we have to develop. In our case the standard form IN01 is copied to ZN02. For each HR form we have some sub objects as we see in the screen shot above.

Attributes Background Single fields Window Line layout Cumulative ID’s Text Modules Rules Documentation

Attributes 

The attributes are technical characteristics, like form name, form size, form class, as well as administrative information on the form, like the person who changed the form last, when the change took place, and so on. The system automatically sets the administrative information. 

Page 4: HR Forms

Background

The form background contains information that is printed in the same position in the form and does not vary. For example, the company’s address, Logo of the company and others.

The form background is set up using lines. You must define all lines in a form. This means that lines containing only individual fields or windows need to be defined as blank lines on the form background. In our case, once the form IN01 is copied to ZN02. Go to the change mode of the form ZN02. The screen would look like the one below. Remove / Add the extra lines as per the requirement. 

Page 5: HR Forms

 

Use page up / page down and forward / backward buttons to view the rest of the page. After making changes to the form as per required, it would look like the one below

Page 6: HR Forms
Page 7: HR Forms

Text Modules

These are the individual fixed texts that have to appear on the form. These can be the description of the fields, which appear on the pay slip like Name, ID, Pay period etc… For creating the text modules, from the initial screen of PE51, select the radio button text modules and click on change. Add each of them as shown below. 

 

Single Fields

These contain information that is always printed in the same position but can vary. For example, on the pay slip the Employee ID, name, department, Location, Bank Account number and so on will change from employee to employee. So these are to be kept in single fields. The text modules created above should also be placed using the single fields. Placing a field on the form is simple. From the initial screen of PE51, select the radio button Single field and click on change. Now place the cursor at the position where you want to add a single field. For example, if you want to add the text module ‘Name’ on the form. Place the cursor at that position and double click at that position. You can find a pop-up as follows: 

Page 8: HR Forms

Background

The form background contains information that is printed in the same position in the form and does not vary. For example, the company’s address, Logo of the company and others.

The form background is set up using lines. You must define all lines in a form. This means that lines containing only individual fields or windows need to be defined as blank lines on the form background. In our case, once the form IN01 is copied to ZN02. Go to the change mode of the form ZN02. The screen would look like the one below. Remove / Add the extra lines as per the requirement. 

Page 9: HR Forms

 

Use page up / page down and forward / backward buttons to view the rest of the page. After making changes to the form as per required, it would look like the one below

Page 10: HR Forms
Page 11: HR Forms

Text Modules

These are the individual fixed texts that have to appear on the form. These can be the description of the fields, which appear on the pay slip like Name, ID, Pay period etc… For creating the text modules, from the initial screen of PE51, select the radio button text modules and click on change. Add each of them as shown below. 

 

Single Fields

These contain information that is always printed in the same position but can vary. For example, on the pay slip the Employee ID, name, department, Location, Bank Account number and so on will change from employee to employee. So these are to be kept in single fields. The text modules created above should also be placed using the single fields. Placing a field on the form is simple. From the initial screen of PE51, select the radio button Single field and click on change. Now place the cursor at the position where you want to add a single field. For example, if you want to add the text module ‘Name’ on the form. Place the cursor at that position and double click at that position. You can find a pop-up as follows: 

Page 12: HR Forms

Click here to continue....

Select the radio button Text Module, take the F4 help and select the text, which you want to place. You can specify the output length of it if required.

Now if you have to place a field from the table P0001 against the text ‘Name’. Follow the same procedure. But in the pop-up select the radio button Table field and give the table name and field to consider as in the screen shot below.

Page 13: HR Forms

In the same way, as per required place the other fields also on the form. Finally it would appear like the one below: 

Page 14: HR Forms

Window

An HR form can contain more than one window. A window is a particular area within a form.

Information in a window is only printed on the form if there is a value in the data record at the

Page 15: HR Forms

time of evaluation. The quantity of information can vary, depending on whether or not the required information exists at the time of the evaluation. For example, values for a wage type may exist in the payroll result for one personnel number but not for other. If the information was printed in a individual field, the form would therefore be printed with gaps. To avoid this, this type of information is usually printed in a window. 

In order to align the windows on the form, from the initial screen of PE51, select the radio button Window and click on change. Right Click on the form and select the option window overview. And set the positions as required. After setting the window positions it would look like the one below:

After positioning the windows, double click on each window to see the window group which comes as a pop-up as this:

Page 16: HR Forms

 

The above screen shot is for the Window 1 i.e., Earnings window. If you double Click on Group – 01, we can see the different fields, which have to be populated in this window. For the Earnings window the following fields are added. The user can add additional fields or can remove unnecessary fields from this. The screen shot of these fields would look like the one below: 

Page 17: HR Forms

Follow the same procedure for rest of the windows too.  

The report ‘HINCEDT0’ can be executed to see the output of this R/3 form. The output of this would look like this.

Page 18: HR Forms

 

This R/3 form is being used by smart form ‘HR_ESS_PAYSLIP_TO_PDF’ to convert the output in PDF format. The standard smart form ‘HR_ESS_PAYSLIP_TO_PDF’ is copied to ‘ZHR_ESS_PAYSLIP_TO_PDF’ and the main window is adjusted so that the data in the form gets fixed into it properly. To see the output of PDF form ‘ZHR_ESS_PAYSLIP_TO_PDF’, use transaction ‘PZ11_PDF’. You can only execute this transaction from SE93 since it’s an Easy web transaction. Finally, the output in the PDF format would be as follows: 

Page 19: HR Forms

Note: 

The prerequisites to achieve this scenario:

The form ZN02 created above should be attached to the report ‘HINCEDT0’. HR master data should be maintained in the system. If we want to report on the payroll Results then we should make sure that the Payroll should be

completed successfully. One should know which data is required to create the form, and also must know which SAP System tables are used to store the data. If the data is stored in customer tables or info types, it means data is maintained in the metadata.

Payslip through PE51 - adding custom fields from info types

Page 20: HR Forms

By Ribhu Ahuja, TCS

Suppose your requirement for payslip through PE51 involves certain fields which are not there in CRT, RT or ZRT or other payroll tables, and you want to show the same in your payslip, you can do so by customer enhancement in the standard program – HINCEDT0 and making necessary alterations in your PE51 form. (SAP ECC 6.0).  

Let us proceed with our payslip design in PE51 (This tutorial does not cover the design part of payslip in PE51. For that, please visit this Link.) Suppose we want to show a running number on the payslips of various employees during mass printing of the payslips (1 for first processed employee, 2 for second processed employee) and License Plate Numbers of employee in our payslip, which is stored in Infotype 0032 - Internal Data, field KFZKZ. 

 

The main program which comes into picture for payslip generation through tcodes PC00_M40_CALC and PC00_M40_CEDT is HINCEDT0. We would have to make a Z enhancement for the same. Go to Transaction SE38 and open report HINCEDT0 in display mode.  

Page 21: HR Forms

 

Double click on include rpcedsz9 (form routines for customer modifications). It will take you to the include

program. Click on the , button on the top and it will show all the enhancements.  

Next, click on edit -> Enhancement Operations  -> Show Implicit Enhancement Operations.  

Page 22: HR Forms

Choose or double click on HINCEDT0 as shown.  

It shows various enhancement points with arrows:  

Page 23: HR Forms

 

We can write our code in these enhancement points by creating an enhancement and an implementation of the same. These various forms are called either one time (e.g. Form INIT-MOD), or once for every personnel number called during payslip program (e.g. Form INIT_SOS-MOD) or once for every processed personnel number (e.g. Form FILL-ZK-MOD). You can find out the same by putting a break point on these forms and running pc00_m40_cedt and pc00_m40_calc. As per our requirement, we want to increase counter of serial number for every PERNR processed and fetch pa0032- KFZKZ, so we would use the Form FILL-ZK-MOD. Right click on FILL-ZK-MOD and click Enhancement Implementation  -> create.  

Page 24: HR Forms

Choose Code for the type of Enhancement.  

It asks for the Enhancement implementation and Composite Enhancement Implementation. Give let's say zenhancement for Enhancement Implementation and click on create button.  

Give zmainenhancement� as Composite Enhancement Implementation and click on the green tick mark.

In the form FILL-ZK-MOD, write the following code in ENHANCEMENT and END-ENHANCEMENT:  

data tt type i.

Page 25: HR Forms

data tt1 type i.

data: begin of itab occurs 0,

number1 type char4,

end of itab.  

data itl like line of itab.

IMPORT ITAB FROM MEMORY ID 'rab1'.

READ TABLE ITAB INTO ITL INDEX 1.

ITL-number1 = ITL-number1 + 1. INSERT ITL INTO ITAB INDEX 1.

LOOP AT ITAB INTO ITL.

IF SY-TABIX NE 1.

DELETE ITAB INDEX SY-TABIX.

ENDIF.

ENDLOOP.

FREE MEMORY ID 'rab1'.

EXPORT ITAB TO MEMORY ID 'rab1'.

read table itab index 1 into itl.

P0185-GRPVL = itl-number1. " We will store sequence number here in str. P0185  

select single * from pa0057 into corresponding fields of p0057 where begda le PN-BEGDA and endda ge pn-endda and pernr = pernr-pernr.  

select single * from pa0581 into CORRESPONDING FIELDS OF p0581 where begda le PN-BEGDA and endda ge pn-endda and pernr = pernr-pernr.  

select single * from pa0032 into CORRESPONDING FIELDS OF p0032 where begda le PN-BEGDA and endda ge pn-endda and pernr = pernr-pernr.  

Now save and activate the code and go to transaction pe51_checktab. Here, in this T code, we will put the additional structures p0185, p0057, p0581 and p0032 and their respective fields, so they become available in pe51 - payslip form designing.  

Page 26: HR Forms

 

In country grouping, give 40 (India) and in form class, give CEDT (payslip) and click on change button as shown.  

It gives a pop up message. Click on the green tick mark.  

Now we see the following screen:  

Page 27: HR Forms

Click on the create button. Let us add say P0032 structure and a field KFZKZ here and you can similarly add your required structures and fields. Put ‘p0032’ in table column; check all the three check boxes and give description in description column, as shown.

Next, click on the fields tab and enter the values after clicking on insert button.  

Page 28: HR Forms

Now, lets change the payslip in transaction PE51 or rather add the newly available fields in transaction PE51. Give form name in PE51 and click Change:  

Page 29: HR Forms

 

On the next screen, click on the "Next Screen" button, to go to the single fields screen, as shown below.  

On the next screen, click on the add button to add the newly available field:  

Page 30: HR Forms

Next, make the entry of table p0032, field KFZKZ as shown.  

As we click on the green tick mark, the field adds up in our payslip on desired location.  

Page 31: HR Forms

 

Similarly add all the fields you want to show in the payslip output. Now, Lets take a look at info type 32 of say an employee – 2007:  

 

The License Plate Number is 111111. Now let’s run the payroll by using t code PC00_M40_CEDT. Give the values as shown and click on the execute button.  

Page 32: HR Forms

As we run the payslip program, we see the following output, which is according to our requirement.  

Important – If you want to check the payslip of any employee or bring it on to your Smart form, you can use FM ‘GET_PAYSLIP’. Go to SE37 and give fm name as ‘get_payslip’. Click on display.

Page 33: HR Forms

Click on execute and give the following values as shown:  

 

Page 34: HR Forms

Following is the output:

 

Double click on . Hence we see the output of the generated payslip:  

Page 35: HR Forms