PA40 step by step: Personnel Actions
In this exercise, we use Winshuttle Transaction in Studio v11 to create a PA40 t-code template in Excel. The Excel template provides an easy way for users to upload new hire information into SAP. We will add one new hire so that we can see how to create an Excel template in Transaction.
- Start Winshuttle Studio from the desktop shortcut or from the Windows Start menu.
- Click New.
- Click Transaction, and then click Create from Recording.
- Choose the SAP system that you want to use, enter the appropriate user data, and then click Log On to SAP.
If you do not see the SAP system that you want, click Advanced SAP Logon, click Add System, provide the system information, and click OK.
- In the Transaction code box, type PA40.
- Leave the recording mode as Standard. If you do not see Standard, click Change, click Non-Batch Input Mode Without SAP Controls, and then click OK.
Note: For most transactions, the default mode is Standard, and the Winshuttle Function Module (WFM) selects the optimum mode for the t-code that is being recorded. If the WFM is not installed, Non-Batch Input Mode Without Controls will work for most transactions. Non-Batch modes are necessary for downloading information from SAP transactions, or for Finance or HR transactions in which there are Dynamic Actions executing or user parameter values being used; otherwise, if you do not have access to Non-Batch modes, you can try recording in Batch Mode. The difference between Without SAP Controls and With SAP Controls is just a matter of what tools are on the transaction screens. For more information, see the Recording modes topic (Connect mode or Foundation mode).
- Click Start Recording.
The PA40 transaction starts. For each HR Action performed, the SAP system configuration requires certain info types to be created.
These are called Dynamic Actions.
Note: The following screens may vary according to the way that your SAP system has been configured.
- In SAP, on the Personnel Actions screen, enter the start date. For the Action Type, select Hire. Click the Execute button.
- On the Hire screen, enter the required data, and then click Save.
The Personnel Data info type is created.
- On the Personal Data screen, fill in the required data, and then click Save. The Personal Data info type has been created.
Based on your SAP system configuration for a Hire Action, you will then be directed to the next info type that must be completed for the Hire Action.
- Continue to create info types. Click Save to move to the next info type in the Hire Action. When you complete the Hire Action, SAP returns to the Personnel Actions screen.
- Click Back. This will end the recording.
After Studio finishes compiling the script, it will take you to the Map tab.
It is now time to create the mapping for this transaction. Mapping a script is just a matter of connecting SAP fields to fields in your data file. Transaction provides a Mapper to facilitate this process.
Auto Mapping will map the entire script to an Excel spreadsheet in the order that they appear in the Mapper. Because of the complexity of this transaction, we will map the fields manually instead.
The screenshot below shows the Basic View tab of the Mapper.
Each row of the Mapper displays the following:
- Mapper row number: This is just a reference number.
- Enable flag: only enabled Mapper rows will be executed by Transaction.
- Field Description: The label associated with the SAP technical field name.
- Field Name: The SAP technical field name.
- Field Type & Length: For example, String or Decimal, and the padding options.
- Mapping direction: Fixed Value, Excel to SAP, SAP to Excel (or, if mapping to Access: Access to SAP, SAP to Access).
- Value: Values assigned to the SAP field; either fixed values or mapped locations in the associated data source.
Note: The Properties pane is also displayed, but it is not shown below.
In the Data Set panel, you will see a preview screen of the selected data source.
To change the data source type, click the drop-down menu under the Data Set tab and choose the data source type that you want.
The preview will change to reflect the choice. In this case, we will use Excel.
- To map the script to the data source, you will drag in the direction that the data will move. For this script, you are uploading data from Excel to SAP, so you will drag from Excel to the Mapper.
Drag column A up and drop it onto row 3.
Continue across the Excel preview by dragging column B up and dropping it onto row 3, column C onto row 4, and so on, until all the fields that you want have been mapped.
- Continue this mapping process for any other info types created during the Hire Action.
Clearing the Personnel Number field
By default in SAP, the personnel number field on the initial screen contains the personnel number of the previously hired employee. For Transaction to process subsequent Hire Actions, you must clear this field.
- Click the Expert View tab.
In the Transaction Mapper, the Personnel Number field (RP50G-PERNR) is not displayed because we did not edit this field in the initial recording. Click the View tab and then click Disabled Fields.
- To enable the Personnel Number (RP50G-PERNR) field, click its check box in the Enable column.
- Leave the Mapping Type set to Fixed Value Upload, which is indicated by the red push pin, and leave the Value field blank.
- Go to the last screen in the Mapper where you can find an instance of RP50G-PERNR, and enable that field as well.
- To download personnel numbers from SAP, drag that instance of the Personnel Number field down and drop it in the column in the Excel preview pane where you want the Personnel Number to be displayed.
Add the data and run the script
- Click the Run tab.
Note: Transaction will automatically assign the Log column to the next available column after the last mapped column (in this case, column N).
- Type the data in the columns.
- To execute the upload, click the Test button, if you are a Foundation, or click the Run button if you are not a Foundation user.
Studio prompts you to save the script and data files.
The best practice is to name the Excel spreadsheet the same name as the script unless an Excel spreadsheet will be used for multiple scripts.
After you save the script and data files, the script runs.
The yellow message bar displays a message when the run has finished.
The Hire Action is executed based on the data in the spreadsheet.
The note in the Log column indicates that the Hire Action was successful, and column M, in this example contains the downloaded personnel number for each new hire.