Thursday, December 12, 2013

HR ABAP FAQs

Define HR ABAP:
HR deals with the INFOTYPES which are similar to Tables in General ABAP. There are different ways of fetching data from these infotypes. There are different areas in HR LIKE Personal Administration, Organizational Management, Time management, Event Management; Payroll etc. LDBS (Logical Database) like PNP are used in HR programming. Instead of Select, we use some ROUTINES and PROVIDE, ENDPROVIDE etc. In the case of Pay roll, we use Clusters and we Import and Export them for data fetching. On the whole Normal ABAP is different from HR ABAP.

What is LDB?
A logical database (LDB) is a special ABAP/4 program which combines the contents of certain database tables. Using logical databases facilitates the process of reading database tables. HR Logical Database is PNP.
Main Functions of the logical database PNP: 1) Standard Selection screen. 2) Data Retrieval. 3) Authorization check. To use logical database PNP in your program, specify in your program attributes.

Modules of HR ABAP:
1) Personnel Management. 2) Personnel Administration. 3) Personnel Development.      4) Personnel Time Management. 5) Organization Management. 6) Payroll Management.  7) Compensation. 8) Benefit Management.

What is the difference between ABAP and HR-ABAP?
1) ABAP contains only one database where as HR-ABAP contains two database's.
2) We can retrieve data from HR-ABAP before payroll run and after payroll run where as it is not possible in ABAP.
3) We can find new concept like INFOTYPES along with database but in ABAP we can find only database tables.

What is an Infotype?
Info types are tables (for user Data entry screen) that contain logically related employee data. Data can be stored for specific periods, which includes current and historical.
Use: Recording employee data for administrative, time recording and payroll purposes is of primary importance for master data administration in HR. In the SAP System, the information units used to enter master data are called info types

What is PROVIDE and ENDPROVIDE?
PROVIDE and ENDPROVIDE is nothing but a select statement. Through this u can select records from more that one table and this also acts as a loop.

What is a macro? Where can u get the macros?
It is nothing but a global subroutine. You can get the macros from the table "TRMAC".

What is the Transaction code for creating Custom Infotypes?
PM01 is the tcode for creating custom Infotypes.

What is the difference between Smartforms and sap scripts?
1) Smartforms is client independent where as script is client dependent.
2) Main window is optional in Smartforms where as main window is mandatory in script.
3) Logo cannot be created in Smartforms where as logo can be created

What is client independent and client dependant?
Client Independent means: There is no necessary to transfer the program from one client to another client with in the same server example Smartforms. Client dependent: program must be transferred from one client to another client even in the same server.example sap scripts. These scripts must be transferred using the tcode scc1.

How to exclude one person and run payroll?
Locking the person would automatically stop running his/her payroll. A person can be locked using the Infotype 0003 (Payroll status). In the Infotype 0003, use the field "Lock person No". This would stop from running the payroll.

How the Infotype number ranges classified?
1.HR Master Data -> 0000-0999, 2.Organizational Management/Personnel Planning ->1000-1999, 3.Time Management ->2000-2999, 4.Recruitment ->4000-4999, 5.Customer-Developed enhancements -9000-9999

What is PA?
PA (Personnel Administration) involves administrating employee data, commonly referred to Master Data.
Master Data contains all employee data used in HR processing. Master Data includes Personal (Eg. address), Organizational (Position description), Benefits (Insurance, Pension). Master Data is stored in Info types.

What is a Cost Center in an Organization?
It is the smallest organizational entity where budget and actual cost activities take place. As costs are incurred, they are assigned or posted to the appropriate cost center.
It has both characteristics pertinent in cost generation and the ability to track and control those costs.

What is the range of infotypes for PA, PY, TM, OM, RECRUITMENT and Custom infotypes?
PA OR PY = 0000 To 0999. OM = 1000 To 1999. TM = 2000 To 2999. RECRUITMENT = 4000 To 4999. Custom infotypes start from 9000 To 9999 and the series 3000 to 3999 are not in use.

