Following Steps are involved in creating an HR query:
1. Set Query Area
2. Creating a user group
3. Creating info set
4. Creating Query and Executing
Set Query Area
There are two query areas, Standard area which is client dependant and Global area which is client independent.
For our exercise and development we would be using “Global area” because of following reasons:
- It requires transport request to create any object in Global area, means no separate process for transport request required.
- If any change is required in any component in future, it can only be done in development client and then moved along the landscape.
- It ensures that all queries under the info set created in global area will also have to be created in global area.
To set query area go to transaction SQ01, Environment and Query Areas: Select Global area and click choose
Now go to tcode SQ03 to create a user group as follows with a meaningful name like ZHRPA for users in HR and using Personnel Administration Module and click on create tab….as shown below
Now that the user group is created, assign user id to this user group. In other words, it is nothing but assigning users to this user group by clicking on Assign users and infosets…
Creating Info set
Next step is to create infoset, an infoset defines the data that needs to be used for building reports such as name of employee, position, salary, education etc.
For HR, Logical databases are used, which makes it fairly simple to have a query with a lot of data without much effort. Infoset is created based on Logical database and all the data related to that logical database can be used in queries.
Go to transaction SQ02 for creating infoset, even now you are still in the global area, which will not change unless you change it from step 1, however do ensure that it shows query area as Global.
Give a meaningful name in infoset area in our exercise we will be using ZHRPA_INFOSET, click on create in SQ02 as follows:
Now give a meaningful name to the infoset, and assign logical database as PNPCE, it’s the logical data base for personnel administration and uses all info types mentioned in personnel administration. Now click OK
It will take you to the infotype selection area, select the ones required, in our case we will select Organizational Assignment and Personal Data. Click Ok Icon
The screen will have two areas, one that shows complete set of fields and one on the right that shows fields that can be used in queries. Fields can be moved from Left to right side if not already available
Save the infoset at this stage and provide with the same transport request used previously. Generate the infoset
Go back to first screen of transaction SQ02 and this time enter the info set already created and click on Role/User Group Assignment. Select the user group that was create previously ZHRPA from the list click it and click save
Now go to ADHOC Query by Menu Path as follows: SAP Easy Access Menu—HR—Info systems—Reporting tools—Adhoc query
and give the info set and select the user group as follows:
Now Select the company code field to list the employees under SAM8 as follows
To the right hand side of the screen, give SAM8 (or any company code) as follows
Now select the first name and last name as follows as the output fields:
And click on Output as below:
To see the report as follows :