sap hr abap infotype 2 enhancement for displaying age based on the age
DESCRIPTION
This document will help you to make enhancement to infotype 2 to display the age of employee based on the DOB entered.TRANSCRIPT
Generated by Jive on 2013-02-08+01:001
Infotype 2 enhancement for displayingEmployee age based on the date of birth
First of all my glad wishes to SAP SDN for providing this platform for ABAPers mainly as thisis the basic step to get into sap community for discussing.
THANKS TO MR.SRINIVAS KATREDDY for giving this idea to present it on ourplatform.
In this cool sezn I want to write about a small introduction about infotype enhancement witha tiny example.
OBJECTIVE: Enhancement of Infotype 0002 for displaying age of Employee based on thedate of birth entered in Single screen.
PROCEDURE STEPS:-
1. Open Tcode ' PM01 ' then select 'SINGLE SCREEN'.
2. Enter Infotype 0002 then click on ''GENERATE OBJECTS'.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:002
3. Popup will display with message that 'CI_P0002' doesn't exist. Do you want it create it?Click CREATE button.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:003
4. Then Add a new field with name AGE and give the new custom data element which wascreated with datatype NUMC and lenght '2' .
After that activate and Press F3 for to come back.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:004
5. press enter for the transport requests shown. You will be redirected to BADIimplementation screen then click F3 to return to Infotype Enhancement.
6. Open new Session and open TCODE 'SE80' (OBJECT BROWSER) for editing theInfotype custom include field details i.e. values.
Open program ' ZP000200 ' as below.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:005
7. Double click on Screen ' 0200 ' & go to change mode then (CTRL+F1) then Click on'LAYOUT' (CTRL+F7) to enter into screen Painter.
Double Click the properties of AGE input/output field and change the field attributes to'OUTPUT ONLY' for display only purpose. Please refer the below screenshot.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:006
8. Activate the screen and exit to FLOWLOGIC . Then open PBO module 'MODULE_PBO_0002 ' write the below function module code to calculate and populate ageon the screen as below.
** Function module to calculate the age based on the date of birth entered in screen.
CALL FUNCTION 'HRCM_TIME_PERIOD_CALCULATE'
EXPORTING
BEGDA = P0002-GBDAT
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:007
ENDDA = SY-DATUM
IMPORTING
NOYRS = P0002-AGE " AGE is the custom field name created at PM01
* NOMNS =
* NODYS =
EXCEPTIONS
INVALID_DATES = 1
OVERFLOW = 2
OTHERS = 3.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:008
9. Similarly add the above code in PAI module 'MODULE_PAI_0002' also and then activatethe whole program by right-clicking on the program name in the left hand side window.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:009
10. Then EXIT from the SE80 & PM01 (Infotype enhancement) .
11. Open Tcode PA30 then open Infotype 0002 to check the implemented enhancement.
The AGE field will get populated at both the PBO & PAI levels.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:0010
This was the end of the story.
Keep Blogging.......
Regards,
Praveen Chitturi,
ABAP Enthusiast.
Infotype 2 enhancement for displaying Employee age based on the date of birth
Generated by Jive on 2013-02-08+01:0011