What is the tcode to check the master data?
PA30

What is the tcode to check the personnel actions?
PA40

Specify the areas in which the organizational assignments are made in PA?
1) Enterprise structure. 2) Personnel structure. 3) Pay scale structure. 4) Wage types.
5) User authorizations.

What are the elements of Enterprise Structure in PA?
1) Client. 2) Company code. 3) Personnel Area. 4) Personnel Sub Area. 5) Organizational Key.

Define Employee Group:
It divides or groups the employees into various categories. E.g. External employees, Retired employees, Contractors Employee groups are used to generate default values for payroll accounting area and basic pay.
In Customizing, each employee group is defined with one-digit identification.

What is a Payroll Area?
Payroll Area - A group of employees for whom payroll should be run together at the same time.

The payroll area contains the following information:
1. Payroll area Text
2. Period Parameters - Key that uniquely identifies payroll periodicity in the system. You can assign different period parameters to different payroll areas so that the payroll runs for them at different intervals.
Example: 1) Period parameter 01 (monthly). 2) Period parameter 03 (weekly).
3. Date modifier - Distinguishing criterion enabling you to define various date specifications for the payment days with the same periodicity (for example, monthly).
Example: In your enterprise, payroll is run monthly. For industrial employees, the payment day is the 15th of the month; for salaried employees it is the 25th. Since both employee groups have the same periodicity, the system requires two date modifiers as a distinguishing criterion to define different payment dates.

What are the elements of Personnel Structure in PA?
Personnel Structure describes an employee’s position in a company from the individual employee’s view.
The personnel structure can be considered from two perspectives:
- Administrative perspective
- Organizational perspective

Elements of Administrative personnel structure:
1) Employee Group. 2) Employee Sub Group. 3) Payroll Area. 4) Organizational Key.
The organizational key consists of a part of both the enterprise structure and the personnel structure. The elements employee group and employee subgroup could also be relevant in forming the organizational key.

Elements of Organizational personnel structure:
1)      Position. 2) Job. 3) Organizational unit.

What is a Personnel Area?
Personnel Area: represents a division of a company code into subunits. It is an organizational entity representing an area within an organization defined by specific aspects of personnel administration, time management and payroll. Personnel areas are subdivided into personnel sub areas. Personnel area is specific to HR and is a four character alphanumeric identification.
E.g. Personnel area "BANG" is for employees in Bangalore; "CHEN" is for Chennai.

Why use LDB in HR Programming?

To reduce programming efforts -events driven, selection screen and data extraction provided by LDB. Centralized Authorization Checking. Improved performance.

Deductions

Enhancement code

ENHANCEMENT 1  ZDECLARE.    "active version
******** "HERE WRITE THE CODE
  DATA:  B 
TYPE T706V-BETFA,
         
C TYPE T706V-BETFA,
         A 
TYPE T706V-BETFA,
         D 
TYPE T706V-BETFA,
         E 
TYPE T706V-BETFA.


DATA: WA_T706V_CONST 
TYPE T706_CONST,
      IT_T706_CONST 
TYPE TABLE OF T706_CONST.

DATA: WA_ABZUG 
TYPE PTK04,
      WA_VPFPA 
TYPE PTK23,
      WA_VPFPS 
TYPE PTK22.

DATA: COUNTT    
TYPE I, "T706T TABLE SCHEM IN ('20','21','22','23').
      COUNTTT   
TYPE I, "T706T TABLE SCHEM IN ('22','23').
      COUNTTTT  
TYPE I, "T706T TABLE SCHEM IN ('20','21').
      COUNTX    
TYPE I, "T706X TABLE BEREI IN ('F').
      COUNTXX   
TYPE I, "T706X TABLE BEREI IN ('O').
      COUNTXXX  
