Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
25 views

Demo Program Using The Logical Database PNP

Logical database

Uploaded by

rakesh1619
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Demo Program Using The Logical Database PNP

Logical database

Uploaded by

rakesh1619
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Demo program using the logical database PNP

By Chandeep Singh, Fujitsu India

************************************************************************
*** NAME : Chandeep Singh
*** DESCRIPTION : TO GENERATE SIMPLE REPORT USING HR ABAP
** LOGICAl DATABASE- PNP .
************************************************************************
REPORT ZChandeep_HR_prog_1
LINE-SIZE 200 .
****************************
*Database Table
****************************
TABLES: PERNR, " Pernr structure for Logical database
PA0001, " Actions
PA0002. " Personnel Info
****************************
*Infotypes
****************************
INFOTYPES: 0001, " Actions
0002. " personnel info
****************************
*Variable Declaration
****************************
DATA: FORM_NAM LIKE P0001-ENAME,
V_AGE(5) TYPE C, "variable for calculating age in days
V_CTR1 TYPE I VALUE 0, "counter
V_CTR2 TYPE I VALUE 0, "counter
VAR(5) TYPE C , " variable to store btrtl
VAR1(5) TYPE C . " variable to store werks
*****************************
*Internal Table Decalartion
*****************************
DATA: BEGIN OF I_TAB1 OCCURS 0,
WERKS LIKE PA0001-WERKS, "personnel area
BTRTL LIKE PA0001-BTRTL, "personnel sub area
PERNR LIKE PA0001-PERNR, "employee number
ENAME LIKE PA0001-ENAME, "employee name
BEGDA LIKE PA0002-BEGDA, "employee join date
PERSG LIKE PA0001-PERSG, "employee group
PERSK LIKE PA0001-PERSK, "employee sub-group
PLANS LIKE PA0001-PLANS, "position
GBDAT LIKE P0002-GBDAT, "date of birth
END OF I_TAB1.
******************************
*START-OF-SELECTION
******************************
START-OF-SELECTION .
GET PERNR .
RP-PROVIDE-FROM-LAST P0001 SPACE PN-BEGDA PN-ENDDA . " Macro for IFT-0001
RP-PROVIDE-FROM-LAST P0002 SPACE PN-BEGDA PN-ENDDA . " Macro for IFT-0002
**--> Populate internal table
MOVE P0001-WERKS TO I_TAB1-WERKS .
MOVE P0001-BTRTL TO I_TAB1-BTRTL .
MOVE P0001-PERNR TO I_TAB1-PERNR .
MOVE P0001-ENAME TO I_TAB1-ENAME .
MOVE P0002-BEGDA TO I_TAB1-BEGDA .
MOVE P0001-PERSG TO I_TAB1-PERSG .
MOVE P0001-PERSK TO I_TAB1-PERSK .
MOVE P0001-PLANS TO I_TAB1-PLANS .
MOVE P0002-GBDAT TO I_TAB1-GBDAT .
**--> Append data to internal table
APPEND I_TAB1 .
CLEAR I_TAB1 . " Clear header I_TAB1
******************************
*END-OF-SELECTION
******************************
END-OF-SELECTION.
*****sorting the internal table on Personnel Area & Personnel Sub-Area
SORT I_TAB1 BY WERKS BTRTL.
******************************
*TOP_OF_PAGE
******************************
PERFORM TOP_OF_PAGE.
******************************
*Output Display
******************************
LOOP AT I_TAB1.
*for calculating the age in days
V_AGE = SY-DATUM - I_TAB1-GBDAT.
*control break on Personal Sub Area
AT NEW BTRTL .
IF SY-TABIX NE 1.
FORMAT COLOR COL_NORMAL ON.
WRITE:/5 'Total Number of Employees for personnel Sub-Area:',
VAR , 'is ',
V_CTR1.
CLEAR V_CTR1.
FORMAT COLOR OFF.
ENDIF.
ENDAT .
**Control Break on personnel Area
AT NEW WERKS.
IF SY-TABIX NE 1.
FORMAT COLOR COL_TOTAL ON.
WRITE:/5 'Total Number of Employees for Personal Area: ',
VAR1 ,'is ', V_CTR2. "color col_total.
CLEAR V_CTR2.
SKIP 1.
FORMAT COLOR OFF.
ENDIF.
ENDAT .
WRITE:/5 I_TAB1-PERNR, "personnel number
16 I_TAB1-ENAME, "emp name
47 I_TAB1-BEGDA, "join date
60 V_AGE, "age in days
74 I_TAB1-WERKS, "P area
84 I_TAB1-BTRTL, "P sub Area
94 I_TAB1-PERSG, "emp group
104 I_TAB1-PERSK, "emp sub group
114 I_TAB1-PLANS. "position
V_CTR1 = V_CTR1 + 1.
V_CTR2 = V_CTR2 + 1.
VAR = I_TAB1-BTRTL .
VAR1 = I_TAB1-WERKS .
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form top_of_page
*&---------------------------------------------------------------------*
* Header Output
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
FORM TOP_OF_PAGE.
FORMAT COLOR COL_HEADING ON.
WRITE:/5 'Employee',
16 'Employee',
47 'Join Date',
62 'Age',
74 'Personal',
84 'Personal',
94 'Employee',
104 'Employee',
114 'Position ',
/5 'Number',
16 'Name',
60 '(In Days)',
74 'Area',
84 'Sub-Area',
94 'Group',
104 'Sub-Group'.
FORMAT COLOR OFF.
SKIP 1.
ENDFORM. " top_of_page
Following is the output:

You might also like