Quantcast
Channel: SCN : Document List - SAP ERP Human Capital Management (SAP ERP HCM)
Viewing all 672 articles
Browse latest View live

Late Coming, Early Going and Unauthorized absence

$
0
0

Client Requirements

 

The client would like to report on employees who come late or leave early and also report on unauthorized absence. This is required for working days as well as for attendance on public holidays and OFF days.


There are only 2 shifts – day shift and night shift - in the plant and an employee can work during one of the shifts. All working days of each shift have the same planned start time and planned end time.


When an employee is working on a public holiday and the daily work schedule is not OFF, then the start time and end time of the daily work schedule will be used to determine if the employee has come late or left early. If an employee works on OFF day or on public holiday, it will be counted as overtime.


When the employee is working on a day with daily work schedule as OFF, the planned start time and planned end time can differ. Hence, on some OFF days, the planned start time and planned end time can be 08:15 and 17:45 respectively and on some days, they can be 09:00 and 13:30 respectively.


Below are the conditions for late coming, early going and unauthorized absence.


  • 0 min < {Clock In Time – Planned Start Time} < 60 min    =>     Late Coming
  • 60 min =< {Clock In Time – Planned Start Time}             =>     May be an unauthorized absence. The time administrator/ supervisor will determine whether there is a need for unauthorized absence or not.
  • 0 min < {Planned End Time – Clock Out Time} < 60 min    =>     Early Going
  • 60 min =< {Planned End Time – Clock Out Time}             =>     May be an unauthorized absence. The time administrator/ supervisor will determine whether there is a need for unauthorized absence or not.

 

If clock in and clock out times are both missing on a working day, then the time administrator/supervisor must get informed about the employee not being at work. The time administrator/ supervisor will determine the cause of absence and then accordingly apply for unauthorized absence if needed.


 

Solution Design

 

The solution on late coming, early going and unauthorized absence can be achieved based on custom time types and PCRs.


I will create five time types as below:


  • ZVB7– This time type will get generated if the employee is late by more than 0 min but less than 60 min when compared to shift start time. The time type will contain the decimalized min.

 

1.jpg


  • ZVB8– This time type will get generated if the employee leaves early by more than 0 min but less than 60 min when compared to shift end time. The time type will contain the decimalized min.

 

2.jpg                                                                                                                       

  • ZVB9– This time type will get generated if the employee comes to office more than 60 min late than the shift start time. This may bring following possibilities:


    • Employee is actually late by more than 60 min
    • Employee is on leave during the first half of the shift (IT2001 record)
    • Employee is in workshop at some other location during the first half (IT2002 record)

 

Hence, it is advisable that the system generates a time type with the decimalized time and a system message to the time administrator where he can take a judicious decision of handling this. If the employee is actually late by more than or equal to 60 min, then the time administrator will apply unauthorized leave for the duration in the system.

 

3.jpg

 

  • ZVB0 – This time type will get generated if the employee leaves office early by more than 60 min than the shift end time. This may bring following possibilities:


    • Employee actually left early by more than 60 min
    • Employee is on leave during the second half of the shift (IT2001 record)
    • Employee is in workshop at some other location during the second half (IT2002 record)

 

Hence, it is advisable that the system generates a time type with the decimalized time and a system message to the time administrator where he can take a judicious decision of handling this. If the employee actually left early by more than or equal to 60 min, then the time administrator will apply unauthorized leave for the duration in the system.

 

4.jpg

 

  • ZVBA– This monthly time type will get generated from unauthorized absence type 0150 through a custom PCR.

 

5.jpg

 

The next step is to find a way to apply planned start time and planned end time for days with daily work schedule as OFF. But before we decide this, let us go through the WSRs for the two shifts that the client has.


WSR 3/US/10 D0001-01– This WSR uses PWS D001 and it is a 5D2X (5 working days 2 OFF days) PWS with DWS as D001 and OFF.

 

V_T508A

 

6.jpg

 

V_T551A

 

7.jpg

 

T550A

 

8.jpg

 

WSR 3/US/10 N0001-01– This WSR uses PWS N001 and it is a 5N2X (5 working days 2 OFF days) PWS with DWS as N001 and OFF.

 

V_T508A

 

9.jpg

 

V_T551A

 

10.jpg

 

T550A

 

11.jpg

 

Now, we are going to create constants in Table V_T511K to specify planned start time and planned end time for OFF days for each WSR.

 

V_T511K

 

12.jpg

 

Since these constants are date dependent, we can change the planned start time and planned end time on any particular OFF day by using delimitation functionality.


The first two constants will be considered for WSR D0001-01 when the employee works on OFF day. The next two constants will be considered for WSR N0001-01 when the employee works on OFF Day.


In this way, we need to define two constants for every WSR to be used in the plant to denote start time and end time of shift on OFF days.

 

Now we are going to define system messages which will get generated if the employee’s “clock in” is late by more than and equal to an hour compared to planned start time or if the employee’s “clock out” is early by more than and equal to an hour compared to planned end time. These messages can be accessed by time administrator through TCode PT_ERL00 or through PTMW.

 

 

V_T555E

13.jpg

 

The next step is to create a PCR which will generate time types and system messages. This is a very big PCR and hence, I will explain the logic in parts.

 

 

PCR ZVB1 Screenshot A

 

14.jpg


In PCR ZVB1 Screenshot A, we first determine whether the planned working hours is 0 or not using VARSTFREE. If it is not, it goes for processing at N and then if we check the day type of the day using VARSTDAYTY.


If the day type is *, the time pair is moved to output table using COLOP *. In the current scenario, only day types 0 and 1 are being used by client.


If the day type is 0, then we check if start and end times exist in the time pair or not using OUTTPEXTIM. If any of the start or end time is missing, the time pair gets processed through N and moves to output table using COLOP *. This time pair will later cause time evaluation to fail in PCR TE30 since either the clock in or clock out is missing.


If the start time and end time exist in the time pair, then it gets processed under Y and further processing happens under employee subgroup grouping specification A and B for PCR ZVB1 using PCY ZVB1A and PCY ZVB1B.


If the day type is 1, the processing is same as day type 0.

 

 

PCR ZVB1 Screenshot B


15.jpg

 

If the planned working hours is 0 (meaning DWS is OFF), the processing happens under Y (PCR ZVB1 Screenshot B). We check whether time pair has start and end times or not using OUTTPEXTIM.


If the start and end times don’t exist, then the time pair is processed under N and it is moved to output table using COLOP *.


If the start and end times do exist, the processing happens under Y and further processing happens under employee subgroup grouping specification C for PCR ZVB1 using PCY ZVB1C.


Under employee subgroup grouping A for PCR ZVB1, the “clock in” time of the time pair is read using HRS=PBEG. Then the planned start time of the shift is subtracted from “clock in” time using HRS-SWTB. The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.

 

If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB7 using ADDDBZVB7 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB9 using ADDDBZVB9, a message Z1 – “Employee came late > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

 

 

PCR ZVB1 Screenshot C

 

16.jpg

 

Under employee subgroup grouping B for PCR ZVB1, the planned end time of the shift is read using HRS=SWTE. Then the “clock out” time of the shift is subtracted from planned end time of the shift using HRS-PEND. The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB8 using ADDDBZVB8 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB0 using ADDDBZVB0, a message Z2 – “Employee left early > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.


The time pair comes for processing under employee subgroup grouping C of PCR ZVB1 when the time pair has start and end times on an OFF day. The work schedule rule of the employee is read using OUTWPSHIFT.


If the WSR of the employee is D0001-01, the time pair gets processed under D0001-01. Further processing happens under employee subgroup grouping D & E using PCY ZVB1D and ZVB1E.


If the WSR of the employee is N0001-01, the time pair gets processed under N0001-01. Further processing happens under employee subgroup grouping F & G using PCY ZVB1F and ZVB1G.


If the WSR is other than D0001-01 and N0001-01, the processing happens under ******** and the time pair is moved to output table using COLOP *. This means that the late coming and early going time types won’t get generated in this case.

 

 

PCR ZVB1 Screenshot D

 

17.jpg

 

 

The time pair comes for processing under employee subgroup grouping D for WSR D0001-01 when start and end times exist in time pair for OFF day.


The “clock in” time of the time pair is read using HRS=PBEG. Then the planned start time of OFF day is subtracted from “clock in” time using HRS-CZD01B (The constant ZD01B is read from Table V_T511K). The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB7 using ADDDBZVB7 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB9 using ADDDBZVB9, a message Z1 – “Employee came late > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

 

 

PCR ZVB1 Screenshot E

 

18.jpg

 

The time pair comes for processing under employee subgroup grouping E for WSR D0001-01 when start and end times exist in time pair for OFF day.