TYPE I. "T706X TABLE BEREI IN ('O')

**********************************************************************
* GETTING THE B VALUE OVER HERE
**********************************************************************
SELECT SINGLE FROM T706_CONST  INTO WA_T706V_CONST WHERE KONST = 'ZGMRT'.
IF SY-SUBRC EQ 0.
 B = WA_T706V_CONST-KWERT.
ENDIF.

**********************************************************************
* GETTING THE E VALUE OVER HERE
**********************************************************************
SELECT SINGLE FROM T706_CONST  INTO WA_T706V_CONST WHERE KONST = 'ZICFL'.
IF SY-SUBRC EQ 0.
 E = WA_T706V_CONST-KWERT.
ENDIF.
********************************************************************************
*****CONUS OFF Base and OCONUS OFF Base: ***************************************
*CHECK THE TABLE T706T WHERE MOREI = '10' AND SCHEM 20 AND 21 AND 22 AND 23.
*CHECK THE TABLE T706X WHERE BEREI = 'F'.
*****************OR**************************************************************
******CONUS ON Base**************************************************************
*CHECK THE TABLE T706T WHERE MOREI = '10' AND SCHEM 20 AND 21.
*CHECK THE TABLE T706X WHERE BEREI = 'O'.
*********************************************************************************
SELECT COUNT(*) FROM T706T INTO COUNTT WHERE MOREI EQ '10'
                    
AND SCHEM IN ('20','21','22','23'). "CONUS OFF Base and OCONUS OFF Base:
SELECT COUNT(*) FROM T706T INTO COUNTTTT WHERE MOREI EQ '10'
                    
AND SCHEM IN ('20','21').           "CONUS ON Base:

  
IF COUNTT EQ 4.
*  BREAK-POINT.
  
SELECT COUNT(*) FROM T706X INTO COUNTX WHERE MOREI EQ '10'
                    
AND BEREI IN ('F').
  
SELECT COUNT(*) FROM T706X INTO COUNTXXX WHERE MOREI EQ '10'
                    
AND BEREI IN ('O').

*      BREAK-POINT.
      
IF COUNTX GE OR COUNTXXX GE 1.
*        CODE FOR REIMBURSE AMOUNT
        
IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
            
LOOP AT ABZUG INTO WA_ABZUG.
                          
READ TABLE VPFPA INTO WA_VPFPA WITH KEY DATV1 = WA_ABZUG-ABDAT.

                         
IF WA_ABZUG-FRSTK EQ 'X' AND WA_ABZUG-MITAG EQ 'X' AND WA_ABZUG-ABEND EQ 'X'"IF SELECT ALL CHECK BOXS
                           D = WA_VPFPA-BETKU.
                           WA_VPFPA-BETFA = D.
                           
MODIFY TABLE VPFPA FROM WA_VPFPA.
                           CLEAR: D, WA_VPFPA.

                         
ELSEIF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'."IF SELECT ANY ONE OR TWO CHECK BOXS
                           A = ( WA_VPFPA-BETFA - WA_VPFPA-BETKU ).
                           
= ( A + B ) / 2.
                           D = 
+ WA_VPFPA-BETKU.

                           WA_VPFPA-BETFA = D.
                           
MODIFY TABLE VPFPA FROM WA_VPFPA.
                         ENDIF.
                        CLEAR: A, C, D, WA_VPFPA.
            ENDLOOP.
        ENDIF.

      
IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
        
LOOP AT ABZUG INTO WA_ABZUG.

                
READ TABLE VPFPS INTO WA_VPFPS WITH KEY DATV1 = WA_ABZUG-ABDAT.

                 
IF WA_ABZUG-FRSTK EQ 'X' AND WA_ABZUG-MITAG EQ 'X' AND WA_ABZUG-ABEND EQ 'X'"IF SELECT ALL CHECK BOXS
                   D = WA_VPFPS-BETKU.
                   WA_VPFPS-BETFA = D.
                   
