Thursday, February 25, 2010
What is logical Data base
In other words, a LDB is a method by which ABAP programs read and process the data. The sequence in which the data is supplied to the program is determined by a tree structure.
LDB Components
Structure
Selections
Database program
Features
Logical databases have a tree structure.
A logical database can contain a maximum of 300 tables
SAPDBPNP is the name of the database program for the logical database PNP.
SE36 is the Transaction code for the LDB creation.
LDB Events
GET node
This statement defines an event block whose result is triggered by the ABAP runtime environment after submitting an executable program.
If the logical database to which the program is linked, provides data in the work area node. The node work area must be declared with the NODES statement (or TABLES).
The data can be processed in the event block
Different LDB’s for HR module
Organizational Management - PCH
Personnel Administration - PNP or PNPCE
Recruitment - PAP
Personnel Development - PCH
Time Management - PNP
Training and Event Management - PCH
Functions of LDB
1. Data retrieval
The personnel data of each employee is loaded into the main memory where it can be accessed for processing
2. Screening
Employees will be filtered as per the data selection period and the personal selection period from the LDB selection screen
3. Authorization checks
This ensures that the person starting the evaluation Is authorized to access the report data.
HR Report category
Used for HR reports that use the PNP logical database.
It controls the type and number of fields that appear on the selection screen of an evaluation report. HR Report category and the LDB name for an abap program will be provided as attributes information. we have sufficient standard report categorys provided for each LDB and we can even create report categorys as and how we want.
Monday, February 22, 2010
How to Create a Infotype
In general we use T-code PM01 to create Personnel administration infotypes and PPCI to create OM info types.
let us start with a simple example.
If suppose Your company has decided to create a new dress code policy. This policy will be strictly enforced, so your company needs to ensure that everyone has read the new guidelines. Printing the new policy and mailing this out to the employees in order to receive a signed signature back from them is far too costly and cumbersome. A decision has been made to create a custom infotype. You have been tasked with creating the new infotype.
Steps to Creating a Custom Personnel Administration Infotype.
1. Go to transaction PM01 - Create Infotype.
There are six tabs on the transaction PM01’s screen. These are:
· Create Infotype
· Copy Infotype
· Enhance Infotype
· Enhance List Screen
· Delete Infotype
· Action Menu
2. Make certain you are on the create infotype tab.
3. To begin, you need to choose an infotype number from the customer name range. For our example, we will use the infotype number 9990.
4. Ensure that you have the radio button for Employee Data selected.
Note:- here we have three radio buttons available 1.Employee data 2.Applicant data 3.B0th. if we go with employee data then this info type is only ment for employee and table PA9990 will be created, if it is applicant data then this info type is for only applicant and table PB9990 will be created if it is both it is for bothPA9990 and PB9990 will be created
5. Start the create infotype process by defining the components of the infotype. Make sure the radio button for the PS Structure is selected.
6. Select the Create All button to have the system create the module pool (the program with the code to process the infotype), the interface screen, the customizing table entries, and the data dictionary objects for your infotype automatically. (NOTE: the sequence of these steps follows a slightly different path than in the standard SAP Help files)
Data Dictionary Entries
7. You will receive a notice stating that the PS9990 Data Dictionary Object does not exist and you will be asked if you wish to continue. Select yes.
8. R/3 will branch you to the data dictionary.Define the PS9990 structure. A structure consists of a list of components and component types. The component is referred to in screens and programs. The component type determines the attributes of the component, such as whether it is a numeric or character field and the length of the field. Type in the name DRESS_CODE_POL for the component and XFELD as the component type. The short text name should be “Dress code policy” for the PS9990 structure.
9. Define the PS9990 structure. A structure consists of a list of components and component types. The component is referred to in screens and programs. The component type determines the attributes of the component, such as whether it is a numeric or character field and the length of the field. Type in the name DRESS_CODE_POL for the component and XFELD as the component type. The short text name should be “Dress code policy” for the PS9990 structure.
10. Now save and activate the new PS9990 structure. Since you used the PM01 transaction instead of going directly to the data dictionary to create the PS9990 structure, the system builds the top level structure P9990, including both PSHDR and PS9990, for you. The database table PA9990 is automatically built using the definition of P9990.
Infotype Customizing Settings.
11. Carefully hit the green back arrow once (and only once). You will automatically be taken to a view of table T582A – Infotype attributes (Customizing). Here you will give your infotype characteristics that control the way the infotype is processed. If you need to access the customizing table later, you may go to transaction SM30, enter the view name V_T852A, and maintain the customizing settings there.
a. Select “New Entries”.
b. Enter your infotype number 9990 and the Short Text Name “Dress Code Policy”.
c. Make the Time Constraint a 2 since the employee is not required to have this infotype maintained, but if they do maintain this, they can only have one valid record at any given time. (See Time Constraint inset for an explanation of Time Constraints)
d. You will not have subtypes for the infotype, so you may leave the fields relevant to subtypes blank.
e. Check the Access Auth checkbox, which indicates to use the current date for authorization checks.
f. Check the Text checkbox, which allows text to be maintained on the infotype via the transaction PA30 – Maintain Text functionality, via transaction PA30 with the menu path – EDIT>Maintain Text.
g. Place a 3 in the Select with Start field, which indicates if a date is entered in PA30 in the “Period” section, records valid on the date specified are displayed.
h. Enter a 5 into the Select w/end field, which means that the records valid any time within the entered period are displayed.
i. For Select w/o date field, enter a 2, which means records valid for the system date are displayed when no dates have been entered in PA30.
j. The Create w/o start field should be a 3. This field controls what defaults into the start data field during a create process. A 3 indicates the system CPU date will be used.
k. Create w/o end should be a 1. This field controls what defaults into the end date field during a create. A 1 indicates 12/31/9999 will be used.
l. For Screen Header, you should enter the standard screen header 01. This determines the header style displayed on the infotype screen.
m. Do not enter anything into the Retroactive Accounting Trigger section as this infotype would not trigger any retroactivity functionality for payroll or time.
n. In the Technical Data section, place screen number 2000 in for the Single Screen field’s value and a List Screen value of 3000. These are the standard screens numbers that will be generated by PM01.
o. The Dialog Module will be RP_9990. The Structure will be P9990 and the Database table will be PA9990.
*Please note if you are uncertain as to what the field values mean, simply place your cursor into an R/3 field and hit your F1 key for help or F4 for possible field entry values. You can also accomplish the same result by clicking the right mouse button and selecting help or possible entries.
Screen Painter
12. You should now be on transaction PM01 – Create Infotype.
13. Select the Screen radio button and type in 2000 for the screen number.
14. Hit the Edit button.
15. Now you will be taken to the Screen Painter: Initial Screen. PM01 builds a screen based on the fields in the infotype, but you will then refine the screen manually.
16. Select Layout Editor for the MP999000 Screen 2000 and then edit.
17. You will need to remove the Checkbox field/attribute from your screen as it was inserted in the screen just as regular field, and then draw your own checkbox. To do the delete, highlight the word Checkbox (text field) the input field and push the delete button. Select the checkbox Icon to draw a new box (if you do not have the graphical editor turned on, simply select the following path: Edit -> Create Element -> Checkbox.) Enter in the name of the checkbox field, which is P9990-DRESS_CODE_POL. Enter “I agree to the dress code policy” as the text for the checkbox. Double click on the field to access its attributes and make certain that “From dict.” Is checked and your group1 number is 006.
18. Now test your screen by clicking on the Test icon or menu path Screen>Test.
19. If you are happy with your screen, save the screen and activate it.
20.Green arrow back to the PM01 Transaction Screen
Program
21. PM01 uses P9990 to automatically generate MP999000, the module pool program for the infotype. For this example you will not need to change the module pool program to add edits or special processing.
22. You will not need to change the menu or toolbar. We will use the SAP standard menu and toolbar from transaction PA30 – Maintain Master Data.
Testing
23. Go to transaction PA30 – Maintain Master Data.
24. Enter a personnel number of an employee and then type in the infotype 9990 into the direct selection of an infotype field.Hit the create icon (upper left hand corner of the Maintain Master Data screen.)
Wednesday, February 10, 2010
Some thing about info types
Infotypes:
The information units used to enter the data of an employee are called Infotypes.
The Infotypes are used to group related data fields together.
Examples
0002 -Personal data-->This infptype contains data like first name,last name,DOB,maritial status...etc
0006 - Address---> it contains data like, street,city,region.district and telephone numbers where employess residing or working.
0009 - Bank details --> It contains data like bank name,account number..etc of an employee.
why Infotype :
As HR is related to time, we require old data as well as new data. The data we enter into the Infotypes are automatically checked for accuracy and against the table entries. In simple, HR data is huge and to access data easily we require Infotype.
for example: In the above said info types, in 0002 an employee may change his name or marital status may change or any other personnel data may get changed, then it is very important to save old data with correct time frame along with the changed data.
let us suppose if an employee personnel data record exists from 01/01/2000 t0 31/12/9999( this is the max date we consider when there is no end date is given) . if he changes his personnel data on 01/01/2008 then a new record Will be created from 01/01/2008 to 31/12/9999 and the old record Will get delimited to 01/01/2000 to 31/12/2007. so here we have two records for the same employee in the same info type but with the different dates.
Moving on further about infotypes we have to know about time constraints and subtypes.
A time constraint indicates whether more than one Infotype record may be available at one time. When you update an infotype, old data is not lost but archived for historical evaluation. The system records a specific period of validity for each infotype, This enables the system to store more than one infotype record at the same time, even if their validity periods overlap. This means that the time relationships between infotype records must be defined. The concept of time constraints enables you to do this.
There are seven different types of time constraints avilable.
Time Constraint 1:
For the entire time that the employee works at the enterprise, exactly one valid infotype record must exist. The validity periods of the individual records must not overlap. If a new record is created, the system automatically uses the start date of the new record as the delimitation date of the old record. Gaps are only allowed between the employee’s entry date and the start date of the first record.
Time constraint 1 must be used for all of the infotypes containing information that must be available at all times. This is particularly true of personal and organizational assignment data.
If a record is delimited because of time constraint 1, the system displays an appropriate message. Eg:0000-Actions,0001-orgassignent..etc.
Time Constraint 2
No more than one valid record can exist at any one time. Records with constraint 2 must not overlap. Their existence is not obligatory. If a new record is created, the system automatically delimits the previous record, if one exists.
If a record is delimited because of time constraint 2, the system displays an appropriate message. Eg-0023-previous employee.
Time Constraint 3
Any number of valid records can exist at any one time. The individual records do not conflict with each other. Eg0105-comunications.
Time Constraint A
Infotypes with time constraint A must have no more than one record. The system automatically assigns the record a validity period from January 01, 1800 through December 31, 9999. This validity period cannot be subdivided.
Infotype records with time constraint A cannot be deleted.Eg:0003 -payrollstatus
Time constraint B
Infotypes with time constraint B must have no more than one record. The system automatically assigns the record a validity period from January 01, 1800 through December 31, 9999. This validity period cannot be subdivided.
Infotype records with time constraint B can be deleted.Eg
Time Constraint T
Infotype records with time constraint T depend on the subtype.
Subtype:-subtype is a sub category of an info type based on the type of data. for example IT0006 is for addresses and it has many subtypes 1,2,3 and so on for each type of addresses like home address ,work address...etc.
Time Constraint z.
Z: Refers to time management Infotypes. The time constraint for these Infotypes depends on the time constraint class defined in view V_T554S_I Absence: General Control. Collision checks are defined in view V_T554Y Time Constraint Reaction
The principles of data entry and time constraints that apply to infotypes ensure that data is consistent and accurate. They also constitute the basis of time recording, payroll accounting, and reporting.
http://help.sap.com/saphelp_di471/helpdata/EN/48/35c9f24abf11d18a0f0000e816ae6e/frameset.htm
Operation that can be performed on infotypes.
Create
Delimit
Change
Delete
Lock/unlock
display
Infotypes range
0000 – 0999 -> Personal Administration
1000 – 1999 -> Org Management
2000 – 2999 -> Time data
4000 – 4999 -> Applicant Data
9000 – 9999 -> Customer Name space
Apart from org management infotypes all other infotypes can accessed from T-codes PA30 for create and change and PA20 for display and OM infotypes can be accessed from T-Codes PPOME for change,PPOCE for create and PPOSE for display.
Moving on to structures and tables that are associated to each info type.
Each PA info type XXXX requires two structures and one table.
Structures PSXXXX and PXXXX (Eg: For IT0001 containstwo structures PS0001 and p0001)
PSXXXX-> is a structure which contains only info type fields (for example for IT0001 fields like BUKRS,WERKS,PERSG,PERSK..etc will be available.)
PXXXX-> is a combination of structres PSKEY,PSHD1,PSXXX,CI_PXXXX(optional).
PSKEY:- it is a PA info type comman Key fields structurethe same structure is used for all PA info types as key.bleow are the fields fields of this structure.
PERNR-> PersonnelNumber
INFTY-> Infotype
SUBTY ->Subtype
OBJPS ->Object Identification
SPRPS-> Lock Indicator for HR Master Data Record
ENDDA ->End DateBEGDA
BEGDA ->Start Date
SEQNR ->Number of Infotype Record with Same Key
PSHD1-> is a structure with Control Fields like "changed on, Name of the person who changed..etc it contains 15 fields all are related to control data. This is also comman to all PA info types.
CI_Pxxxx-> Is an optional structure which indicates whether that particular info type can be enhanced or not, if you enhance info type with new fields those fields will be saved under this structure. (Eg:-for IT0001 ->CI_P0001)
Tables:-PAXXXX and PBXXXX(optional).
PAXXXX-> Is a transparent table which includes structures PSKEY,PSHD1,PSXXX,CI_PXXXX(optional) and MANDT field. the structure of this table resumbles same like PXXXX.
PBXXXX-> Is also a transparent table and resumbles same as PAXXXX table. This table stores only APPLICANT DATA which means not employees data, for example data of the candidates who applied for the organisation are stored. This table is optional and it may or may not exist for info type.
Coming to OM info types XXXX each infotype has one table and one structure.
Table:HRPXXXX,Structure PXXXX (for example IT10001 table is HRP1001, P1001)
Infotype screensAn initial screen
Single screen
List screen
Infotype includes
MPXXXX00 – Main program
MPXXXX10 – Declarations and includes
MPXXXX20 – PBO for the screen
MPXXXX30 – PAI for the screen
MPXXXX40 – Subroutines
Difference between ABAP and HR-ABAP
To simply say HR-ABAP is also ABAP where existing FMs, macros,LDBs...etc are designed specially to retrieve HR-DATA.
Before getting into HR-ABAP technically, we have to know about some concepts which are specific to SAP-HR and some terms where we have not used much while working with ABAP.
concepts:Info-types,LDBs,macros, provide/endprovide statement and Authorisation checks.