The planned end time on OFF day is read using HRS=CZD01E (Constant ZD01E is read from Table V_T511K. Then the “clock out” time of the shift is subtracted from planned end time of the shift using HRS-PEND. The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB8 using ADDDBZVB8 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB0 using ADDDBZVB0, a message Z2 – “Employee left early > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

 

 

PCR ZVB1 Screenshot F

 

19.jpg

 

The time pair comes for processing under employee subgroup grouping F for WSR N0001-01 when start and end times exist in time pair for OFF day.


The “clock in” time of the time pair is read using HRS=PBEG. Then the planned start time of OFF day is subtracted from “clock in” time using HRS-CZN01B (The constant ZN01B is read from Table V_T511K). The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB7 using ADDDBZVB7 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB9 using ADDDBZVB9, a message Z1 – “Employee came late > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

 

 

PCR ZVB1 Screenshot G

 

20.jpg

 

The time pair comes for processing under employee subgroup grouping G for WSR N0001-01 when start and end times exist in time pair for OFF day.


The planned end time on OFF day is read using HRS=CZN01E (Constant ZN01E is read from Table V_T511K. Then the “clock out” time of the shift is subtracted from planned end time of the shift using HRS-PEND. The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB8 using ADDDBZVB8 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB0 using ADDDBZVB0, a message Z2 – “Employee left early > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

 

If a new WSR is being defined in the plant, then we must incorporate this WSR in the PCR ZVB1 at the point highlighted below. We should also define the constants for the WSR shift start and end times for OFF day. Also, the processing under D and E in PCR ZVB1 for existing WSR D0001-01 should be copied to the new ones and the constants of WSR D0001-01 are replaced by constants of new WSR.


 

PCR ZVB1 Screenshot H

 

21.jpg

 

An unauthorized absence 0150 is also created.


Table T554S

 

22.jpg

 

The time evaluation class of this absence type is maintained as 10. This has been done because all absences captured currently get a time type 0220 assigned to absence time pair through table V_T555Z using function TIMTP.


We would like to have a custom time type ZVBA – unauthorized absence assigned to absence type – unauthorized absence. This is done using PCR ZVB2.


V_554S_E

 

23.jpg

 

PCR ZVB2

 

24.jpg

 

This PCR helps to assign a unique time type ZVBA for unauthorized absence captured in IT2001. The PCR reads the pair type of the time pair using OUTTPPTYPE. If the pair type is anything other than 2, the time pair gets processed under * and it moves to output table using COLOP *.


If the pair type is 2, the time pair gets processed under 2 and the class for time evaluation for the absence captured on the particular day is read using VARABCAT. If the class is anything other than 10 (means absence captured is not unauthorized absence), the time pair moves to output table using COLOP *.


If the pair type is 10, the time pair gets processed under 10 and the no. of hours of unauthorized absence is added to time type ZVBA using ADDDBZVBA and the time pair is moved to output table using COLOP *.


The next step is to include both the PCRs in custom time schema ZTCN. The time schema ZTCN is a copy of time schema TM00 – Time Evaluation with Personnel Time Events.

 

 

Schema ZTCN

 

25.jpg

 

PCR ZVB1 is being processed by function RTIP because TIP table is being read in this PCR. Par 2 is GEN because it is called for all time types.


PCR ZVB2 is being processed by function RTIPA because TIP table is being read in this PCR only in case of absence on this day. Par 2 is GEN because it is called for all time types.


Let us now move towards testing this solution design.


I could think of 18 different scenarios and I tested them and all of them successfully passed.


IT0007

 

26.jpg

 

Work Schedule

 

27.jpg

 

Please note the below:


  • 01-Jan-12 has DWS as OFF and is also a public holiday
  • 02-Jan-12 has DWS as D001 and is also a public holiday
  • 03-Jan-12 has DWS as D001 and is not a public holiday

 

 

Scenario 1: No time type generation if the employee neither comes late nor leaves early on a working day

Scenario 2: No time type generation if the employee neither comes late nor leaves early on a public holiday

Scenario 3: No time type generation if the employee neither comes late nor leaves early on a off day

 

IT2011

 

28.jpg

 

Time Evaluation Result– It is successful and doesn’t generate any time types.

 

29.jpg

30.jpg                                                                                                                  

01-Jan-12– Late coming, early going time types don’t get generated

 

31.jpg

 

02-Jan-12– Late coming, early going time types don’t get generated

 

32.jpg

 

03-Jan-12– Late coming, early going time types don’t get generated

 

33.jpg

 

Scenario 1:Pass


Scenario 2:Pass


Scenario 3:Pass

 

-------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Scenario 4: Employee came late by more than 0 min but less than 60 min on a working day


Scenario 5: Employee went early by more than 0 min but less than 60 min on a working day


Scenario 6: Employee came late by more than 0 min but less than 60 min on a public holiday


Scenario 7: Employee went early by more than 0 min but less than 60 min on a public holiday


Scenario 8: Employee came late by more than 0 min but less than 60 min on an off day


Scenario 9: Employee went early by more than 0 min but less than 60 min on an off day

 

 

IT2011

 

34.jpg

 

Time Evaluation Result– It is successful and generates early going and late coming time types.

 

35.jpg

36.jpg

 

01-Jan-12

 

37.jpg

 

02-Jan-12

 

38.jpg

 

03-Jan-13

 

39.jpg

 

RPTBAL00 Report – This report will display the late coming, early going and unauthorized absence for an employee.

 

40.jpg

 

RPTBAL00 Report Output

 

41.jpg

 

Scenario 4: Pass


Scenario 5: Pass


Scenario 6: Pass


Scenario 7: Pass


Scenario 8: Pass


Scenario 9: Pass

 

-------------------------------------------------------------------------------------------------------------------------------------------------

 

Scenario 10: Employee came late by more than 60 min on a working day


Scenario 11: Employee went early by more than 60 min on a working day


Scenario 12: Employee came late by more than 60 min on a public holiday


Scenario 13: Employee went early by more than 60 min on a public holiday


Scenario 14: Employee came late by more than 60 min on an off day


Scenario 15: Employee went early by more than 60 min on an off day

 

 

IT2011

 

42.jpg

 

Time Evaluation– It is successful and generates late coming and early going time types and messages of being late or leaving early by more than an hour. These messages can also be read in PTMW or TCode PT_ERL00.

 

43.jpg

44.jpg

45.jpg

46.jpg

47.jpg

 

01-Jan-12

 

48.jpg

 

 

02-Jan-12

 

49.jpg

 

03-Jan-12

 

50.jpg

 

 

RPTBAL00 Report

 

51.jpg

 

RPTBAL00 Report Output

 

52.jpg

 

There are no existing absences or attendances for the first half or second half for the period 01-Jan-12 to 03-Jan-12. This means that the employee actually came late (> 1hr) and went early (>1 hr) on these days. We can’t capture any unauthorized absence on 01-Jan-12 and 02-Jan-12 as they are non-working days due to being OFF day and public holiday.


The unauthorized absence will be captured only for 03-Jan-12.


IT2001

 

53.jpg

 

Once the time evaluation rerun happens because of capture of unauthorized absence, the time type ZVBA gets generated.

 

54.jpg

 

Report RPTBAL00 Output

 

55.jpg

 

A variant of the report RPTBAL00 can be developed to display data related to the below time types only:


  • ZVB7   -       Late Coming
  • ZVB8   -       Early Going
  • ZVBA  -        Unauthorized Absence

 

Scenario 10: Pass


Scenario 11: Pass


Scenario 12: Pass


Scenario 13: Pass


Scenario 14: Pass


Scenario 15: Pass

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Scenario 16: Employee didn’t turn up on a working day


Scenario 17: Employee didn’t turn up on a public holiday


Scenario 18: Employee didn’t turn up on an off day

 

IT2011

 

56.jpg

 

Time Evaluation– No message gets generated for 01-Jan-12 (OFF and public holiday) and 02-Jan-12 (public holiday) because they are non-working days and no attendance or time events have been captured for these days.


The time evaluation fails for 03-Jan-12 since there is no leave or attendance captured and time events are missing too. The message will go to time administrator in PTMW or can also be accessed using TCode PT_ERL00.

 

57.jpg

58.jpg

 

Unauthorized absence is captured in IT2001 since the employee was not at work and also didn’t have any pre-approved absence or attendance captured for 03-Jan-12.


IT2001

 

59.jpg

 

Time Evaluation– It runs successfully after absence is captured.

 

60.jpg

 

 

P2001

 

61.jpg

 

 

Table TES

 

62.jpg

 

RPTBAL00 Report

 

63.jpg

 

RPTBAL00 Report Output

 

64.jpg

 

Scenario 16: Pass


Scenario 17: Pass


Scenario 18: Pass

 

-------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Here I come to the end of this knowledge artifact. I hope you enjoyed reading through this document.

 

If you liked this document and found it to be beneficial, request you to please kindly rate it for the benefit of other users.

 

Warm regards,

Vivek Barnwal,

vianshu@gmail.com


SAP HCM Russia Roll-out Case

$
0
0

1. Introduction – describing the process if SAP HCM in Russia Implementation.


I will describe in this case study the prerequsites and steps in order to implement SAP HCM functionality (OM, PA, TM, PY -modules)  on SAP HCM ECC 6.00 applicable for Russian client requirements.

If you are planning to implement or roll-out your HR Global Solution in  Russia, I recommend to read this article before  project estimation and implementation.
Russian SAP HCM  Solution is very  complex and requires a deep knowledge of Russian conditions and law peculiarities.  In order to understand immediately the depth of  solution complexity is enough to open  section for the Russian Payroll customizing 
IMG-> Payroll-> Payroll: Russia:

image001.jpg

Image1

I can mark that only one scheme of Russian Payroll driver - RUS0  is about 4810 lines of code. The typical Wage type catalog consists of round  1100 Wage types.
Before implementation  you also should  know that in Russia it is very strict regulation for document flow: orders , reporting to official authorities should be  in paper  and some of reporting should be uploaded in .xml format.

In Russian Solution you also should maintain a lot of Official Dictionaries, like OKPDTR, OKSO, Military Catalog,  KLADR  etc.

2. Prerequisites for RU- Implementation


There are the following mandatory requirements for the system that needs to be done, before the implementation in order to save your time and budget:

2.1. Installed Russian Language

Before the implementation it is obsolete to install   the Russian language in the system, because orders and reports should be generated only in Russian language and Information for it should be put on Russian.
Name of Object such as Positions, Job and Organizational units should be kept in Russian in IT 1000  Object and  IT 1002 Description and information also is input  for personal data in the IT 0002, 0016, 0022, 0290, 0294,0296, 0298

2.2. Check Licenses for  Adobe Document Services Credentials , which  are required  for Adobe interactive forms .

Most standard RU-forms and RU-orders for Russia were realized in .PDF format  on base of Adobe Interactive forms, which require licenses for the Adobe Document Services Credentials. If the license is absent, you will not be able to run the forms and orders. These links help you:

https://service.sap.com/sap/support/notes/944221
 
https://www.sdn.sap.com/irj/sdn/weblogs ... xdepth%3D0

Installing AdobeDocument Services Credentials:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/39ce42e6-0401-0010-df96-e28d39742611
http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70aa75cc-6ac3-2910-c78c-ade192ec861e

2.3. Patch Levels


Before the implementation  you need also  to install  the latest Service Packs(SP), as in the past two years were greatly changes  the in Russian Law , e.g. Sick Leave payments  and Taxation. If you do not want to affect other countries by installing a new version of SP in your  global system, then install the latest SP  specially for Russia - Sub component SAP_HRCRU of SAP_HR - SAP_HRCRU. If you already have EHP4, I advise you to upgrade to EHP 5, thus you get a variety of reports on business trips, as well as improve the handling of Absence Quotas, and get improvements for Concurrent employment. In this case also you should check the activation of business function  HCM_LOC_CI_01, 02 and HCM_LOC_CI_19.

 

3. Organizational Management(OM)  Issues


3.1. Organizational Management Customizing

 

Generally the  Organizational management customizing  is typical as  for other countries. Features for Russian Solution are storing long names in the IT 1002 Description in order to output it in the orders and reports and maintaining Objects of working conditions. If you will implement EHP5 , so you can maintain a new Object OR Legal entity  for which is maintained IT 1655 legal  details which contained legal details for organization.

3.2. Organizational Management Customizing


If we speaking about Long names of positions and organizational units( the full name can be more than 150 Symbols), usually  the data for long names of objects is maintained for such Objects of  Organizational management like as the Position( S), Job ( C) and Organizational units (O) in the IT 1002 Description Subtype 0001 General Description  or make a copy of this subtype ( than put in table T7RURPTCST00 parameter  OBJLONGNAMES SUBTY XXXX , where XXXX is the number of  customer subtype )

The next requirement for Russia  is the maintenance of  OKPDTR Dictionary  (Russian National Classification of Occupations of Employees, Positions of Civil Servants and Wage Category), which consists of two sections - the profession of workers and office employees. This Dictionary  is loaded onto an Object  - Job (C).   in the IT 1000 Object  which  has 12-digit code and in IT 1002 Description -  full name of the profession. Loading is carried out via LSMW.

Special Russian objects - Objects working conditions are maintained In the Organizational Management :

    • Regional condition - CR
    • Hazardous condition - CH
    • Special - long service condition - CL
    • Special - calculated seniority condition –CT

These objects allow to  carry out  the calculation of seniority for these working conditions and than proceed it in the  Payroll and finally get  reporting for  the Pension fund of the Russian Federation. For these objects are maintained  IT 1000 Object on which the code of the working conditions is stored and long name is stored  in the IT 1002 Description. Further it will be created relationships in IT1001 Relationships with object Position or Job.

3.3. Reporting (OM):

3.3.1. Staff List (Form T-3)

 

Form T-3 is official unified form, which is necessary for the formation of  staffing list of the company.  Organizational units, Positions , Amount of salaries and allowances are introduced in this form.

At the enterprises are also developing  Staffing list , which is contained Names of employees, who  occupying staff positions or another position and which position are vacant  .

The customizing is made to the following path IMG-> Payroll-> Payroll: Russia-> Reporting-> Organizational Management-> Staff List (Form T-3).

 


3.4. Data Migration of Organizational Management(OM)

Data Migration for OM is provided by means of LSMW, it is  requires an additional upload  the Russian names of objects in IT 1000 and IT1002  .

3.4.1. Upload the OKPDTR Dictionary
Prepared dictionary  is loaded via LSMW object 777 through transaction PP02 for an object Job (C)

 

3.4.2. Loading working conditions.
The program HRUULSP1 is used to download the working conditions ( IMG-> Payroll-> Payroll: Russia-> Reporting-> Pension Insurance-> Pension Calculation for Special Working Conditions-> Upload Catalogs for Working -there is a help notes for this program).

 

4. Personnel Administration (PA) Issues

In the Russian part of Personnel Administration  is required to provide  a serious customizing  of info-types and action, as well as the   seniority calculation for employee and Personal  Orders and Forms.

In the end of Personnel Action , it is  creates a SAP HCM RU info type 0298 Personnel Orders (CIS), through which we get Personal orders for the employee (e.g. Order T-1 Hiring , Order T-8 , Termination order as well as employment contracts and supplementary agreements to them).

Info-types is adapted to correctly output the screen parts relating to the Russian data. Screen- 2033 is used for RU-infotypes.

The Russian employer   must keep records of employee seniority, the most common types of experience are  General seniority, Seniority for insurance, Job  seniority and Company  seniority (there are  also seniority for regional and hazardous working  conditions).
The common forms in RU-Personnel Administration  are Personal Orders ( t-1, T5, T-6, T8, T-11) and Forms T-2 - Employee Personal card  and T-7 – Vacation balance  are

4.1. Personnel Administration (PA) Issues Customizing

4.1.1. Customizing of Infotypes:

4.1.1.1. Names on Russian in IT0002 Personal Data

IT 0002 Personal data should be customized  to output fields  for the employee name in Russian. It  should be customized fields P0002-LNAMR, P0002-FNAMR, P0002-NAME2  and check its priority in table V_T522N fo outputting in the  reporting .
Also in this infotype is defined Citizenship of employee, which then affects on Payroll calculation.

image001.jpg

Image 2 . IT0002 Personal Data

4.1.1.2. IT0006 Address 

 

For this info type 0006  is required to download  the  K LADR - Russian Classification of Addressees Data.  Classification is the official address of the Russian Federation. This dictionary is used to input information to the addresses , which  is will be required for the preparation of personalized reports and 2NDFL form .  If you enter the address data, it  is searched for matches  in this dictionary.  To upload in the system  the  KLADR it is   used  the program HRUUKLADRLOAD.  To download the latest version, please visit site of GNIVTS FTS  RU (http://www.gnivc.ru/inf_provision/classifiers_reference/kladr/)

The most common addresses are -    Home Address, Secondary Address , Birthday place ( required for reporting)

image002.jpg

Image 3 . IT0006 Personal Data

4.1.1.3. IT 0016 Contract Elements

This international Info-type  has been enhanced , and now, when you create a contract, it  is automatically generated number of the contract employee. To customize automatic numbering  of   Contracts and Supplementation Agreements follow to this patch  IMG_>Personnel Management-> Personnel Administration-> Personal Data-> Russian-Specific Settings->  Employment Details-> Automatic Numbering for Contracts.

Also if you put in this infotype in Time limits Probation period it will be automatically created IT0019 Monitoring of Tasks with Term of Probation period

image003.jpg

Image 4 . IT0016 Contract Elements

4.1.1.4. Customizing IT0022 Education

In this infotype you should to upload Dictionary  OKSO - National Classification of specialties according to education , as well as educational institutions, which are maintained in TableT7RUSCHOOL or you can input it directly in infotypes , If  it is activated parameter and value INSERT_SCHOOL - for report MP002200 in table T7RURPTCST00.

image004.jpg

Image 5 . IT0022 Education

 

 

4.1.1.5. Customizing of IT 0024 Qualifications

In the info-type 0024 Qualifications are stored the data for language proficiency. Group of foreign language qualifications QK define in the  transaction OOQA  and than create  qualification Q for foreign languages. To enabling integration to display Qualification in   IT0024 put in table T77S0 -PLOGI QUALI A032 Q Integration switch for qualifications

 

image005.jpg

Image 6. IT 0024 Qualification

4.1.1.6. Customizing subtypes of IT 0290 Documents and Certificates (CIS)

 

In the info-type 0290 Documents and Certificates (CIS) is stored information about on identification documents, documents for Tax priviledges, etc.

The commonly used subtypes of IT0290 Documents and Certificates (CIS)

03             Birth Certificate

04             Military Officer's ID Card

06             Minmorflot Passport

07             Military Card

09             Diplomatic Passport of RF Citizen

10              Foreign passport

11               Immigrant Certificate

14              Temporary ID Card of RF Citizen

21               Passport of RF Citizen

22              Travel Passport of RF Citizen

26              Sailor's Passport

27              Discharged Mil. Officer's Certificate

28              Driver's License

801           Tax Payer ID Card

802           Pension Insurance Certificate

803           Notice of Right to Tax Remission (RE)

To customize IT0290 0290 Documents and Certificates (CIS) follow to this patch  IMG->Personnel Management->Personnel Administration->Personal Data->Russian-Specific Settings->Documents and Certificates . 

In most cases, the subtype  07 Military Card is customized , information for this the military dictionary  in this subtype should be input  in  table V_T7RUM0.

For several subtypes  you need to prioritize the their date output for reporting in  table V_T7RU0290PRIOR for groups of documents:

  • HA-Notice of Right to Tax Remission (Real Estate),
  • IC-Identity card for tax accounts,
  • IN-INN,
  • LC-Passport/ID Card Data for Employment Contract,
  • ML - Military card,
  • ND-Document confirming non-resident status,
  • PC-PFR card,
  • PS PFR card (special codes),
  • RD-Document confirming resident status,
  • TA-Tax accounts

 

image006.jpg

Image 7. IT 00290 Documents and Certificates (CIS) Subtype 07 Military Card

 

4.1.1.7. Customizing of IT0294 Employment Book (RU)

 

Under the seniority  it is assumed   the total duration of employment (work, education ) and other socially useful activities, such as paid and not paid activity . Seniority, as a special measure of the value of work, has a quantitative and qualitative characteristics. Quantitative characteristic of seniority is  the duration, the qualitative characteristics reflects the nature and conditions under which the work activity takes place (harmful working conditions, North area , etc.). Influence both on the Sick leave calculation , and on allowances  for work in different working conditions.

Basic settings:

For It 0294 Output customizing:

Personnel Management-> Personnel Administration-> Personal Data->Russian-Specific Settings->Employment Details-> Employment Book and Working Conditions->Determine Types of Labor and Other Activities

For Seniority calculation customizing:

IMG->Personnel Management->Personnel Administration->Evaluation Basis->Calculation of Employment Period

 

1.On the first step  is to configure Selection Rule.

1.1 Define Selection Criteria for Infotypes (It’s recommend to take data from the IT 0294)

(Table V_T525A_A  and V_T525Z)

1.2. Define Selection Exit:One way to select data in the Selection rule . Contains a functional module that selects data from infotypes  for IT 0294 Employment Book (CIS), in this case choose a program RUWB  (T525V)

2. Define  Selection Class . It is Combines one or more selection rules. (T525NT)

3. Define Valuation Model - Combines one or more Selection Classes

3.1 Sets for each Selection Classes  a weighting factor and sets  for the Selection Classes  limits (V_T525L)

3.2 Define rounding rules (V_T525E)

4.1Define Calculation Process -  Object that returns the value of seniority  for use in reports, function modules, payroll, etc. (V_T525P)

4.2 Symptom SENOR - assigning the return code for the split in the V_T525S

5.  Set records in the workbook in IT0294 Employment Book (CIS) - T7RUSEN

image007.jpg

Image 8. IT 0294 Employment Book (CIS)

 

 

4.1.1.8. Customizing of IT0298 Personnel Orders (CIS)

 

Once the user completes the Action, the last step is to output info-type  0298 Personnel Orders (CIS). In this info-type it is automatically assigned  a number of orders and contracts,  signer person, and it is possible to see the Personal order.

Customizing patch : IMG_>Personnel Management-> Personnel Administration-> Personal Data-> Russian-Specific Settings->  Personnel Orders

To configure the Orders you should first configure the connection between Action and the reasons for action in table T7RURs (in the this table it  can be specified Details About Reasons for Personnel Actions, which allows to output  a long cause of the action). Table T7rur0 determines the relationship between Action and its reason  and the Report’s program output . Currently the most printed form of orders are derived through the Adobe Formular and updates are already being applied only to them.

 

CGrpg

Cty

  1. Act.

ActR

DT

Program Name

Form

Form

33

RU

01

1

 

HRUA_ORDER_T1

HRRU_T1

ADOBE

33

RU

01

1

G

HRUA_ORDER_T1A

HRRU_T1

ADOBE

 

 

Table 1. T7RUR0 Typical customizing for T-1 Hiring order .

 


In the feature  33298 is customized input mask for Action orders.
Throughout the transaction  SNRO It is defined number ranges of orders for Object   HRYP298 for Company codes.

 

image008.jpg

Image 9. IT 0298 Personnel orders

4.1.2. Customizing  of RU- Action

The main feature is that the information group has  at the end of the Action  a line in order to create and display the Info-type 0298 for example, where the operation DIS   allows you to immediately view during the Action process see the its personnel Order

image009.jpg

Image 9. Creation and display IT 0298 Personnel Orders (CIS) in table T588D

Often there is a problem when it is customized Rehiring action on the same day after the employee was dismissal - the main problem is that it is checked  indicators in the table T529A  more details in the Note 923678 - HR-RU Rehiring or Reentry into company (on the next day too)

The most common of Dynamic action (Table T588Z) are created  typically when hiring and firing employees:
When you firing:

  • Creation Print orders and Contracts
  • Creation IT 0416 Time Quota Compensation , when during the Termination action ,it is limited  IT 2006 Absence Quotas.

 

4.1.3. Customizing of Reports (PA):

When it is customized Orders and Forms, it is  necessary to input all Data for Legal entities  in the table T7RU9a.

4.1.4. Customizing  of Orders (T-1, T-5, T-6, T-8, T-11)

Russian Personal orders   are both Individual (eg, the T-1 Hiring order – program HRUA_ORDER_T1) and Group  Orders (e.g. T-1A -Group order for hiring  -the program HRUA_ORDER_T1A).

If you implemented EHP5, then you can get Forms For Business trips ( T-9, T-10)  from the system.

 

4.1.5. T-2 (Personal Card)

The Form T-2 is  a statistical form ,that contains detailed information about each employee in a company.  According to Russian legislation, companies must prepare form T-2 for each employee, and keep the form up-to-date. For example, when an employee has personal or organizational data changes, it should be prepared  a new version of the form.

4.1.6. T-7 (Vacation Schedule)

Form T-7 is required by  State Committee for Statistics (Goskomstat) to prepare for every company in Russia. The form contains details about periods of planed vacation that your employees take each year. Goskomstat requires Legal entity  to prepare this form at the start of each year, and again whenever your employees change their vacation plans.

4.2 Data Migration (PA)

The data is loaded by the tool LSMW through the transaction PA40 and PA30. Provided and downloaded to the data for all active employees. The files for Personnel Administration Migration is the following

  • Hiring employees
  • Hiring Contractors. Employees who are in the company did not have a specific staff position is recorded on the Position with code 99999999
  • Employees Termination
    • Home Address,
    • Birthday place
  • IT 0009 Bank Details Migration
  • IT 0021-Family Member/Dependents Migration;
  • IT 0022 Education Migration
  • IT 0024 Qualifications
  • IT 0290 Documents and Certificates (CIS):
    • Passport of RF Citizen
    • Foreign passport
    • Travel Passport of RF Citizen
    • Pension Insurance Certificate
    • Tax Payer ID Card
    • Military Card


5. Time management  ( TM) Issues Customizing.


The Time management Customizing for Russia is in most cases the same as for  other Countries. The first step during Time management  customizing in Russia  should be Factory calendar’s configuration. Each year, the Russian government passes a new Factory calendar for next year, which governs transfers of holidays. Factory Calendar - a calendar  which  taking into account holidays and weekends, based on which are created the working schedules,   determined number of working hours per month and proceeded Payroll. It shows the true and accurate information about which days re weekends, holidays or reduced working days in accordance of the Government of the Russian Federation resolution.

In one case, if it was implemented Note 1020749 ,it should be customized  Special rules for transfer of public holidays in Factory Calendar – RU through the transaction SCAL.

 

image001.jpg
Image 10. Special rules for RU-Factory Calendar.

In  another case,  it can be generated work schedules for the next year and then to do manually the work day transfer for each work schedule  through the transaction PT02 

 

5.1.1. Peculiarities of  Absences and Attendances Customizing

In Russian SAP HCM Solution there are a lot  of Absences types.  Absences can be divided into those that can use Absence Quota  and another one that doesn’t use Absence Quota.

Traditionally, creating the Absence Quota  for  Annual leave, it can be created for Additional types of absences that consume Absence Quota  for the Unregulated work or Seniority or for Work in  regions of the Far North.
Also, extensive list of absentees for the Sick Leave  and Maternity Leaves purposes:

  • Sick leave
  • Sick leave for taking care of a child under the age of 7
  • Sick leave for taking care of a child aged from 7 to 15
  • Home accident
  • Sick leave for taking care of a family member
  • Industrial injury
  • Sick leave for taking care of a disabled child under the age of 3
  • Sick leave for taking care of a child under the age of 7 in a hospital
  • Maternity Leave
  • Child Care leave 1,5 years
  • Child Care Leave 3  years

Also for the Form  T-7 Vacation Balance it should be created  a Planned absence through  which to create on next year planned Vacation  (This Absence is not proceed in Time Evaluation, because it created with blocked status and displays only in Form T-7)

In Attendances  also is maintained  Work on weekends and holidays, business trips, overtimes etc.

5.1.2. Peculiarities of Absence and Attendance quota customizing

 

A very important point in Russia's SAP HCM Solution is Absence Quota generation. Let’s to consider it on  the example of Annual leave. If a person  worked  15 days and above, he is entitled to 2.33 of Absence quota in work month and if he works all year, so in the  end of the year he already has 28 days.

In this situation the problem arises when people will be dismissed  or want to know the number of Absence Quota days on date. It  is calculated Absence quota , depending on the period of cummulation. Imagine that it is calculated on daily base, then the number of limits can be anything and still have totally different numbers after the decimal point (t.e.365/12 * Number of days). The result should be rounded. The another problem is that standard SAP Solution doesn’t proceed the Absence quota deduction in order of unpaid leaves Maternity leaves.  Because of that on projects it is developed User-exit, which deducts the Absent Quota in accordance with those Absences from  Z –table.

The developed program calculates the Absence quota number  on the day of Termination  (or on any given day) by the formula: (28/366 * (366 - number of days> 14) / 366 * number of days worked). Next step I  adjust the rounding rules (table T556D):

image002.jpg

Image 11. Rounding Rules for Annual Vacation Absence qouta.


SAP   is provided solution in EHP5,  where it can be excluded certain absence types from an employee's absence quota by adding the duration of those absence types to the end of the quota validity period: http://help.sap.com/erp2005_ehp_05/helpdata/en/fd/6bccca90774ea59a7e6a782212ba34/frameset.htm

Next problem is the right  control of Overtime  work. By law an employee may work out only 120 hours of overtime per  year. Control  is performed either manually or  through Attendance Quota or Time valuation.

5.2. Time Management Reporting  Customizing:

Form T-13 - Timesheets  is used to account for the time actually spent and (or) unfinished each employee organization to monitor compliance with the regime ( established by the employees working hours), to obtain data on hours worked, the calculation of remuneration and to compile statistical reports on the work. This report is run  only after the Time evaluation time.

5.2.1. FormT-13 Customizing

 

To Customize   this form  follow by this patch:

IMG-> Payroll-> Payroll: Russia-> Reporting-> Time Management-> Working Time Schedule (Form T-13)

5.3. Time management  (TM) Data Migration

For Time Data Migration is used  LSMW-tool .

5.3.1. AbsencesMigration

  • IT 2001 – Absences
  • IT 2002  - Attendances

5.3.2. AbsencequotaMigration

  • It is migrated remains days for certain periods for  IT 2006 Absence Quota 
  • It is migrated data type for vacation from IT 0041 Date Specifications

 

6. Payroll(PY) Issues


Russian Payroll is  very complex and difficult in SAP ERP HCM, like in US Payroll ,  so before its implementation, I strongly advise to find a Russian consultants in order to evaluate realization and real terms of implementation. To understand the depth of the problem look at the scheme RUS0.

6.1. Payroll (PY) Customizing :

For payroll, you should use the standard Payroll driver HRUCALC0 and the modified schema  RUS0, if it is installed EHP5, it could be use HRUCALC0_CE and schema RU0C.

6.2. RU PY Infotypes Customizing

6.2.1. It0009 BankDetails

Bank details  are designated by employee on infotype 0009.  It is required only configuration for this is population of the BNKA table with bank details such as key, bank name, address, etc. 

 

 

6.2.2. IT0048  Residence Status

 

The data on the residence status in the country influences on  the calculation of income tax: those employees who are not tax residents are charged 30% income tax, whereas tax residents are charged 13% tax rate.

It is described  the response of the system to a value in  IT  0048 Residence Status  in the feature of 33TXSimage002.jpg

Image 12. IT 0048 Residence Status

6.2.3. IT0291 Tax and Social Ins. Payments (CIS)

This infotype is used for maintaining information about taxes and net payments.

 

image003.jpg

Image 13. IT 0291 Tax and Social Ins. Payments (CIS)

 

6.2.4. IT0292 Add. Social Insurance Data (CIS)

Infotype 0292 is used for maintaining information about employee social group. This information is needed for sick payments.

image004.jpg

Image 14.IT 0292 Add. Social Insurance Data (RU)

6.2.5. IT0293 Other and Previous Employers (RU)

In this infotype stored information about previous employers payments for current tax year.

 

image005.jpg

Image 15. IT Add. Social Insurance Data (CIS)

6.2.6. IT0296 Garnishment Documents (CIS)

It is using for recording details of the  staffs garnishment documents. The system automatically create IT  0295 Garnishment Orders (RU) after completing the infotype   0296 Garnishment Documents (RU)  . Used to register the amount of  the garnishment document.  Impassible to enter the record in the  infotype 295 if there is no corresponding record in the infotype 0296.

 

image006.jpg

Image 16.IT0296 Garnishment Documents (CIS)

6.2.7. IT0299 Tax Privileges (CIS)

IT 0299 Tax Privileges (CIS) is used to maintain individual tax exemptions: income tax exemption for a child, tax deduction (Art.218 Cl. 2), tax deduction (Art.218 Cl. 1, 219), material tax deduction etc. It is connected with individual Benefit flag in table T7rut3

         image007.jpg

           Image 17. IT0299 Tax Privileges (CIS)

 

6.3. WT Catalog Peculiarities

Wage type catalog  is  a list of charges, deductions and taxes. Russian WT catalog includes round 580 Technical Wage types,  round 448 Dialogs Wage types ( wage types with R*** and N*** are used for Regional and North Conditions).


When you create your own WT in RU WT Catalog , take the following into account:

Step

Table

Value

Description

1

V_512W_O

 

Wage type(WT) code creation and WT Valid dates

2

V_512W_T

 

Short and full name of WT

3

V_511_B

 

Define the required personnel area and employee group

4

V_T512Z

 

Define Wage type permitted WT for infotypes

5

V_512W_O

10

Define Class for reducing in proportion to the  worked hours

6

V_T511

 

Payment type (deduction/accrual), input type ( amount, percent, constant, automatically)

7

V_512W_B

 

Define valuation bases

8

V_512W_O

30 C

Define Class for cumulation period

9

V_512W_O

65

Valuation according to principle of averages

10

V_512W_O

13, 14

Include in cumulation  for  Total gross amount

11

V_512W_O

20, 21, 22, 23, 24, 25, 26

Include in cumulations for  Pension Social Security and Medicine Funds

12

V_512W_O

02, 03

Define analysis class for output in Pay slip

13

T7RUNC

 

Included in  Wage type grouping for the reporting

14

V_T52EZ

 

Define for postings (Debit/credit)

Table 2. WT creation for RU-Wage type catalog

 

6.4. Payments peculiarities

There are also Fixied Salary payments and Hourly wage in Russia. In Russia there are a lot of compensatory payments connected with working conditions. Regional premium is made for work in the regions of Extreme North and equivalent areas. Calculation is made by multiplying regional premium rate by a sum of charges in a calculation month subject to regional premium rate charging.

It is customized  in the feature 33BMC For every personnel area is assigned Bonus Model. Bonus Model is maintained in table T7RUB1.  It is assigned to Bonus Model wage types and scales in table  T7RUB3.  The names of bonus scales are maintained in table  T7RUB4. The percent of allowances is input in  table   T7RUB5.

 

Payments for Harmful conditions are made for hours worked to employees whose positions are connected with insalubrious and hazards working conditions.  Usually it is input Payment for harmful working condition in It 0015 or put time in  IT 2002 or 2010 and then It is calculated through time evaluation than it will be proceed in rule RU25.

Payments for non-worked hours ( e.g. Vacation, Donor days) with average earnings maintained. Salary calculation is made on the basis of average earnings. The calculation period is considered as 12 calendar months preceding the month of the beginning of the event. Daily earnings are calculated by dividing the sum of earnings for the salary calculation period by the worked days for this period. Average earnings sum is defined as the product of average daily wages by the days of absence.

All types of paid absence refer to the appropriate Absence valuation rule, which connection is  configured in view V_554S_G.

Te common evaluated  absences  are grouped by the  Absence evaluation rule . The rule defines evaluation as a paid absence, and then generates a WT for accruals  . Absence evaluation rule is maintained in view V_T554C.

The Cumulation rules  are configured in view  V_T51AV_B in accordance with cumulative types of payments - the basis of average values.

 

6.5. Tax peculiarities

Personal income tax  is collected from all staff  that are tax residents of the Russian Federation, as well as from the staff members that get income from the sources of the Russian Federation and are not tax residents of the Russian Federation.

   Depending on category of tax payer Income tax can be 13, 30 and 35% 

 

Tax schema controls the payments for income tax.  It is customized IMG -> Payroll-> Payroll: Russia-> Tax and Social Insurance Payments-> Maintain Taxes and Social Insurance Payments.

Each Personnel area has Tax schema in table  V_T7RUP0. Tax schemas are described in table T7RUP1. Personnel grouping for Tax schema  is described in feature 33ТАХ.

Depending on thee return value of feature fro m the table T7RUP3 , it will catch up with some tax class. Tax classes is maintained in table  T7RUT1. Here you specify the scale for the deduction of taxes and benefits that must be applied to this tax.

To calculate the tax base tax payers can get standard tax deduction. Standard tax deductions are provided to the tax payer on the basis of his written statement and the documents confirming the right of such tax deductions.

The size of tax deductions is configured  in the view V_T7RUT3.

 

6.6. Sick leave peculiarities

In Russia there is a lot of  Sick leaves. Sick leaves are paid partially by Employer and by Social Security found.   Generally , Sick leave Payment is calculated on the basis of average earnings. The average daily wage is calculated by dividing the sum of earnings for 2 years at 730.

The function RUSIO proceed the  Sick leave. The total amount of average earnings (based on the data received from other employers) for each calendar year does not exceed the limit value base for the calculation of insurance premiums to the FSS RF, established in 2012 (463,000 rubles) , it is defined in table T511P . Amount of daily allowance is calculated by multiplying the average daily wage rate on the insurance seniority.

In table T7RUT5 is stored the amount for  Social group (which is defined in table T7RUT6)

In table V_T7RUT5_PAID you can assign the amount of sick leave days and WT which paid by employer.

Amount of  payments for sick leaves  ,e.g. 1,5 year Child care leave ,   is configured  in table T510J . Wage types  SI10, SI11  in IT 0293 stores  bases for the calculation of insurance premiums in the FSS. The Wage type SIRT in IT0015 stores  averages  rate for Sick leaves pavement.

6.7. Deductions peculiarities

Fines and Alimonies are maintained in table T7RUG1. Types of Garnishment orders are maintained in table T7RUG0.  It  is processed by  the function RUAID.
In the case of processing multiple deductions priorities are processed by function RUPRI.
The rules for deductions are adjusted in the table T7RUD3. Priority of processing in case , if it is not possible to deduct the whole sum, is stored in view of V_51P6_B.

6.8. RU Payroll Schema – RUS0

Subschemas

Description

  1. Initialization (subschema XIN0)

The start of payroll processing

  1. Master Data Processing (subschema XBD0)

ENAME - Determine name of Employee from IT  0001
WPBP -  Read Work Center/Basic Pay Data

RUSPL- function is used for internal table  WPBP  splitting in case of :
1)Absence registration in IT2001

2)There is a dates in table  T51D5

P0014 –WPBP  split in accordance with  periods from IT 0014

  1. Import last payroll results

Subschema RUR0 - Import previous result current period
Subshema
RULP- Import last regular payroll result

RUFUP (Parameter 4 = PTAB) – Import table  FUP from OFUP

  1. Import additional payments/deduction (Subschema RUP9)

P0014 – Import WTypes from IT 0014

P0015 – Import additional Payments from IT 0015

RU293 – import data from previous Employer from IT ИТ0293

RU267 - Import additional off-cycle payments  from IT 0267

Rule  RUSC – Prepare percent of allowances For regional and North condition.

  1. Time Wage Types Processing  (Subschema  RUT1)

RURAB - Absences reading  according with quotas

RUNAB –Refinement of the table AB (a partition shall record the absence on the calculating period)

PAB -   Absence processing

RUGAB -  This function determines the duration of periods with a 40-  week spread over five or six working days (target time), defined by :

-  Duration of incomplete periods

  -Duration of complete periods

  -Target time for one year

  -Target time resulting from absences.

P2003 -  imports the shift substitutions entered in infotype 2003

PARTT (PSP) -  Defining the parameters of incomplete periods

Rule RU1N – Create valuation bases (addition)
Rule RUM0 - Determine payroll modifiers

DAYPR - Day processing
Rule RU33 -  Evaluation basis (division) creation also WT  /010

Rule RUF0 – Time calculation for Averages

Rule RUF4 - Numbers in calendar days for Vacations

Rule RUF3 - Number of public holidays

Rule RUMN – Minimal Salary calculation for Sick leaves

P2010 X930 –Import  employee remuneration information from IT 2010

ZLIT – Total records - to ZL and IT

P0416 – Process Quota Compensation

RUOAV – Check the data in field  SPPE1 in IT2001 for  Absence.

Subschema XIW0 – Incentive wages

Rule RU25  - Valuation of time wage

Rule X020  – Gross and RT storage for time wage for calculation class 3

Business trips

(Subschema RURE)

ASREI – The function ASREI cumulates all the travel expenses for an employee per period in wage types

  1. Factoring and storage time wage types (Subschema  RUL0)

If the employee is not working full time, you must recalculate the sums  to obtain the proportionally
worked time. This requirement is performed in schema RUL0.

Rule  RU23  - Gross input and storage in RT in accordance with 20 Processing  Class.

  1. Valuation of averages  (Subschema RUAV)

Sub-schema RUAV and RUA0 perform all absence calculation

The function RUAVE is proceeded the technical WT  / V*, generated by the rules of RU17, RU18, just before calling the function, along with the main type of payment for M *, generated by a function of PAB in the absence proceeding, based on the settings table T554C.

Rule  RUA3 – Processing Averages after  RUAVE

Rule  RUA4 - Processing Sick List

Rule  RUA5 - Restricts Baby Care Compensations (Maternity leave for 1,5 year)

Function RUFUP  processes the results table for calculating to future periods, that is, table FUP.

Rule  RU62  - Cumulation & storage WT in accordance with 62 Processing class .

  1. Process & prepare old and retro results (Subschema RURC)

Subschema RUSC Derived WT ( regional, northern ). Generates WTs for regional and north allowances . Percent value is prepared by the rule  RUSC, which is used separately for  basic payments , bonuses, vacation payments.

Loan processing

  • (Subschema RUL0)

P0045 – Function P0045 processes the master data in the Loans infotype (0045) Loans

RUC45 – The function redefines all currency fields related to loans to another currency.

Processing deductions and storage

  • (Subschema RUD9)

Rule  RU14 –  processing delay of the preceding period
Rule  RU64 – rounding WT in accordance with Processing Class 64
Subschema RURC – Process off-cycle data
Subschema RUID – the main processing of Garnishment documents

Rule  RUDE - Process Garnishments in accordance with priorities
Rule  RUI2 – Rule  processing Fee for garnishments
Rule   RU35 – Gross cumulation, cost distribution in accordance with Processing Class4

Rule  X024 - Gross input and storage in RT in accordance with Processing Class 41

Taxes

  • (Subschema RUTX)

RUTAX proceed information from  IT  0001, 0002, 0048, 0291
It calculate taxes in accordance with table  T7RUT1:
- initial launch of the rules for calculating taxes, the formation of variable RU **,containing bases of evaluation for the calculation of taxes;
- Define Tax Privileges from IT  0299;
- Consistent calculation of the tax benefits according to the priority benefits, subtract benefits from taxable income of the employee;
- Calculation and save the amount of tax in in  created WT

GRSUP – calculates the corresponding gross values for each guaranteed net amount from table T541N

Rule  RUD9 - Gross input and storage in RT in accordance with Processing Class 70

  1. Calculation the amounts after deduction

RUA9 RUD1 –  proceed WT from the previous periods (from  LRT into  IT)
RU30 – Net part summation
RUPRI –   processes additional tables for deductions

  1. Net payments/deductions and transfer (Subschema RUN0)

There are the following features in this subschema :

calculation of delta for income taxes,

the transfer of deltas from the previous period,

the reading function
P0011 data for bank transfers from the in  IT 0011,

the transfer of alimonies and fines, the formation of the payment amounts, the function reads data from P0009 Employee bank account detail in IT 0009

Retroactive accounting

  • (Subschema RURR)

Used for Payroll recalculation

Total amounts

(Subschema RUE9)

Export results in cluster

(Subschema RUO2)

Check table  IT, refresh table  RT

ADDCU – Update cumulations  according to the processing class (CRT)

EXPRT UR – Export Payroll Data in Payroll Cluster UR.

Table 3. Russian payroll Schema RUS0

 

6.9. Posting Peculiarities

 

Most posting configuration can be found at IMG path:  Payroll à Payroll: Russia à Reporting for Posting Results to Accounting.

    • Table T52EK is where symbolic accounts must be defined.
    • Table T52EL maps wage types to symbolic accounts  including posting details such as account type and credit/debit designation.
    • Table T52EM is where EE grouping codes are defined.
    • Feature PPMOD is where employees are assigned to grouping codes based on organizational data.
    • Date identifier  for posting - V_T549S_B

    6.10. Reporting (PY)

    PY reporting is the also the  difficult  theme in Russian Reporting.  It is required to customize the output form in .PDF format and download the report in .xml format.

    6.10.1. Pay slip

    Pay slip is customized as usually in tr. PE51 .  It analyses classes for WT , which you defined for  output wage type in Pay slip

    6.10.2. Form 4 FSS- form is for paymentof contributionsto the fund ofsocial insurance

    6.10.3. Form RSV-1-form is for the calculation of accrued and paid insurance premiums to the Pension Fund of the Russian Federation, the insurance premiums for compulsory health insurance in the Federal Fund for compulsory medical insurance and territorial funds of compulsory medical insurance payers of insurance premiums, making payments and other compensation to individuals.

     

    6.10.4. Form SZV 6-1-2- Information on accrued and paid insurance contributions for compulsory pension insurance of the insured and the insurance period of the insured , 6-2- Registry data on assessed and paid insurance contributions for compulsory pension insurance and the insurance period of the insured

     

    6.10.5. Form  2 NDFL- a form on which employers report for taxes assessed on personal income

     

    6.10.6. Payroll Sheet (Form T-53)- is payroll unified form

      

    6.11. Data Migration (PY)

    6.11.1. Data Migration for previous Employer

    Create files for IT  0293   for WT /DA0 ,  SI09, SI10 аnd loadedtax deductions through LSMW.

     

    6.11.2. Data Migration for Payroll Cluster

    You must download the data for the year prior periods in order to ensure the correct calculation of pay for the average values ​​within a year after the start of a productive system For this purpose, load data into tables T558B and T558D, or use outdated table to load the T558A, which contains fewer fields than the previous table. Loading of the tools used, or LSMW - BUS7023 and IDOC to load the data, but in this case triggered numerous checks and loading is interrupted when transferring 100,000 entries and more. The second option - developing its program for downloading data base can be taken from this. Before the Migration  the Personnel Administration data must already be uploaded the staff, and WT should be customized

    The order of loading:


    1.Check the format and completeness of the data being loaded
    2. Erase entries in the tables T558
    3 Load the records into a table with the help of a program or LSMW
    4. . Clean the cluster of loud personnel numbers with the report - RPUDEL20 or  its modification
    5 Use a standard report RPUTRBK0 and move the date in IT 0003 "The status of the calculation of" employee number of load
    6. Create your chart data is loaded into the cluster with scheme RU30 or  RLK0

              7. load the required personnel number with created Migration Scheme in   Payroll driver  HRUCALC0

    SAP also proposed a new solution for PY Migration in the note 1677296 - HR-RU: Report HRUURU30 - Uploading old payroll data to SAP

     

     

     


     

     


    3 hands-on techniques for managing operational change in HRIS projects

    $
    0
    0

    Hi,

     

    it has been suggested that I should have posted this blog in the HCM space, as the topic link doesn't seem to make it easily visible for those browsing the space. Apologies for the confusion!

     

    Here's the link to the blog article posted in the Organisational Change space. Could be interesting to all HRIS project managers, project sponsors and process owners:

     

    http://scn.sap.com/community/organizational-change-management/blog/2013/07/24/3-hands-on-techniques-for-managing-operational-change-in-hris-projects

    HR BASICS IN SAP

    $
    0
    0

    Human Resource Management

    HR– Play very important role – Deals with people not in money.

    HCM  - Human Capital Management – Deals with both people and money.

    Human Resource deals with employee and company policy. Always deals with people and money.

    Modules in HR/HCM

    Personal Administration– Information about each employees in company.

    Time Management– Submit time sheets to PMO at the end of each month.

    Recruitment– Deals with the Hiring employees.

    Payroll– Deals with the Salary of employees and integrate with Finance.

    Organization Management– This is the main module in HR/HCM. Others are sub-modules. It is deals with the following,

    How many departments are there.

    How many employee’s are there.

    In which department employees are working.

    This is the basic for run the other module.

    Infotypes– Group of related data, records and etc..,
    It always numeric it should be four character.

    In Technical– It consist of 1 structure, 2 tables, 7 programs, and 3 module pool program are running in the back ground.

    We have 5000 infotypes and there are secondary infotypes(Deals with configuration).

    Personal Administration Infotypes - 0000 to 0999(Some infotypes deals with payroll).

    Organizational Management Infotypes - 1000 to 1999.

    Time Management Infotypes– 2000 to 2999.

    Recruitment Infotypes– 4000 – 4999.

    Custom Infotypes– 9000 – 9999( Only we create for personal administration organization management and recruitment).

    Totally HR have 4 cluster tables

    I) PCL1. II) PCL2. III)PCL3. IV)PCL4.

    Secondary Infotypes– 5000 to 5999.

    We can not create infotypes for time management.

    For SAP future enhancement 3000 – 3999.

    Infotypes Screens

    1000 – Dummy screens.

    2000 – Single level screen or entry screen.

    3000 – Overview screen.

    T.codes

    PA30 – Employees administration.

    PA20 – Display employee administration.

    PA40 – To take action on employees(Termination, Suspends and etc.., ).

    PB20 – Display the recruitment of applicant.

    PB30 – Applicant Administration(For example some company have the policy for recruitment if any one attend interview then they will not allow to attend interview next 6 months ).

    PB40 – Actions on applicant.

    Organization management.

    PPOME – Modify.

    PPOCE – Create.

    PPOSE – Display.

    PM01 – Create or Enhancement(PA and Recruitment).

    PPC1 – Create organization management infotypes.

    PPCM – Enhancement organization management infotype.

    Time constraint in Infotypes

    Infotypes have 3 types of time constraint.

    1 – Records will be only one.

    Always only one records until leave from company. Don’t have multiple records.

    2 – Not allow overlapping and have multiple records.

    Ex – Employee have the type Trainee, contract, Permanent and etc..,

    3 – Allow overlapping and also multiple records.

    Ex – Some employees are deployed into many projects.

    HR data is time dependent data. Because based on date we have to know whether the employee is active.

    HR is time and country specific.

    Payroll is differ to every company.

    We can re-assign the employee here like ABAP consultant move to BI consultant.

    PM01 – To create a custom infotype.

    It has three includes.

    First Includes – Key Values.

    Second Includes – Administration include common to any infotypes.

    Third Includes – Depends on Infotypes structure.

    In last we have include for every infotypes for enhance the infotype.

    Subtype– Ex – Address – It has different type permanent, Emergency, Contact, Temporary and etc..,

    Using LDB we will get the data in HR. There are as follows,

    PNP AND PNPCE. When we use PNP, PNPCE we can define our selection screen using HR report category. Instead of select…endselect. we can use provide…endprovide.

    Using macros also we will get the data. They are as follows,

    RP_PROVIDE_FROM_FRST – Initial records.

    RP_PROVIDE_FROM_LAST – Latest records.

    Organization management– It is an hierarchical manner like altimetrik->under this->CEO->Different departments.

    It has different object types,

    O – Organization Unit(Department, Place,and etc..,). It is an hierarchical manner. It has two type as follows,

    Top to Bottom->A.

    Bottom to Top->B.

    S– Position.

    K– Cost Center.

    P– Employee number.

    C– Job.

    Q– Qualification.

    D– Course type.

    E– Course.

    H– External person.

    R– Resource and etc..,.

    Relationship– It has 3 alpha numeric.

    Based on relation ship we can get data as well as hierarchy extract data.

    Ex – s ————> p(008).

    HRP1001-> Relationship between object.

    HRP1000-> Description about the object.

    we can get the different relationship data using relat in (’008 ’002′ ’003′.)

    Evaluation path– The combination of relationship.

    Delimit-ion - One of term in HR like below.

    Ex – 01-08-2011 to 31-08-201 – Developer.

    01-09-2011 to 31-12-999 – Consultant.

    Quota Based on Working more than 8 Hours a Day in +/-Time Management

    $
    0
    0

    Quota Based on Working more than 8 Hours a Day in +/-Time Management

    I. Purpose

     

    The Purpose of this document id to generate the absence Quotas using PCR.Which is often same for US Clients. I have taken the Example. Requirements may vary client to client. This document can be used for the reference.

     

    Note: before looking at the document, basic knowledge in Absence Quota must be investigated carefully

     

    II Requirement:

     

    Part time employees who work on Hourly basis will get 0.5 Day quota on completion of more than 8 hours of shift on a particular Day shift.

    Solution:

    We need to group the Part time employees under different grouping as per our requirement.

     

    Table: V_503_E

    test1.png

    To full fill the requirement I have written A PCR to   check the number of working hours entered in info type 2011 and 2002. We have two info types from where we enter the timings. For positive employees.

    Time Types: 1712

    test1.png

     

    1715:

    test1.png

    PCR Z0006

    test1.png

                                  test1.png

    Inserting the PCR in TM04 (Alias ZM04)

    test1.png

                               

    ·         Here Firstly we Query on Employee Group: OUTWPPERSG this will check the employee group “V”

    ·         OUTTPORIGS: Here we check the origin status of the Time Types.

     

    The origin Indicators:

         E-     Time Events from 2011

         P-     Time Events from 2002

     

    ·         HRS=PNUM; this will check the Number of working hours in TIP Table for 2011 and 2002.

    ·         We will add the number of working hours to the Day Balance 1715

    ·         Next the HRS Operation will check the hours for More than 8

    ·         If it is less than 8 HRS will add 0 to the time type 1712

    ·         If It is greater than >8 this will add the 0.5 number of hours to the time type 1712.

     

    TESTING

    2011:

    test1.png

    TIP Entry:

    test1.png

    ABWKONTI:

    test1.png

    After running The Live time Evaluation:

    2006:

    test1.png

    Thanks and Regards,

    Srikanth Reddy Munugala

     

    "Hidden" Absence Reporting including Bradford Score

    $
    0
    0

    2 reports probably considered useful by HR professionals in any country are hidden away in the menu for British payroll.

    They aim at analysing absenteism and can be used globally - provided approval from data privacy officers and workforce reps are obtained, where this is required. Intended for the UK the reportss miss some texts, if the user is not logged on in English.  

     

    1. Spotting Absence Patterns

    The report RPLABSG0_PATTERN (transaction code PC00_M08_PATTERN) checks, whether absenses of selected types (e.g. sickness) are frequently used to extend off periods (e.g. Friday or Monday to extend weekends). It can also spot absences related to:

    • the employee's or his / her family members' birthdays
    • special days (e.g. after company Christmas party or the FA cup finale)
    • regularities such as 'same day every month' can be chosen on the selection screen

    AbsRep1.png

     

    You can choose the relevant absence types on the selection screen. The report produces the following list with the right hand column showing how often sickness (or the absence types you selected) have occurred extending a weekend:

     

    AbsRep2.png

    2. Bradford Score (Absence Spells Analysis)

     

    The Bradford Score is a widely used method to indicate possible abuse of sick notes. Number of sick days as well as spells are used to calculate the score with the number of spells going into the formula squared thus being emphasised more strongly.The formula is simple:

     

    (Bradford score) = (no spells) * (no spells) * (no days)

     

    This means: an employee absent for 5 single days has a score of 125, whilst one five days absence only leads to a score of 5. A high score indicates that abuse of sick notes might be an issue, but it will always require the thorough consideration of the particular circumstances before any action is taken.

     

    The SAP Standard report for calculating the Bradford Score is RPLABSG0_SPELLS (Transaction Code PC00_M08_SPELLS). As in the first report the absence types to be considered are chosen on the selection screen. Apart from the Bradford Score value (last column in picture) various other absence statistics as you know them from other reports are included:

     

    AbsRep3.png

     

    Good to know:

     

    • 2 absence records immediately following each other without a single day in between are counted as one spell. However, the infotypoe 2001 fields to link absences to each other as used in some countries (e.g. Austria, Germany or Spain) are not considered.

    • Only full years can be reported on for the Bradford score.

    • The report counts calendar days rather than working days.

    Should these constrains not work for you, you can still enhance the standard reports or copy and amend them. I've used implicit enhancements to achieve this.

    Benefits enrollment configuration unleashed:)Part 2

    $
    0
    0
    Benefits->Flexible Administration->Define Administrative Parameters->Prerequisites and Corequisites->Define Define Corequisite Plans

     

     

    30.png

     

     

    Benefits->Flexible Administration->Benefits Adjustment Reasons->Define Benefit Adjustment Groupings

     

     

    31.png

     

     

     

    Benefits->Flexible Administration->Benefits Adjustment Reasons->Define Benefit Adjustment Reasons

     

     

    32.png

     

     

     

    Benefits->Flexible Administration->Benefits Adjustment Reasons->Define Adjustment Permissions->Health Plans

     

     

    33.png

     

     

    Benefits->Flexible Administration->Programs->Define First Program Grouping

     

    34.png

     

     

     

     

    Benefits->Flexible Administration->Programs->Define Second Program Grouping

     

     

    35.png

     

    Benefits->Flexible Administration->Programs->Employee Eligibility->Define Eligibility Groupings

     

     

    36.png

     

    Benefits->Flexible Administration->Programs->Employee Eligibility->Define Eligibility Variants

     

     

    37.png

    Benefits->Flexible Administration->Programs->Employee Eligibility->Define Eligibility Rules

     

     

    38.png

     

    Benefits->Flexible Administration->Programs->Define Benefit Programs

     

     

    39.png

     

     

     

    Benefits->Flexible Administration->Standard Selections->Define Standard Health Selections

     

     

     

    40.png

     

     

    Enrollment->HRBEN0001 TCD

     

     

    41.png

     

     

    42.png

     

     

     

    PA20->0167I

     

     

    43.png

     

     

     

    Benefits->Toolset->Configuration Consistency Check

     

    useful program to check configuration settings

     

    ProgramRPUBEN42

     

     

    44.png

     

     

    Frequent error-select at least one plan for processing whilst enrolling the benefit plan for employee.Not defaulting.

     

    45.png

     

     

     

    to address this issue check the feature ELIGR

     

    46.png

    Benefits->Flexible Administration->Programs->Employee Eligibility->Define Eligibility Rules

    Benefit Eligibility Rule

    View:   V_T5UBV

     

    These are the two controls V_T5UBV and ELIGR feature to default plans for enrollment.

     

    The above tables and feature need to be maintained to fix the error select at least one plan for processing.

     

    Error2->The plan might not default because of table V_t74HA-Benefit adjustment reason.The validy if infotype records need to have the correct one checked.

    like start of infotype record and end of record.

     

    46.png

     

    1.png

     

    2.png

     

     

    Error 3->wagteype might not populated in wagteypes for benefit plan node.

     

    The reasons could be the start date of t512z for 0167 wagteypes for ex 01011800 could be the plan start date and in t512z if its 01011900 then the wagetypes might not  populate:)

     

    http://sap.ittoolbox.com/groups/technical-functional/sap-hr/wage-types-for-benefit-plans-2654315%20No%20entry%20for%20infotype%200167

     

     

    Determination of First Clock In & Last Clock Out in Positive Time Evaluation

    $
    0
    0

    Client Situation

     

    Our client requirement was to implement SAP HR Positive Time Management solution to record and evaluate the actual times of their blue collar workers. The client was installing time recording terminals which were not SAP CC1 certified. Only Clock In (Time Event Type P10) and Clock Out (Time Event Type P20) were required to be recorded.

     

    The factory/plant had four production shops. Each production shop had two time recording terminals mounted on the wall - one for clock in and another for clock out. These time recording terminals didn't have any unique way to specify whether a time punched at time recording terminal is "clock in" or "clock out". Hence, there was a board mounted with the sign "Clock In" above "Clock In Time Recording Terminal" and with the sign "Clock Out" above "Clock Out Time Recording Terminal". Some employees had access to all production shops and some had access to few of them only. An employee could work in multiple production shops in the same shift. Each time an employee entered into a production shop, it was expected that he clocked in at the "Clock In Time Recording Terminal" while entering into the production shop and clocked out at the "Clock Out Time Recording Terminal" while leaving the production shop.

     

    There were no turnstiles at the entrance of production shops and hence, there was a high chance that employees may forget to clock in or clock out while entering or leaving the production shops. Hence, we could have scenarios where an employee has a clock in data once and clock out data multiple times for the same shift.

     

    For evaluation purposes, client wanted us to consider the first clock in and the last clock out since it was difficult to enforce employees to clock in while entering and clock out while leaving the production shop in absence of a turnstile. If the first clock in was missing, then it should be reported as a missing clock in. Also, if the last clock out was missing, then it should be reported as a missing clock out.


    The time recording system would send a .txt file with all the time events (P10 & P20) data recorded for a shift for all employees in that shift in a predefined format to SAP R/3. These time events would be uploaded in IT2011 (Table TEVEN).


    Hence, if the time events were recorded as shown in the table below, the first clock in will be blank and the last clock out will be 18:00:00.

     

    Date

    P10

    P20

    03-Jan-2012

    -

    14:00:00

    03-Jan-2012

    14:15:00

    18:00:00

     

    There was no requirement to record break times and employees could clock in/clock out multiples times for the same shift. The break time would be considered from the daily work schedule.

     

     

     

    Failed Solution Approach

     

    For quite some time, this requirement was giving me sleepless nights. There were various approaches which I was trying out but none of them gave the desired results.


    One such approach tried by me was to use operation VARST to read the first time pair (VARSTFIRST) and then use operation HRS=PBEG to capture the no. of hours and enter it into a time type.


    Then use operation VARST to read the last time pair (VARSTLAST) and use operation HRS=PEND to capture the no. of hours and enter it into another time type.


    Using the time types, I would modify the start time and end time using operation FILLP for the first time pair and ignore the remaining time pairs.


    On the face of it, this solution looked good. However, it had inherent shortcomings.


    Please refer the below screenshot for time events in IT2011 to understand the shortcomings. The employee recorded a clock in at 08:00:00 and then clock outs at 10:30:00, 14:00:00 and 18:00:00 on 03-Jan-12.


    1.jpg

     

    When the time evaluation is run, the time pairs formed get sorted as shown in the screenshot below:

     

    2.jpg

     

    SAP has sorted all the time pairs first by “From” and then by “To” in Table TIP. Hence, the PBEG of first time pair comes out to be blank and the PEND of the last time pair comes out to be 10.5000. However, the real time scenario demands that the first clock in should be 08.0000 and the last clock out should be 18.0000. Hence, this solution approach failed.

     

     

     

    Solution Logic

     

    I realized that I was not having clarity of thought on the logic to develop this solution and hence, the various attempts resulted in failure. Finally, I thought to myself that if I have to give this requirement to an ABAPer, what would be the requirement I would give to develop a program to find the first clock in and last clock out. Also, if the first clock in or last clock out was missing, the system would report that.


    After some thinking, I came up with the below logic for ABAPer for determining the first clock in and last clock out:


    • Find all the recordedclock ins for a shift from the time pairs formed in Table TIP from function P2011. Please note the word “recorded” which I have used. It means that I am trying to find earliest or latest recorded times from the time events that have actually got recorded at the time recording terminals.
    • Out of the recorded clock ins, find the earliest recorded clock in and latest recorded clock in.
    • Find all the recorded clock outs for the shift from the time pairs formed in Table TIP from function P2011.
    • Out of this recorded clock outs, find the earliest recorded clock out and latest recorded clock out.
    • Then compare the earliest recorded clock in with earliest recorded clock out. If the earliest recorded clock in is less than the earliest recorded clock out, then the earliest recorded clock in is the first clock in of the shift and should be called P10. If the earliest recorded clock in is greater than the earliest recorded clock out, then there is a missing clock in. Hence, the first clock in of the shift should be blank.
    • Then compare the latest recorded clock out with the latest recorded clock in. If the latest recorded clock out is greater than the latest recorded clock in, then the latest recorded clock out is the last clock out of the shift and should be called P20. If the latest recorded clock out is less than the latest recorded clock in, then there is a missing clock out. Hence, the last clock out of the shift should be blank.


    Let us now test this logic to the time events in our failed solution approach. Below table shows the time pairs formed in Table TIP from function P2011.


    3.jpg                                                                   

    Earliest Recorded Clock In    =       08.0000


    Latest Recorded Clock In     =       08.0000


    Earliest Recorded Clock Out  =       10.5000


    Latest Recorded Clock Out   =       18.0000


    We see that the “earliest recorded clock in” (08.0000) is less than the “earliest recorded clock out” (10.5000) and hence, the “earliest recorded clock in” is the first clock in of the shift. This is correct.


    The “latest recorded clock out” (18.0000) is greater than the “latest recorded clock in” (08.0000) and hence, the “latest recorded clock out” is the last clock out of the shift. This is correct too.


    Hence, the above solution logic proved correct and I built custom PCRs and time types to fulfill the requirement based on this logic.

     

     

     

    Solution Design

     

    There are two key tables which we would need to maintain to build this solution.


    • TPT_PAIRSTAT2        -        Pair Formation: Status Table
    • V_T705B                 -        PDC Processing Statuses

     

    Table TPT_PAIRSTAT2 determines how time pairs are formed in Table TIP.


    Below is a partial screenshot of the Pair Formation Status Table.

    4.jpg

     

    From State: At any time, an employee has a state. This is the state in which the employee is in before the time event happens.


    Time Event Type: The field shows the time event recorded when the employee is in a given state. It will change the state of the employee from “From state” to “To State”.


    Unique Time Event Type: Time Event Type P01 can be used to record both clock in/clock out. If the “From state” of employee is absent before clock in and the “Time Event Type” is P01, then it means that the employee has clocked in. In such a case, the value of “Unique time event type” will be P10. This interpretation is defined in this field. Where no unique interpretation is required, the value of time event type is same as unique time event type. As shown in the screenshot above, the value of both time event type and unique time event type are P10 for “From state” – Absent before Clock In because no unique interpretation is needed.


    To State: This is the state at which employee reaches from “From State” once the time event type is recorded.


    Continue: This field is used for interim postings. Let us say that there is an interim posting between clock out and clock in and we would like to have two complete pairs – one from clock out to interim posting and another from interim posting to clock in. The first two events form the first time pair and the third event ends the new time pair taking the end event of previous time pair as the start event of the new time pair.


    Closed: Time pairs are formed by a starting time event and an ending time event. However, if a time event is missing, then the pair won’t get formed or if there are multiple time events, incorrect time pairs may be formed. To avoid any errors, this check box should be checked for scenarios where the time event type is the ending time event and there is a missing starting time event type. This implies that the time event should create a new closed time pair only with “To” time and the “From” time will be blank. An example of this scenario is where clock in is missing and clock out is recorded.


    Close: This field is meant to close an open time pair if it exists. If the employee is at work and a time event is recorded and this field is checked, then the pair should be closed. Fields Close and Closed are mutually exclusive. Both of them can’t be maintained at the same time for the same states and time event type.


    New: This field means that a new time pair should be started.


    Customer Adjustment: This field is used to specify PDC Processing Status and its reaction maintained in Table V_T705B.


    Error: If the pair formation is not error free, it gives an error message in time evaluation run corresponding to the error message number maintained here.


    Pair Formation Status: This field gives the status of the time pair formed – whether it is error free or not or clock in is missing or clock out is missing etc.


    Let us now understand the PDC Processing Statuses Table V_T705B.


    This table specifies the actions to be taken in situations where time pairs can’t be formed because the time events data don’t make sense.

     

    5.jpg

     

    PSGrp: This is Grouping of Personnel Subareas for Time Recording for which the same time types, time transfer specifications, access control groups, and message types are defined.


    PDC Processing Status: This field displays the PDC Processing Status which defines the behavior to be taken into account during time pair formation.


    Processing Status Text: This field displays the description of the PDC Processing Status.


    Start Date: This field displays the start date from which the PDC Processing Status is valid.


    End Date: This field displays the end date till which the PDC Processing Status is valid.


    Reaction: The return code in field reaction will specify the reactions to be taken for PDC Processing Status.


    Let us now study the values relevant for our scenarios from Pair Formation Status Table and the relevant values (C02 & C11) from PDC Processing Statuses Table.


    TPT_PAIRSTAT2 Screenshot A – This shows the values in the table relevant for our scenarios.

    6.jpg

     

    V_T705B Screenshot B – The highlighted rows in the table show the values relevant for our scenarios.

     

    7.jpg

     

    Let us refer to the 2nd and 6th rows in Table TPT_PAIRSTAT2 Screenshot A. In both cases, employee was not at work and there was a clock out recorded. The system has to create a time pair with the clock out time event because the field “Closed” is checked. The “Customer adjustment” field has PDC Processing Status as C02 and the error message 21 (Clock in Missing) will get generated. The reaction field in Table V_T705B Screenshot B for PDC Processing Status C02 should be left blank to allow open time pair creation with only clock out time in Table TIP from function P2011. The time pair will have “From” field blank and “To” field with clock out time.


    The other possible reaction value for PDC Processing Status C02 is 1. If 1 is maintained, then it doesn’t allow even creation of open time pair with just clock out data.


    Below are the examples of system behavior with reaction as blank and as 1 for PDC Processing Status C02.


    PDC Processing Status Scenario 1: Reaction indicator is blank for PDC Processing Status C02.


    V_T705B

     

    8.jpg

     

    IT2011

     

    9.jpg

     

    P2011 – Open Pair Type gets created with clock out data and clock in is missing.

     

    10.jpg

     

    Time Evaluation Result – The time evaluation fails with error that clock in is missing.

     

    11.jpg


    PDC Processing Status Scenario 2: Reaction indicator is 1 for PDC Processing Status C02.


    V_T705B

     

    12.jpg

     

    IT2011

     

    13.jpg

     

    Time Evaluation Result – The time evaluation fails at PCR TD20 which points out that time pair is not error free and has clock in missing. It doesn’t allow the system to reach function P2011 which creates open time pair with clock out time. Hence, this option is ruled out.

     

    14.jpg

     

    Let us refer to the 3rd row in Table TPT_PAIRSTAT2 Screenshot A. The employee was at work and a clock in was recorded. The field “Close” is checked and hence, it will close the open pair. Also, the field “New” is checked and hence, it will start the creation of a new time pair. The PDC Processing Status in field “Customer Adjustment” is C11. The reaction indicator for PDC Processing Status C11 is 1. If the reaction is 1, the system will end ongoing time pair with the current clock in time and also start a new time pair with the same clock in time. If the reaction for PDC Processing Status is blank, the system will give an error that clock in is missing.


    PDC Processing Status Scenario 3: Reaction indicator is 1 for PDC Processing Status C11.


    V_T705B

     

    15.jpg

     

    IT2011 – Employee is at work (Clock In 08:00:00) and clocks in again (14:00:00). It means that there is a missing clock out between two clock ins.

     

    16.jpg

     

    P2011 – There wasn’t any clock out at 14.0000. However, the system closes the existing open pair with the clock in time and starts a new time pair with the same clock in time. This is due to PDC Processing Status C11 and its return code as 1.

     

    17.jpg

     

    Time Evaluation Result – The time evaluation run is successful.

     

    18.jpg

     

     

    PDC Processing Status Scenario 4: Reaction indicator is blank for PDC Processing Status C11.


    V_T705B


    19.jpg

     

    IT2011 – Employee is at work (Clock In 08:00:00) and clocks in again (14:00:00). It means that there is a missing clock out between two clock ins.

     

    20.jpg

     

    Time Evaluation Result – The time evaluation fails at PCR TD20 and generates error during pair formation. It doesn’t allow system to reach function P2011 for processing. Hence, this option is ruled out.

     

    21.jpg

     

    After maintaining Pair Formation Status Table - TPT_PAIRSTAT2 and PDC Processing Statuses Table - V_T705B, the next step is to create time types. Below are the daily time types which are needed.


    • Earliest Recorded Clock In – ZVB1
    • Latest Recorded Clock In – ZVB2
    • Earliest Recorded Clock Out – ZVB3
    • Latest Recorded Clock Out – ZVB4
    • First Clock In – ZVB5
    • Last Clock Out – ZVB6

     

    Go to TCode SM30 > Table V_T555A.


    ZVB1 – Earliest Recorded Clock In

     

    22.jpg

     

    ZVB2 – Latest Recorded Clock In

     

    23.jpg

     

    ZVB3 – Earliest Recorded Clock Out

     

    24.jpg

     

    ZVB4 – Latest Recorded Clock Out

     

    25.jpg

     

    ZVB5 – First Clock In

     

    26.jpg

     

    ZVB6 – Last Clock Out

     

    27.jpg

     

    After creating the six daily time types, I created five PCRs as mentioned below:


    • ZVB4   -        Find Earliest Recorded Clock In and Latest Recorded Clock In
    • ZVB5   -        Find Earliest Recorded Clock Out and Latest Recorded Clock Out
    • ZVB6   -        Determine First Clock In
    • ZVB7   -        Determine Last Clock Out
    • ZVB9   -        Form Time Pair in TIP using First Clock In & Last Clock Out

     

     

    Let us now go inside each PCR to understand its functionality.



     

    PCR ZVB4– The objective of PCR ZVB4 is to find the “earliest recorded clock in” and “latest recorded clock in” in a shift and feed the values in daily time types ZVB1 (earliest recorded clock in) and ZVB2 (latest recorded clock in).


    If no clock in has been recorded, then the daily time types ZVB1 and ZVB2 won’t get generated. If only one clock in has been recorded, then both ZVB1 and ZVB2 will have the same value.


    Below is a screenshot of PCR ZVB4.

     

    28.jpg

     

    Let us see how time pairs in TIP table get processed through PCR ZVB4.


    • The PCR checks if start time exists in time pair or not using OUTTPEXBTM. If start time doesn’t exist (N), the time pair is moved to output table using COLOP *. If all time pairs of the shift don’t have start time, then time types ZVB1 and ZVB2 aren’t created. Hence, the values of ZVB1 and ZVB2 are 0.

     

    • If the start time exists (Y) in time pair, the value of time type ZVB1 (Earliest Recorded Clock In) is read using HRS=DZVB1. If it is the first time pair with start time and getting processed in the rule, the value of ZVB1 will be 0. If it is not the first time pair with start time, then there will be some value in time type ZVB1.

     

    • After reading the value of time type ZVB1, it is compared with 0 using HRS?0. If the value of ZVB1 is not greater than 0, it is processed under * and the start time of the time pair is read using HRS=PBEG. The start time is added to time types ZVB1 (earliest recorded clock in) and ZVB2 (latest recorded clock in) and the time pair is moved to output table using COLOP *.

     

    • Let us assume that the first time pair with start time had start time as 10:00:00. Hence, the value of ZVB1 and ZVB2 will be 10.0000. Now let us assume that the next time pair with start time has start time as 08:00:00. This time pair will get processed through Y (OUTTPEXBTM). The value of time type ZVB1 is read using HRS=DZVB1 (ZVB1 = 10.0000). This value is compared with 0 using HRS?0 and since the value of ZVB1 (10.0000) is greater than 0, the time pair gets processed under >. Then the start time of the time pair is read using HRS=PBEG (HRS = 08.0000) and it is compared with “earliest recorded clock in” time type ZVB1 (10.0000) using HRS?DZVB1. Since the value of HRS=PBEB (08.0000) is not greater than ZVB1 (10.0000), the start time of this time pair is the new “earliest recorded clock in” for this shift and gets processed under *. Hence, the start time (08.0000) of the current time pair  is fed into daily time type ZVB1 after removing its old value 10.0000 using ADDDBZVB1Z and the time pair is moved to output table using COLOP *.

     

    • Currently, the value of ZVB1 and ZVB2 are 08.0000 and 10.0000 respectively. Let us assume now that the next time pair with start time has start time as 15:00:00. This time pair will get processed through Y (OUTTPEXBTM). The value of time type ZVB1 is read using HRS=DZVB1 (ZVB1 = 08.0000). This value is compared with 0 using HRS?0 and since the value of ZVB1 (08.0000) is greater than 0, the time pair gets processed under >. Then the start time of the time pair is read using HRS=PBEG (HRS = 15.0000) and it is compared with “earliest recorded clock in” time type ZVB1 (08.0000) using HRS?DZVB1. Since the value of HRS=PBEG (15.0000) is greater than “earliest recorded clock in” time type ZVB1 (08.0000), the time pair gets processed under >. Then the value of HRS=PBEG (15.0000) is compared with “latest recorded clock in” time type ZVB2 (10.0000). Since the value of HRS=PBEB (15.0000) is greater than ZVB2 (10.0000), the start time of this time pair is the new “latest recorded clock in” for this shift and it gets processed under >. Hence, the start time (15.0000) of the current time pair  is fed into daily time type ZVB2 after removing its old value 10.0000 using ADDDBZVB2Z and the time pair is moved to output table using COLOP *.

     

    • Currently, the value of ZVB1 and ZVB2 are 08.0000 and 15.0000 respectively. Let us assume now that the next time pair with start time has start time as 13:00:00. This time pair will get processed through Y (OUTTPEXBTM). The value of time type ZVB1 is read using HRS=DZVB1 (ZVB1 = 08.0000). This value is compared with 0 using HRS?0 and since the value of ZVB1 (08.0000) is greater than 0, the time pair gets processed under >. Then the start time of the time pair is read using HRS=PBEG (HRS = 13.0000) and it is compared with “earliest recorded clock in” time type ZVB1 (08.0000) using HRS?DZVB1. Since the value of HRS=PBEG (13.0000) is greater than “earliest recorded clock in” time type ZVB1 (08.0000), the time pair gets processed under >. Then the value of HRS=PBEG (13.0000) is compared with “latest recorded clock in” time type ZVB2 (15.0000). Since the value of HRS=PBEB (13.0000) is not greater than ZVB2 (15.0000), the start time of this time pair is not the new “latest recorded clock in” for this shift and it gets processed under *. Hence, this time pair is moved into output table using COLOP *.

     

    • Finally, the value of “earliest recorded clock in” time type ZVB1 and “latest recorded clock in” time type ZVB2 are 08.0000 and 15.0000 respectively.

     

     

     

    PCR ZVB5– The objective of PCR ZVB5 is to find the “earliest recorded clock out” and “latest recorded clock out” in a shift and feed the values into daily time types ZVB3 (earliest recorded clock out) and ZVB4 (latest recorded clock out).


    If no clock out has been recorded, then the daily time types ZVB3 and ZVB4 won’t get generated. If only one clock out has been recorded, then both ZVB3 and ZVB4 will have the same value.


    Below is a screenshot of PCR ZVB5.

     

    29.jpg

     

    Let us see how time pairs in TIP table get processed through PCR ZVB5.


    • The PCR checks if end time exists in time pair or not using OUTTPEXETM. If end time doesn’t exist (N), the time pair is moved to output table using COLOP *. If all time pairs of the shift don’t have end time, then time types ZVB3 and ZVB4 aren’t created. Hence, the values of ZVB3 and ZVB4 are 0.

     

    • If the end time exists (Y) in time pair, the value of time type ZVB3 (Earliest Recorded Clock Out) is read using HRS=DZVB3. If it is the first time pair with end time and getting processed in the rule, the value of ZVB3 will be 0. If it is not the first time pair with end time, then there will be some value in time type ZVB3.

     

    • After reading the value of time type ZVB3, it is compared with 0 using HRS?0. If the value of ZVB3 is not greater than 0, then the time pair gets processed under * and the end time of the time pair is read using HRS=PEND. The end time is added to time types ZVB3 (earliest recorded clock out) and ZVB4 (latest recorded clock out) and the time pair is moved to output table using COLOP *.

     

    • Let us assume that the first time pair with end time had end time as 12:00:00. Hence, the value of ZVB3 and ZVB4 will be 12.0000. Now let us assume that the next time pair with end time has end time as 10:00:00. This time pair will get processed through Y (OUTTPEXETM). The value of time type ZVB3 is read using HRS=DZVB3 (ZVB3 = 12.0000). This value is compared with 0 using HRS?0 and since the value of ZVB3 (12.0000) is greater than 0, the time pair gets processed under >. Then the end time of the time pair is read using HRS=PEND (HRS = 10.0000) and it is compared with “earliest recorded clock out” time type ZVB3 (12.0000) using HRS?DZVB3. Since the value of HRS=PEND (10.0000) is not greater than ZVB3 (12.0000), the end time of this time pair is the new “earliest recorded clock out” for this shift and it gets processed under *. Hence, the end time (10.0000) of the current time pair is fed into daily time type ZVB3 after removing its old value 12.0000 using ADDDBZVB3Z and the time pair is moved to output table using COLOP *.

     

    • Currently, the value of ZVB3 and ZVB4 are 10.0000 and 12.0000 respectively. Let us assume now that the next time pair with end time has end time as 18:00:00. This time pair will get processed through Y (OUTTPEXETM). The value of time type ZVB3 is read using HRS=DZVB3 (ZVB3 = 10.0000). This value is compared with 0 using HRS?0 and since the value of ZVB3 (10.0000) is greater than 0, the time pair gets processed under >. Then the end time of the time pair is read using HRS=PEND (HRS = 18.0000) and it is compared with “earliest recorded clock out” time type ZVB3 (10.0000) using HRS?DZVB3. Since the value of HRS=PEND (18.0000) is greater than “earliest recorded clock out” time type ZVB3 (10.0000), the time pair gets processed under >. Then the value of HRS=PEND (18.0000) is compared with “latest recorded clock out” time type ZVB4 (12.0000). Since the value of HRS=PEND (18.0000) is greater than ZVB4 (12.0000), the end time of this time pair is the new “latest recorded clock out” for this shift and the time pair is processed under *. Hence, the end time (18.0000) of the current time pair  is fed into daily time type ZVB4 after removing its old value 12.0000 using ADDDBZVB4Z and the time pair is moved to output table using COLOP *.

     

    • Currently, the value of ZVB3 and ZVB4 are 10.0000 and 18.0000 respectively. Let us assume now that the next time pair with end time has end time as 16:00:00. This time pair will get processed through Y (OUTTPEXETM). The value of time type ZVB3 is read using HRS=DZVB3 (ZVB1 = 10.0000). This value is compared with 0 using HRS?0 and since the value of ZVB3 (10.0000) is greater than 0, the time pair gets processed under >. Then the start time of the time pair is read using HRS=PEND (HRS = 16.0000) and it is compared with “earliest recorded clock out” time type ZVB3 (10.0000) using HRS?DZVB3. Since the value of HRS=PEND (16.0000) is greater than “earliest recorded clock out” time type ZVB3 (10.0000), the time pair gets processed under >. Then the value of HRS=PEND (16.0000) is compared with “latest recorded clock out” time type ZVB4 (18.0000). Since the value of HRS=PEND (16.0000) is less than ZVB4 (18.0000), the end time of this time pair is not the new “latest recorded clock out” for this shift and the time pair gets processed under <. Hence, this time pair is moved into output table using COLOP *.

     

    • Finally, the value of “earliest recorded clock out” time type ZVB3 and “latest recorded clock out” time type ZVB4 are 10.0000 and 18.0000 respectively.

     

     

     

    PCR ZVB6– The objective of PCR ZVB6 is to find the “first clock in” by comparing “earliest clock in” time type ZVB1 with “earliest clock out” time type ZVB3. If the value of ZVB1 is less than ZVB3, then ZVB1 is the “first clock in” and its value should be fed in time type ZVB5 – First Clock In.


    If the value of ZVB1 is more than ZVB3, then there is a “missing clock in”. The “missing clock in” is the “first clock in” and hence, the value of ZVB5 will be 0.0000.


    If ZVB1 was not created due to “missing clock in”, then the value of ZVB5 will be 0.0000 implying that there is a “missing clock in”.

     

    Below is a screenshot of PCR ZVB6.

     

    30.jpg

     

    • Scenario 1: “Earliest Recorded Clock In” Time Type ZVB1 not created and “Earliest Recorded Clock Out” Time Type ZVB3 has value 10.0000 - The PCR ZVB6 reads the value of “earliest recorded clock in” time type ZVB1 (blank) using HRS=DZVB1 and then subtracts the value of “earliest recorded clock out” time type ZVB3 (10.0000) using HRS-DZVB3. The result is compared with 0 using HRS?0 and since this is not greater than 0, it gets processed under *. The value of “earliest recorded clock in” time type ZVB1 is read using HRS=DZVB1 and is fed into “first clock in” time type ZVB5 using ADDDBZVB5Z. The value of ZVB5 is 0.0000 implying that the “first clock in” is missing.

     

    • Scenario 2: “Earliest Recorded Clock In” Time Type ZVB1 has value 08.0000 and “Earliest Recorded Clock Out” Time Type ZVB3 has value 10.0000 - The PCR ZVB6 reads the value of “earliest recorded clock in” time type ZVB1 (08.0000) using HRS=DZVB1 and then subtracts the value of “earliest recorded clock out” time type ZVB3 (10.0000) using HRS-DZVB3. The result is compared with 0 using HRS?0 and since this is not greater than 0, it gets processed under *. The value of “earliest recorded clock in” time type ZVB1 (08.0000) is read using HRS=DZVB1 and is fed into “first clock in” time type ZVB5 using ADDDBZVB5Z. Hence, the value of ZVB5 is 08.0000.


    • Scenario 3: “Earliest Recorded Clock In” Time Type ZVB1 has value 12.0000 and “Earliest Recorded Clock Out” Time Type ZVB3 has value 10.0000 - The PCR ZVB6 reads the value of “earliest recorded clock in” time type ZVB1 (12.0000) using HRS=DZVB1 and then subtracts the value of “earliest recorded clock out” time type ZVB3 (10.0000) using HRS-DZVB3. The result is compared with 0 using HRS?0 and since this is greater than 0, it gets processed under >. The result is compared with “earliest recorded clock in” time type ZVB1 (12.0000) using operation HRS?DZVB1 and since the result is less than the value of ZVB1, it gets processed under <. Using HRS=0.00, the value is set to 0 and then fed into “first clock in” time type ZVB5 using ADDDBZVB5Z. Hence, the value of ZVB5 is 0.0000 implying that the “first clock in” is missing.


    • Scenario 4: “Earliest Recorded Clock In” Time Type ZVB1 has value 08.0000 and “Earliest Recorded Clock Out” Time Type ZVB3 has value 0.0000 - The PCR ZVB6 reads the value of “earliest recorded clock in” time type ZVB1 (08.0000) using HRS=DZVB1 and then subtracts the value of “earliest recorded clock out” time type ZVB3 (0.0000) using HRS-DZVB3. The result is compared with 0 using HRS?0 and since this is greater than 0, it gets processed under >. The result is compared with “earliest recorded clock in” time type ZVB1 (08.0000) using operation HRS?DZVB1 and since the result is equal to the value of ZVB1, it gets processed under =. The value of “earliest recorded clock in” time type ZVB1 (08.0000) is read using HRS=DZVB1 and then fed into “first clock in” time type ZVB5 using ADDDBZVB5Z. Hence, the value of ZVB5 is 08.0000.

     

     

    PCR ZVB7– The objective of PCR ZVB7 is to find the “last clock out” by comparing “latest clock out” time type ZVB4 with “latest clock in” time type ZVB2. If the value of ZVB4 is greater than ZVB2, then ZVB4 is the “last clock out” and its value should be fed in time type ZVB6 – Last Clock Out.


    If the value of ZVB4 is less than ZVB2, then there is a “missing clock out”. The “missing clock out” is the “last clock out” and hence, the value of ZVB6 will be 0.0000.


    If ZVB4 was not created due to “missing clock out”, then the value of ZVB6 will be 0.0000 implying that there is a “missing clock out”.


    Below is a screenshot of PCR ZVB7.

     

    31.jpg

     

    • Scenario 1: “Latest Recorded Clock Out” Time Type ZVB4 not created and “Latest Recorded Clock In” Time Type ZVB2 has value 12.0000 - The PCR ZVB7 reads the value of “latest recorded clock out” time type ZVB4 (blank) using HRS=DZVB4 and then subtracts the value of “latest recorded clock in” time type ZVB2 (12.0000) using HRS-DZVB2. The result is compared with 0 using HRS?0 and since this is not greater than 0, it gets processed under *. Using HRS=0.00, the value is set to 0 and then fed into “last clock out” time type ZVB6 using ADDDBZVB6Z. Hence, the value of ZVB6 is 0.0000 implying that the “last clock out” is missing.

     

    • Scenario 2: “Latest Recorded Clock Out” Time Type ZVB4 has value 18.0000 and “Latest Recorded Clock In” Time Type ZVB2 has value 12.0000 - The PCR ZVB7 reads the value of “latest recorded clock out” time type ZVB4 (18.0000) using HRS=DZVB4 and then subtracts the value of “latest recorded clock in” time type ZVB2 (12.0000) using HRS-DZVB2. The result is compared with 0 using HRS?0 and since this is greater than 0, it gets processed under >. The value of “latest recorded clock out” time type ZVB4 (18.0000) is read using HRS=DZVB4 and then fed into “last clock out” time type ZVB6 using ADDDBZVB6Z. Hence, the value of ZVB6 is 18.0000.


    • Scenario 3: “Latest Recorded Clock Out” Time Type ZVB4 has value 14.0000 and “Latest Recorded Clock In” Time Type ZVB2 has value 16.0000 - The PCR ZVB7 reads the value of “latest recorded clock out” time type ZVB4 (14.0000) using HRS=DZVB4 and then subtracts the value of “latest recorded clock in” time type ZVB2 (16.0000) using HRS-DZVB2. The result is compared with 0 using HRS?0 and since this is not greater than 0, it gets processed under *. Using HRS=0.00, the value is set to 0 and then fed into “last clock out” time type ZVB6 using ADDDBZVB6Z. Hence, the value of ZVB6 is 0.0000 implying that the “last clock out” is missing.


    • Scenario 4: “Latest Recorded Clock Out” Time Type ZVB4 has value 18.0000 and “Latest Recorded Clock In” Time Type ZVB2 not created - The PCR ZVB7 reads the value of “latest recorded clock out” time type ZVB4 (18.0000) using HRS=DZVB4 and then subtracts the value of “latest recorded clock in” time type ZVB2 (0.0000) using HRS-DZVB2. The result is compared with 0 using HRS?0 and since this is greater than 0, it gets processed under >. The value of “latest recorded clock out” time type ZVB4 (18.0000) is read using HRS=DZVB4 and then fed into “last clock out” time type ZVB6 using ADDDBZVB6Z. Hence, the value of ZVB6 is 18.0000.

     

    By now, we have identified the “first clock in” and “last clock out” of a shift. We also have the solution logic in place to identify if the “first clock in” or “last clock out” of any shift is missing or not.

     

     

     

    PCR ZVB9 - The next step is to create a time pair using the “first clock in” and “last clock out” that we have determined and process only this time pair for further evaluation. Any other time pair if present gets eliminated from further processing.


    Below is the screenshot of PCR ZVB9.

     

    32.jpg

     

     

    The PCR ZVB9 uses VARSTFIRST to read the first time pair. If it is the first time pair, it gets processed under Y. Any other time pair gets stopped at N and doesn’t move to output table. In this way, we are ensuring that only one time pair will move to output table for further processing.


    The first time pair will be modified with the “first clock in” and “last clock out” data and will be moved to output for further processing.


    Below are the four possible scenarios that may happen.

     

    Scenario 1: Both “First Clock In” (ZVB5) and “Last Clock Out” (ZVB6) have value as 0.0000 – The first time pair moves for processing under Y. The value of “first clock in” time type ZVB5 (0.0000) is read using HRS=DZVB5 and then compared with 0 using HRS?0. Since the result is not greater than 0, the processing happens under *. Below things happen for the first time pair:


    • The start time of the time pair is deleted using FILLPB-
    • The start of record type (P10) is deleted using FILLPF
    • The no. of hours is reduced to 0.0000 using FILLPN

     

    Then the value of the “last clock out” time type ZVB6 (0.0000) is read using HRS=DZVB6 and then compared with 0 using HRS?0.           Since the result is not greater than 0, the processing happens under *. Below things happen for the first time pair:

     

    • The end time of the time pair is deleted using FILLPE-
    • The end of record type (P20) is deleted using FILLPG
    • The status of the time pair is changed to 1 using FILLP11 implying that both start and end times are missing from the time pair
    • The time pair is moved to output table for further processing using COLOP *.
    • Hence, the time pair has both “From” time and “To” time as blank.

     

     

    Scenario 2: “First Clock In” (ZVB5) and “Last Clock Out” (ZVB6) have value as 0.0000 and 18.0000 respectively – The first time pair moves for processing under Y. The value of “first clock in” time type ZVB5 (0.0000) is read using HRS=DZVB5 and then compared with 0 using HRS?0. Since the result is not greater than 0, the processing happens under *. Below things happen for the first time pair:


    • The start time of the time pair is deleted using FILLPB-
    • The start of record type (P10) is deleted using FILLPF
    • The no. of hours is reduced to 0.0000 using FILLPN

     

    Then the value of the “last clock out” time type ZVB6 (18.0000) is read using HRS=DZVB6 and then compared with 0 using HRS?0. Since the result is greater than 0, the processing happens under >. Below things happen for the first time pair:


    • The end time of the time pair is filled with value of “last clock out” time type ZVB6 (18.0000) using FILLPE.
    • The end of record type (P20) is added to time pair using FILLPG
    • The status of the time pair is changed to 2 using FILLP12 implying that clock in time is missing from time pair.
    • The time pair is moved to output table for further processing using COLOP *.
    • Hence, the time pair has “From” time and “To” time as blank and 18.0000 respectively.

     

     

    Scenario 3: “First Clock In” (ZVB5) and “Last Clock Out” (ZVB6) have value as 08.0000 and 0.0000 respectively – The first time pair moves for processing under Y. The value of “first clock in” time type ZVB5 (08.0000) is read using HRS=DZVB5 and then compared with 0 using HRS?0. Since the result is greater than 0, the processing happens under >. Below things happen for the first time pair:

     

    • The start time of the time pair is set from “first clock in” time type ZVB5 using FILLPB.
    • The start of record type (P10) is set for time pair using FILLPFP10.

     

    Then the value of the “last clock out” time type ZVB6 (0.0000) is read using HRS=DZVB6 and then compared with 0 using HRS?0. Since the result is not greater than 0, the processing happens under *. Below things happen for the first time pair:

     

    • The end time of the time pair is deleted using FILLPE-
    • The end of record type (P20) is deleted using FILLPG
    • The no. of hours is reduced to 0.0000 using FILLPN
    • The status of the time pair is changed to 3 using FILLP13 implying that clock out time is missing from time pair.
    • The time pair is moved to output table for further processing using COLOP *.
    • Hence, the time pair has “From” time and “To” time as 08.0000 and blank respectively.

     

     

    Scenario 4:  “First Clock In” (ZVB5) and “Last Clock Out” (ZVB6) have value as 08.0000 and 18.0000 – The first time pair moves for processing under Y. The value of “first clock in” time type ZVB5 (08.0000) is read using HRS=DZVB5 and then compared with 0 using HRS?0. Since the result is greater than 0, the processing happens under >. Below things happen for the first time pair:

     

    • The start time of the time pair is set from “first clock in” time type ZVB5 using FILLPB.
    • The start of record type (P10) is set for time pair using FILLPFP10.

     

    Then the value of the “last clock out” time type ZVB6 (18.0000) is read using HRS=DZVB6 and then compared with 0 using HRS?0. Since the result is greater than 0, the processing happens under >. Below things happen for the first time pair:

     

    • The end time of the time pair is set from “last clock out” time type ZVB6 (18.0000) using FILLPE.
    • The end of record type (P20) is set for time pair using FILLPGP20.
    • The status of the time pair is changed to 0 using FILLP10 implying that the pair is error free with both start time and end time.
    • The time pair is moved to output table for further processing using COLOP *.
    • Hence, the time pair has “From” time and “To” time as 08.0000 and 18.0000 respectively.

     

     

    The next step is to include these PCRs ZVB4, ZVB5, ZVB6, ZVB7 and ZVB9 in positive time management schema.


    A custom schema ZTCN is created by copying from standard time schema TM00 – Time Evaluation with Personnel Time Events.


    Below is a screenshot of the custom time schema ZTCN.

     

    33.jpg

     

    The PCRs ZVB4, ZVB5, ZVB6, ZVB7 and ZVB9 are included in time schema ZTCN as per the sequence shown in the above screenshot.


    PCRs ZVB4, ZVB5 and ZVB9 are being processed by function PTIP because TIP table is being processed in these PCRs. Par 2 is GEN because it is called for all time types.


    PCRs ZVB6 and ZVB7 are being processed by function ACTIO because TIP table is not being processed in these PCRs.


    I have included function PRINT after PCRs ZVB4 and ZVB5 to print table TES to display the value of time types ZVB1, ZVB2, ZVB3 and ZVB4 which get generated in these PCRs.


    In the same way, I have included function PRINT after PCRs ZVB6 and ZVB7 to print table TES to display the value of time types ZVB5 and ZVB6 which get generated in these PCRs.


    I tested around 22 different scenarios for this solution and all the scenarios passed with the desired result.

     

    Please refer the below screenshots for the results.

    54.jpg

    55.jpg

     

    56.jpg

     

    I will now pick up some scenarios from the 22 scenarios that I tested and show how the time events got processed in system.

     

    Testing Scenario 1:


    IT2011

     

    34.jpg


     

    P2011

     

    35.jpg

     

    Table TES

     

    36.jpg

     

    Final Pair Formed

     

    37.jpg

     

     

    Time Evaluation Result – It fails since last clock out is missing.

     

    38.jpg

     

     

    Testing Scenario 2:


    IT2011

     

    39.jpg

     

    P2011

     

    40.jpg

     

    Table TES

     

    41.jpg


    Final Pair Formed

     

    42.jpg

     

    Time Evaluation Result – It fails since first clock in is missing.

     

    43.jpg

     

     

    Testing Scenario 3:


    IT2011

     

    44.jpg

     

    P2011

     

    45.jpg

     

    Table TES

     

    46.jpg

     

    Final Pair Formation

     

    47.jpg

     

    Time Evaluation Result – It fails since last clock out is missing

     

    48.jpg

     

     

    Testing Scenario 4:


    IT2011

     

    49.jpg

     

    P2011

     

    50.jpg

     

    Table TES

     

    51.jpg

     

    Final Pair Formation

     

    52.jpg

     

    Time Evaluation Result – It is successful.

     

    53.jpg

     

    Here I come to the end of this knowledge artifact. Thank you for your patience for going through this document. I hope this knowledge artifact has been beneficial for you.

     

    Warm regards,

    Vivek Barnwal,

    vianshu@gmail.com


    Manage Multiple Languages in Custom Developments for OM

    $
    0
    0

    Hi,
    I posted this document in my non-SCN blog and it seems some people find it quite useful. So, I thought SCN members, particularly HR technical people, might find it useful as well:

     

    For objects in OM (as indeed for other PD-modules like Training and Events Management, Qualifications, etc.) you can easily capture texts in several languages. But you need to be aware of the concepts behind it, most notably, when you design custom developments for OM in a multi-lingual environment

     

    Capturing texts for all objects in all languages the system is used in can be quite an effort, so many organisations choose to be selective about which languages are used for which parts of the organisational structure. E.g. you might decide that:

    • everything needs to be available in English
    • all orgunits and jobs need to be available in the language the corporate HQ
      is using, say, for the sake of the argument, in Spanish
    • and data in other local languages are only used for the objects used in that
      particular country

     

    So, if everybody is following these rules (and we strongly recommend to define and communicate these rules as part of your global template), it can already be difficult enough, but then you can be sure that sometimes there will be an orgunit in, say, Germany, which hasn't been translated into English or Spanish.

     

    SAP provides a good tool to manage this problem. In table T778L, you can define, in which sequence the system should look for data, if it can't be found in the logon language:

    2013-07_01_T778L.JPG

     

     

    So, in this example, if you are logged in in Japanese and some orgunit you are seeing on the screen doesn't have a Japanese description, the system will show it in English instead. If English is not available, it will show it in Spanish, and so on. So, the SAP standard deals quite well with this issue, but how about your custom programs?

     

    Most developers follow the best practise of selecting language dependant content using the logon language of the user (available in system table as SYLANGU) and many think that this is enough. However, it is not necessarily. As shown above, a user might be logged on in a language where there is no text available and in this case, to be as good as SAP standard, you'd need to select using the language sequence of T778L. Failing to observe the language issue might not only lead to objects displayed with no description text. It might even lead to omitting whole orgunits from your report.

     

    If you use a simple statement like
    "SELECT * FROM HRP1000 WHERE ... and LANGU = SY-LANGU"
    then you would miss any orgunits in the system, which are only captured in other languages completely and without any hint something might go wrong. Imagine your CEO running a global headcount report and missing a whole country, because its top orgunit doesn't have its text translated into English!  Therefore, to be really clean, you should always select without using a language key first and then use the language sequence to determine the right description. Or make sure the SAP function modules or methods you are using are doing this for you.

     

    Of course, there may be bespoke circumstances in your organisation allowing for a simpler solution. It might be the case that you know for sure your org management is always going to be there in English only. In that case, you can go for a simpler solution. In that case, you might not even use SY-LANGU, but rather hard code the selection on "EN" to make sure anybody, who happens to log in with a different language, would still get a result.

    Debugging a process model

    $
    0
    0

    You create or maintain a process by transaction PEST; A simple example which will be used throughout this article is the following:

     

    Capture.PNG

     

    In this model, the unique root node is the German payroll driver RPCALCD0. It constitutes the first step of this process model. In the second and third step, payslips are printed by the RPCEDTD0, and payroll accounts are generated by the RPCKTOD0. In other words, the node "Payroll" has two children, namely the nodes for RPCEDTD0 and RPCKTOD0, respectively. One also says that these two nodes have the "Payroll" node as a parent. Note that an e-mail notification will be sent after the execution of RPCEDTD0. This is indicated by the symbol in the upper right corner of the corresponding box. Associated with this model is the selection program H99_SELECT_PERNR.

     

    A process model is executed via the HR Process Workbench which can be called by transaction PUST. The following diagram illustrates the program flow of a process in its simplest form:

     

     

    Capture.PNG

     

    With transaction SWEL you can monitor all events that have been raised by a process model. In our example the event trace looks as follows:
    Capture.PNG

    After these preparations, we are now in a position to collect some hints how to debug the above steps of a process model.

    • How to debug the selection program:
      1. Create a process in transaction PUST.
      2. Start this process by pressing F8.
      3. Choose "Immediately" on the upcoming pop-up.
      4. On the selection screen of the report, fill in the data, enter "/h" in the command field, press Enter, and execute the program.
        Capture.PNG

    From now on, we assume throughout that a process has already been carried out by transaction PUST.

    • How to debug the reports along with their variants used during a process:
      1. In transaction PUST, right-click on the number of the process you want to analyze. Go to "Display additional information" and keep in mind the starting time of this process.
      2. Start transaction SM37. Enter WF-BATCH as user name and choose the time appropriately around the starting time of the process. You obtain a list containing the jobs executed during the process. If you want to debug one of this jobs, mark the job in question, enter JDBG in the command field, and press Enter.
        Capture.PNG 

                                                                                                                                                                                                                                                                    

    • How to debug a single step of a process:
      1. Set a breakpoint in method DETERMINE_SUPPLIED_OBJECTS of class CL_HR_PM_PW_PROCESS_PROG at line 47 for the command  CALL METHOD me->modify_parcel_objects.
      2. Go to transaction SE37, choose HRPY_PROCESS_WORK_ON_EVENT as  function module, and press F8 (Test/Execute).
      3. In the following screen click on "Debugging".
      4. Press "Save" on the two upcoming pop-ups without entering anything.
      5. Press F7. After that, you are at the coding of HRPY_PROCESS_WORK_ON_EVENT.
      6. Press F6.
      7. Change the values of the variables H52SPS-PROCESSID, H52SPS-STEPID, EVT_NAME, P_CONT as follows:
        H52SPS-PROCESSIDprocess number from transaction PUST
        H52SPS-PROCESSID0000000001 for the first step, 0000000002 for the second step, etc.
        EVT_NAMEJOB_STARTED
        P_CONTX
        Capture.PNG
      8. At the breakpoint jump to the next statement by putting the cursor on the next statement in line 51 and choose "Goto Statement" in the "Debugger" menu. (Otherwise, the system recognizes that this step has already been performed and proceeds in a different way.)
      9. Note that the job generated by the function module is no longer planned by user WF-BATCH, but by the user who started the function module.

     

    • How to debug all children of a process step. This also enables you to monitor how the STEP_ENDED event is raised:
      1. Proceed similarly as for the first step, but at point 7. choose the appropriate values for the parent node:
        H52SPS-PROCESSIDprocess number from transaction PUST
        H52SPS-STEPIDthe step ID of the parent node
        H52SPS-RUNIDthe run ID of a finished run of the parent node from transaction PUST, e.g. 0000000001 for the first run
        H52SPS-PARAIDe.g. 000001
        EVT_NAMEJOB_ENDED
        P_CONTX
    • How to debug the communication such as e-mail notifications after a step has ended:
      1. Go to transaction SE37, choose HRPY_PROCESS_COMMUNI_ON_EVENT as  function module, and press F8 (Test/Execute).
      2. In the following screen click on "Debugging".
      3. Press "Save" on the two upcoming pop-ups without entering anything.
      4. Press F6.
      5. Change the values of the variables H52SPS-PROCESSID, H52SPS-STEPID, EVT_NAME, P_CONT as follows:
        H52SPS-PROCESSIDprocess number from transaction PUST
        H52SPS-STEPIDstep ID from PUST for the step you want to monitor, e.g. 0000000001

     


    Introducing HR Renewal 1.0, Feature Pack 4

    $
    0
    0

    In my recent blog, Implementing HR Renewal 1.0, Feature Pack 04,my co-authors Sherin Hanna and John Macy describe Continental's experience implementing Feature Pack 4. In this one, I'll provide some highlights about the content of Feature Pack 4.  The release is targeted to both professional and casual users and helps optimize how people do things and provides insights to aid in decision making.  There are additional enhancements as well - these are just some of the highlights.

    Optimize how people do things

     

    User experience for professional users

    Focus Areas - HR professionals

    • Full localization for additional countries (FP4 includes Australia, Canada, Switzerland, Germany, Mexico, Netherlands)
    • Best practice forms for hire, transfer, termination
    • Usage across roles
    • Search Lane for different user roles
    • Embedded Search
    • Faster search across large volumes of data

    Picture1.png

     

    User experience for casual users

    Focus Areas - Employees and managers

    • New Home Page based on SAP UI5
    • Lanes for:

    Approvals

    Work Feeds

    My Team

    My Team Services

    My Favorite KPIs

    Analytics

    Search

     

    Picture2.png

     

    • Team Calendar - Unified calendar for leave, travel, training, holidays, birthdays, anniversaries etc.
    • Leave Approval - Shows conflicts up front in the Team Calendar
    • Employee Profile - Card-based layout for Personal Profile, Talent, Compensation & Learning, graphical layout for Talent Grid & Compensation

     

    Picture3.png

    Workforce Viewer

    Focus Areas - Casual and professional users

    • Intuitive team visualization
    • Displays org unit, position and employee in same view
    • Customizable buttons
    • Quick View support (using pagination, move up / down, navigation)
    • Multiple Manager scenarios
    • Actions on multiple employees & roles (compare, perform evaluations etc.)
    • Accessibility for specially-abled people

     

    Picture4.png

    Picture5.png

     

     

     

    Provide insight to decide
    Transactional Analytics

    Focus Areas - Casual and professional users

    • Single point of access for reports / analytics
    • Info on 3 lanes: KPI, Status, Reporting
    • KPI Lane: 6 standard delivered KPIs along with a graphic display of status, threshold values and trend data; configurable
    • Status Lane
    • Reporting Lane (reports for managers to choose from, with data from various data sources)

     

    Picture6.jpg

     

    More information

     

     

    Here are the minimum requirements or pre-requisites to implement HR Renewal - HR Renewal requires ECC 6.0 and Enhancement Package 6 (EhP6) as a prerequisite.  The required components for installing HCM Renewal 1.0 FP4 are NW 731 SP07 , NW UI SP04 , GW Core 2.0 SP06 , IW_BEP 2.0 SP06 , IW_PGW 1.0 SP3

     

    For more details please see http://help.sap.com/erp_hcm_ias_2013_01 in the section HR Renewal 1.0 SP14.  While the title says FP3, there is information on this page for FP4.

     

    Which request includes my change(s)?

    $
    0
    0

    Sometimes during the project implementation you find you change a program or do customizing in a table but system does not request any new change request. This means your program / table is already included into another open(not released) request.

     

    In this case if you would separate your changes and send them into other servers(Q and P) you must take them out from other request and make your own request. For this you can do:

     

    1. Create a request thru SE01. Choose the same type of request which your changes are included. (Customizing / Workbench and so on)

     

    2- Right-mouse click on your request and choose "Include Objecs...".  Now you can include the other request and then delete not required objects and just keep your own objects.

     

    11.jpg

     

    12.jpg

     

         2.1 Otherwise you have to find the key of object one by one and add them. In this case double click on original request and in "Objects" tab you have object key in columns "Program ID", "Object Type" and "Object Name". You must copy all of them and past into your request.

     

    22.jpg

     

    Now if the question is which request includes my changes it's simple to find it. If you have a program go into SE38 and open it(display) or if you have a table go, for example thru SE11 and display it. Then in "Utilities" menu choose "Versions > Version management".

     

    21.jpg

     

    Here you will find the request name(number)

     

    23.jpg

     

    Hope this help functional consultants in this issue because having information about request structure and handling issues are important for a functional consultant.

     

    Omid

    Personnel Cost Planning: wrong calculation with calculation base pre org change

    $
    0
    0

    Many users are not aware of this issue, although it's been around for some time:

     

    Deriving a dependant cost item from a direct cost item in an earlier period doesn't work, if the cost object (e.g. employee) has changed its org unit since that period. Example: you have a business rule saying that the Xmas bonus paid in December equals x percent of the base salary plus overtime payments paid in September. This is easy to configure with standard configuration. No BAdI needed. However, If the employee has changed orgunit in October, this doesn't work. The bonus will be calculated as zero.

     

    This is due to the fundamental design of the planning run, which is running per org unit rather than per employee / cost object. Therefore, you can't even deal with this issue using custom programming in the planning run BAdI.

     

    We've been dealing with this by creating dummy cost items in the data collection BAdI, which are moved into the target period, where they can be used as calculation basis. When several cost items are affected, we also found it handy, to have these things configurable rather than all hard coded in the BAdI. No custom table needed - you can create a "dummy" planning context instead to hold the config for the dummy cost items. A quick and easy solution.

     

    However: like everything done in data collection, it can't respond to any changes made in detail planning. So, in these cases a manual correction would still be necessary.

     

    It would be interesting to know, who is aware of the problem, whom it is really bothering, and which solutions you may have found, particularly for detail planning. Please share your experience here.

     

    A solution by SAP doesn't seem to be planned. The issue is merely documented in note 888780, but the suggested "solution" is to make corrections manually. This could affect large numbers of employees and it's also some effort to find out, who's affected. So, not an acceptable solution in my book. Maybe it would help, if more customers are aware of the issue and push SAP for a solution either directly or through their respective user groups.

     

    This document was generated from the following discussion: The specified item was not found.

    SuccessFactors Employee Central Payroll - list of supported countries

    $
    0
    0

    SuccessFactors Employee Central Payroll supports the following 23 countries:

     

    • Australia
    • Austria
    • Brazil
    • Canada
    • Chile
    • China
    • Denmark
    • Finland
    • France
    • Hong Kong
    • India
    • Ireland
    • Italy
    • Japan
    • Malaysia
    • Mexico
    • Netherlands
    • Russia
    • Singapore
    • Spain
    • Sweden
    • United Kingdom
    • United States

    SuccessFactors - Useful Resources and Documents

    $
    0
    0

    This is a collection of the most useful SuccessFactors resources: documents, blogs, reports, and videos. This includes links that will cover an introduction to SuccessFactors, the acquisition by SAP, SAP's strategy, the BizX suite, integration, and other related documents and resources.

     

    Overview

    SAPexperts in-depth Special Report: SAP and SuccessFactors - An Overview (SAPexperts)

    SuccessFactors with SAP ERP HCM - SAP PRESS Bookstore (SAP PRESS)

     

    Market, Customer, and Consultant-related

    SAP and SuccessFactors – Staying Informed

    SuccessFactors named Market Leader in Six IDC Reports (SuccessFactors)

    Magic Quadrant for Talent Management Suites 2013 (Gartner)

    How to Transition from an SAP HCM to a SuccessFactors Consultant

    SuccessFactors and SAP HCM consulting: The Wild West of 2013

    The Future of SAP HCM and SuccessFactors Consulting - 2013 : CloudAve (Cloud Avenue)

    Future of SAP HCM [podcast] (SAP HCM Insights Podcast)

    The state of Talent Management in SAP HCM and Impact of SuccessFactors - With Thomas Otter [podcast] (SAP HCM Insights Podcast)

    SAP and SuccessFactors - Mobility, Innovation, Payroll and Charity

    SuccessFactors, The Future of SAP HCM Consulting, Project Execution, Training and more! [podcast] (SAP HCM Insights Podcast)

    Cloud: When & Why Whitepaper (SuccessFactors)

    Business Execution for Dummies (SuccessFactors)

    SAP Forum: Life after Lars [diginomica.com]

    Impact of DevOps and Cloud on SAP and ERP System Administrators (YouTube)

    How significant is SAP’s on-premise and Cloud licensing swap announcement?

     

    Solutions

    SAP Jam – SAP Help Portal Page (help.sap.com)

    SAP Jam Administrator Guide [PDF]

    SuccessFactors Onboarding: Taking a Fresh Approach to Employee Engagement and Retention              ... (SuccessFactors)

    Calibrate Employee Performance Through SuccessFactors [registration required] (SAPexperts)

    SuccessFactors Employee Central Time Off - Made for You! - YouTube (YouTube)

    SuccessFactors LMS vs SAP LSO – Some observations | NTT DATA Business Solutions | Australia (NTT Data Solutions)

    Comparison Between SAP ERP HCM E-Recruiting and SuccessFactors Recruiting [registration required] (SAPexperts)

    SuccessFactors Workforce Analytics or SAP Business Intelligence for Human Resources?

     

    Solutions: Employee Central

    Employee Central handbooks from SAP [s-user required]

    What’s New in SuccessFactors 1302 release for Employee Central, Platform and Admin Tools

    Implementing SuccessFactors Employee Central with a SAP background

    SAP HANA Cloud Platform: Turbocharge SuccessFactors Applications (YouTube)

    Eat like never before: SAP Networking Lunch

    Manage Mass Changes in SuccessFactors Employee Central [registration required] (SAPexperts)

     

    Solutions: Employee Central Payroll

    Employee Central handbooks from SAP [s-user required]

    SuccessFactors Employee Central Payroll - list of supported countries

    New SAP and SuccessFactors Cloud Payroll Offering

    EPI-USE Announces Its SAP-Qualified EPI-USE U.S./U.K./Australia Payroll Rapid-Deployment Solutions for SuccessFactors Employee Central Payroll | SuccessFactors (SuccessFactors)

     

    Technical, data model, and configuration

    Mapping SAP OM objects to SuccessFactors For a Hybrid Model

    SuccessFactors: The X Factor of Data Models

    Employee Central Entities and Interfacing

    Extending SuccessFactors with the Metadata Framework

    Rules and Picklists in the SuccessFactors Metadata Framework

     

    Integration Strategy

    SAP and SuccessFactors talent hybrid model: what lies ahead, plus a few small hidden jewels

    SAP HCM and SuccessFactors Integration Packages: an overview

    The Real Truth about SAP and SuccessFactors Integration

    SAP and SuccessFactors - "Proven" Integration is Hype

     

    Integration and Integration Packages

    SAP HCM and SuccessFactors Integration Packages: an overview

    Integration Add-on 1.0 for SAP HCM and SuccessFactors

    Integration Add-on 1.0 for SAP HCM and SuccessFactors: Support Package 2

    Integration Add-on 2.0 for SAP HCM and SuccessFactors

    Integration add-on 2.0 for SAP ERP HCM and SuccessFactors BizX – SAP Help Portal Page (help.sap.com)

    Integration Packages Administration Guide on SAP Service Marketplace [S-user required]

    Pilot Test of the Integration add-on for SAP ERP HCM & SuccessFactors BizX

    Integration Q&A: Managing employee compensation using SAP HCM and SuccessFactors

    Integration Q&A: Real-World Impressions on SAP and SuccessFactors Integration Add-On’s

    SAP HCM and SuccessFactors Biz X Employee Basic Data Integration RDS Demo - YouTube (YouTube)

    SAP HCM and SuccessFactors Biz X Compensation Integration RDS Demo - YouTube (YouTube)

    Employee Central – Employee Mini-Master Add-on Available

    Dell Boomi AtomSphere for SuccessFactors (Dell Boomi)

    How to integrate SuccessFactors talent data into SAP NetWeaver Business Warehouse?

    SAP Jam ABAP Integration - Configuration Guide for SP Level 5

    SAP Jam ABAP Integration - Configuration Guide for SP Level 6

    LSO-to-SuccessFactors LMS RDS | hyperCision, Inc. [HyperCision]

    PI Configuration Example (NWPI 1.0 SP2-4 & 2.0 SP0) [S-user required]

    PI Configuration Example (NWPI 1.0 SP6 & 2.0 SP2) [S-user required]

     

    Tips and Tricks

    Tip: Creating a single URL for logging directly into SuccessFactors BizX demo instance

    Single Sign-On to SuccessFactors from SAP HCM

     

    Acquisition by SAP and Roadmap

    Thoughts on SuccessFactors, Holiday Wish Lists for SAP HCM, and UNICEF [podcast] (SAP HCM Insights Podcast)

    SAP and SuccessFactors Acquisition Q&A (Cloud Avenue)

    News Analysis: SAP Buys SuccessFactors for $3.4B Signals SAP's Commitment To Cloud, HCM, and Social (Constellation Research)

    SAP to Buy Into Software as a Service With SuccessFactors Deal [PDF] (Garnter)

    SAP To Buy SuccessFactors: Major Shift In Talent Management Market (updated) (Bersin by Deloitte)

    SAP and SuccessFactors Roadmap Analysis (Cloud Avenue)

    SAP and SuccessFactors HCM Roadmap - With Amy Thistle [podcast] (SAP HCM Insights Podcast)


    Salary Comparison Report by creating Dynamic Internal Table

    $
    0
    0

    This report will show the data of given date ranges.

    The report is created using dynamic internal table creation.

     

    The Main Program

     

     

    ***********************************************************************
    * Description:This program will read the payroll results and display  *
    * them on ALV report.It will also compare the salary data               *
    *  between the provided date ranges                                                   *
    ***********************************************************************
    REPORT  zhrpy01.
    ***********************************************************************
    * INCLUDES                                                                                             *
    ***********************************************************************
    "---Include for all types and data
    INCLUDE zhrpy01_top.
    "---Include for selection screen
    INCLUDE zhrpy01_screen.
    "---Include for class and methods
    INCLUDE zhrpy01_class.
    "---Include for PBO
    INCLUDE zhrpy01_pbo.
    "---Include for PAI
    INCLUDE zhrpy01_pai.
    *&--------------------------------------------------------------------*
    *& INITIALIZATION
    *&--------------------------------------------------------------------*
    INITIALIZATION.
    "--initialize default data
    CREATE OBJECT o_sal_comp.
    *&--------------------------------------------------------------------*
    *& AT SELECTION SCREEN
    *&--------------------------------------------------------------------*
    AT SELECTION-SCREEN.
    IF o_sal_comp IS NOT BOUND.
    CREATE OBJECT o_sal_comp.
    ENDIF.
    *---Validate screen
    o_sal_comp
    ->m_validate_screen( ).
    *&--------------------------------------------------------------------*
    *& START OF SELECTION
    *&--------------------------------------------------------------------*
    START-OF-SELECTION.
    *&--------------------------------------------------------------------*
    *& Build field catalog first and than  create dynamic table
    *&--------------------------------------------------------------------*
    o_sal_comp
    ->m_build_field_catalog( ).
    CLEAR it_saldata.
    *&--------------------------------------------------------------------*
    *& GET PERNR
    *&--------------------------------------------------------------------*
    GET pernr.
    UNASSIGN <x_empdata>
    .
    APPEND INITIAL LINE TO it_empdata ASSIGNING <x_empdata>.
    IF <x_empdata> IS ASSIGNED.
    *&--------------------------------------------------------------------*
    * Get Action details
    rp
    -provide-from-last p0000 space s_date-low s_date-high.
    IF pnp-sw-found = c_1 AND p0000-stat2 = c_3.

    *&--------------------------------------------------------------------*
    * Get organnization details
    rp
    -provide-from-last p0001 space s_date-low s_date-high.
    IF pnp-sw-found = c_1.
    *&---PERNR
    <x_empdata>
    -pernr = p0001-pernr.
    *&---Employee Name
    <x_empdata>
    -ename = p0001-ename.
    *&---Cost Center
    <x_empdata>
    -kostl = p0001-kostl.
    *&---Department
    <x_empdata>
    -zzdept1 = p0001-zzdept1.
    *&---Section
    <x_empdata>
    -btrtl = p0001-btrtl.
    *&---Grade
    <x_empdata>
    -persk = p0001-persk.
    *&---SBU
    <x_empdata>
    -zzsbu1 = p0001-zzsbu1.
    *&---Segment
    <x_empdata>
    -zzseg1 = p0001-zzseg1.
    *&---Payroll Area
    <x_empdata>
    -abkrs = p0001-abkrs.
    ENDIF.
    *&--------------------------------------------------------------------*
    * Get Bank details
    rp
    -provide-from-last p0009 space s_date-low s_date-high.
    IF pnp-sw-found = c_1.
    *&---Bank Key
    <x_empdata>
    -bankl = p0009-bankl.
    *&---Account Number
    <x_empdata>
    -bankn = p0009-bankn.
    ENDIF.
    *&--------------------------------------------------------------------*
    * Get Dates
    rp
    -provide-from-last p0041 space s_date-low s_date-high.
    IF pnp-sw-found = c_1.
    CLEAR :gv_dar,gv_dat.
    *&---------------------------------------------------------------------*
    *& Do loop to check for hire date or original hire date
    DO 12 TIMES VARYING gv_dar FROM p0041-dar01 NEXT
    p0041
    -dar02
    VARYING gv_dat
    FROM p0041-dat01 NEXT
    p0041
    -dat02.
    *&---------------------------------------------------------------------*
    *& Check for Original date
    IF gv_dar = c_92.
    <x_empdata>
    -jdate = gv_dat.
    *&---------------------------------------------------------------------*
    *& Check for hire date
    ELSEIF gv_dar = c_95.
    <x_empdata>
    -rdate = gv_dat.
    ENDIF.
    CLEAR: gv_dar, gv_dat.
    ENDDO.
    ENDIF.
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Get Salary Details
    *&---------------------------------------------------------------------*

    *& Reading of the Payresult for all the Periods
    CLEAR: it_rgdir,it_rgdir_tmp,gv_relid,gv_type, gv_typename,
    ref_payresult
    , gv_molga, gv_type_1,gv_tadir.

    *&---------------------------------------------------------------------*
    * Get Sequence numbers
    CALL FUNCTION 'CU_READ_RGDIR'
    EXPORTING
    persnr         
    = pernr-pernr
    TABLES
    in_rgdir       
    = it_rgdir
    EXCEPTIONS
    no_record_found
    = 1
    OTHERS          = 2.
    IF sy-subrc = 0.
    *&---------------------------------------------------------------------*
    *PYXX_GET_RELID_FROM_PERNR
    CALL FUNCTION 'PYXX_GET_RELID_FROM_PERNR'
    EXPORTING
    employee                   
    = pernr-pernr
    IMPORTING
    relid                      
    = gv_relid
    molga                      
    = gv_molga
    EXCEPTIONS
    error_reading_infotype_0001
    = 1
    error_reading_molga        
    = 2
    error_reading_relid        
    = 3
    OTHERS                      = 4.
    IF sy-subrc NE 0.
    ENDIF.
    *&---------------------------------------------------------------------*
    *Verify the relid
    SELECT SINGLE typename
    FROM t52relid
    INTO gv_type
    WHERE relid EQ gv_relid
    AND tabname = 'PCL2'.
    IF sy-subrc NE 0.
    gv_relid
    = 'IN'.
    gv_type
    = 'PAYIN_RESULT'.
    ENDIF.
    gv_typename
    = gv_type.
    CREATE DATA ref_payresult TYPE (gv_typename).
    ASSIGN ref_payresult->* TO <x_payresult>.
    *      SRTZA--Status Of records.
    *      SRTZA = 'A' --Current Result.
    *      DELETE it_rgdir WHERE srtza NE 'A'.
    * PAYTY --> Payment Type ( Regular or Bonus)
    * PAYTY =  SPACE --'Regular Payroll'.
    * PAYTY = 'B'   --> 'Bonus'.
    *&---------------------------------------------------------------------*
    *Get Payroll Result
    IF it_rgdir IS NOT INITIAL.
    it_rgdir_tmp
    = it_rgdir.
    SORT it_rgdir_tmp BY seqnr DESCENDING.
    LOOP AT it_monthrange ASSIGNING <x_monthrange> WHERE type  = c_s.
    LOOP AT it_rgdir_tmp INTO wa_rgdir WHERE abkrs IN pnpabkrs
    AND srtza = 'A'
    AND fpbeg <= <x_monthrange>-endda
    AND fpend >= <x_monthrange>-begda .
    CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
    EXPORTING
    clusterid                   
    = gv_relid
    employeenumber              
    = pernr-pernr
    sequencenumber              
    = wa_rgdir-seqnr
    CHANGING
    payroll_result              
    = <x_payresult>
    EXCEPTIONS
    illegal_isocode_or_clusterid
    = 1
    error_generating_import     
    = 2
    import_mismatch_error       
    = 3
    subpool_dir_full            
    = 4
    no_read_authority           
    = 5
    no_record_found             
    = 6
    versions_do_not_match       
    = 7
    error_reading_archive       
    = 8
    error_reading_relid         
    = 9
    OTHERS                       = 10.
    IF sy-subrc EQ 0.
    ASSIGN COMPONENT 'INTER-RT'
    OF STRUCTURE <x_payresult> TO <x_rt>.
    LOOP AT <x_rt> INTO wa_rt.
    UNASSIGN <x_saldata>
    .
    APPEND INITIAL LINE TO it_saldata ASSIGNING <x_saldata>.
    IF <x_saldata> IS ASSIGNED.
    <x_saldata>
    -pernr = pernr-pernr.
    <x_saldata>
    -lgart = wa_rt-lgart.
    <x_saldata>
    -betrg = wa_rt-betrg.
    <x_saldata>
    -pabrj = <x_monthrange>-pabrj.
    <x_saldata>
    -pabrp = <x_monthrange>-pabrp.
    <x_saldata>
    -begda = <x_monthrange>-begda.
    <x_saldata>
    -endda = <x_monthrange>-endda.
    <x_saldata>
    -payty = wa_rgdir-payty.
    CONCATENATE c_s <x_monthrange>-monthnm <x_monthrange>-begda+0(4)
    INTO <x_saldata>-month.
    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDLOOP.
    ENDLOOP.
    *&---------------------------------------------------------------------*
    *If Comparison to be made
    IF s_cdate IS NOT INITIAL.
    LOOP AT it_monthrange ASSIGNING <x_monthrange> WHERE type  = c_c.
    CLEAR : wa_rgdir,wa_rt,<x_rt>,<x_payresult>.

    LOOP AT it_rgdir_tmp INTO wa_rgdir WHERE abkrs IN pnpabkrs
    AND srtza = 'A'
    AND fpbeg <= <x_monthrange>-endda
    AND fpend >= <x_monthrange>-begda .
    CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
    EXPORTING
    clusterid                   
    = gv_relid
    employeenumber              
    = pernr-pernr
    sequencenumber              
    = wa_rgdir-seqnr
    CHANGING
    payroll_result              
    = <x_payresult>
    EXCEPTIONS
    illegal_isocode_or_clusterid
    = 1
    error_generating_import     
    = 2
    import_mismatch_error       
    = 3
    subpool_dir_full            
    = 4
    no_read_authority           
    = 5
    no_record_found             
    = 6
    versions_do_not_match       
    = 7
    error_reading_archive       
    = 8
    error_reading_relid         
    = 9
    OTHERS                       = 10.
    IF sy-subrc EQ 0.
    UNASSIGN <x_rt>
    .
    ASSIGN COMPONENT 'INTER-RT'
    OF STRUCTURE <x_payresult> TO <x_rt>.
    LOOP AT <x_rt> INTO wa_rt.
    UNASSIGN <x_saldata>
    .
    APPEND INITIAL LINE TO it_saldata ASSIGNING <x_saldata>.
    IF <x_saldata> IS ASSIGNED.
    <x_saldata>
    -pernr = pernr-pernr.
    <x_saldata>
    -lgart = wa_rt-lgart.
    <x_saldata>
    -betrg = wa_rt-betrg.
    <x_saldata>
    -pabrj = <x_monthrange>-pabrj.
    <x_saldata>
    -pabrp = <x_monthrange>-pabrp.
    <x_saldata>
    -begda = <x_monthrange>-begda.
    <x_saldata>
    -endda = <x_monthrange>-endda.
    <x_saldata>
    -payty = wa_rgdir-payty.
    CONCATENATE c_c <x_monthrange>-monthnm <x_monthrange>-begda+0(4)
    INTO <x_saldata>-month.

    ENDIF.
    ENDLOOP.
    ENDIF.
    ENDLOOP.
    ENDLOOP.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    *&--------------------------------------------------------------------*
    *& END OF SELECTION
    *&--------------------------------------------------------------------*
    END-OF-SELECTION.
    IF it_saldata  IS NOT INITIAL.
    CLEAR: it_wagedata.
    o_sal_comp
    ->m_get_wage_data( ).
    o_sal_comp
    ->m_populate_final_table( ).
    IF <x_final> IS ASSIGNED.
    o_sal_comp
    ->m_display_data( ).
    ELSE.
    MESSAGE text-054  TYPE c_e.
    ENDIF.
    ENDIF.

     

     

     

    The top Include

     

    *&---------------------------------------------------------------------*

    *&  Include           ZHRPY01_TOP

    *&---------------------------------------------------------------------*

    CLASS cl_salary_comparison DEFINITION DEFERRED.

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

    *Tables                                                                *

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

    TABLES:

    pernr, pcl1, pcl2, pc260, pc261, pc207,t549a,t52ek,t52ep.

    INFOTYPES:

    0000, 0001,0041,0009.

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

    *Objects                                                               *

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

    DATA :

    o_sal_comp   TYPE REF TO cl_salary_comparison           ,

    o_cc         TYPE REF TO cl_gui_custom_container        ,

    o_split      TYPE REF TO cl_gui_easy_splitter_container ,

    o_top_cntnr  TYPE REF TO cl_gui_container               ,

    o_btm_cntnr  TYPE REF TO cl_gui_container               ,

    o_doc        TYPE REF TO cl_dd_document                 , "Document

    o_alv        TYPE REF TO cl_gui_alv_grid                .

     

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

    *Constants                                                             *

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

    CONSTANTS : c_e       TYPE  VALUE  'E'  ,

                 c_i       TYPE  VALUE  'I'  ,

                 c_c       TYPE  VALUE  'C'  ,

                 c_s       TYPE  VALUE  'S'  ,

                 c_x       TYPE  VALUE  'X'  ,

                 c_1       TYPE  VALUE  '1'  ,

                 c_2       TYPE  VALUE  '2'  ,

                 c_3       TYPE  VALUE  '3'  ,

                 c_92(2)   TYPE  VALUE  '92' ,

                 c_95(2)   TYPE  VALUE  '95' ,

                 c_40(2)   TYPE  VALUE  '40' ,

                 c_char(4) TYPE  VALUE  'STRG',

                 c_curr(4) TYPE  VALUE  'CURR',

                 c_dats(4) TYPE  VALUE  'DATS'.

     

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

    *Global Data                                                           *

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

    DATA gv_colpos     TYPE  VALUE  1     ,

             gv_dar        TYPE datar            ,

             gv_dat        TYPE dardt            ,

             gv_relid      TYPE t500l-relid      ,

             gv_type       TYPE t52relid-typename,

             gv_typename   TYPE hrpclx_type      ,

             ref_payresult TYPE REF TO data      ,

             gv_molga      TYPE molga            ,

             gv_type_1     TYPE tadir-obj_name   ,

             gv_tadir      TYPE tadir-obj_name   .

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

    *Types                                                                 *

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

    TYPES:

    *&---------------------------------------------------------------------*

    * Employee Data

    *&---------------------------------------------------------------------*

    BEGIN OF ty_empdata           ,

       pernr    TYPE pernr_d       ,    "Employee Number

       ename    TYPE emnam         ,    "Employee Name

       jdate    TYPE sy-datum      ,    "Joining Date

       rdate    TYPE sy-datum      ,    "Resignation Date

       kostl    TYPE kostl         ,    "Cost center

       zzdept1  TYPE zzdept1       ,    "Department

       btrtl    TYPE btrtl         ,    "Section

       persk    TYPE persk         ,    "Employee Sub Group

       zzsbu1   TYPE zzsbu1        ,    "SBU

       zzseg1   TYPE zzseg1        ,    "Segment

       abkrs    TYPE abkrs         ,    "Payroll Area

       bankl    TYPE bankk         ,    "Bank Key

       bankn    TYPE bankn         ,    "Account Number

       stat2    TYPE stat2         ,    "Employee Status

    END   OF ty_empdata           ,

    *&---------------------------------------------------------------------*

    *Salary Data

    *&---------------------------------------------------------------------*

    BEGIN OF ty_saldata           ,

       pernr    TYPE pernr_d       ,    "Employee Number

       lgart    TYPE lgart         ,    "Wage type

       pabrj     TYPE pabrj         ,

       pabrp     TYPE pabrp         ,

       payty    type c             ,

       begda     TYPE begda         ,

       endda     TYPE endda         ,

       betrg    TYPE maxbt         ,    "amount

       expct    TYPE sy-datum      ,    "Expense Category

       month(20) type c            ,

    END   OF ty_saldata           ,

    *&---------------------------------------------------------------------*

    *Wage Type Symbolic Account

    *&---------------------------------------------------------------------*

    BEGIN OF ty_wagedata          ,

       lgart    TYPE lgart         ,    "Wage type

       symko    TYPE p_komok40     ,    "Symbolic Account

    END   OF ty_wagedata          ,

    *&---------------------------------------------------------------------*

    *Wage Type GL Account

    *&---------------------------------------------------------------------*

    BEGIN OF ty_gldata            ,

       symko    TYPE p_komok40     ,    "Symbolic Account

       konth    TYPE saknr         ,    "GL Account number

    END   OF ty_gldata            ,

    *&---------------------------------------------------------------------*

    *Month Range

    *&---------------------------------------------------------------------*

    BEGIN OF ty_monthrange        ,

       type     TYPE c             ,    "type

       month(2) TYPE c             ,    "Month No

       monthnm  TYPE t247-ltx      ,    "Name

       year(4TYPE c             ,    "year

       permo     TYPE permo         ,

       pabrj     TYPE pabrj         ,

       pabrp     TYPE pabrp         ,

       begda     TYPE begda         ,

       endda     TYPE endda         ,

    END   OF ty_monthrange        ,

    *&---------------------------------------------------------------------*

    *Wage Type Text

    *&---------------------------------------------------------------------*

    BEGIN OF ty_wagetypetext      ,

       LGART    TYPE LGART         ,

       LGTXT    TYPE LGTXT         ,

    END   OF ty_wagetypetext      ,

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

    *Field symbols                                                         *

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

    FIELD-SYMBOLS:

      <x_empdata>          TYPE ty_empdata                     ,

      <x_saldata>          TYPE ty_saldata                     ,

      <x_csaldata>         TYPE ty_saldata                     ,

      <x_wagedata>         TYPE ty_wagedata                    ,

      <x_gldata>           TYPE ty_gldata                      ,

      <x_monthrange>       TYPE ty_monthrange                  ,

      <x_final>            TYPE STANDARD TABLE                 ,

      <x_wfinal>                                               ,

      <x_field>                                                ,

      <x_payresult>        TYPE ANY                            ,

      <x_rt>               TYPE hrpay99_rt                     ,

      <x_wagetypetext>     TYPE ty_wagetypetext                .

     

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

    *Global tables                                                         *

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

    DATA:

    it_empdata        TYPE STANDARD TABLE OF ty_empdata       ,

    it_saldata        TYPE STANDARD TABLE OF ty_saldata       ,

    it_wagedata       TYPE STANDARD TABLE OF ty_wagedata      ,

    it_gldata         TYPE STANDARD TABLE OF ty_gldata        ,

    it_csaldata       TYPE STANDARD TABLE OF ty_saldata       ,

    it_rgdir          TYPE STANDARD TABLE OF pc261            ,

    it_rgdir_tmp      TYPE STANDARD TABLE OF pc261            ,

    it_monthrange     TYPE STANDARD TABLE OF ty_monthrange    ,

    it_fieldcatalog   TYPE lvc_t_fcat                         ,

    it_wagetypetext   type STANDARD TABLE OF ty_wagetypetext  .

     

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

    *Global Work Area                                                      *

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

    DATA:

    wa_rt             TYPE pc207             ,

    wa_rgdir          TYPE pc261             ,

    wa_fieldcatalog   TYPE lvc_s_fcat        ,

    wa_layout         TYPE lvc_s_layo        .

     

     

    The Selection Screen

     

     

    *&---------------------------------------------------------------------*

    *&  Include           ZHRPY01_SCREEN

    *&---------------------------------------------------------------------*

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

    *& Selection screen

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

    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.

    SELECT-OPTIONS : s_date  FOR sy-datum   , "Date Range

                      s_cdate FOR sy-datum   . "Compare date

    SELECTION-SCREEN END OF BLOCK b1.


     

    The Class Include

     

    *&---------------------------------------------------------------------*

    *&  Include           ZHRPY01_CLASS

    *&---------------------------------------------------------------------*

    *----------------------------------------------------------------------*

    *       CLASS cl_salary_comparison DEFINITION

    *----------------------------------------------------------------------*

    *       Class Definition to define methods

    *----------------------------------------------------------------------*

    CLASS cl_salary_comparison DEFINITION FINAL.

       PUBLIC SECTION.

    *----------------------------------------------------------------------*

    *  DATA

    *----------------------------------------------------------------------*

    *----------------------------------------------------------------------*

    * METHODS

    *----------------------------------------------------------------------*

         METHODS:

    *---Method to validate screen inputs

         m_validate_screen                   ,

    *---Method to build field catalog

         m_build_field_catalog               ,

    *---Method to get the GL accoung for wage type

         m_get_wage_data                     ,

    *---Method to populate final table

         m_populate_final_table              ,

    *---Method to display data

         m_display_data                      ,

    *---Method to display alv

         m_display_alv                       .

       PRIVATE SECTION.

         METHODS:

    *---Method to build field catalog

         m_create_dynmc_table                ,

    *---Method to build field catalog

         m_set_layout                        ,

    *---Method to prepare top of page

         m_prepare_topofpage                 ,

    *---Method to set field catalog

         m_set_field_catalog

         IMPORTING p_field   TYPE lvc_fname

                   p_seltext TYPE lvc_txt

                   p_dosum   TYPE lvc_dosum

                   p_datatype TYPE datatype_d.

    ENDCLASS.                    "cl_Salary_comparison DEFINITION

    *----------------------------------------------------------------------*

    *       CLASS cl_salary_comparison IMPLEMENTATION

    *----------------------------------------------------------------------*

    *       Class implementation to implement methods

    *----------------------------------------------------------------------*

    CLASS cl_salary_comparison IMPLEMENTATION.

    *----------------------------------------------------------------------*

    *       CLASS m_validate_screen

    *----------------------------------------------------------------------*

    *       To Validate screen

    *----------------------------------------------------------------------*

       METHOD  m_validate_screen.

    *---Validate the Date

         IF s_date IS INITIAL.

           MESSAGE text-002 TYPE c_e.

         ENDIF.

         IF s_date-low IS NOT INITIAL AND s_date-high IS INITIAL.

           MESSAGE text-003 TYPE c_e.

         ENDIF.

         IF s_date-low IS INITIAL AND s_date-high IS NOT INITIAL.

           MESSAGE text-003 TYPE c_e.

         ENDIF.

    *---Validate the comparison Date

         IF s_cdate-low IS NOT INITIAL AND s_cdate-high IS INITIAL.

           MESSAGE text-003 TYPE c_e.

         ENDIF.

         IF s_cdate-low IS INITIAL AND s_cdate-high IS NOT INITIAL.

           MESSAGE text-003 TYPE c_e.

         ENDIF.

       ENDMETHOD.                    "m_validate_screen

    *----------------------------------------------------------------------*

    *       Method m_display_data

    *----------------------------------------------------------------------*

    *       To display data

    *----------------------------------------------------------------------*

       METHOD m_display_data.

         m_set_layout( ).

         CALL SCREEN 100.

       ENDMETHOD.                    "m_display_data

    *----------------------------------------------------------------------*

    *       Method m_set_layout_catalog

    *----------------------------------------------------------------------*

    *       To set field catalogs

    *----------------------------------------------------------------------*

       METHOD m_set_layout.

         wa_layout-zebra = c_x.

         wa_layout-numc_total = c_x.

         wa_layout-cwidth_opt = c_x.

       ENDMETHOD.                    "m_set_layout_catalog

    *----------------------------------------------------------------------*

    *       Method m_build_field_catalog

    *----------------------------------------------------------------------*

    *       To build field catalogs

    *----------------------------------------------------------------------*

       METHOD  m_build_field_catalog.

         DATA:it_t549q TYPE STANDARD TABLE OF t549q                .

         FIELD-SYMBOLS: <lx_t549q> LIKE LINE OF it_t549q           ,

                        <x_monthrange> LIKE LINE OF  it_monthrange .

         DATA:lv_month   TYPE t247-ltx                             ,

              lv_month1  TYPE t247-ltx                             ,

              lv_field   TYPE lvc_fname                            ,

              lv_seltext TYPE lvc_txt                              .

         CLEAR it_fieldcatalog.

    *---PERNR

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-005

             p_seltext  = text-006

             p_dosum    = space

             p_datatype = c_char.

    *---Name

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-007

             p_seltext  = text-008

             p_dosum    = space

             p_datatype = c_char.

    *---Joining Date

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-009

             p_seltext  = text-010

             p_dosum    = space

             p_datatype = c_dats.

    *---Resignation Date

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-011

             p_seltext  = text-012

             p_dosum    = space

             p_datatype = c_dats.

    *---Cost Center

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-013

             p_seltext  = text-014

             p_dosum    = space

             p_datatype = c_char.

    *---Department

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-015

             p_seltext  = text-016

             p_dosum    = space

             p_datatype = c_char.

    *---Section

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-017

             p_seltext  = text-018

             p_dosum    = space

             p_datatype = c_char.

    *---Grade

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-019

             p_seltext  = text-020

             p_dosum    = space

             p_datatype = c_char.

    *---SBU

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-021

             p_seltext  = text-022

             p_dosum    = space

             p_datatype = c_char.

    *---Segment

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-023

             p_seltext  = text-024

             p_dosum    = space

             p_datatype = c_char.

    *---Payroll Area

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-025

             p_seltext  = text-026

             p_dosum    = space

             p_datatype = c_char.

    *---Bank Key

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-027

             p_seltext  = text-028

             p_dosum    = space

             p_datatype = c_char.

    *---Account Number

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-029

             p_seltext  = text-030

             p_dosum    = space

             p_datatype = c_char.

    *---Wage Type

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-046

             p_seltext  = text-047

             p_dosum    = space

             p_datatype = c_char.

    *---Wage Type Text

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-055

             p_seltext  = text-056

             p_dosum    = space

             p_datatype = c_char.

    *---Symbolic Account

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-048

             p_seltext  = text-049

             p_dosum    = space

             p_datatype = c_char.

    *---GL Account

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-050

             p_seltext  = text-051

             p_dosum    = space

             p_datatype = c_char.

    *---Expense Category

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-052

             p_seltext  = text-053

             p_dosum    = space

             p_datatype = c_char.

    *----------------------------------------------------------------------*

    *Dynamic Columns

         CLEAR it_monthrange.

         CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'

           EXPORTING

             get_begda             = s_date-low

            get_endda             s_date-high

    *       GET_PERMO             = RPTIME_PERIOD

    *     IMPORTING

    *       GET_PABRJ             =

    *       GET_PABRP             =

          TABLES

            get_periods           = it_t549q

          EXCEPTIONS

            no_period_found       = 1

            no_valid_permo        = 2

            OTHERS                = 3

                   .

         IF sy-subrc <> 0.

           MESSAGE text-031 TYPE c_e.

         ELSE.

           LOOP AT it_t549q ASSIGNING <lx_t549q>.

             CLEAR lv_month.

             CALL FUNCTION 'ISP_GET_MONTH_NAME'

               EXPORTING

                date               = <lx_t549q>-begda

                 language           = sy-langu

    *           MONTH_NUMBER       = '00'

              IMPORTING

                langu_back         = sy-langu

                longtext           = lv_month

    *           SHORTTEXT          =

              EXCEPTIONS

                calendar_id        = 1

                date_error         = 2

                not_found          = 3

                wrong_input        = 4

                OTHERS             = 5.

             IF sy-subrc <> 0.

               MESSAGE text-032 TYPE c_e.

             ELSE.

               TRANSLATE lv_month TO UPPER CASE.

     

               UNASSIGN <x_monthrange>.

               APPEND INITIAL LINE TO it_monthrange ASSIGNING  <x_monthrange>.

               IF <x_monthrange> IS ASSIGNED.

                 <x_monthrange>-type   = c_s."s IS USED FOR DATE RANGE MONTHS

                 <x_monthrange>-month  = <lx_t549q>-begda+4(2).

                 <x_monthrange>-monthnm  = lv_month.

                 <x_monthrange>-year  = <lx_t549q>-begda+0(4).

                 <x_monthrange>-permo  = <lx_t549q>-permo.

                 <x_monthrange>-pabrj  = <lx_t549q>-pabrj.

                 <x_monthrange>-pabrp  = <lx_t549q>-pabrp.

                 <x_monthrange>-begda  = <lx_t549q>-begda.

                 <x_monthrange>-endda  = <lx_t549q>-endda .

                 CLEAR lv_field.

     

                 CONCATENATE c_s lv_month <lx_t549q>-begda+0(4) INTO lv_field.

                 CLEAR lv_seltext.

     

                 CONCATENATE lv_month <lx_t549q>-begda+0(4) INTO lv_seltext  SEPARATED BY '-'.

     

                 CALL METHOD m_set_field_catalog

                   EXPORTING

                     p_field    = lv_field

                     p_seltext  = lv_seltext

                     p_dosum    = c_x

                     p_datatype = c_curr.

               ENDIF.

             ENDIF.

           ENDLOOP.

         ENDIF.

    *----------------------------------------------------------------------*

    *If comparison to be made

         IF s_cdate IS NOT INITIAL.

           CLEAR it_t549q.

           CALL FUNCTION 'HR_PAYROLL_PERIODS_GET'

           EXPORTING

             get_begda             = s_cdate-low

            get_endda             s_cdate-high

    *       GET_PERMO             = RPTIME_PERIOD

    *     IMPORTING

    *       GET_PABRJ             =

    *       GET_PABRP             =

          TABLES

            get_periods           = it_t549q

          EXCEPTIONS

            no_period_found       = 1

            no_valid_permo        = 2

            OTHERS                = 3.

           IF sy-subrc <> 0.

             MESSAGE text-031 TYPE c_e.

           ELSE.

             LOOP AT it_t549q ASSIGNING <lx_t549q>.

               CLEAR: lv_month1,lv_month.

               CALL FUNCTION 'ISP_GET_MONTH_NAME'

                 EXPORTING

                  date               = <lx_t549q>-begda

                   language           = sy-langu

    *           MONTH_NUMBER       = '00'

                IMPORTING

                  langu_back         = sy-langu

                  longtext           = lv_month

    *           SHORTTEXT          =

                EXCEPTIONS

                  calendar_id        = 1

                  date_error         = 2

                  not_found          = 3

                  wrong_input        = 4

                  OTHERS             = 5.

               IF sy-subrc <> 0.

                 MESSAGE text-032 TYPE c_e.

               ELSE.

                 TRANSLATE lv_month TO UPPER CASE.

                 UNASSIGN <x_monthrange>.

                 APPEND INITIAL LINE TO it_monthrange ASSIGNING  <x_monthrange>.

                 IF <x_monthrange> IS ASSIGNED.

                   <x_monthrange>-type   = c_c."c IS USED FOR DATE RANGE MONTHS

                   <x_monthrange>-month  = <lx_t549q>-begda+4(2).

                   <x_monthrange>-monthnm  = lv_month.

                   <x_monthrange>-year  = <lx_t549q>-begda+0(4).

                   <x_monthrange>-permo  = <lx_t549q>-permo.

                   <x_monthrange>-pabrj  = <lx_t549q>-pabrj.

                   <x_monthrange>-pabrp  = <lx_t549q>-pabrp.

                   <x_monthrange>-begda  = <lx_t549q>-begda.

                   <x_monthrange>-endda  = <lx_t549q>-endda .

                   CLEAR lv_field.

                   CONCATENATE c_c lv_month <lx_t549q>-begda+0(4) INTO lv_field.

                   CLEAR lv_seltext.

                   CONCATENATE  lv_month <lx_t549q>-begda+0(4) INTO lv_seltext  SEPARATED BY '-'.

                   CALL METHOD m_set_field_catalog

                     EXPORTING

                       p_field    = lv_field

                       p_seltext  = lv_seltext

                       p_dosum    = c_x

                       p_datatype = c_curr.

                 ENDIF.

               ENDIF.

             ENDLOOP.

           ENDIF.

         ENDIF.

    *-- Actual Paid

         CALL METHOD m_set_field_catalog

           EXPORTING

             p_field    = text-035

             p_seltext  = text-036

             p_dosum    = c_x

             p_datatype = c_curr.

    *Create dynamic table

         m_create_dynmc_table( ).

    *&---------------------------------------------------------------------*

    * Create dynamic work area and assign to FS

         DATA :lr_line  TYPE REF TO data.

         CREATE DATA lr_line LIKE LINE OF <x_final>.

         ASSIGN lr_line->* TO <x_wfinal>.

       ENDMETHOD.                    "m_build_field_catalog

    *----------------------------------------------------------------------*

    *       Method m_set_field_catalog

    *----------------------------------------------------------------------*

    *       To set field catalogs

    *----------------------------------------------------------------------*

       METHOD  m_set_field_catalog.

    *----------------------------------------------------------------------*

    *Populate fieldcatalog for Dynamic table

         CLEAR  wa_fieldcatalog.

         wa_fieldcatalog-fieldname   = p_field.     "Field Name

         wa_fieldcatalog-seltext     = p_seltext.   "Text

         wa_fieldcatalog-coltext     = p_seltext.

         wa_fieldcatalog-do_sum      = p_dosum.

         wa_fieldcatalog-col_pos     = gv_colpos.    "Column position

         wa_fieldcatalog-datatype    = p_datatype.

         APPEND wa_fieldcatalog TO it_fieldcatalog.

    **----------------------------------------------------------------------*

    **Populate ALV fieldcatalogs

    *    CLEAR  wa_fieldcat.

    *    wa_fieldcat-fieldname   = p_field.

    *    wa_fieldcat-seltext_m   = p_seltext.

    *    wa_fieldcat-col_pos     = gv_colpos.

    *    APPEND wa_fieldcat TO it_fieldcat.

    *    gv_colpos = gv_colpos + 1.

       ENDMETHOD.                    "m_set_field_catalog

     

    *----------------------------------------------------------------------*

    *       Method m_set_layout_catalog

    *----------------------------------------------------------------------*

    *       To set field catalogs

    *----------------------------------------------------------------------*

       METHOD m_create_dynmc_table.

         DATA: lt_final TYPE REF TO data.

         CALL METHOD cl_alv_table_create=>create_dynamic_table

           EXPORTING

             it_fieldcatalog = it_fieldcatalog

           IMPORTING

             ep_table        = lt_final.

    *----------------------------------------------------------------------*

    *& Assign retrived structure to a field symbol

         UNASSIGN <x_final>.

         ASSIGN lt_final->* TO <x_final>.

         CLEAR: wa_fieldcatalog.

       ENDMETHOD.                    "m_create_dynmc_table

    *----------------------------------------------------------------------*

    *       Method m_get_wage_data

    *----------------------------------------------------------------------*

    *       To get wage type data

    *----------------------------------------------------------------------*

       METHOD m_get_wage_data.

         DATA : lt_temp  TYPE STANDARD TABLE OF ty_saldata ,

                lt_temp1 TYPE STANDARD TABLE OF ty_wagedata,

                lt_return_tab TYPE STANDARD TABLE OF bapiret2,

                lw_return_tab LIKE LINE OF lt_return_tab,

                lw_t52ek TYPE t52ek,

                lw_t52ep TYPE t52ep,

                lv_process TYPE ktosl,

                lv_gl_act TYPE acct_det_bf-gl_account.

         FIELD-SYMBOLS: <lx_temp1> TYPE ty_wagedata,

                        <lx_gldata> TYPE ty_gldata.

     

         CLEARit_wagedata,it_gldata.

    *----------------------------------------------------------------------*

    * Copy table of salary details into temp table to get unique wage types

         lt_temp = it_saldata.

         SORT lt_temp BY lgart ASCENDING.

    *----------------------------------------------------------------------*

    * Delete duplicate wagetypes

         DELETE ADJACENT DUPLICATES FROM lt_temp COMPARING lgart.

    *----------------------------------------------------------------------*

    * Get budgeted data

         CLEAR it_budgetdata.

         SELECT pernr frdat todat fyear lgart betrg

           FROM zbudget_upload

           INTO TABLE it_budgetdata

           FOR ALL ENTRIES IN lt_temp

           WHERE pernr = lt_temp-pernr

           AND   frdat <= s_date-high

           AND   todat  >= s_date-low

           AND   lgart = lt_temp-lgart.

         IF sy-subrc = 0.

           SORT it_budgetdata BY pernr lgart ASCENDING.

         ENDIF.

    *----------------------------------------------------------------------*

    * Get Wage type texts

         CLEAR it_wagetypetext.

         SELECT lgart lgtxt

           FROM t512t

           INTO TABLE it_wagetypetext

           FOR ALL ENTRIES IN lt_temp

           WHERE sprsl = sy-langu AND

                 molga = c_40     AND

                 lgart = lt_temp-lgart.

         IF sy-subrc = 0.

           SORT it_wagetypetext BY lgart ASCENDING.

         ENDIF.

    *----------------------------------------------------------------------*

    * Get symbolic account for filtered wagetypes

         SELECT lgart symko

           FROM t52el

           INTO TABLE it_wagedata

           FOR ALL ENTRIES IN lt_temp

           WHERE molga = c_40          AND

                 lgart = lt_temp-lgart AND

                 seqno > 0             AND

                 endda >= sy-datum.

    *          AND

    *            sign = '-'              .

         IF sy-subrc = 0.

    *----------------------------------------------------------------------*

    * Below code is written to get the GL Account for symbolic accounts

    *----------------------------------------------------------------------*

    * Copy the data of wage types ( Symbolic account ) into temp table

           lt_temp1 = it_wagedata.

           SORT lt_temp1 BY symko ASCENDING.

    *----------------------------------------------------------------------*

    * Delete duplicate symbolic accounts

           DELETE ADJACENT DUPLICATES FROM lt_temp1 COMPARING symko.

    *----------------------------------------------------------------------*

    * Loop the temp table to get the GL account

           LOOP AT lt_temp1 ASSIGNING <lx_temp1>.

    *----------------------------------------------------------------------*

    * Retrive the account assignment type

             SELECT SINGLE *

               FROM t52ek

               INTO lw_t52ek

               WHERE symko = <lx_temp1>-symko.

             IF sy-subrc EQ 0.

    *----------------------------------------------------------------------*

    * Retrive the account process

               SELECT SINGLE *

                 FROM t52ep

                 INTO lw_t52ep

                 WHERE koart = lw_t52ek-koart.

               IF sy-subrc EQ 0.

                 CLEAR: lv_process,lt_return_tab.

                 CONCATENATE 'HR' lw_t52ep-kttyp INTO lv_process.

    *----------------------------------------------------------------------*

    * Call the function module with below stated parameters and get the

    * GL account associated with Symbolic account

                 CALL FUNCTION 'HRPP_FI_ACCT_DET_HR'

                   EXPORTING

                     companycode       = 'DFPL'

                     process           = lv_process

                     symb_acct         = <lx_temp1>-symko

                     eg_acct_det       = ''

                     add_modif         = ''

                   IMPORTING

                     gl_account_debit  = lv_gl_act

    *                gl_account_credit = account_table-account_credit

                   TABLES

                     return_tab        = lt_return_tab.

    *----------------------------------------------------------------------*

    * Check the return table for error

                 IF lt_return_tab IS NOT INITIAL.

                   READ TABLE lt_return_tab INTO lw_return_tab

                   WITH KEY type = c_e.

                   IF sy-subrc = 0.

                     MESSAGE text-043 TYPE c_e.

                   ELSE.

                     UNASSIGN <lx_gldata>.

                     APPEND INITIAL LINE TO it_gldata ASSIGNING <lx_gldata>.

                     IF <lx_gldata> IS ASSIGNED.

                       <lx_gldata>-symko = <lx_temp1>-symko.

                       <lx_gldata>-konth = lv_gl_act.

                     ENDIF.

                   ENDIF.

                 ELSE.

                   UNASSIGN <lx_gldata>.

                   APPEND INITIAL LINE TO it_gldata ASSIGNING <lx_gldata>.

                   IF <lx_gldata> IS ASSIGNED.

                     <lx_gldata>-symko = <lx_temp1>-symko.

                     <lx_gldata>-konth = lv_gl_act.

                   ENDIF.

                 ENDIF.

               ENDIF.

             ENDIF.

           ENDLOOP.

         ENDIF.

       ENDMETHOD.                    "m_get_wage_data

    *----------------------------------------------------------------------*

    *       m_populate_final_table

    *----------------------------------------------------------------------*

    *       To populate the final table to process

    *----------------------------------------------------------------------*

       METHOD m_populate_final_table.

         DATA : lv_date(10TYPE c,

                lv_month(25) TYPE c,

                lv_type      TYPE c,

                lv_budgeted(15TYPE p DECIMALS 2,

                lv_actual(15)    TYPE p DECIMALS 2,

                lv_percent(5)    TYPE p DECIMALS 2.

    *--------------------------------------------------------------------*

         SORT it_saldata BY pernr lgart pabrj pabrp payty month ASCENDING betrg DESCENDING.

    *    DELETE ADJACENT DUPLICATES FROM it_saldata COMPARING pernr lgart pabrj pabrp month.

         SORT it_csaldata BY pernr lgart pabrj pabrp ASCENDING.

         SORT it_empdata BY pernr ASCENDING.

         SORT it_wagedata BY lgart ASCENDING.

         SORT it_gldata BY symko ASCENDING.

         SORT it_monthrange BY pabrj pabrp ASCENDING.

    *--------------------------------------------------------------------*

         LOOP AT it_saldata ASSIGNING <x_saldata>.

           AT NEW lgart.

             APPEND INITIAL LINE TO <x_final> ASSIGNING <x_wfinal>.

           ENDAT.

    *--------------------------------------------------------------------*

           IF <x_wfinal> IS ASSIGNED.

             READ TABLE it_empdata ASSIGNING <x_empdata>

             WITH KEY pernr = <x_saldata>-pernr

             BINARY SEARCH.

             IF <x_empdata> IS ASSIGNED.

    *pernr

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-005

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_saldata>-pernr.

               ENDIF.

    *empname

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-007

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-ename.

               ENDIF.

    *Joinind date

    *--------------------------------------------------------------------*

               IF <x_empdata>-jdate IS NOT INITIAL.

     

                 UNASSIGN <x_field>.

                 ASSIGN COMPONENT  text-009

                     OF STRUCTURE <x_wfinal> TO <x_field>.

                 IF <x_field> IS ASSIGNED.

                   <x_field> = <x_empdata>-jdate.

                 ENDIF.

               ENDIF.

    *Resignation Date

    *--------------------------------------------------------------------*

               IF  <x_empdata>-rdate IS NOT INITIAL.

                 UNASSIGN <x_field>.

                 ASSIGN COMPONENT  text-011

                     OF STRUCTURE <x_wfinal> TO <x_field>.

                 IF <x_field> IS ASSIGNED.

                   <x_field> = <x_empdata>-rdate.

                 ENDIF.

               ENDIF.

    *Cost Center

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-013

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-kostl.

               ENDIF.

    *Department

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-015

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-zzdept1.

               ENDIF.

    *Section

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-017

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-btrtl.

               ENDIF.

    *Grade

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-019

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-persk.

               ENDIF.

    *SBU

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-021

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-zzsbu1.

               ENDIF.

    *Segment

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-023

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-zzseg1.

               ENDIF.

    *Payroll area

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-025

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-abkrs.

               ENDIF.

    *Baank Key

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-027

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-bankl.

               ENDIF.

    *Account Number

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-029

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_empdata>-bankn.

               ENDIF.

    *Wage Type

    *--------------------------------------------------------------------*

               UNASSIGN <x_field>.

               ASSIGN COMPONENT  text-046

                   OF STRUCTURE <x_wfinal> TO <x_field>.

               IF <x_field> IS ASSIGNED.

                 <x_field> = <x_saldata>-lgart.

    *Wage type text

                 UNASSIGN <x_wagetypetext> .

                 READ TABLE it_wagetypetext ASSIGNING <x_wagetypetext>

                 WITH KEY lgart = <x_saldata>-lgart

                 BINARY SEARCH.

                 IF <x_wagetypetext> IS ASSIGNED.

                   UNASSIGN <x_field>.

                   ASSIGN COMPONENT  text-055

                       OF STRUCTURE <x_wfinal> TO <x_field>.

                   IF <x_field> IS ASSIGNED.

                     <x_field> = <x_wagetypetext>-lgtxt.

                   ENDIF.

                 ENDIF.

                 UNASSIGN <x_wagedata> .

                 READ TABLE it_wagedata ASSIGNING <x_wagedata>

                 WITH KEY lgart = <x_saldata>-lgart

                 BINARY SEARCH.

    *Symbolic account

                 IF <x_wagedata> IS ASSIGNED.

                   UNASSIGN <x_field>.

                   ASSIGN COMPONENT  text-048

                       OF STRUCTURE <x_wfinal> TO <x_field>.

                   IF <x_field> IS ASSIGNED.

                     <x_field> = <x_wagedata>-symko.

     

                     UNASSIGN <x_gldata>.

                     READ TABLE it_gldata ASSIGNING <x_gldata>

                     WITH KEY symko = <x_wagedata>-symko

                     BINARY SEARCH.

    *GL account

    *--------------------------------------------------------------------*

                     IF  <x_gldata> IS  ASSIGNED.

     

                       UNASSIGN <x_field>.

                       ASSIGN COMPONENT  text-050

                           OF STRUCTURE <x_wfinal> TO <x_field>.

                       IF <x_field> IS ASSIGNED.

                         <x_field> = <x_gldata>-konth.

                       ENDIF.

                     ENDIF.

    *--------------------------------------------------------------------*

                   ENDIF.

                 ENDIF.

     

               ENDIF.

    *Wage Type value

               UNASSIGN <x_monthrange>.

               READ TABLE it_monthrange ASSIGNING <x_monthrange>

               WITH KEY pabrj = <x_saldata>-pabrj

                        pabrp = <x_saldata>-pabrp

                        type  = <x_saldata>-month+0(1).

               IF <x_monthrange> IS ASSIGNED.

                 CLEAR lv_type.

                 lv_type = <x_monthrange>-type.

     

                 IF lv_type = c_s.

                   CONCATENATE c_s <x_monthrange>-monthnm <x_monthrange>-year

                 INTO lv_month.

                 ELSE.

                   CONCATENATE c_c <x_monthrange>-monthnm <x_monthrange>-year

                   INTO lv_month.

                 ENDIF.

     

                 CONDENSE lv_month.

                 UNASSIGN <x_field>.

                 ASSIGN COMPONENT  lv_month

                     OF STRUCTURE <x_wfinal> TO <x_field>.

                 IF <x_field> IS ASSIGNED.

                   IF <x_saldata>-payty = ''.

                     <x_field> <x_saldata>-betrg.

                   ELSE.

                     <x_field> = <x_field> + <x_saldata>-betrg.

                   ENDIF.

                 ENDIF.

               ENDIF.

    *--------------------------------------------------------------------*

    *Actual Paid

               IF lv_type = c_s.

                 UNASSIGN <x_field>.

                 ASSIGN COMPONENT  text-035

                     OF STRUCTURE <x_wfinal> TO <x_field>.

                 IF <x_field> IS ASSIGNED.

                   <x_field> = <x_field> + <x_saldata>-betrg.

                 ENDIF.

               ENDIF.

     

     

    *--------------------------------------------------------------------*

             ENDIF.

           ENDIF.

         ENDLOOP.

       ENDMETHOD.                    "m_populate_final_table

       METHOD m_display_alv.

         IF <x_final> IS ASSIGNED.

           IF o_alv IS NOT BOUND.

             "Create object for first container

             CREATE OBJECT o_cc

               EXPORTING

                 container_name              = 'CC_SALDATA'

               EXCEPTIONS

                 cntl_error                  = 1

                 cntl_system_error           = 2

                 create_error                = 3

                 lifetime_error              = 4

                 lifetime_dynpro_dynpro_link = 5

                 OTHERS                      = 6.

             IF sy-subrc <> 0.

               MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

             ELSE.

    *----------------------------------------------------------------------*

    *Create object for first ALV grid

    *----------------------------------------------------------------------*

               CREATE OBJECT o_split                       "split container obj

                 EXPORTING

                   parent            = o_cc

                   sash_position     = 20

                   with_border       = 1

                 EXCEPTIONS

                   cntl_error        = 1

                   cntl_system_error = 2

                   OTHERS            = 3.

               IF sy-subrc <> 0.

                 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

               ENDIF.

               o_top_cntnr = o_split->top_left_container .

               o_btm_cntnr = o_split->bottom_right_container .

               CREATE OBJECT o_doc

                 EXPORTING

                   style = 'ALV_GRID'.

               o_sal_comp->m_prepare_topofpage( ).

               CREATE OBJECT o_alv

                 EXPORTING

                   i_parent          = o_btm_cntnr

                 EXCEPTIONS

                   error_cntl_create = 1

                   error_cntl_init   = 2

                   error_cntl_link   = 3

                   error_dp_create   = 4

                   OTHERS            = 5.

               IF sy-subrc <> 0.

                 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

               ELSE.

                 CALL METHOD o_alv->list_processing_events

                   EXPORTING

                     i_event_name = 'TOP_OF_PAGE'

                     i_dyndoc_id  = o_doc.

     

                 "Display ALV grid

                 CALL METHOD o_alv->set_table_for_first_display

                   EXPORTING

                     is_layout                     = wa_layout

                   CHANGING

                     it_fieldcatalog               = it_fieldcatalog

                     it_outtab                     = <x_final>

                   EXCEPTIONS

                     invalid_parameter_combination = 1

                     program_error                 = 2

                     too_many_lines                = 3

                     OTHERS                        = 4.

                 IF sy-subrc <> 0.

                   MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

                 ENDIF.

               ENDIF.

             ENDIF.

           ELSE.

             o_alv->refresh_table_display( ).

           ENDIF.

         ELSE.

           MESSAGE text-054 TYPE c_e.

         ENDIF.

       ENDMETHOD.                    "m_display_alv

       METHOD m_prepare_topofpage.

         DATA : lv_daterange TYPE sdydo_text_element.

     

    *&---------------------------------------------------------------------*

    *&   Report Title

         CALL METHOD o_doc->add_text

           EXPORTING

             text         = text-044

             sap_fontsize = cl_dd_area=>medium

             sap_emphasis = cl_dd_area=>strong.

         CALL METHOD o_doc->new_line.

     

    *&---------------------------------------------------------------------*

    *&   Date Range

     

         CONCATENATE text-045 ` ` s_date-low+4(2) '.'

                     s_date-low+6(2) '.' s_date-low+0(4) 'To' s_date-high+4(2) '.'

                     s_date-high+6(2) '.' s_date-high+0(4)

                     INTO lv_daterange SEPARATED BY space.

         CALL METHOD o_doc->add_text

           EXPORTING

             text         = lv_daterange

             sap_fontsize = cl_dd_area=>medium

             sap_emphasis = cl_dd_area=>strong.

         CALL METHOD o_doc->new_line.

     

         CALL METHOD o_doc->display_document

           EXPORTING

             parent             = o_top_cntnr

           EXCEPTIONS

             html_display_error = 1

             OTHERS             = 2.

         IF sy-subrc <> 0.

           MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

         ENDIF.

     

       ENDMETHOD.                    "m_prepare_topofpage

    ENDCLASS.                    "cl_salary_comparison IMPLEMENTATION


    The PBO Include

     

    *&---------------------------------------------------------------------*

    *&  Include           ZHRPY01_PBO

    *&---------------------------------------------------------------------*

    *&---------------------------------------------------------------------*

    *&      Module  STATUS_0100  OUTPUT

    *&---------------------------------------------------------------------*

    *       Status at screen 100

    *----------------------------------------------------------------------*

    module STATUS_0100 output.

       SET PF-STATUS 'Z_SALCOMP'.

    *  SET TITLEBAR 'xxx'.

    endmodule.                 " STATUS_0100  OUTPUT

    *&---------------------------------------------------------------------*

    *&      Module  DISPLAY_ALV  OUTPUT

    *&---------------------------------------------------------------------*

    *       Display ALV grid

    *----------------------------------------------------------------------*

    module DISPLAY_ALV output.

    o_sal_comp->m_display_alv( ).

    endmodule.                 " DISPLAY_ALV  OUTPUT

     

    The PAI Include

     

    *&---------------------------------------------------------------------*

    *&  Include           ZHRPY01_PAI

    *&---------------------------------------------------------------------*

    *&---------------------------------------------------------------------*

    *&      Module  USER_COMMAND_0100  INPUT

    *&---------------------------------------------------------------------*

    *       User command on screen 100

    *----------------------------------------------------------------------*

    MODULE user_command_0100 INPUT.

       CASE sy-ucomm .

         WHEN 'BACK' OR 'RW' OR '%EX' .

           LEAVE SCREEN .

       ENDCASE .

    ENDMODULE.                 " USER_COMMAND_0100  INPUT

     

     

     


    Employee Hiring Details using PNP

    $
    0
    0

    MAIN

    ************************************************************************
    * Object Name : REPORT  ZHCM_ASMNT1PNP. *
    * Author/Company Name : Krishnakant Joshi / *
    * Transport Request *
    * Creation Date * 01/21/2013
    ************************************************************************
    * Description: *  Employee hiring details
    ************************************************************************
    * Dependencies *
    ************************************************************************
    * Modification History *
    ************************************************************************
    * Date Programmer Client Ref No. Description Correction *
    ************************************************************************
    REPORT  zhcm_asmnt1pnp.
    *&**********************************************************************
    *&    INCLUDE
    *&**********************************************************************
    INCLUDE : zhcm_asmnt1pnp_top,    "Global Types and Data
    zhcm_asmnt1pnp_form.  
    "Subroutines
    *&**********************************************************************
    *&    INITIALIZATION.
    *&**********************************************************************
    INITIALIZATION.
    v_repid = sy-repid.
    *&**********************************************************************
    *&    AT SELECTION-SCREEN
    *&**********************************************************************
    AT SELECTION-SCREEN.
    *&**********************************************************************
    *&    START-OF-SELECTION
    *&**********************************************************************
    START-
    OF-SELECTION.
    PERFORM get_texts.
    SORT: i_t513s BY stell,
    i_t530t
    BY massn massg,
    i_t529t
    BY massn.
    *&**********************************************************************
    *&    GET PERNR.
    *&**********************************************************************
    GET pernr.
    DATA : w_final TYPE t_final,
    v_dar
    TYPE datar,
    v_dat
    TYPE dardt.
    *&---------------------------------------------------------------------*
    *& Local data for prosessing
    DATA : w_t529t  TYPE t_t529t,
    w_t530t 
    TYPE t_t530t,
    w_t513s 
    TYPE t_t513s,
    w_t548t 
    TYPE t_t548t,
    lw_p0000
    TYPE p0000.
    *&---------------------------------------------------------------------
    *& Get Date specifications
    rp-
    provide-from-last p0041 space pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    *&---------------------------------------------------------------------*
    *& Do loop to check for hire date or original hire date
    DO12TIMES VARYING v_dar FROM p0041-dar01 NEXT
    p0041-dar02
    VARYING v_dat
    FROM p0041-dat01 NEXT
    p0041-dat02.
    *&---------------------------------------------------------------------*
    *& Check for Original date
    IF v_dar = c_16.
    w_final-dat01 = v_dat.
    w_final-dtext = v_dar.
    *&---------------------------------------------------------------------*
    *& Check for hire date
    ELSEIF v_dar = c_u1.
    w_final-dat01 = v_dat.
    w_final-dtext = v_dar.
    EXIT.
    ENDIF.
    CLEAR: v_dar, v_dat.
    ENDDO.
    IF w_final-dat01 ISINITIAL.
    REJECT.
    ENDIF.
    ENDIF.
    *&---------------------------------------------------------------------
    *& Get action data
    rp-
    provide-from-last p0000 space pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    DELETE p0000[] WHERE stat2 <> 3.
    IF p0000[] ISNOTINITIAL.
    SORT p0000 BY endda DESCENDING.
    READTABLE p0000 INTO lw_p0000 INDEX1.
    w_final-pernr = lw_p0000-pernr.
    "Employee number
    w_final-begda = lw_p0000-begda.
    "Start date
    READTABLE i_t529t INTO w_t529t
    WITHKEY massn = lw_p0000-massn
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-mntxt = w_t529t-mntxt.
    "Action text
    ENDIF.
    IF lw_p0000-massg ISNOTINITIALAND lw_p0000-massn  ISNOTINITIAL.
    CLEAR w_t530t.
    *&---------------------------------------------------------------------*
    *& Populate Action reason text
    READTABLE i_t530t INTO w_t530t
    WITHKEY massn = lw_p0000-massn
    massg = lw_p0000-massg
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-mgtxt = w_t530t-mgtxt.
    "Action reason text
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    *&---------------------------------------------------------------------
    *& Get organizational assignments
    rp-
    provide-from-last p0001 space pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    w_final-werks = p0001-werks.
    w_final-orgeh = p0001-orgeh.
    w_final-kostl = p0001-kostl.
    *&---------------------------------------------------------------------*
    *& Populate job text
    CLEAR w_t513s.
    READTABLE i_t513s INTO w_t513s
    WITHKEY stell = p0001-stell
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-stltx = w_t513s-stltx.
    ENDIF.
    ENDIF.
    *&---------------------------------------------------------------------
    *& Get Personal data
    rp-
    provide-from-last p0002 space pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    w_final-vorna = p0002-vorna.
    "First name
    w_final-nachn = p0002-nachn.
    "Last name
    CASE p0002-gesch. "Gender
    WHEN c_1.
    w_final-gesch =
    text-037.
    WHEN c_2.
    w_final-gesch =
    text-038.
    WHENOTHERS.
    w_final-gesch =
    text-039.
    ENDCASE.
    w_final-gbdep = p0002-gbdep.
    w_final-gbdat = p0002-gbdat.
    ENDIF.
    *&---------------------------------------------------------------------
    *& Get Address details
    rp-
    provide-from-last p0006 c_1 pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    w_final-pstlz = p0006-pstlz.
    ENDIF.
    *&---------------------------------------------------------------------
    *& Get Basic Pay details
    rp-
    provide-from-last p0008 space pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    w_final-ansal = p0008-ansal.
    "Annual salary
    ENDIF.
    *&---------------------------------------------------------------------
    *& Get Email details
    rp-
    provide-from-last p0105 c_0010 pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    w_final-usrid_long = p0105-usrid_long.
    "Email
    ENDIF.
    *&---------------------------------------------------------------------
    *& Append work area
    IF w_final-dat01 ISNOTINITIAL.
    CLEAR w_t548t.
    *&---------------------------------------------------------------------*
    *& Populate date text
    READTABLE i_t548t INTO  w_t548t
    WITHKEY datar = w_final-dtext.
    IF sy-subrc = 0.
    w_final-dtext = w_t548t-dtext.
    "Date text
    ENDIF.
    APPEND w_final TO i_final.
    CLEAR w_final.
    ENDIF.
    *&**********************************************************************
    *&    END-OF-SELECTION
    *&**********************************************************************
    END-OF-SELECTION.
    IF i_final ISNOTINITIAL.
    PERFORM  build_fieldcatalog.
    PERFORM  set_layout.
    PERFORM  display_alv_report.
    ELSE.
    MESSAGEtext-046  TYPE c_i.
    ENDIF.

     
     

     

    TOP

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT1PNP_TOP
    *&---------------------------------------------------------------------*

    TYPE-POOLS: slis.
    TABLES: pernr.
    INFOTYPES: 0000, 0001, 0002, 0006, 0008, 0041, 0105.
    *&---------------------------------------------------------------------*
    TYPES:
    *&---------------------------------------------------------------------*
    *&     Date text
    BEGINOF t_t548t,
    datar    
    TYPE  datar,
    dtext    
    TYPE datax,
    ENDOF   t_t548t,
    *&---------------------------------------------------------------------*
    *&     Personnel Action Texts
    BEGINOF t_t529t,
    massn    
    TYPE  massn,  "Action Type
    mntxt    
    TYPE  mntxt,  "Name of Action Type
    ENDOF   t_t529t,
    *&---------------------------------------------------------------------*
    *&     Reason for Action Texts
    BEGINOF t_t530t,
    massn    
    TYPE  massn,  "Action Type
    massg    
    TYPE  massg,  "Reason for Action
    mgtxt    
    TYPE  mgtxt,  "Name of reason for action
    ENDOF   t_t530t,
    *&---------------------------------------------------------------------*
    *&     Job Titles
    BEGINOF t_t513s,
    stell    
    TYPE  stell,  "Job
    stltx    
    TYPE  stltx,  "Job Title
    begda    
    TYPE  begda,  "Start Date
    endda    
    TYPE  endda,  "End Date
    ENDOF   t_t513s,
    *&---------------------------------------------------------------------*
    *&     Final table
    BEGINOF t_final,
    pernr    
    TYPE pernr,
    begda    
    TYPE begda,
    mntxt    
    TYPE mntxt,
    mgtxt    
    TYPE mgtxt,
    vorna    
    TYPE pad_vorna,
    nachn    
    TYPE pad_nachn,
    gesch    
    TYPE char20,
    gbdep    
    TYPE gbdep,
    pstlz    
    TYPE pstlz_hr,
    werks    
    TYPE persa,
    stltx    
    TYPE stltx,
    orgeh    
    TYPE orgeh,
    kostl    
    TYPE kostl,
    gbdat    
    TYPE gbdat,
    usrid_long 
    TYPE comm_id_long,
    dtext    
    TYPE datax,
    dat01    
    TYPE dardt,
    ansal    
    TYPE ansal,
    ENDOF t_final.
    *&**********************************************************************
    *&   Data
    *&**********************************************************************
    DATA:  i_t529t  TYPESTANDARDTABLEOF t_t529t,
    i_t530t 
    TYPESTANDARDTABLEOF t_t530t,
    i_t513s 
    TYPESTANDARDTABLEOF t_t513s,
    i_final 
    TYPESTANDARDTABLEOF t_final,
    i_t548t 
    TYPESTANDARDTABLEOF t_t548t.
    DATA: i_fieldcatalog TYPETABLEOF slis_fieldcat_alv,
    w_fieldcatalog
    TYPE slis_fieldcat_alv,
    v_repid    
    LIKE sy-repid,
    v_gridtitle
    TYPE lvc_title,
    w_layout
    TYPE slis_layout_alv.
    DATA : v_colpos TYPEiVALUE  1.
    *&**********************************************************************
    *&   Constants
    *&**********************************************************************
    CONSTANTS : c_x TYPEcVALUE'X',
    c_h
    TYPEcVALUE'H',
    c_i
    TYPEcVALUE'I',
    c_s
    TYPEcVALUE'S',
    c_1
    TYPEcVALUE'1',
    c_2
    TYPEcVALUE'2',
    c_u1
    TYPE char02 VALUE'U1',
    c_16
    TYPE char02 VALUE'16',
    c_0010
    TYPE char04 VALUE'0010'.

     
     

     

    FORM

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT1PNP_FORM
    *&---------------------------------------------------------------------*
    *----------------------------------------------------------------------*
    * Form build_fieldcatalog *
    *----------------------------------------------------------------------*
    * This form is used set field catalog
    *----------------------------------------------------------------------*
    FORM build_fieldcatalog .
    * SET Field Catalog
    PERFORM set_fieldcatalog USINGtext-019text-001,
    text-020text-018,
    text-021text-002,
    text-022text-003,
    text-023text-004,
    text-024text-005,
    text-025text-006,
    text-026text-007,
    text-027text-008,
    text-028text-009,
    text-029text-010,
    text-030text-011,
    text-031text-012,
    text-032text-013,
    text-033text-014,
    text-034text-015,
    text-035text-016,
    text-036text-017.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *----------------------------------------------------------------------*
    * Form display_alv_report *
    *----------------------------------------------------------------------*
    * This form is used to display report
    *----------------------------------------------------------------------*
    FORM display_alv_report .
    v_gridtitle =
    text-042.
    * ALV GRID DISPLAY Function Module call---------------------------------
    CALLFUNCTION'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program     = v_repid
    i_callback_top_of_page =
    'TOP_OF_PAGE'
    it_fieldcat            = i_fieldcatalog
    is_layout              = w_layout
    i_grid_title           = v_gridtitle
    TABLES
    t_outtab               = i_final
    EXCEPTIONS
    program_error          =
    1
    OTHERS                 = 2.
    IF sy-subrc <> 0.
    MESSAGEID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM.                    "display_alv_report

    *----------------------------------------------------------------------*
    * Form set_fieldcatalog *
    *----------------------------------------------------------------------*
    * This form is used to set field catalog
    *----------------------------------------------------------------------*
    FORM set_fieldcatalog  USING p_field type slis_fieldname
    p_seltext
    type SCRTEXT_M .
    CLEAR  w_fieldcatalog.
    w_fieldcatalog-fieldname   = p_field.
    w_fieldcatalog-seltext_m   = p_seltext.
    w_fieldcatalog-col_pos     = v_colpos.
    w_fieldcatalog-do_sum      = c_x.
    APPEND w_fieldcatalog TO i_fieldcatalog.
    v_colpos = v_colpos +
    1.
    ENDFORM.                    " set_fieldcatalog
    *----------------------------------------------------------------------*
    * Form set_layout *
    *----------------------------------------------------------------------*
    * This form is used to set report layout
    *----------------------------------------------------------------------*
    FORM set_layout.
    w_layout-no_hotspot = c_x.
    w_layout-zebra  = c_x.
    w_layout-colwidth_optimize = c_x.
    ENDFORM.                    "set_layout

    *----------------------------------------------------------------------*
    * top_of_page *
    *----------------------------------------------------------------------*
    * This form is used to set top of page
    *----------------------------------------------------------------------*
    FORM top_of_page.
    DATA : li_header TYPETABLEOF slis_listheader,
    lw_header
    TYPE slis_listheader,
    lv_count
    TYPEi,
    lv_date
    TYPE char10.
    lw_header-info =
    text-042.
    lw_header-
    key = text-045.
    lw_header-typ = c_h.
    APPEND lw_header TO li_header.
    CLEAR lw_header.
    DESCRIBETABLE i_final LINES lv_count.
    WRITE lv_count TO lw_header-info.
    "lw_header-info = lv_date.
    lw_header-
    key = text-043.
    lw_header-typ = c_s.
    APPEND lw_header TO li_header.
    CLEAR lw_header.
    WRITE: sy-datum TO lv_date USINGEDITMASK'__/__/____'.
    lw_header-info = lv_date.
    lw_header-
    key = text-044.
    lw_header-typ = c_s.
    APPEND lw_header TO li_header.
    CALLFUNCTION'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = li_header.
    ENDFORM.                    "TOP_OF_PAGE
    *&---------------------------------------------------------------------*
    *&      Form  GET_TEXTS
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    FORM get_texts .
    *&---------------------------------------------------------------------*
    *& Get Date text
    SELECT datar dtext
    FROM t548t
    INTOTABLE i_t548t
    WHERE sprsl = sy-langu AND ( datar = c_u1 OR datar = c_16 ).
    *&---------------------------------------------------------------------*
    *& Get Job title
    SELECT stell stltx endda begda
    FROM t513s
    INTOTABLE i_t513s
    WHERE sprsl = sy-langu.
    *&---------------------------------------------------------------------
    *& Action Texts
    SELECT massn mntxt
    INTOTABLE i_t529t
    FROM t529t
    WHERE  sprsl = sy-langu.
    *&---------------------------------------------------------------------
    *& Reason for Action Texts
    SELECT massn massg mgtxt
    INTOTABLE i_t530t
    FROM t530t
    WHERE sprsl = sy-langu.
    ENDFORM.                    " GET_TEXTS

    Employee Hiring Details ( Without PNP)

    $
    0
    0

    MAIN

    ************************************************************************
    * Object Name : REPORT  ZHCM_ASMNT1. *
    * Author/Company Name : Krishnakant Joshi*
    * Transport Request *
    * Creation Date * 01/17/2012
    ************************************************************************
    * Description: *  Report to Get Employees Hiring Details
    ************************************************************************
    * Dependencies *
    ************************************************************************
    * Modification History *
    ************************************************************************
    * Date Programmer Client Ref No. Description Correction *
    ************************************************************************
    REPORT  zhcm_asmnt1.
    *&**********************************************************************
    *&    INCLUDE
    *&**********************************************************************
    INCLUDE : zhcm_asmnt1_top,    "Global Types and Data
    zhcm_asmnt1_screen,
    "Screen Design
    zhcm_asmnt1_class, 
    "Class
    zhcm_asmnt1_pbo,   
    "PBO
    zhcm_asmnt1_pai.   
    "PAI

    *&**********************************************************************
    *&    INITIALIZATION
    *&**********************************************************************
    INITIALIZATION.
    *& Create object
    CREATE OBJECT o_empdata.
    *&**********************************************************************
    *&    AT SELECTION-SCREEN
    *&**********************************************************************
    AT SELECTION-SCREEN.
    o_empdata->validation( ).
    *&**********************************************************************
    *&    START-OF-SELECTION
    *&**********************************************************************
    START-
    OF-SELECTION.
    o_empdata->get_data( ).
    "Populate internal tables
    *&**********************************************************************
    *&    END-OF-SELECTION
    *&**********************************************************************
    END-OF-SELECTION.
    IF i_final ISNOTINITIAL.
    o_empdata->display_alv( ).
    "Populate internal tables
    ELSE.
    MESSAGEtext-002TYPE c_i.
    Leave LIST-PROCESSING.
    ENDIF.

     
     

     

    TOP:

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT1_TOP
    *&---------------------------------------------------------------------*
    CLASS cl_empdata DEFINITION DEFERRED.
    *&**********************************************************************
    *&   TYPES
    *&**********************************************************************
    TYPES :
    *&  Actions
    BEGINOF t_pa0000,
    pernr    
    TYPE persno,
    endda    
    TYPE endda,
    begda    
    TYPE begda,
    massn    
    TYPE massn,   "Action Type
    massg    
    TYPE massg,   "Reason for Action
    ENDOF   t_pa0000,
    *&  Org. Assignment
    BEGINOF t_pa0001,
    pernr    
    TYPE persno,
    endda    
    TYPE endda,
    begda    
    TYPE begda,
    werks    
    TYPE persa,   "Personnel Area
    kostl    
    TYPE kostl,   "Cost center
    orgeh    
    TYPE orgeh,   "Organization Unit
    stell    
    TYPE stell,   "Job
    ENDOF   t_pa0001,
    *&  Personal Dat
    BEGINOF t_pa0002,
    pernr    
    TYPE persno,
    endda    
    TYPE endda,
    begda    
    TYPE begda,
    vorna    
    TYPE pad_vorna,"First name
    nachn    
    TYPE pad_nachn,"Last name
    gesch    
    TYPE gesch,   "Gender Key
    gbdep    
    TYPE gbdep,   "State
    gbdat    
    TYPE gbdat,   "DOB
    ENDOF   t_pa0002,
    *&  Address
    BEGINOF t_pa0006,
    pernr    
    TYPE persno,
    endda    
    TYPE endda,
    begda    
    TYPE begda,
    pstlz    
    TYPE pstlz_hr,"Postal Code
    ENDOF   t_pa0006,
    *&  Basic Pay
    BEGINOF t_pa0008,
    pernr    
    TYPE persno,
    endda    
    TYPE endda,
    begda    
    TYPE begda,
    ansal    
    TYPE ansal,   "Annual Salary
    ENDOF   t_pa0008,
    *&  Date Specifications
    BEGINOF t_pa0041,
    pernr    
    TYPE  persno,
    endda    
    TYPE  endda,
    begda    
    TYPE  begda,
    dar01    
    TYPE  datar,
    dat01    
    TYPE  dardt,
    dar02    
    TYPE  datar,
    dat02     
    TYPE  dardt,
    dar03     
    TYPE   datar,
    dat03     
    TYPE   dardt,
    dar04     
    TYPE   datar,
    dat04     
    TYPE   dardt,
    dar05     
    TYPE   datar,
    dat05     
    TYPE   dardt,
    dar06     
    TYPE   datar,
    dat06     
    TYPE   dardt,
    dar07     
    TYPE   datar,
    dat07     
    TYPE   dardt,
    dar08     
    TYPE   datar,
    dat08    
    TYPE  dardt,
    dar09     
    TYPE   datar,
    dat09     
    TYPE   dardt,
    dar10    
    TYPE  datar,
    dat10    
    TYPE  dardt,
    dar11    
    TYPE  datar,
    dat11    
    TYPE  dardt,
    dar12     
    TYPE   datar,
    dat12     
    TYPE   dardt,
    ENDOF   t_pa0041,
    BEGINOF t_pa0041d,
    pernr    
    TYPE  persno,
    endda    
    TYPE  endda,
    begda    
    TYPE  begda,
    dar01    
    TYPE  datar,
    dat01    
    TYPE  dardt,
    ENDOF   t_pa0041d,
    *& Date text
    BEGINOF t_t548t,
    datar    
    TYPE  datar,
    dtext     
    TYPE datax,
    ENDOF   t_t548t,
    *&  Communication
    beginof t_pa0105,
    pernr    
    type persno,
    endda    
    type endda,
    begda    
    type begda,
    usrty    
    type usrty,   "Communication Type
    usrid_long 
    type comm_id_long,"Long Identification/Number
    endof   t_pa0105,
    *& Personnel Action Texts
    beginof t_t529t,
    massn    
    type  massn,  "Action Type
    mntxt    
    type  mntxt,  "Name of Action Type
    endof   t_t529t,
    *      & Reason for Action Texts
    beginof t_t530t,
    massn    
    type  massn,  "Action Type
    massg    
    type  massg,  "Reason for Action
    mgtxt    
    type  mgtxt,  "Name of reason for action
    endof   t_t530t,
    *      & Job Titles
    beginof t_t513s,
    stell    
    type  stell,  "Job
    stltx    
    type  stltx,  "Job Title
    begda    
    type  begda,  "Start Date
    endda    
    type  endda,  "End Date
    endof   t_t513s,
    *      & Final table
    beginof t_final,
    pernr    
    type pernr_d,
    begda    
    type begda,
    mntxt    
    type mntxt,
    mgtxt    
    type mgtxt,
    vorna    
    type pad_vorna,
    nachn    
    type pad_nachn,
    gesch    
    type char20,
    gbdep    
    type gbdep,
    pstlz    
    type pstlz_hr,
    werks    
    type persa,
    stltx    
    type stltx,
    orgeh    
    type orgeh,
    kostl    
    type kostl,
    gbdat    
    type gbdat,
    usrid_long 
    type comm_id_long,
    dtext    
    type datax,
    dat01    
    type dardt,
    ansal    
    type ansal,
    endof t_final.

    *&**********************************************************************
    *&   Data
    *&**********************************************************************
    DATA : i_pa0000 TYPESTANDARDTABLEOF t_pa0000,
    i_pa0001
    TYPESTANDARDTABLEOF t_pa0001,
    i_pa0002
    TYPESTANDARDTABLEOF t_pa0002,
    i_pa0006
    TYPESTANDARDTABLEOF t_pa0006,
    i_pa0008
    TYPESTANDARDTABLEOF t_pa0008,
    i_pa0041
    TYPESTANDARDTABLEOF t_pa0041,
    i_pa0041d
    TYPESTANDARDTABLEOF t_pa0041d,
    i_pa0105
    TYPESTANDARDTABLEOF t_pa0105,
    i_t529t 
    TYPESTANDARDTABLEOF t_t529t,
    i_t530t 
    TYPESTANDARDTABLEOF t_t530t,
    i_t513s 
    TYPESTANDARDTABLEOF t_t513s,
    i_final 
    TYPESTANDARDTABLEOF t_final,
    i_t548t 
    TYPESTANDARDTABLEOF t_t548t,
    w_final
    TYPE t_final.

    *&---------------------------------------------------------------------*
    *& Local data for prosessing
    DATA : w_pa0000 TYPE t_pa0000,
    w_t529t 
    TYPE t_t529t,
    w_t530t 
    TYPE t_t530t,
    w_pa0001
    TYPE t_pa0001,
    w_t513s 
    TYPE t_t513s,
    w_pa0002
    TYPE t_pa0002,
    w_pa0006
    TYPE t_pa0006,
    w_pa0008
    TYPE t_pa0008,
    w_pa0105
    TYPE t_pa0105,
    w_t548t 
    TYPE t_t548t.

    DATA : v_pernr TYPE persno, "Employee Number
    v_date  
    TYPE begda, "Run Date
    i_fieldcat
    TYPE lvc_t_fcat,
    w_fieldcat
    TYPE lvc_s_fcat,
    v_colpos
    TYPEiVALUE1,
    v_dar
    TYPE datar,
    v_dat
    TYPE dardt.
    *&**********************************************************************
    *&   Objects
    *&**********************************************************************
    DATA : o_empdata    TYPEREFTO cl_empdata,
    o_cc        
    TYPEREFTO cl_gui_custom_container,
    o_split     
    TYPEREFTO cl_gui_easy_splitter_container,
    o_top_cntnr 
    TYPEREFTO cl_gui_container,
    o_btm_cntnr 
    TYPEREFTO cl_gui_container,
    o_doc       
    TYPEREFTO cl_dd_document, "Document
    o_alv       
    TYPEREFTO cl_gui_alv_grid.
    *&**********************************************************************
    *&   Constants
    *&**********************************************************************
    CONSTANTS : c_e TYPEcVALUE'E',
    c_1
    TYPEcVALUE'1',
    c_2
    TYPEcVALUE'2',
    c_i
    TYPEcVALUE'I'.

    FIELD-SYMBOLS <lx_data> TYPE t_pa0041.

     
     

     

    SCREEN

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT1_SCREEN
    *&---------------------------------------------------------------------*
    ************************************************************************
    *& Selection screen
    ************************************************************************
    SELECTION-
    SCREENBEGINOFBLOCK b1 WITHFRAMETITLEtext-000.
    SELECT-OPTIONS : s_pernr for v_pernr, "Employee Number
    s_rundte
    for v_date.   "Run date
    SELECTION-
    SCREENENDOFBLOCK b1.

     
     

     

    CLASS

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT1_CLASS
    *&---------------------------------------------------------------------*
    *&**********************************************************************
    *&   CLASS CL_EMPDATA DEFINITATION
    *&**********************************************************************
    CLASS cl_empdata DEFINITION.
    PUBLICSECTION.
    METHODS : validation,   "Screen validation
    get_data,    
    "Fetch Data
    merge_data,  
    "Populate final table to display
    set_fieldcat
    IMPORTING fieldname TYPE lvc_fname
    seltext  
    TYPE lvc_txt
    coltext  
    TYPE lvc_txtcol
    outputlen
    TYPE lvc_outlen
    EXPORTING w_fieldcatr TYPE lvc_s_fcat,
    populate_finaldata,
    prepare_topofpage,
    build_fieldcatalog,
    "Build field catalogs
    display_alv. 
    "Display dta
    ENDCLASS.                   "CL_EMPDATA
    *&**********************************************************************
    *&   CLASS CL_EMPDATA IMPLEMENTATION
    *&**********************************************************************
    CLASS cl_empdata IMPLEMENTATION.
    *&---------------------------------------------------------------------*
    *&   METHOD validation
    *&   Method to validate screen inputs
    *&---------------------------------------------------------------------*
    METHOD  validation.
    DATA: lv_pernr TYPE persno,
    lv_check
    TYPEi.
    *& Validate employee number
    IF s_pernr ISNOTINITIAL.
    SELECTSINGLE pernr
    FROM pa0000
    INTO lv_pernr
    WHERE pernr IN s_pernr AND stat2 = 3.
    IF sy-subrc <> 0.
    MESSAGEtext-042TYPE c_e.
    ENDIF.
    ENDIF.
    *& Validate run date
    IF s_rundte ISNOTINITIAL.
    lv_check = s_rundte-low.
    IF lv_check = 0.
    MESSAGEtext-043TYPE c_e.
    ENDIF.
    CLEAR lv_check.
    lv_check = s_rundte-high.
    IF lv_check = 0.
    MESSAGEtext-043TYPE c_e.
    ENDIF.
    ELSE.
    s_rundte-low =
    '00010101'.
    s_rundte-high =
    '99991231'.
    ENDIF.
    ENDMETHOD.                "Validation
    *&---------------------------------------------------------------------*
    *&   METHOD get_data
    *&   Method to fetch data
    *&---------------------------------------------------------------------*
    METHOD  get_data.
    DATA : li_pa0000 TYPESTANDARDTABLEOF t_pa0000,
    li_pa0001
    TYPESTANDARDTABLEOF t_pa0001.
    *&---------------------------------------------------------------------*
    *& Select Action data
    SELECT pernr endda begda massn massg
    INTOTABLE i_pa0000
    FROM pa0000
    WHERE endda >= s_rundte-low
    AND begda <= s_rundte-high
    AND pernr IN s_pernr AND stat2 = 3.
    IF sy-subrc = 0.
    *& Assign data of i_pa0000 to temp table
    li_pa0000 = i_pa0000.
    *& Sort table
    SORT li_pa0000 BY massn.
    *& Delete duplicate Action type from Actions
    DELETEADJACENTDUPLICATESFROM li_pa0000 COMPARING massn.
    *&---------------------------------------------------------------------
    *& Action Texts
    SELECT massn mntxt
    INTOTABLE i_t529t
    FROM t529t
    FORALL ENTRIES IN li_pa0000
    WHERE massn = li_pa0000-massn AND sprsl = sy-langu.
    *& Clear temp table
    CLEAR li_pa0000.
    *& Assign data of i_pa0000 to temp table
    li_pa0000 = i_pa0000.
    *& Sort table
    SORT li_pa0000 BY massn massg.
    *& Delete duplicate Action reasons keys from Actions
    DELETEADJACENTDUPLICATESFROM li_pa0000 COMPARING massn massg.
    *&---------------------------------------------------------------------

    *& Reason for Action Texts
    SELECT massn massg mgtxt
    INTOTABLE i_t530t
    FROM t530t
    FORALL ENTRIES IN li_pa0000
    WHERE massn = li_pa0000-massn
    AND massg = li_pa0000-massg
    AND sprsl = sy-langu.
    *&---------------------------------------------------------------------
    *& Clear temp table
    CLEAR li_pa0000.
    *& Assign data of i_pa0000 to temp table
    li_pa0000 = i_pa0000.
    *& Sort table
    SORT li_pa0000 BY pernr.
    *& Delete duplicate Action reasons keys from Actions
    DELETEADJACENTDUPLICATESFROM li_pa0000 COMPARING pernr.

    *& Select organizational assignment
    SELECT  pernr endda begda
    werks kostl orgeh stell
    INTOTABLE i_pa0001
    FROM pa0001
    FORALL ENTRIES IN li_pa0000
    WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
    AND begda <= s_rundte-high.

    IF sy-subrc = 0.
    *& Assign data of i_pa0001 to temp table
    li_pa0001 = i_pa0001.
    *& Sort table
    SORT li_pa0001 BY stell.
    *& Delete duplicate job from organizational assignment
    DELETEADJACENTDUPLICATESFROM li_pa0001 COMPARING stell.
    *&---------------------------------------------------------------------

    *& Get jobitle text
    SELECT stell stltx endda begda
    FROM t513s
    INTOTABLE i_t513s
    FORALL ENTRIES IN li_pa0001
    WHERE stell = li_pa0001-stell
    AND sprsl = sy-langu.
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Select Personal Data
    SELECT  pernr endda begda
    vorna nachn gesch gbdep gbdat
    INTOTABLE i_pa0002
    FROM pa0002
    FORALL ENTRIES IN li_pa0000
    WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
    AND begda <= s_rundte-high.
    *&---------------------------------------------------------------------*
    *& Select Address
    SELECT  pernr endda begda
    pstlz
    INTOTABLE i_pa0006
    FROM pa0006
    FORALL ENTRIES IN li_pa0000
    WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
    AND begda <= s_rundte-high.
    *&---------------------------------------------------------------------*
    *& Basic Pay
    SELECT  pernr endda begda
    ansal
    INTOTABLE i_pa0008
    FROM pa0008
    FORALL ENTRIES IN li_pa0000
    WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
    AND begda <= s_rundte-high.
    *&---------------------------------------------------------------------*
    *& Date Specifications
    SELECT  pernr endda begda
    dar01 dat01 dar02 dat02 dar03 dat03 dar04
    dat04 dar05 dat05 dar06 dat06 dar07 dat07
    dar08 dat08 dar09 dat09 dar10 dat10 dar11
    dat11 dar12 dat12
    INTOTABLE i_pa0041
    FROM pa0041
    FORALL ENTRIES IN li_pa0000
    WHERE pernr = li_pa0000-pernr AND endda >= s_rundte-low
    AND begda <= s_rundte-high.
    *&---------------------------------------------------------------------*
    *&  Communication
    SELECT pernr endda begda
    usrty usrid_long
    INTOTABLE i_pa0105
    FROM pa0105
    FORALL ENTRIES IN li_pa0000
    WHERE  pernr = li_pa0000-pernr
    AND subty = '0010'AND endda >= s_rundte-low
    AND begda <= s_rundte-high.
    o_empdata->merge_data( ).

    ELSE.
    MESSAGEtext-002TYPE c_e.
    ENDIF.
    ENDMETHOD.                "Get_data
    *&---------------------------------------------------------------------*
    *&   METHOD merge_data
    *&   Method to populate final table to display
    *&---------------------------------------------------------------------*
    METHOD  merge_data.
    *&---------------------------------------------------------------------*
    *& Loop date specification table for getting hire date or original hire
    *& date

    SELECT datar dtext
    FROM t548t
    INTOTABLE i_t548t
    WHERE sprsl = sy-langu and datar = 'U1'OR datar = '16'.

    SORT i_pa0041  BY pernr endda DESCENDING.
    SORT i_pa0000  BY pernr endda DESCENDING.
    SORT i_pa0001  BY pernr endda DESCENDING.
    SORT i_pa0002  BY pernr endda DESCENDING.
    SORT i_pa0006  BY pernr endda DESCENDING.
    SORT i_pa0008  BY pernr endda DESCENDING.
    SORT i_pa0105  BY pernr endda DESCENDING.
    SORT i_t529t   BY massn.
    SORT i_t513s   BY stell endda DESCENDING.

    LOOPAT i_pa0041 ASSIGNING<lx_data>  .
    CLEAR: w_final.
    *&---------------------------------------------------------------------*
    *& Do loop to check for hire date or original hire date
    DO12TIMES VARYING v_dar FROM<lx_data>-dar01 NEXT
    <lx_data>-dar02
    VARYING v_dat
    FROM<lx_data>-dat01 NEXT
    <lx_data>-dat02.
    *&---------------------------------------------------------------------*
    *& Check for Original date
    IF v_dar = '16'.
    w_final-dat01 = v_dat.
    w_final-dtext = v_dar.
    *&---------------------------------------------------------------------*
    *& Check for hire date
    ELSEIF v_dar = 'U1'.
    w_final-dat01 = v_dat.
    w_final-dtext = v_dar.
    EXIT.
    ENDIF.
    CLEAR: v_dar,  v_dat.
    ENDDO.
    IF w_final-dat01 ISNOTINITIAL.
    o_empdata->populate_finaldata( ).
    ENDIF.
    ENDLOOP.
    ENDMETHOD.                  "Merge_data

    METHOD  populate_finaldata.
    CLEAR w_t548t.
    *&---------------------------------------------------------------------*
    *& Populate date text
    READTABLE i_t548t INTO  w_t548t
    WITHKEY datar = w_final-dtext.
    IF sy-subrc = 0.
    w_final-dtext = w_t548t-dtext.
    "Date text
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Populate Employee number, start date
    CLEAR w_pa0000.
    READTABLE i_pa0000 INTO w_pa0000
    WITHKEY pernr = <lx_data>-pernr
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-pernr = w_pa0000-pernr.
    "Employee number
    w_final-begda = w_pa0000-begda.
    "Start date
    *&---------------------------------------------------------------------*
    *& Populate Action text
    CLEAR w_t529t.
    READTABLE i_t529t INTO w_t529t
    WITHKEY massn = w_pa0000-massn
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-mntxt = w_t529t-mntxt.
    "Action text
    ENDIF.
    IF w_pa0000-massg ISNOTINITIAL.
    CLEAR w_t530t.
    *&---------------------------------------------------------------------*
    *& Populate Action reason text
    READTABLE i_t530t INTO w_t530t
    WITHKEY massn = w_pa0000-massn
    massg = w_pa0000-massg
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-mgtxt = w_t530t-mgtxt.
    "Action reason text
    ENDIF.
    ENDIF.
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Populate Organizational Assignments
    CLEAR w_pa0001.
    READTABLE i_pa0001 INTO w_pa0001
    WITHKEY pernr = <lx_data>-pernr
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-werks = w_pa0001-werks.
    w_final-orgeh = w_pa0001-orgeh.
    w_final-kostl = w_pa0001-kostl.
    *&---------------------------------------------------------------------*
    *& Populate job text
    CLEAR w_t513s.
    READTABLE i_t513s INTO w_t513s
    WITHKEY stell = w_pa0001-stell
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-stltx = w_t513s-stltx.
    ENDIF.
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Populate Personnel details
    CLEAR  w_pa0002.
    READTABLE i_pa0002 INTO w_pa0002
    WITHKEY pernr = <lx_data>-pernr
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-vorna = w_pa0002-vorna.
    "First name
    w_final-nachn = w_pa0002-nachn.
    "Last name
    CASE w_pa0002-gesch. "Gender
    WHEN c_1.
    w_final-gesch =
    text-039.
    WHEN c_2.
    w_final-gesch =
    text-040.
    WHENOTHERS.
    w_final-gesch =
    text-041.
    ENDCASE.
    w_final-gbdep = w_pa0002-gbdep.
    w_final-gbdat = w_pa0002-gbdat.
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Populate postal address
    CLEAR w_pa0006.
    READTABLE i_pa0006 INTO w_pa0006
    WITHKEY pernr = <lx_data>-pernr
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-pstlz = w_pa0006-pstlz.
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Populate Basic pay data  - annual salary
    CLEAR w_pa0008.
    READTABLE i_pa0008 INTO w_pa0008
    WITHKEY pernr = <lx_data>-pernr
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-ansal = w_pa0008-ansal.
    "Annual salary
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Populate Email id
    CLEAR w_pa0105.
    READTABLE i_pa0105 INTO w_pa0105
    WITHKEY pernr = <lx_data>-pernr
    BINARYSEARCH.
    IF sy-subrc = 0.
    w_final-usrid_long = w_pa0105-usrid_long.
    "Email
    ENDIF.
    *&---------------------------------------------------------------------*
    *& Append work area to final table
    APPEND w_final TO i_final.

    ENDMETHOD.                  "Populate_finaldata

    *&---------------------------------------------------------------------*
    *&   METHOD build_fieldcatalog
    *&   Method to build field catalogs
    *&---------------------------------------------------------------------*
    METHOD  build_fieldcatalog.
    CLEAR : w_fieldcat,i_fieldcat.
    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-021
    seltext     =
    text-003
    coltext     =
    text-003
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-022
    seltext     =
    text-020
    coltext     =
    text-020
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-023
    seltext     =
    text-004
    coltext     =
    text-004
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-024
    seltext     =
    text-005
    coltext     =
    text-005
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-025
    seltext     =
    text-006
    coltext     =
    text-006
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-026
    seltext     =
    text-007
    coltext     =
    text-007
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-027
    seltext     =
    text-008
    coltext     =
    text-008
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-028
    seltext     =
    text-009
    coltext     =
    text-009
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-029
    seltext     =
    text-010
    coltext     =
    text-010
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-030
    seltext     =
    text-011
    coltext     =
    text-011
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-031
    seltext     =
    text-012
    coltext     =
    text-013
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-032
    seltext     =
    text-013
    coltext     =
    text-013
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-033
    seltext     =
    text-014
    coltext     =
    text-014
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-033
    seltext     =
    text-014
    coltext     =
    text-014
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-034
    seltext     =
    text-015
    coltext     =
    text-015
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-035
    seltext     =
    text-016
    coltext     =
    text-016
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-036
    seltext     =
    text-017
    coltext     =
    text-017
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-037
    seltext     =
    text-018
    coltext     =
    text-018
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.


    CALLMETHOD o_empdata->set_fieldcat
    EXPORTING
    fieldname   =
    text-038
    seltext     =
    text-019
    coltext     =
    text-019
    outputlen   =
    '10'
    IMPORTING
    w_fieldcatr = w_fieldcat.
    APPEND w_fieldcat TO i_fieldcat.
    CLEAR : w_fieldcat.

    ENDMETHOD.                "Build_fieldcatalog
    *&---------------------------------------------------------------------*
    *&   METHOD prepare_topofpage
    *&   Method to report header
    *&---------------------------------------------------------------------*
    METHOD prepare_topofpage.

    DATA: lv_count TYPE char255,
    lv_count1
    TYPE string,
    lv_rundte
    TYPE char255,
    lv_rundte_l
    TYPE char20,
    lv_rundte_h
    TYPE char20.


    DESCRIBETABLE i_final.
    lv_count1 = sy-tfill.

    CONCATENATEtext-045':' lv_count1 INTO lv_count.

    IF s_rundte-low ISNOTINITIAL.

    CONCATENATEtext-047  s_rundte-low+4(2) '.'
    s_rundte-low+
    6(2) '.' s_rundte-low+0(4)
    INTO lv_rundte_l.
    ENDIF.

    IF s_rundte-high ISNOTINITIAL.
    CONCATENATE  text-048 s_rundte-high+4(2) '.'
    s_rundte-high+
    6(2) '.' s_rundte-high+0(4)
    INTO lv_rundte_h .
    ENDIF.

    CONCATENATEtext-046 lv_rundte_l  lv_rundte_h
    INTO lv_rundte.
    *&---------------------------------------------------------------------*
    *&   Employee’s Hiring Details
    CALLMETHOD o_doc->add_text
    EXPORTING
    text         = text-044
    sap_fontsize = cl_dd_area=>medium
    sap_emphasis = cl_dd_area=>strong.
    CALLMETHOD o_doc->new_line.
    *&---------------------------------------------------------------------*
    *&   Number of records
    CALLMETHOD o_doc->add_text
    EXPORTING
    text         = lv_count
    sap_fontsize = cl_dd_area=>medium
    sap_emphasis = cl_dd_area=>strong.
    CALLMETHOD o_doc->new_line.
    *&---------------------------------------------------------------------*
    *&   Run Date
    CALLMETHOD o_doc->add_text
    EXPORTING
    text         = lv_rundte
    sap_fontsize = cl_dd_area=>medium
    sap_emphasis = cl_dd_area=>strong.
    CALLMETHOD o_doc->display_document
    EXPORTING
    parent             = o_top_cntnr
    EXCEPTIONS
    html_display_error =
    1
    OTHERS             = 2.
    IF sy-subrc <> 0.
    MESSAGEID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDMETHOD.                    "prepare_topofpage

    *&---------------------------------------------------------------------*
    *&   METHOD set_fieldcat
    *&   Method to set_fieldcat
    *&---------------------------------------------------------------------*
    METHOD set_fieldcat.
    CLEAR: w_fieldcat.
    w_fieldcatr-fieldname = fieldname.
    w_fieldcatr-col_pos = v_colpos.
    w_fieldcatr-outputlen = outputlen.
    w_fieldcatr-coltext = coltext.
    w_fieldcatr-seltext = seltext.
    v_colpos = v_colpos +
    1.
    ENDMETHOD.                    "set_fieldcat

    *&---------------------------------------------------------------------*
    *&   METHOD display_alv
    *&   Method to display ALV grid
    *&---------------------------------------------------------------------*
    METHOD  display_alv.
    o_empdata->build_fieldcatalog( ).
    CALLSCREEN100.
    ENDMETHOD.                "Display_alv
    ENDCLASS.                   "CL_EMPDATA

     
     

     

    PAI

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT1_PAI
    *&---------------------------------------------------------------------*
    *&---------------------------------------------------------------------*
    *&      Module  USER_COMMAND_0100  INPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    module USER_COMMAND_0100 input.
    CASE sy-ucomm .
    WHEN'BACK'OR'RW'OR'%EX' .
    LEAVEPROGRAM .
    ENDCASE .
    endmodule.                 " USER_COMMAND_0100  INPUT

     
     

    PBO

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT1_PBO
    *&---------------------------------------------------------------------*
    *&---------------------------------------------------------------------*
    *&      Module  STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'EMP_DATA'.
    *  SET TITLEBAR 'xxx'.

    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&---------------------------------------------------------------------*
    *&      Module  DSPLY_EMPDATA  OUTPUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    MODULE dsply_empdata OUTPUT.
    *----------------------------------------------------------------------*
    *Check for object of first grid
    *----------------------------------------------------------------------*

    IF o_alv ISINITIAL.
    "Create object for first container
    CREATE OBJECT o_cc
    EXPORTING
    container_name              =
    'CC_EMPDATA'
    EXCEPTIONS
    cntl_error                  =
    1
    cntl_system_error           =
    2
    create_error                =
    3
    lifetime_error              =
    4
    lifetime_dynpro_dynpro_link =
    5
    OTHERS                      = 6.
    IF sy-subrc <> 0.
    MESSAGEID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    *----------------------------------------------------------------------*
    *Create object for first ALV grid
    *----------------------------------------------------------------------*
    CREATE OBJECT o_split                       "split container obj
    EXPORTING
    parent            = o_cc
    sash_position     =
    20
    with_border       =
    1
    EXCEPTIONS
    cntl_error        =
    1
    cntl_system_error =
    2
    OTHERS            = 3.
    IF sy-subrc <> 0.
    MESSAGEID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.

    o_top_cntnr = o_split->top_left_container .
    o_btm_cntnr = o_split->bottom_right_container .

    CREATE OBJECT o_doc
    EXPORTING
    style =
    'ALV_GRID'.

    o_empdata->prepare_topofpage( ).



    CREATE OBJECT o_alv
    EXPORTING
    i_parent          = o_btm_cntnr
    EXCEPTIONS
    error_cntl_create =
    1
    error_cntl_init   =
    2
    error_cntl_link   =
    3
    error_dp_create   =
    4
    OTHERS            = 5.
    IF sy-subrc <> 0.
    MESSAGEID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ELSE.
    CALLMETHOD o_alv->list_processing_events
    EXPORTING
    i_event_name =
    'TOP_OF_PAGE'
    i_dyndoc_id  = o_doc.

    "Display ALV grid
    CALLMETHOD o_alv->set_table_for_first_display
    CHANGING
    it_fieldcatalog               = i_fieldcat
    it_outtab                     = i_final
    EXCEPTIONS
    invalid_parameter_combination =
    1
    program_error                 =
    2
    too_many_lines                =
    3
    OTHERS                        = 4.
    IF sy-subrc <> 0.
    MESSAGEID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDMODULE.                 " DSPLY_EMPDATA  OUTPUT

    Get Line Supervisor

    $
    0
    0

    MAIN

    ************************************************************************
    * Object Name : REPORT  ZHR_8235_ASG2_1. *
    * Author/Company Name : Krishnakant Joshi / *
    * Transport Request *
    * Creation Date * 01/29/2013
    ************************************************************************
    * Description: *  Get Employee Manager
    ************************************************************************
    * Dependencies *
    ************************************************************************
    * Modification History *
    ************************************************************************
    * Date Programmer Client Ref No. Description Correction *
    ************************************************************************
    REPORT ZHR_8235_ASG2_1 .
    *&**********************************************************************
    *&    INCLUDE
    *&**********************************************************************
    INCLUDE : ZHR_8235_ASG2_1_TOP,    "Global Types and Data
    ZHR_8235_ASG2_1_SCREEN,
    "Screen Design
    ZHR_8235_ASG2_1_FORM.  
    "Subroutines
    *&**********************************************************************
    *&    INITIALIZATION
    *&**********************************************************************
    INITIALIZATION.
    V_REPID = SY-REPID.
    *&**********************************************************************
    *     AT SELECTION-SCREEN OUTPUT.
    *&**********************************************************************
    AT SELECTION-SCREENOUTPUT.
    PERFORM POPULATE_STATUS.
    *&**********************************************************************
    *&    AT SELECTION-SCREEN
    *&**********************************************************************
    AT SELECTION-SCREEN.
    PERFORM VALIDATATION. "Validate Screen
    *&**********************************************************************
    *&    START-OF-SELECTION
    *&**********************************************************************
    START-
    OF-SELECTION.
    PERFORM GETDATA."Populate internal tables
    *&**********************************************************************
    *&    END-OF-SELECTION
    *&**********************************************************************
    END-OF-SELECTION.
    IF I_FINAL ISNOTINITIAL.
    PERFORM  BUILD_FIELDCATALOG.
    PERFORM  SET_LAYOUT.
    PERFORM  DISPLAY_ALV_REPORT.
    ELSE.
    MESSAGETEXT-010TYPE C_I DISPLAY LIKE C_E.
    ENDIF.

     
      

     

    TOP

    *&---------------------------------------------------------------------*
    *&  Include           ZHR_8235_ASG2_1_TOP
    *&---------------------------------------------------------------------*
    TYPE-POOLS: SLIS,
    VRM.
    *&**********************************************************************
    *&   TYPES
    *&**********************************************************************
    TYPES :
    *&  Actions
    BEGINOF T_PA0000,
    PERNR          
    TYPE PERNR-PERNR,   "Employee Number
    ENDDA          
    TYPE ENDDA,   "End Date
    BEGDA          
    TYPE BEGDA,   "Start Date
    MASSN          
    TYPE MASSN,   "Action Type
    MASSG          
    TYPE MASSG,   "Reason for Action
    ENDOF   T_PA0000,
    *&  Org. Assignment
    BEGINOF T_PA0001,
    PERNR          
    TYPE PERNR-PERNR,   "Employee Number
    ENDDA          
    TYPE ENDDA,   "End Date
    BEGDA          
    TYPE BEGDA,   "Start Date
    WERKS          
    TYPE PERSA,   "Personnel Area
    KOSTL          
    TYPE KOSTL,   "Cost center
    ORGEH          
    TYPE ORGEH,   "Organization Unit
    STELL          
    TYPE STELL,   "Job
    PLANS          
    TYPE PLANS,   "Position
    ENDOF   T_PA0001,
    *&  Personal Data
    BEGINOF T_PA0002,
    PERNR          
    TYPE PERNR-PERNR,    "Employee Number
    ENDDA          
    TYPE ENDDA,    "End Date
    BEGDA          
    TYPE BEGDA,    "Start Date
    VORNA          
    TYPE PAD_VORNA,"First name
    NACHN          
    TYPE PAD_NACHN,"Last name
    ENDOF   T_PA0002,
    *&  Personnel Action Texts
    BEGINOF T_T529T,
    MASSN          
    TYPE  MASSN,   "Action Type
    MNTXT          
    TYPE  MNTXT,   "Action Text
    ENDOF   T_T529T,
    *&  Reason for Action Texts
    BEGINOF T_T530T,
    MASSN          
    TYPE  MASSN,   "Action Type
    MASSG          
    TYPE  MASSG,   "Reason for Action
    MGTXT          
    TYPE  MGTXT,   "Reason Text
    ENDOF   T_T530T,
    *&  Final Table
    BEGINOF T_FINAL,
    PERNR          
    TYPE  PERNR-PERNR, "Employee number
    BEGDA          
    TYPE  BEGDA,       "Start Date
    MNTXT          
    TYPE  MNTXT,   "Action Text
    MGTXT          
    TYPE  MGTXT,   "Reason Text
    STELL          
    TYPE  STELL,   "Job
    KOSTL          
    TYPE  KOSTL,   "Cost center
    VORNA          
    TYPE  PAD_VORNA,"First name
    NACHN          
    TYPE  PAD_NACHN,"Last name
    MGRID          
    TYPE  HROBJID,  "Manager Id
    MGRNAME        
    TYPE  CHAR80,   "Manager Name
    ORGEH          
    TYPE  ORGEH,   "Organization Unit
    ORGTEXT        
    TYPE  CHAR40,  "Org. Text
    ENDOF   T_FINAL,
    *&  HRP1001
    BEGINOF T_HRP1001,
    OBJID          
    TYPE  OBJEKTID,
    BEGDA          
    TYPE  BEGDATUM,
    ENDDA          
    TYPE  ENDDATUM,
    SEQNR          
    TYPE  SEQNR,
    SOBID          
    TYPE  SOBID,
    ENDOF T_HRP1001,
    BEGINOF T_T527X,
    ORGEH          
    TYPE ORGEH,
    ENDDA          
    TYPE ENDDA,
    BEGDA          
    TYPE BEGDA,
    ORGTX          
    TYPE ORGTX,
    ENDOF T_T527X.

    *&**********************************************************************
    *&   DATA
    *&**********************************************************************
    DATA : V_PERNR          TYPE  PERNR-PERNR,   "Employee Number
    V_DATE          
    TYPE  BEGDA,   "Selection Date
    V_COLPOS        
    TYPEIVALUE  1.
    DATA : I_PA0000         TYPESTANDARDTABLEOF T_PA0000,
    I_PA0001        
    TYPESTANDARDTABLEOF T_PA0001,
    I_PA0002        
    TYPESTANDARDTABLEOF T_PA0002,
    I_T529T         
    TYPESTANDARDTABLEOF T_T529T,
    I_T530T         
    TYPESTANDARDTABLEOF T_T530T,
    I_HRP1001       
    TYPESTANDARDTABLEOF T_HRP1001,
    I_0002          
    TYPESTANDARDTABLEOF T_PA0002,
    I_FINAL         
    TYPESTANDARDTABLEOF T_FINAL,
    I_T527X         
    TYPESTANDARDTABLEOF T_T527X.
    DATA: I_FIELDCATALOG    TYPETABLEOF SLIS_FIELDCAT_ALV,
    W_FIELDCATALOG   
    TYPE SLIS_FIELDCAT_ALV,
    V_REPID          
    LIKE SY-REPID,
    V_GRIDTITLE      
    TYPE LVC_TITLE,
    W_LAYOUT         
    TYPE SLIS_LAYOUT_ALV.
    DATA: v_name            TYPE vrm_id,
    i_list           
    TYPE vrm_values,
    w_value          
    LIKELINEOF i_list,
    V_CHECK          
    TYPEI.
    FIELD-SYMBOLS : <X_HRP1001> TYPE  T_HRP1001,
    <X_0002>   
    TYPE T_PA0002.
    *&**********************************************************************
    *&   CONSTANTS
    *&**********************************************************************
    CONSTANTS : C_E         TYPEC          VALUE'E', "Constant For E
    C_I        
    TYPEC          VALUE'I', "Constant For I
    C_X        
    TYPEC          VALUE'X', "Constant For X
    C_1        
    TYPEC          VALUE'1', "Constant For 1
    C_2        
    TYPEC          VALUE'2', "Constant For 2
    C_3        
    TYPEC          VALUE'3', "Constant For 3
    C_0        
    TYPEC          VALUE'0', "Constant For 0
    C_P_STAT2  
    TYPE CHAR07     VALUE'P_STAT2',"Stat2 Param
    C_STARTDATE
    TYPE CHAR10     VALUE'18000101',"Start Date
    C_ENDDATE  
    TYPE CHAR10     VALUE'99991231',"End Date
    C_99999999 
    TYPE CHAR08     VALUE'99999999',
    C_01       
    TYPE PLOG-PLVAR VALUE'01',
    C_S        
    TYPE PLOG-OTYPE VALUE'S',
    C_P        
    TYPE PLOG-OTYPE VALUE'P',
    C_O        
    TYPE PLOG-OTYPE VALUE'O',
    C_A002     
    TYPE PLOG-SUBTY VALUE'A002',
    C_A003     
    TYPE PLOG-SUBTY VALUE'A003',
    C_A008     
    TYPE PLOG-SUBTY VALUE'A008',
    C_B012     
    TYPE PLOG-SUBTY VALUE'B012',
    C_1001     
    TYPE PLOG-INFTY VALUE'1001',
    C_VACANT   
    TYPE CHAR6      VALUE'VACANT',
    C_01010001 
    TYPE CHAR08     VALUE'01010001'.

     
      

     

    SCREEN

    *&---------------------------------------------------------------------*
    *&  Include           ZHR_8235_ASG2_1_SCREEN
    *&---------------------------------------------------------------------*
    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT2_SCREEN
    *&---------------------------------------------------------------------*
    ************************************************************************
    *& Selection screen
    ************************************************************************
    SELECTION-
    SCREENBEGINOFBLOCK B1 WITHFRAMETITLETEXT-000.
    SELECT-OPTIONS : S_PERNR FOR V_PERNR, "Employee Number
    S_SELDTE
    FOR V_DATE. "Run date
    PARAMETERS: P_STAT2 AS LISTBOX VISIBLE LENGTH 10 OBLIGATORY.
    SELECTION-
    SCREENENDOFBLOCK B1.

     
      

     

    FORM

    *&---------------------------------------------------------------------*
    *&  Include           ZHR_8235_ASG2_1_FORM
    *&---------------------------------------------------------------------*
    *&---------------------------------------------------------------------*
    *&      Form  GETDATA
    *&---------------------------------------------------------------------*
    *       Populate internal tables
    *----------------------------------------------------------------------*
    FORM GETDATA .
    DATA: LV_MGRID TYPE HROBJID,
    LV_MGRNAME
    TYPE CHAR80,
    LV_POS
    TYPE PLANS.
    FIELD-SYMBOLS : <LX_PA0001> TYPE T_PA0001,
    <LX_PA0000>
    TYPE T_PA0000,
    <LX_PA0002>
    TYPE T_PA0002,
    <LX_T530T>
    TYPE  T_T530T,
    <LX_T529T>
    TYPE  T_T529T,
    <LX_T527X>
    TYPE  T_T527X.
    DATA :LW_FINAL TYPE  T_FINAL.
    *----------------------------------------------------------------------*
    * Get Action Data
    PERFORM GET_PA0000.
    *----------------------------------------------------------------------*
    * Initial check
    IF I_PA0000 ISNOTINITIAL.
    *----------------------------------------------------------------------*
    * Get Texts
    PERFORM GET_TEXTS.
    *----------------------------------------------------------------------*
    * Loop for populating final table
    UNASSIGN <LX_PA0000>.
    LOOPAT I_PA0000 ASSIGNING<LX_PA0000>.
    * Clear work area
    CLEAR LW_FINAL.
    LW_FINAL-PERNR = <LX_PA0000>-PERNR.
    LW_FINAL-BEGDA = <LX_PA0000>-BEGDA.
    *----------------------------------------------------------------------*
    * Read Org DATA
    UNASSIGN <LX_PA0001>.
    READTABLE I_PA0001 ASSIGNING<LX_PA0001>
    WITHKEY PERNR = <LX_PA0000>-PERNR
    BINARYSEARCH.
    IF<LX_PA0001> ISASSIGNED.
    LW_FINAL-STELL = <LX_PA0001>-STELL.
    LW_FINAL-KOSTL = <LX_PA0001>-KOSTL.
    LW_FINAL-ORGEH = <LX_PA0001>-ORGEH.
    LV_POS = <LX_PA0001>-PLANS.
    *----------------------------------------------------------------------*
    *Get organization Text
    UNASSIGN <LX_T527X>.
    READTABLE I_T527X ASSIGNING<LX_T527X>
    WITHKEY ORGEH = <LX_PA0001>-ORGEH
    BINARYSEARCH.
    IF<LX_T527X> ISASSIGNED.
    LW_FINAL-ORGTEXT = <LX_T527X>-ORGTX.
    ENDIF.
    ENDIF.
    *----------------------------------------------------------------------*
    * Read action Text
    IF<LX_PA0000>-MASSN ISNOTINITIAL.
    UNASSIGN <LX_T529T>.
    READTABLE I_T529T ASSIGNING<LX_T529T>
    WITHKEY MASSN = <LX_PA0000>-MASSN
    BINARYSEARCH.
    IF<LX_T529T> ISASSIGNED.
    LW_FINAL-MNTXT = <LX_T529T>-MNTXT.
    ENDIF.
    ENDIF.
    *----------------------------------------------------------------------*
    * Read Action reason text
    UNASSIGN <LX_T530T>.
    READTABLE I_T530T  ASSIGNING<LX_T530T>
    WITHKEY MASSN = <LX_PA0000>-MASSN
    MASSG = <LX_PA0000>-MASSG
    BINARYSEARCH.
    IF<LX_T530T> ISASSIGNED.
    LW_FINAL-MGTXT = <LX_T530T>-MGTXT.
    ENDIF.
    *----------------------------------------------------------------------*
    * Read personal data
    UNASSIGN <LX_PA0002>.
    READTABLE I_PA0002 ASSIGNING<LX_PA0002>
    WITHKEY PERNR = <LX_PA0000>-PERNR
    BINARYSEARCH.
    IF<LX_PA0002> ISASSIGNED.
    LW_FINAL-VORNA = <LX_PA0002>-VORNA.
    LW_FINAL-NACHN = <LX_PA0002>-NACHN.
    ENDIF.
    IF LV_POS <> C_99999999.
    *----------------------------------------------------------------------*
    * Get Line supervisor details
    PERFORM GET_LINESUPERVISOR USING     LV_POS
    CHANGING  LV_MGRID
    LV_MGRNAME.
    IF LV_MGRID ISINITIAL.
    *----------------------------------------------------------------------*
    * Get Manager Details
    PERFORM GET_MANAGER USING    LV_POS
    CHANGING LV_MGRID
    LV_MGRNAME.
    ENDIF.
    ELSE.
    LV_MGRNAME = C_VACANT.
    ENDIF.
    LW_FINAL-MGRID = LV_MGRID.
    LW_FINAL-MGRNAME = LV_MGRNAME.
    *----------------------------------------------------------------------*
    * Add row to final table
    APPEND LW_FINAL TO I_FINAL.
    CLEAR: LV_MGRID,LV_MGRNAME,LV_POS.
    ENDLOOP.
    UNASSIGN <LX_PA0000>.
    ENDIF.
    ENDFORM.                     " GETDATA
    *&---------------------------------------------------------------------*
    *&      Form  GET_PA0000
    *&---------------------------------------------------------------------*
    *       Get data from TABLE PA0000
    *----------------------------------------------------------------------*
    FORM GET_PA0000 .
    SELECT PERNR ENDDA BEGDA MASSN MASSG
    FROM PA0000
    INTOTABLE I_PA0000
    WHERE PERNR IN S_PERNR
    AND ENDDA >= S_SELDTE-LOW
    AND BEGDA <= S_SELDTE-HIGH
    AND STAT2 = P_STAT2.
    IF SY-SUBRC = 0.
    *----------------------------------------------------------------------*
    *Sort table I_PA0000
    SORT I_PA0000 BY PERNR ENDDA DESCENDING
    BEGDA
    DESCENDING.
    *----------------------------------------------------------------------*
    *Get latest records from I_PA0000
    DELETEADJACENTDUPLICATESFROM I_PA0000 COMPARING PERNR.
    *----------------------------------------------------------------------*
    *Get data from PA00001
    PERFORM GET_PA0001.
    *----------------------------------------------------------------------*
    *Get data from PA00002
    PERFORM GET_PA0002.
    ENDIF.
    ENDFORM.                    " GET_PA0000
    *&---------------------------------------------------------------------*
    *&      Form  GET_PA0001
    *&---------------------------------------------------------------------*
    *       Get data from TABLE PA0001
    *----------------------------------------------------------------------*
    FORM GET_PA0001 .
    CLEAR I_PA0001.
    IF I_PA0000 ISNOTINITIAL.
    SELECT PERNR ENDDA BEGDA WERKS KOSTL ORGEH STELL PLANS
    FROM PA0001
    INTOTABLE I_PA0001
    FORALL ENTRIES IN I_PA0000
    WHERE PERNR = I_PA0000-PERNR
    AND ENDDA >= S_SELDTE-LOW
    AND BEGDA <= S_SELDTE-HIGH.
    IF SY-SUBRC = 0.
    *----------------------------------------------------------------------*
    *Sort table I_PA0001
    SORT I_PA0001 BY PERNR ENDDA DESCENDING
    BEGDA
    DESCENDING.
    *----------------------------------------------------------------------*
    *Get latest records from I_PA0001
    DELETEADJACENTDUPLICATESFROM I_PA0001 COMPARING PERNR.
    ENDIF.
    ENDIF.
    ENDFORM.                    " GET_PA0001
    *&---------------------------------------------------------------------*
    *&      Form  GET_TEXTS
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM GET_TEXTS .
    DATA : LI_PA0000 TYPESTANDARDTABLEOF T_PA0000,"Temporaty Table
    LI_PA0001
    TYPESTANDARDTABLEOF T_PA0001."Temporaty Table
    CLEAR: I_T529T,I_T530T,I_T527X.
    IF I_PA0000 ISNOTINITIAL.
    *&---------------------------------------------------------------------
    *& Action Texts
    LI_PA0000 = I_PA0000.
    *----------------------------------------------------------------------*
    *Sort temporaty table
    SORT LI_PA0000 BY MASSN.
    *----------------------------------------------------------------------*
    *Delete duplicates
    DELETEADJACENTDUPLICATESFROM LI_PA0000 COMPARING MASSN.
    SELECT MASSN MNTXT
    INTOTABLE I_T529T
    FROM T529T
    FORALL ENTRIES IN LI_PA0000
    WHERE  SPRSL = SY-LANGU
    AND  MASSN = LI_PA0000-MASSN.
    IF SY-SUBRC = 0.
    SORT I_T529T  BY MASSN.
    ENDIF.
    *&---------------------------------------------------------------------
    *& Reason for Action Texts
    CLEAR LI_PA0000.
    LI_PA0000 = I_PA0000.
    *----------------------------------------------------------------------*
    *Sort temporaty table
    SORT LI_PA0000 BY MASSN MASSG.
    *----------------------------------------------------------------------*
    *Delete duplicates
    DELETEADJACENTDUPLICATESFROM LI_PA0000 COMPARING MASSN MASSG.
    SELECT MASSN MASSG MGTXT
    INTOTABLE I_T530T
    FROM T530T
    FORALL ENTRIES IN LI_PA0000
    WHERE SPRSL = SY-LANGU
    AND MASSN = LI_PA0000-MASSN
    AND MASSG = LI_PA0000-MASSG.
    IF SY-SUBRC = 0.
    SORT I_T530T  BY MASSN MASSG.
    ENDIF.
    ENDIF.
    *&---------------------------------------------------------------------
    *& Organization Text
    IF I_PA0001 ISNOTINITIAL.
    LI_PA0001 = I_PA0001.
    *----------------------------------------------------------------------*
    *Sort temporaty table
    SORT LI_PA0001 BY ORGEH.
    *----------------------------------------------------------------------*
    *Delete duplicate records from temporary table to get ORG text
    DELETEADJACENTDUPLICATESFROM LI_PA0001 COMPARING ORGEH.
    SELECT ORGEH ENDDA BEGDA ORGTX
    FROM T527X
    INTOTABLE I_T527X
    FORALL ENTRIES IN LI_PA0001
    WHERE SPRSL = SY-LANGU
    AND ORGEH = LI_PA0001-ORGEH
    AND ENDDA >= S_SELDTE-LOW
    AND BEGDA <= S_SELDTE-HIGH.
    IF SY-SUBRC  = 0.
    *&---------------------------------------------------------------------
    *& Sort and delete duplicate records internal table to get the
    *& latest records
    SORT I_T527X BY ORGEH ENDDA BEGDA DESCENDING.
    DELETEADJACENTDUPLICATESFROM I_T527X COMPARING ORGEH.
    ENDIF.
    ENDIF.
    ENDFORM.                    " GET_TEXTS
    *&---------------------------------------------------------------------*
    *&      Form  GET_PA0002
    *&---------------------------------------------------------------------*
    *       Get Personal data
    *----------------------------------------------------------------------*
    FORM GET_PA0002 .
    IF I_PA0000 ISNOTINITIAL.
    CLEAR I_PA0002.
    SELECT PERNR ENDDA BEGDA VORNA NACHN
    INTOTABLE I_PA0002
    FROM PA0002
    FORALL ENTRIES IN I_PA0000
    WHERE PERNR = I_PA0000-PERNR
    AND ENDDA >= S_SELDTE-LOW
    AND BEGDA <= S_SELDTE-HIGH.
    IF SY-SUBRC = 0.
    *----------------------------------------------------------------------*
    *Sort table I_PA0002
    SORT I_PA0002 BY PERNR ENDDA DESCENDING
    BEGDA
    DESCENDING.
    *----------------------------------------------------------------------*
    *Get latest records from I_PA0002
    DELETEADJACENTDUPLICATESFROM I_PA0002 COMPARING PERNR.
    ENDIF.
    ENDIF.
    ENDFORM.                    " GET_PA0002
    *&---------------------------------------------------------------------*
    *&      Form  GET_MANAGER
    *&---------------------------------------------------------------------*
    *       Get manager details
    *----------------------------------------------------------------------*
    *      -->P_PLANS    Position
    *      <--P_MGRID    Manager Id
    *      <--P_MGRNAME  Manager Name
    *----------------------------------------------------------------------*
    FORM GET_MANAGER  USING    P_PLANS    TYPE PLANS
    CHANGING P_MGRID    TYPE HROBJID
    P_MGRNAME 
    TYPE CHAR80.
    DATA: LV_OBJID TYPE HROBJID.
    CLEAR P_MGRID.
    *----------------------------------------------------------------------*
    *Get org unit.
    PERFORM GET_INFTY USING    C_01
    C_S
    P_PLANS
    C_1001
    C_A003
    C_O.
    IF  I_HRP1001 ISNOTINITIAL.
    READTABLE I_HRP1001 ASSIGNING<X_HRP1001> INDEX1.
    IF<X_HRP1001> ISASSIGNED.
    CLEAR LV_OBJID.
    LV_OBJID =  <X_HRP1001>-SOBID.
    *----------------------------------------------------------------------*
    *Get manager position for org unit
    PERFORM GET_INFTY USING    C_01
    C_O
    LV_OBJID
    C_1001
    C_B012
    C_S.
    IF  I_HRP1001 ISNOTINITIAL.
    READTABLE I_HRP1001 ASSIGNING<X_HRP1001> INDEX1.
    IF<X_HRP1001>  ISASSIGNED.
    *----------------------------------------------------------------------*
    *Get manager's Name
    P_MGRID = <X_HRP1001>-SOBID.
    PERFORM GET_MANAGERNAME CHANGING P_MGRID P_MGRNAME.
    ENDIF.
    ELSE.
    *----------------------------------------------------------------------*
    *Get Upper level
    P_MGRNAME = C_VACANT.
    ENDIF.
    ELSE.
    P_MGRNAME = C_VACANT.
    ENDIF.
    ELSE.
    P_MGRNAME = C_VACANT.
    ENDIF.
    ENDFORM.                    " GET_MANAGER
    *&---------------------------------------------------------------------*
    *&      Form  CALL_INFTY
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_PLVAR  Plan Version
    *      -->P_OTYPE  Object type
    *      -->P_OBJID  Object Id
    *      -->P_INFTY  Info type
    *      -->P_SUBTY  Sub Type
    *      -->P_SCLAS  Related object type
    *----------------------------------------------------------------------*
    FORM GET_INFTY USING      P_PLVAR TYPE PLOG-PLVAR
    P_OTYPE
    TYPE PLOG-OTYPE
    P_OBJID
    TYPE PLOG-OBJID
    P_INFTY
    TYPE PLOG-INFTY
    P_SUBTY
    TYPE PLOG-SUBTY
    P_SCLAS
    TYPE PLOG-OTYPE.

    CLEAR I_HRP1001.
    SELECT  OBJID BEGDA ENDDA SEQNR SOBID
    FROM HRP1001
    INTOTABLE I_HRP1001
    WHERE   OTYPE = P_OTYPE AND
    OBJID = P_OBJID
    AND
    PLVAR = P_PLVAR
    AND
    INFTY = P_INFTY
    AND
    SUBTY = P_SUBTY
    AND
    SCLAS = P_SCLAS.
    IF SY-SUBRC = 0.
    SORT I_HRP1001 BY ENDDA DESCENDING BEGDA DESCENDING.
    ENDIF.
    ENDFORM.                    " CALL_INFTY
    *&---------------------------------------------------------------------*
    *&      Form  BUILD_FIELDCATALOG
    *&---------------------------------------------------------------------*
    *       Form to build fieldcatalogs for ALV
    *----------------------------------------------------------------------*
    FORM BUILD_FIELDCATALOG .
    * SET Field Catalog
    PERFORM SET_FIELDCATALOG USINGTEXT-011TEXT-012,
    TEXT-013TEXT-014,
    TEXT-015TEXT-016,
    TEXT-017TEXT-018,
    TEXT-019TEXT-020,
    TEXT-021TEXT-022,
    TEXT-023TEXT-024,
    TEXT-025TEXT-026,
    TEXT-027TEXT-028,
    TEXT-029TEXT-030,
    TEXT-031TEXT-032,
    TEXT-033TEXT-034.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *----------------------------------------------------------------------*
    * Form set_fieldcatalog *
    *----------------------------------------------------------------------*
    * This form is used to set field catalog
    *----------------------------------------------------------------------*
    *      -->p_field    Field name
    *      -->p_seltext  Field Header text
    *----------------------------------------------------------------------*
    FORM SET_FIELDCATALOG  USING P_FIELD TYPE SLIS_FIELDNAME
    P_SELTEXT
    TYPE SCRTEXT_M .
    CLEAR  W_FIELDCATALOG.
    W_FIELDCATALOG-FIELDNAME   = P_FIELD.
    W_FIELDCATALOG-SELTEXT_M   = P_SELTEXT.
    W_FIELDCATALOG-COL_POS     = V_COLPOS.
    APPEND W_FIELDCATALOG TO I_FIELDCATALOG.
    V_COLPOS = V_COLPOS +
    1.
    ENDFORM.                    " set_fieldcatalog
    *&---------------------------------------------------------------------*
    *&      Form  SET_LAYOUT
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM SET_LAYOUT .
    W_LAYOUT-NO_HOTSPOT = C_X.
    W_LAYOUT-ZEBRA  = C_X.
    W_LAYOUT-COLWIDTH_OPTIMIZE = C_X.
    ENDFORM.                    " SET_LAYOUT
    *&---------------------------------------------------------------------*
    *&      Form  DISPLAY_ALV_REPORT
    *&---------------------------------------------------------------------*
    *       ALV display
    *----------------------------------------------------------------------*
    FORM DISPLAY_ALV_REPORT .
    V_GRIDTITLE =
    TEXT-042.
    * ALV GRID DISPLAY Function Module call---------------------------------
    CALLFUNCTION'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM     = V_REPID
    I_CALLBACK_TOP_OF_PAGE =
    'TOP_OF_PAGE'
    IT_FIELDCAT            = I_FIELDCATALOG
    IS_LAYOUT              = W_LAYOUT
    I_GRID_TITLE           = V_GRIDTITLE
    TABLES
    T_OUTTAB               = I_FINAL
    EXCEPTIONS
    PROGRAM_ERROR          =
    1
    OTHERS                 = 2.
    IF SY-SUBRC <> 0.
    MESSAGEID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *----------------------------------------------------------------------*
    * top_of_page *
    *----------------------------------------------------------------------*
    * This form is used to set top of page
    *----------------------------------------------------------------------*
    FORM TOP_OF_PAGE.
    DATA : LI_HEADER    TYPETABLEOF SLIS_LISTHEADER,
    LW_HEADER   
    TYPE SLIS_LISTHEADER,
    LV_COUNT    
    TYPEI,
    LV_DATE     
    TYPE CHAR10,
    LV_SELDTE_L 
    TYPE CHAR20,
    LV_SELDTE_H 
    TYPE CHAR20,
    LV_SELDTE   
    TYPE CHAR40.
    *No of records
    DESCRIBETABLE I_FINAL LINES LV_COUNT.
    WRITE LV_COUNT TO LW_HEADER-INFO.
    LW_HEADER-
    KEY = TEXT-035.
    LW_HEADER-TYP = C_S.
    APPEND LW_HEADER TO LI_HEADER.
    *Run of records
    CLEAR LW_HEADER.
    WRITE: SY-DATUM TO LV_DATE USINGEDITMASK'__/__/____'.
    LW_HEADER-
    KEY = TEXT-036.
    LW_HEADER-INFO = LV_DATE.
    LW_HEADER-TYP = C_S.
    APPEND LW_HEADER TO LI_HEADER.
    CLEAR LW_HEADER.
    *Selection dates
    CONCATENATETEXT-040':' S_SELDTE-LOW+4(2) '/'
    S_SELDTE-LOW+
    6(2) '/' S_SELDTE-LOW+0(4)
    INTO LV_SELDTE_L.
    CONCATENATE  TEXT-041':' S_SELDTE-HIGH+4(2) '/'
    S_SELDTE-HIGH+
    6(2) '/' S_SELDTE-HIGH+0(4)
    INTO LV_SELDTE_H .
    CONCATENATE LV_SELDTE_L LV_SELDTE_H
    INTO LV_SELDTE SEPARATEDBY SPACE.
    LW_HEADER-
    KEY = TEXT-037.
    LW_HEADER-INFO = LV_SELDTE.
    LW_HEADER-TYP = C_S.
    APPEND LW_HEADER TO LI_HEADER.
    CALLFUNCTION'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = LI_HEADER.
    ENDFORM.                    "TOP_OF_PAGE
    *&---------------------------------------------------------------------*
    *&      Form  GET_LINESUPERVISOR
    *&---------------------------------------------------------------------*
    *       Get line supervisor
    *----------------------------------------------------------------------*
    *      -->P_PLANS   Plan Versio
    *      <--P_MGRID   Manager Id
    *      <--P_MGRNAME Manager Name
    *----------------------------------------------------------------------*
    FORM GET_LINESUPERVISOR   USING    P_PLANS    TYPE PLANS
    CHANGING P_MGRID    TYPE HROBJID
    P_MGRNAME 
    TYPE CHAR80.
    *----------------------------------------------------------------------*
    *Get Line Supervisor.
    PERFORM GET_INFTY USING    C_01
    C_S
    P_PLANS
    C_1001
    C_A002
    C_S.
    IF  I_HRP1001 ISNOTINITIAL.
    *----------------------------------------------------------------------*
    *Sort Table
    SORT I_HRP1001 BY ENDDA BEGDA DESCENDING.
    *----------------------------------------------------------------------*
    *Read Latest record
    READTABLE I_HRP1001 ASSIGNING<X_HRP1001> INDEX1.
    IF<X_HRP1001> ISASSIGNED.
    P_MGRID = <X_HRP1001>-SOBID.
    PERFORM GET_MANAGERNAME CHANGING P_MGRID P_MGRNAME.
    ENDIF.
    ENDIF.
    ENDFORM.                    " GET_LINESUPERVISOR
    *&---------------------------------------------------------------------*
    *&      Form  GET_MANAGERNAME
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->P_MGRID    Manager Position Id
    *      <--P_MGRNAME  Manager Name
    *----------------------------------------------------------------------*
    FORM GET_MANAGERNAME  CHANGING    P_MGRID TYPE HROBJID
    P_MGRNAME
    TYPE CHAR80.
    *----------------------------------------------------------------------*
    *Get manager PERNR
    PERFORM GET_INFTY USING C_01
    C_S
    P_MGRID
    C_1001
    C_A008
    C_P.
    IF  I_HRP1001 ISNOTINITIAL.
    SORT I_HRP1001 BY ENDDA BEGDA DESCENDING.
    UNASSIGN <X_HRP1001>.
    READTABLE I_HRP1001 ASSIGNING<X_HRP1001> INDEX1.
    IF<X_HRP1001> ISASSIGNED.
    CLEAR: P_MGRID, I_0002.
    P_MGRID = <X_HRP1001>-SOBID.
    *Get PERNR Details
    SELECT PERNR ENDDA BEGDA VORNA NACHN
    FROM PA0002
    INTOTABLE I_0002
    WHERE PERNR = P_MGRID
    AND ENDDA >= S_SELDTE-LOW
    AND BEGDA <= S_SELDTE-HIGH.
    IF I_0002 ISNOTINITIAL.
    *----------------------------------------------------------------------*
    *Sort Table
    SORT I_0002 BY ENDDA BEGDA DESCENDING.
    *----------------------------------------------------------------------*
    *Read Latest record
    UNASSIGN <X_0002>.
    READTABLE I_0002 ASSIGNING<X_0002> INDEX1.
    *----------------------------------------------------------------------*
    *Conctenate first and last name
    IF<X_0002> ISASSIGNED.
    CONCATENATE<X_0002>-VORNA <X_0002>-NACHN
    INTO P_MGRNAME
    SEPARATEDBY SPACE.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDFORM.                    " GET_MANAGERNAME
    *&---------------------------------------------------------------------*
    *&      Form  POPULATE_STATUS
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM POPULATE_STATUS .
    CLEAR: V_NAME,
    I_LIST,
    W_VALUE.
    V_NAME =
    TEXT-005.
    W_VALUE-
    KEY = C_0 .
    W_VALUE-
    TEXT = TEXT-001.
    APPEND W_VALUE TO I_LIST.
    CLEAR: W_VALUE.
    W_VALUE-
    KEY = C_1.
    W_VALUE-
    TEXT = TEXT-002.
    APPEND W_VALUE TO I_LIST.
    CLEAR: W_VALUE.
    W_VALUE-
    KEY = C_2.
    W_VALUE-
    TEXT = TEXT-003.
    APPEND W_VALUE TO I_LIST.
    CLEAR: W_VALUE.
    W_VALUE-
    KEY = C_3.
    W_VALUE-
    TEXT = TEXT-004.
    APPEND W_VALUE TO I_LIST.
    CLEAR: W_VALUE.
    V_NAME = C_P_STAT2.
    CALLFUNCTION'VRM_SET_VALUES'
    EXPORTING
    ID     = V_NAME
    VALUES = I_LIST.
    P_STAT2 =
    3.
    ENDFORM.                    " POPULATE_STATUS
    *&---------------------------------------------------------------------*
    *&      Form  VALIDATATION
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    FORM VALIDATATION .
    DATA: LV_PERNR TYPE PERNR-PERNR.
    *& Validate employee number
    IF S_PERNR ISNOTINITIAL.
    SELECTSINGLE PERNR
    FROM PA0000
    INTO LV_PERNR
    WHERE PERNR IN S_PERNR.
    IF SY-SUBRC <> 0.
    MESSAGETEXT-006TYPE C_E.
    ENDIF.
    ENDIF.
    *& Validate selection date low
    IF S_SELDTE ISNOTINITIAL.
    IF S_SELDTE-LOW ISNOTINITIAL.
    *& If a date is invalid and we assign it an integer result will be zero
    *& Esle,Number of days from '00010101'.
    V_CHECK = S_SELDTE-LOW.
    IF V_CHECK = 0.
    MESSAGETEXT-007TYPE C_E.
    ENDIF.
    ELSEIF S_SELDTE-LOW ISINITIALAND S_SELDTE-HIGH ISNOTINITIAL.
    MESSAGETEXT-043TYPE C_E.
    ENDIF.
    IF S_SELDTE-HIGH ISNOTINITIAL.
    *& If a date is invalid and we assign it an integer result will be zero
    *& Esle,Number of days from '00010101'.
    V_CHECK = S_SELDTE-HIGH.
    IF V_CHECK = 0.
    MESSAGETEXT-007TYPE C_E.
    ENDIF.
    ELSEIF S_SELDTE-LOW ISNOTINITIALAND S_SELDTE-HIGH ISINITIAL.
    MESSAGETEXT-044TYPE C_E.
    ENDIF.
    ELSE.
    S_SELDTE-LOW = C_STARTDATE.
    S_SELDTE-HIGH = C_ENDDATE.
    ENDIF.
    ENDFORM.                    " VALIDATATION

    Get Manager Up To n Levels

    $
    0
    0

    Main

    ************************************************************************
    * Object Name : REPORT  ZHCM_ASMNT3 *
    * Author/Company Name : Krishnakant Joshi *
    * Transport Request *
    * Creation Date * 01/30/2013
    ************************************************************************
    * Description: *  Report to display Employee Manager
    ************************************************************************
    * Dependencies *
    ************************************************************************
    * Modification History *
    ************************************************************************
    * Date Programmer Client Ref No. Description Correction *
    ************************************************************************
    REPORT  zhcm_asmnt3.
    *&**********************************************************************
    *&    INCLUDE
    *&**********************************************************************
    INCLUDE : zhcm_asmnt3_top,        "Global Types and Data
    zhcm_asmnt3_screen,    
    "Screen
    zhcm_asmnt3_form.      
    "Subroutines
    *&**********************************************************************
    *&    INITIALIZATION
    *&**********************************************************************
    INITIALIZATION.
    v_repid = sy-repid.
    *&**********************************************************************
    *&    AT SELECTION-SCREEN.
    *&**********************************************************************
    AT SELECTION-SCREEN.
    *&---------------------------------------------------------------------*
    *& Validate the screen inputs manualy for Manager levels
    PERFORM validation.
    *&**********************************************************************
    *&    AT SELECTION-SCREEN OUTPUT.
    *&**********************************************************************
    AT SELECTION-SCREENOUTPUT.
    LOOPATSCREEN.
    IFscreen-name = c_PNPS$MSL ORscreen-name = c_PNPS$MCD.
    screen-active = 0.
    MODIFYSCREEN.
    ENDIF.
    ENDLOOP.
    *&**********************************************************************
    *&    START-OF-SELECTION
    *&**********************************************************************
    START-
    OF-SELECTION.
    *&---------------------------------------------------------------------*
    *& Populate fieldcatalog table to create structure for dynamic table
    PERFORM  build_fieldcatalog.
    IF i_fieldcatalog ISNOTINITIAL.
    *&---------------------------------------------------------------------*
    *& Get dynamic table to define final table structure
    PERFORM get_dyntable.
    *&---------------------------------------------------------------------*
    * Create dynamic work area and assign to FS
    DATA :lr_line  TYPEREFTOdata.
    CREATEDATA lr_line LIKELINEOF<x_final>.
    ASSIGN lr_line->* TO<x_wfinal>.
    *&---------------------------------------------------------------------*
    * Get HRP1001
    PERFORM get_hrp1001.
    *&---------------------------------------------------------------------*
    * Get PA0001
    PERFORM get_pa0001.
    ENDIF.
    *&**********************************************************************
    *&    GET PERNR
    *&**********************************************************************
    GET pernr.
    APPENDINITIALLINETO<x_final> ASSIGNING<x_wfinal>.
    *&---------------------------------------------------------------------*
    *& Get Action details
    PERFORM get_0000.
    *&---------------------------------------------------------------------*
    *& Get Organizational assignments
    PERFORM get_0001.
    *&**********************************************************************
    *&    END-OF-SELECTION
    *&**********************************************************************
    END-OF-SELECTION.
    IF<x_final> ISNOTINITIAL.
    PERFORM  set_layout.
    PERFORM  display_alv_report.
    ELSE.
    MESSAGEtext-017TYPE c_i.
    ENDIF.

     
     

     

    TOP

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT3_TOP
    *&---------------------------------------------------------------------*
    TYPE-POOLS: slis.
    TABLES: pernr.
    INFOTYPES: 0000, 0001, 1001.
    *&**********************************************************************
    *&   TYPES
    *&**********************************************************************
    TYPES:
    *&---------------------------------------------------------------------*
    *&  HRP1001
    BEGINOF t_hrp1001,
    otype             
    TYPE otype,
    objid             
    TYPE hrobjid,
    rsign             
    TYPE rsign,
    relat             
    TYPE relat,
    begda             
    TYPE begdatum,
    endda             
    TYPE enddatum,
    subty             
    TYPE subtyp,
    sclas            
    TYPE sclas,
    sobid            
    TYPE sobid,
    ENDOF t_hrp1001,
    BEGINOF t_pa0001,
    pernr            
    TYPE pernr-pernr,
    objps            
    TYPE objps,
    endda            
    TYPE begdatum,
    begda            
    TYPE enddatum,
    ename            
    TYPE emnam,
    ENDOF t_pa0001.
    *&**********************************************************************
    *&   DATA
    *&**********************************************************************
    *&  ALV data
    DATA: i_fieldcatalog      TYPE lvc_t_fcat,
    w_fieldcatalog     
    TYPE lvc_s_fcat,
    i_fieldcat         
    TYPESTANDARDTABLEOF slis_fieldcat_alv,
    w_fieldcat         
    TYPE slis_fieldcat_alv,
    v_repid            
    LIKE sy-repid,
    v_gridtitle        
    TYPE lvc_title,
    w_layout           
    TYPE slis_layout_alv,
    v_colpos           
    TYPEiVALUE  1.
    *&---------------------------------------------------------------------*
    *&  Variables
    DATA :v_pernr             TYPE pernr-pernr,
    v_mgrid            
    TYPE hrobjid,
    v_ename            
    TYPE emnam.
    *&---------------------------------------------------------------------*
    *&  Internal tables
    DATA :i_hrp1001           TYPESTANDARDTABLEOF t_hrp1001,
    i_pa0001           
    TYPESTANDARDTABLEOF t_pa0001.
    *&**********************************************************************
    *&   FIELD-SYMBOLS
    *&**********************************************************************
    FIELD-SYMBOLS:<x_final>   TYPESTANDARDTABLE,
    <x_wfinal>,
    <x_field>,
    <x_hrp1001>
    TYPE  t_hrp1001,
    <x_pa0001>
    TYPE  t_pa0001.
    *&**********************************************************************
    *&   CONSTANTS
    *&**********************************************************************
    CONSTANTS : c_e           TYPEc          VALUE'E', "Constant For E
    c_i          
    TYPEc          VALUE'I', "Constant For I
    c_x          
    TYPEc          VALUE'X', "Constant For X
    c_1          
    TYPEc          VALUE'1', "Constant For 1
    c_01         
    TYPE plog-plvar VALUE'01',
    c_a          
    TYPEc          VALUE'A',
    c_b          
    TYPEc          VALUE'B',
    c_s          
    TYPE plog-otype VALUE'S',
    c_o          
    TYPE plog-otype VALUE'O',
    c_p          
    TYPE plog-otype VALUE'P',
    c_a002       
    TYPE plog-subty VALUE'A002',
    c_a001       
    TYPE plog-subty VALUE'A001',
    c_a008       
    TYPE plog-subty VALUE'A008',
    c_b012       
    TYPE plog-subty VALUE'B012',
    c_002        
    TYPE plog-subty VALUE'002',
    c_001        
    TYPE plog-subty VALUE'001',
    c_008        
    TYPE plog-subty VALUE'008',
    c_012        
    TYPE plog-subty VALUE'012',
    c_1001       
    TYPE plog-infty VALUE'1001',
    c_0123456789 
    TYPE char10     VALUE'0123456789',
    c_pnps$msl   
    TYPE char08     VALUE'PNPS$MSL',
    c_pnps$mcd   
    TYPE char08     VALUE'PNPS$MCD'.

     
     

     

    SCREEN

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT3_SCREEN
    *&---------------------------------------------------------------------*
    ************************************************************************
    *& Selection screen
    ************************************************************************
    SELECTION-
    SCREENBEGINOFBLOCK b1 WITHFRAMETITLEtext-011.
    *& Parameter for the selection of manager level
    PARAMETERS : p_level TYPE char02 DEFAULT1 OBLIGATORY.
    SELECTION-
    SCREENENDOFBLOCK b1.

     
     

     

    FORM

    *&---------------------------------------------------------------------*
    *&  Include           ZHCM_ASMNT3_FORM
    *&---------------------------------------------------------------------*
    *&---------------------------------------------------------------------*
    *&      Form  VALIDATION
    *&---------------------------------------------------------------------*
    *       Validate manager level
    *----------------------------------------------------------------------*
    FORM validation .
    *----------------------------------------------------------------------*
    *& Check for manager level whether it is numeric or not,
    IF p_level CA c_0123456789.
    *----------------------------------------------------------------------*
    *&  Manager level must be greater than 0
    IF p_level = 0.
    MESSAGEtext-021TYPE c_e.
    ENDIF.
    ELSE.
    MESSAGEtext-021TYPE c_e.
    ENDIF.
    ENDFORM.                    " VALIDATION
    *----------------------------------------------------------------------*
    * Form build_fieldcatalog *
    *----------------------------------------------------------------------*
    * This form is used set field catalog
    *----------------------------------------------------------------------*
    FORM build_fieldcatalog .
    DATA: lv_field      TYPE lvc_fname,
    lv_seltext   
    TYPE lvc_txt,
    lv_sy_index  
    TYPE char02.
    *----------------------------------------------------------------------*
    * Populate fieldcatalog table static fields
    PERFORM set_fieldcatalog USINGtext-000text-001"Employee #
    text-002text-003"Name
    text-004text-005"Cost Center
    text-006text-007"Org. Unit
    *----------------------------------------------------------------------*
    * Populate fieldcatalog table for Manager level fields
    DO p_level TIMES.
    CLEAR: lv_field, lv_seltext.
    lv_sy_index = sy-
    index.
    *----------------------------------------------------------------------*
    *& Populate PERNR column
    CONCATENATEtext-013 lv_sy_index INTO lv_field.       "Field Name
    CONCATENATEtext-008 lv_sy_index text-000INTO lv_seltext. "Text
    PERFORM set_fieldcatalog USING :  lv_field lv_seltext.
    *----------------------------------------------------------------------*
    *& Populate Manager Position column
    CLEAR: lv_field, lv_seltext.
    CONCATENATEtext-014 lv_sy_index INTO lv_field.       "Field Name
    CONCATENATEtext-008 lv_sy_index text-009INTO lv_seltext. "Text
    PERFORM set_fieldcatalog USING :  lv_field lv_seltext.
    *----------------------------------------------------------------------*
    *& Populate Manager name column
    CLEAR: lv_field, lv_seltext.
    CONCATENATEtext-015 lv_sy_index INTO lv_field.       "Field Name
    CONCATENATEtext-008 lv_sy_index text-010INTO lv_seltext. "Text
    PERFORM set_fieldcatalog USING :  lv_field lv_seltext.
    ENDDO.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *----------------------------------------------------------------------*
    * Form set_fieldcatalog *
    *----------------------------------------------------------------------*
    * This form is used to set field catalog
    *----------------------------------------------------------------------*
    FORM set_fieldcatalog  USING p_field   TYPE lvc_fname
    p_seltext
    TYPE lvc_txt.
    *----------------------------------------------------------------------*
    *Populate fieldcatalog for Dynamic table
    CLEAR  w_fieldcatalog.
    w_fieldcatalog-fieldname   = p_field.    
    "Field Name
    w_fieldcatalog-seltext     = p_seltext.  
    "Text
    w_fieldcatalog-coltext     = p_seltext.
    w_fieldcatalog-col_pos     = v_colpos.   
    "Column position
    APPEND w_fieldcatalog TO i_fieldcatalog.
    *----------------------------------------------------------------------*
    *Populate ALV fieldcatalogs
    CLEAR  w_fieldcat.
    w_fieldcat-fieldname   = p_field.
    w_fieldcat-seltext_m   = p_seltext.
    w_fieldcat-col_pos     = v_colpos.
    APPEND w_fieldcat TO i_fieldcat.
    v_colpos = v_colpos +
    1.
    ENDFORM.                    " set_fieldcatalog
    *&---------------------------------------------------------------------*
    *&      Form  GET_DYNTABLE
    *&---------------------------------------------------------------------*
    *       Get dynamic table for populated fieldcatalog table
    *----------------------------------------------------------------------*
    FORM get_dyntable .
    *----------------------------------------------------------------------*
    *& Create dynamic table
    DATA: li_final TYPEREFTOdata.
    CALLMETHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = i_fieldcatalog
    IMPORTING
    ep_table        = li_final.
    *----------------------------------------------------------------------*
    *& Assign retrived structure to a field symbol
    ASSIGN li_final->* TO<x_final>.
    CLEAR: i_fieldcatalog, w_fieldcatalog.
    ENDFORM.                    " GET_DYNTABLE
    *&---------------------------------------------------------------------*
    *&      Form  GET_HRP1001
    *&---------------------------------------------------------------------*
    *       Get Relations
    *----------------------------------------------------------------------*
    FORM get_hrp1001 .
    SELECT  otype objid rsign relat begda
    endda subty sclas sobid
    FROM hrp1001
    INTOTABLE i_hrp1001
    WHERE (    otype = c_o    OR
    otype = c_s    )
    AND   objid > 0
    AND   plvar = c_01
    AND ( rsign = c_a    OR
    rsign = c_b    )
    AND ( relat = c_001  OR
    relat = c_002 
    OR
    relat = c_008 
    OR
    relat = c_012  )
    AND   istat = c_1
    AND   endda >= pn-begda
    AND   begda <= pn-endda
    AND   infty = c_1001
    AND ( subty = c_a002 OR
    subty = c_a001
    OR
    subty = c_a008
    OR
    subty = c_b012 )
    AND ( sclas = c_o    OR
    sclas = c_p   
    OR
    sclas = c_s    ).
    IF sy-subrc = 0.
    *----------------------------------------------------------------------*
    *& Sort table as per the keys in subsequent read statements
    SORT i_hrp1001 BY otype objid rsign relat
    subty sclas endda
    DESCENDING
    begda
    DESCENDING.
    ENDIF.
    ENDFORM.                    " GET_HRP1001
    *&---------------------------------------------------------------------*
    *&      Form  GET_PA0001
    *&---------------------------------------------------------------------*
    *       Get Org Data
    *----------------------------------------------------------------------*
    FORM get_pa0001 .
    SELECT pernr objps endda begda ename
    INTOTABLE i_pa0001
    FROM pa0001
    WHERE  pernr > 0
    AND endda >= pn-begda
    AND begda <= pn-endda.
    IF sy-subrc = 0.
    *&---------------------------------------------------------------------*
    *& Sort table to get latest recors up
    SORT i_pa0001 BY pernr  endda DESCENDING
    begda 
    DESCENDING.
    *&---------------------------------------------------------------------*
    *& Delete duplicate entries
    DELETEADJACENTDUPLICATESFROM i_pa0001 COMPARING pernr.
    ENDIF.
    ENDFORM.                    " GET_PA0001
    *&---------------------------------------------------------------------*
    *&      Form  GET_0000
    *&---------------------------------------------------------------------*
    *       Get action details
    *----------------------------------------------------------------------*
    FORM get_0000 .
    *&---------------------------------------------------------------------*
    *& Get action data
    rp-
    provide-from-last p0000 space pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    UNASSIGN <x_field>.
    ASSIGNCOMPONENT  text-000
    OFSTRUCTURE<x_wfinal> TO<x_field>.
    IF<x_field> ISASSIGNED.
    <x_field> = p0000-pernr.
    ENDIF.
    ENDIF.
    ENDFORM.                                                    " GET_0000
    *&---------------------------------------------------------------------*
    *&      Form  GET_0001
    *&---------------------------------------------------------------------*
    *       Get organizatioal assignments
    *----------------------------------------------------------------------*
    FORM get_0001 .
    DATA: lv_ORGEH TYPE ORGEH.
    rp-
    provide-from-last p0001 space pn-begda pn-endda.
    IF pnp-sw-found = c_1.
    *& Employee Name
    UNASSIGN <x_field>.
    ASSIGNCOMPONENTtext-002
    OFSTRUCTURE<x_wfinal> TO<x_field>.
    IF<x_field> ISASSIGNED.
    <x_field> = p0001-ename.
    ENDIF.
    *& Cost center
    UNASSIGN <x_field>.
    ASSIGNCOMPONENT  text-004
    OFSTRUCTURE<x_wfinal> TO<x_field>.
    IF<x_field> ISASSIGNED.
    <x_field> = p0001-kostl.
    ENDIF.
    *& Org. unit
    UNASSIGN <x_field>.
    ASSIGNCOMPONENT  text-006
    OFSTRUCTURE<x_wfinal> TO<x_field>.
    IF<x_field> ISASSIGNED.
    <x_field> = p0001-orgeh.
    lv_ORGEH  = p0001-orgeh.
    *&---------------------------------------------------------------------*
    *& Get Manager data
    PERFORM get_manager USING p_level CHANGING lv_ORGEH.
    ENDIF.
    ENDIF.
    ENDFORM.                                                    " GET_0001
    *&---------------------------------------------------------------------*
    *&      Form  GET_MANAGER
    *&---------------------------------------------------------------------*
    *       Get manager data
    *----------------------------------------------------------------------*
    FORM get_manager USING    p_level TYPE char02
    CHANGING p_orgeh TYPE orgeh.
    DATA : lv_count         TYPEi,
    lv_position_col 
    TYPE char20,
    lv_pernr_col    
    TYPE char20,
    lv_name_col     
    TYPE char20,
    lv_sy_index     
    TYPE char02.
    CLEAR: v_ename, v_mgrid, v_pernr.
    lv_count = p_level.
    *----------------------------------------------------------------------*
    *Get Manager
    DO lv_count TIMES.
    lv_sy_index = sy-
    index.
    *----------------------------------------------------------------------*
    *Get Manager Position
    UNASSIGN <x_hrp1001>.
    READTABLE i_hrp1001 ASSIGNING<x_hrp1001>
    WITHKEY  otype = c_o
    objid = p_orgeh
    rsign = c_b
    relat = c_012
    subty = c_b012
    sclas = c_s
    BINARYSEARCH.
    IF<x_hrp1001> ISASSIGNED.
    v_mgrid = <x_hrp1001>-sobid.
    "Manager Position
    *----------------------------------------------------------------------*
    *Get position column name
    CONCATENATEtext-014 lv_sy_index INTO lv_position_col.
    UNASSIGN <x_field>.
    ASSIGNCOMPONENT  lv_position_col
    OFSTRUCTURE<x_wfinal> TO<x_field>.
    *----------------------------------------------------------------------*
    *Set position column
    IF<x_field> ISASSIGNED.
    <x_field> = v_mgrid.
    ENDIF.
    *----------------------------------------------------------------------*
    *Get Manager PERNR
    UNASSIGN <x_hrp1001>.
    READTABLE i_hrp1001 ASSIGNING<x_hrp1001>
    WITHKEY  otype = c_s
    objid = v_mgrid
    rsign = c_a
    relat = c_008
    subty = c_a008
    sclas = c_p
    BINARYSEARCH.
    IF<x_hrp1001> ISASSIGNED.
    v_pernr = <x_hrp1001>-sobid.
    *----------------------------------------------------------------------*
    *Get pernr column name
    CONCATENATEtext-013 lv_sy_index INTO lv_pernr_col.
    UNASSIGN <x_field>.
    ASSIGNCOMPONENT  lv_pernr_col
    OFSTRUCTURE<x_wfinal> TO<x_field>.
    *----------------------------------------------------------------------*
    *Set pernr column
    IF<x_field> ISASSIGNED.
    <x_field> = v_pernr.
    ENDIF.
    *----------------------------------------------------------------------*
    *Get Manager NAME
    UNASSIGN <x_pa0001>.
    READTABLE i_pa0001 ASSIGNING<x_pa0001>
    WITHKEY  pernr = v_pernr
    BINARYSEARCH.
    IF<x_hrp1001> ISASSIGNED.
    v_ename = <x_pa0001>-ename.
    *----------------------------------------------------------------------*
    *Get pernr column name
    CONCATENATEtext-015 lv_sy_index INTO lv_name_col.
    UNASSIGN <x_field>.
    ASSIGNCOMPONENT  lv_name_col
    OFSTRUCTURE<x_wfinal> TO<x_field>.
    *----------------------------------------------------------------------*
    *Set pernr column
    IF<x_field> ISASSIGNED.
    <x_field> = v_ename.
    ENDIF.
    ENDIF.
    ELSE.
    *----------------------------------------------------------------------*
    *No manager position is assigned
    EXIT.
    ENDIF.
    ENDIF.
    *----------------------------------------------------------------------*
    *Go to next level of organization unit
    IF lv_count <> sy-index.
    UNASSIGN <x_hrp1001>.
    READTABLE i_hrp1001 ASSIGNING<x_hrp1001>
    WITHKEY  otype = c_o
    objid = p_orgeh
    rsign = c_a
    relat = c_002
    subty = c_a002
    sclas = c_o
    BINARYSEARCH.
    IF<x_hrp1001> ISASSIGNED.
    p_orgeh = <x_hrp1001>-sobid.
    "Next level organization unit
    ELSE.
    EXIT.
    ENDIF.
    ENDIF.
    ENDDO.
    ENDFORM.                    " GET_MANAGER
    *----------------------------------------------------------------------*
    * Form set_layout *
    *----------------------------------------------------------------------*
    * This form is used to set report layout
    *----------------------------------------------------------------------*
    FORM set_layout.
    w_layout-no_hotspot = c_x.
    w_layout-zebra  = c_x.
    w_layout-colwidth_optimize = c_x.
    ENDFORM.                    "set_layout
    *----------------------------------------------------------------------*
    * Form display_alv_report *
    *----------------------------------------------------------------------*
    * This form is used to display report
    *----------------------------------------------------------------------*
    FORM display_alv_report .
    v_gridtitle =
    text-016.
    * ALV GRID DISPLAY Function Modulecall---------------------------------
    CALLFUNCTION'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program     = v_repid
    i_callback_top_of_page =
    'TOP_OF_PAGE'
    it_fieldcat            = i_fieldcat
    is_layout              = w_layout
    i_grid_title           = v_gridtitle
    TABLES
    t_outtab               = <x_final>
    EXCEPTIONS
    program_error          =
    1
    OTHERS                 = 2.
    IF sy-subrc <> 0.
    MESSAGEID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM.                    "display_alv_report
    *----------------------------------------------------------------------*
    * top_of_page *
    *----------------------------------------------------------------------*
    * This form is used to set top of page
    *----------------------------------------------------------------------*
    FORM top_of_page.
    DATA : li_header TYPETABLEOF slis_listheader,
    lw_header
    TYPE slis_listheader,
    lv_count
    TYPEi,
    lv_date
    TYPE char10.
    *&---------------------------------------------------------------------*
    *& Manager level
    lw_header-info = p_level.
    lw_header-
    key = text-018.
    lw_header-typ = c_s.
    APPEND lw_header TO li_header.
    CLEAR lw_header.
    *&---------------------------------------------------------------------*
    *& No. of records
    DESCRIBETABLE<x_final> LINES lv_count.
    WRITE lv_count TO lw_header-info.
    lw_header-
    key = text-019.
    lw_header-typ = c_s.
    APPEND lw_header TO li_header.
    *&---------------------------------------------------------------------*
    *& Rundate
    CLEAR lw_header.
    WRITE: sy-datum TO lv_date USINGEDITMASK'__/__/____'.
    lw_header-info = lv_date.
    lw_header-
    key = text-020.
    lw_header-typ = c_s.
    APPEND lw_header TO li_header.
    CALLFUNCTION'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = li_header.
    ENDFORM.                    "TOP_OF_PAGE

    Viewing all 672 articles
    Browse latest View live