MODIFY TABLE VPFPA FROM WA_VPFPA.
                   CLEAR: D, WA_VPFPA.
                
ELSEIF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'."IF SELECT ANY ONE OR TWO CHECK BOXS
                    A = ( WA_VPFPS-BETFA - WA_VPFPS-BETKU ).
                    
= ( A + B ) / 2.
                    D = 
+ WA_VPFPS-BETKU.
                    WA_VPFPS-BETFA = D.
*                    *WA_VPFPs-BETFz = D.
                    
MODIFY TABLE VPFPS FROM WA_VPFPS.
                ENDIF.

                  CLEAR: A, C, D, WA_VPFPS.
        ENDLOOP.
      ENDIF.
*        END OF CODE FOR REIMBURSE AMOUNT
    ENDIF.
  ENDIF.

********************************************************************************
*****OCONUS ON Base: ***************************************
*CHECK THE TABLE T706T WHERE MOREI = '10' AND SCHEM 22 AND 23.
*CHECK THE TABLE T706X WHERE BEREI = 'O'.
*********************************************************************************
SELECT COUNT(*) FROM T706T INTO COUNTTT WHERE MOREI EQ '10'
                    
AND SCHEM IN ('22','23').
BREAK-POINT.
    
IF COUNTT NE AND COUNTTT EQ 2.
      
SELECT COUNT(*) FROM T706X INTO COUNTXX WHERE MOREI EQ '10'
                    
AND BEREI IN ('O').

      BREAK-POINT.
      
IF COUNTXX GE 1.
        
IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
            
LOOP AT ABZUG INTO WA_ABZUG.
                          
READ TABLE VPFPA INTO WA_VPFPA WITH KEY DATV1 = WA_ABZUG-ABDAT.

                          
IF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'.
                           A = ( WA_VPFPA-BETFA - WA_VPFPA-BETKU ).
                           
= ( A + B ) / 2.
                           D = 
+ E.

                           WA_VPFPA-BETFA = D.
                           
MODIFY TABLE VPFPA FROM WA_VPFPA.
                         ENDIF.
                        CLEAR: A, C, D, WA_VPFPA.

*                         IF WA_ABZUG-FRSTK EQ 'X' AND WA_ABZUG-MITAG EQ 'X' AND WA_ABZUG-ABEND EQ 'X'. "IF SELECT ALL CHECK BOX
*                           D = WA_VPFPA-BETKU.
*                           WA_VPFPA-BETFA = D.
*                           MODIFY TABLE VPFPA FROM WA_VPFPA.
*                         ENDIF.
*                        CLEAR: D, WA_VPFPA.


            ENDLOOP.
        ENDIF.

      
IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
        
LOOP AT ABZUG INTO WA_ABZUG.

                
READ TABLE VPFPS INTO WA_VPFPS WITH KEY DATV1 = WA_ABZUG-ABDAT.

                  
IF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'.
                    A = ( WA_VPFPS-BETFA - WA_VPFPS-BETKU ).
                    
= ( A + B ) / 2.
                    D = 
+ E.

                    WA_VPFPS-BETFA = D.
*                    *WA_VPFPs-BETFz = D.

                    
MODIFY TABLE VPFPS FROM WA_VPFPS.
                  ENDIF.

*                  IF WA_ABZUG-FRSTK EQ 'X' AND WA_ABZUG-MITAG EQ 'X' AND WA_ABZUG-ABEND EQ 'X'. "IF SELECT ALL CHECK BOX
*                   D = WA_VPFPS-BETKU.
*                   WA_VPFPs-BETFA = D.
**                    *WA_VPFPs-BETFz = D.
*                    MODIFY TABLE VPFPs FROM WA_VPFPs.
*                  ENDIF.

                  CLEAR: D, WA_VPFPS.
        ENDLOOP.
      ENDIF.
