Posted: Fri Apr 11, 2008 11:39 pm Post subject: Get employee data
Code:
REPORT ZPS_GET_EMPLOYEE_DATA .
***********************************************************************
* This report displays the employee fact sheet developed for the
* Public Sector HRIC functionality Demo using CRM. The report displays
* a predefined set of field values from various infotypes on a screen.
* All infotypes are read using the RH_GET_INFTY_NNNN function call to
* preserve authority checking. If no data exists or no authority to
* view the data the output will contain blanks.
***********************************************************************
* Creation date: 17.03.2002
* Created by: Neil Missig
***********************************************************************
* Last Changed date:
* Changed by:
* Reason:
***********************************************************************
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
* INCLUDES
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
* DATA Section
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
constants SPOUSE TYPE PA0021-FAMSA VALUE '1'.
constants HOMEADDR TYPE PA0006-SUBTY VALUE '1'.
constants EMAIL TYPE PA0105-SUBTY VALUE '0010'.
DATA: SUBRC like sy-subrc.
DATA: I0000 type p0000 occurs 0 with header line.
DATA: I0001 type p0001 occurs 0 with header line.
DATA: I0002 type p0002 occurs 0 with header line.
DATA: I0006 type p0006 occurs 0 with header line.
DATA: I0021 type p0021 occurs 0 with header line.
DATA: I0041 type p0041 occurs 0 with header line.
DATA: I0105 type p0105 occurs 0 with header line.
DATA: I0167 type p0167 occurs 0 with header line.
DATA: I0171 type p0171 occurs 0 with header line.
DATA: SELPER type HROBJECT occurs 0 with header line.
DATA: BEGIN OF IPERDATA,
PERNR TYPE PA0002-PERNR,
NACHN TYPE PA0002-NACHN,
VORNA TYPE PA0002-VORNA,
GESCH TYPE PA0002-GESCH,
GBDAT TYPE PA0002-GBDAT,
FAMST TYPE PA0002-FAMST,
PERID TYPE PA0002-PERID,
FGBDT TYPE PA0021-FGBDT,
FAVOR TYPE PA0021-FAVOR,
FANAM TYPE PA0021-FANAM,
NAME2 TYPE PA0006-NAME2,
STRAS TYPE PA0006-STRAS,
ORT01 TYPE PA0006-ORT01,
ORT02 TYPE PA0006-ORT02,
LAND1 TYPE PA0006-LAND1,
PSTLZ TYPE PA0006-PSTLZ,
TELNR TYPE PA0006-TELNR,
LOCAT TYPE PA0006-LOCAT,
STATE TYPE PA0006-STATE,
USRID_LONG TYPE PA0105-USRID_LONG,
END OF IPERDATA.
DATA: BEGIN OF IEMPDATA,
PERNR TYPE PA0000-PERNR,
STAT2 TYPE PA0000-STAT2,
DAT01 TYPE PA0041-DAT01,
DAT02 TYPE PA0041-DAT02,
BUKRS TYPE PA0001-BUKRS,
WERKS TYPE PA0001-WERKS,
PERSG TYPE PA0001-PERSG,
PERSK TYPE PA0001-PERSK,
BTRTL TYPE PA0001-BTRTL,
ABKRS TYPE PA0001-ABKRS,
ANSVH TYPE PA0001-ANSVH,
KOSTL TYPE PA0001-KOSTL,
ORGEH TYPE PA0001-ORGEH,
PLANS TYPE PA0001-PLANS,
STELL TYPE PA0001-STELL,
ORGTX TYPE P1000-STEXT,
PLSTX TYPE P1000-STEXT,
STLTX TYPE P1000-STEXT,
BAREA TYPE PA0171-BAREA,
BENGR TYPE PA0171-BENGR,
BSTAT TYPE PA0171-BSTAT,
DEPCV TYPE PA0167-DEPCV,
END OF IEMPDATA.
DATA: BEGIN OF DATETYPES,
DAR LIKE P0041-DAR01,
DAT LIKE P0041-DAT01,
END OF DATETYPES.
DATA OK_CODE like sy-ucomm.
DATA SAVE_OK like sy-ucomm.
selection-screen begin of block A1 with frame title TEXT-A01.
parameters tpernr like pa0000-pernr memory id PER.
selection-screen end of block A1.
Selection-screen begin of block A2 with frame title TEXT-A02.
parameters seldat like pa0000-endda default sy-datum.
parameters plang like hrp1000-langu default sy-langu.
parameters: hirdt like pa0041-dar01 default '40',
vacdt like pa0041-dar01 default 'A3'.
selection-screen end of block A2.
select single stext from hrp1000
into iempdata-orgtx
where plvar = '01'
and otype = 'O'
and objid = iempdata-orgeh
and langu = plang
and begda le seldat
and endda ge seldat.
select single stext from hrp1000
into iempdata-plstx
where plvar = '01'
and otype = 'S'
and objid = iempdata-plans
and langu = plang
and begda le seldat
and endda ge seldat.
select single stext from hrp1000
into iempdata-stltx
where plvar = '01'
and otype = 'C'
and objid = iempdata-stell
and langu = plang
and begda le seldat
and endda ge seldat.
endif.
GETDATA '0041' '' I0041.
if subrc = 0.
read table I0041 index 1.
DO 12 TIMES VARYING DATETYPES
FROM I0041-DAR01
NEXT I0041-DAR02.
IF DATETYPES-DAR = HIRDT.
IEMPDATA-DAT01 = DATETYPES-DAT.
EXIT.
ENDIF.
ENDDO.
DO 12 TIMES VARYING DATETYPES
FROM I0041-DAR01
NEXT I0041-DAR02.
IF DATETYPES-DAR = VACDT.
IEMPDATA-DAT02 = DATETYPES-DAT.
EXIT.
ENDIF.
ENDDO.
endif.
end-of-selection.
perform screen_out.
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
* FORMS Section
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
*&---------------------------------------------------------------------*
*& Form screen_out
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM screen_out.
call screen 500.
ENDFORM. " screen_out
*Selection texts
*----------------------------------------------------------
* HIRDT Hire Date Type Code in IT0041
* PLANG Language.
* SELDAT Selection Date
* TPERNR Employee Number
* VACDT Vac. Date Type Code in IT0041
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.