*        END OF CODE FOR REIMBURSE AMOUNT
    ENDIF.


    ENDIF.


*********************************************************************
* GETTING THE A VALUE OVER HERE
*********************************************************************
*IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
*LOOP AT ABZUG INTO WA_ABZUG.
*
*READ TABLE VPFPA INTO WA_VPFPA WITH KEY DATV1 = WA_ABZUG-ABDAT.
*
*IF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'.
*A = ( WA_VPFPA-BETFA - WA_VPFPA-BETKU ).
*C = ( A + B ) / 2.
*D = C + WA_VPFPA-BETKU.
*
*WA_VPFPA-BETFA = D.
*
*
*MODIFY TABLE VPFPA FROM WA_VPFPA.
*ENDIF.
*
*CLEAR: A, C, D, WA_VPFPA.
*ENDLOOP.
*ENDIF.
*
*********Raj********
*
*
*IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
*LOOP AT ABZUG INTO WA_ABZUG.
*
*READ TABLE VPFPS INTO WA_VPFPS WITH KEY DATV1 = WA_ABZUG-ABDAT.
*IF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'.
*A = ( WA_VPFPS-BETFA - WA_VPFPS-BETKU ).
*C = ( A + B ) / 2.
*D = C + WA_VPFPS-BETKU.
*
*WA_VPFPs-BETFA = D.
**WA_VPFPs-BETFz = D.
*
*
*MODIFY TABLE VPFPs FROM WA_VPFPs.
*ENDIF.
*
*CLEAR: A, C, D, WA_VPFPs.
*ENDLOOP.
*ENDIF.
******Raj*********

ENDENHANCEMENT.




Per Diem Calculation for CONUS and OCONUS region.

CONUS                                                                                                                      OCONUS

ON/OFF Base                                                                                     OFF Base                                           ON Base
 


Per Diem Calculation
Per Diem+Incidental
T706V-BETFA (reimbursement Amount + T706V-BETKU (Customer Amount)
                                                                                                                                                                                                                                                                                                                                                                                                                  Per Diem Calculation
                                                                                                                                                            Per Diem-Incidental+Flatrate
      Combination of T706V-BETFA - T706V-BETKU + V_T706_CONST (value of    
     “KONST= ZICFL” i.e. T706_CONST-KWERT.  (line no : 838, line no : 877)              

Deductions
Following are the detailed specification of deductions for CONUS and OCONUS Locations
  1. If employee selects 1 or 2 of the meals (breakfast, lunch, dinner), then the employee only receives Proportional Meal Rate + Incidentals.
    1. The Proportional Meal Rate (PMR) is in the per diem files, however it looks like it can also be a calculated field. The calculation is:

      1. Local meal rate + GMR (Government Meal Rate)
      2. Divide by 2 (rounded-up to the nearest dollar)
      3. Add Incidental Amount
LOGIC
T706V-BETFA (reimbursement Amount) - T706V-BETKU (Customer Amount) + V_T706_CONST (value of   “KONST= GMRTA” i.e. T706_CONST-KWERT divided by TWO + T706V-BETKU (Customer Amount)
NOTE: - Refer the below table for combinations and logic of the deductions (Breakfast-Lunch-Dinner)
  1. If employee selects all 3, then the employee receives only the incidentals amount.
                                                T706V-BETKU (Customer Amount)

Deductions Combination
Options
Breakfast
Lunch
Dinner
Description
1
x
PMR+incidental


2
x
3
x
4
x
x
5
x
x
6
x
x
7
x
x
x
Only Incidental Amount (T706V-BETKU (Customer Amount)
8
Blank
Blank
Blank
Per diems+incidental (T706V- BETFA: Reimbursement Amount) CONUS ON/OFF Base


user exits:
------------

GOS_SRV_SELECT

FAGL_DERIVE_SEGMENT
FAGL_DERIVE_PSEGMENT
CHECK_COBL_ADDON