Posted: Sun Nov 04, 2007 5:38 pm Post subject: Read out IT0001 organizational assignment
Read out IT0001 organizational assignment! Translate code digits into text!
Code:
REPORT ZHR0001.
*
********************** HEADER **************
*
* Copyright (c) 2001 by xxxx xxx, 44318 Anywhere, http://xxxxx
* or: Copyright (c) 2001 by X.X. from X.
*
* You can use or modify this report for your own work as long
* as you don't try to sell or republish it.
* In no event will the author be liable for indirect, special,
* Incidental, or consequental damages (if any) arising out of
* the use of this report.
*//////////////////////////////////////////////////////////////////////*
* Append your coding here ...
TABLES: PERNR, T500P, T001P, PA0001, PA0003, PA0006, CSKT, T513S,
PA0002, T503T, PA0008.
DATA: BEGIN OF TAB OCCURS 50,
BUKRS LIKE P0001-BUKRS,
KOSTL LIKE P0001-KOSTL,
TXT3(25),
PERNR LIKE P0001-PERNR,
NAME(50),
TXT1(25),
TXT2(25),
PK(25),
TXT4(25),
GEBTG(10),
STRAS LIKE P0006-STRAS,
PSTLZ LIKE P0006-PSTLZ,
ORT01 LIKE P0006-ORT01,
EINDT(10),
SACHA LIKE P0001-SACHA,
SCHKZ LIKE P0007-SCHKZ,
BSGRD(6),
TRFGB LIKE P0008-TRFGB,
TRFGR LIKE P0008-TRFGR,
* sumbb like q0008-sumbb,
* anzahl(2) type p value 1, " Anzahl der selektierten MA
END OF TAB.
DATA: BEGIN OF TAB2 OCCURS 50,
BUKRS LIKE P0001-BUKRS, "Buchungskreis
KOSTL LIKE P0001-KOSTL, "Kostenstelle
TXT3(25), "Text Kostenstelle
PERNR LIKE P0001-PERNR, "Personalnummer
NAME(50), "Name
TXT1(25), "Text Personalbereich
TXT2(25), "Text Personalteilbereich
PK(25), "Vertragsart
TXT4(25), "Text Stelle
GEBTG(10), "Geburtsdatum
STRAS LIKE P0006-STRAS, "Strasse
PSTLZ LIKE P0006-PSTLZ, "Postleitzahl
ORT01 LIKE P0006-ORT01, "Wohnort
EINDT(10), "Eintrittsdatum IT 0016
SACHA LIKE P0001-SACHA, "Sachbearbeiter Abrechnung
SCHKZ LIKE P0007-SCHKZ, "Arbeitszeitplan
BSGRD(6), "Beschäftigungsgrad
TRFGB LIKE P0008-TRFGB, "Tarifgebiet
TRFGR LIKE P0008-TRFGR, "Tarifgruppe
* sumbb like q0008-sumbb, "Summe Basisbezüge
* anzahl(3),
END OF TAB2.
DATA: BEGIN OF FIELDNAMES OCCURS 20, " Für Excel-Tabelle, 20 Spalten
TEXT(60), TABNAME(10), FIELDNAME(10), TYP,
END OF FIELDNAMES.
DATA: COMPANYCODE LIKE HRCA_COMPANY-COMP_CODE,
COMPANYTEXT LIKE HRCA_COMPANY-COMP_NAME,
PK(25).
* parameter ------------------------------------------------------
PARAMETERS:
P_LISTE(1) TYPE C DEFAULT 'J', "Ausgabe Excel/Word
P_GESCH(1) TYPE C DEFAULT '*', "Geschlecht
P_SORT(1) TYPE C DEFAULT 'J'. "Sort nach Kostst
GET PERNR.
* Selektion des letzten gueltigen Arbeitsplatzsatzes ===================
RP_PROVIDE_FROM_LAST P0001
SPACE PN-BEGDA PN-ENDDA.
MOVE-CORRESPONDING P0001 TO TAB.
* endprovide.
* Ceck des Geschlechts =================================================
IF P_GESCH EQ '*'.
CHECK P0002-GESCH EQ '1' OR P0002-GESCH EQ '2'.
ENDIF.
IF P_GESCH EQ 'M'.
CHECK P0002-GESCH EQ '1'.
ENDIF.
IF P_GESCH EQ 'W'.
CHECK P0002-GESCH EQ '2'.
ENDIF.
* Selektieren der Personalnummer =======================================
SELECT * FROM PA0001
WHERE PERNR EQ PERNR-PERNR.
ENDSELECT.
* Selektieren der MA mit Abrechnung ====================================
SELECT * FROM PA0003
WHERE PERNR EQ PERNR-PERNR.
ENDSELECT.
CHECK PA0003-ABRSP NE 'X'. " Abrechnung gesperrt
* Selektieren des Textes des Personalbereiches =========================
SELECT * FROM T500P
WHERE PERSA EQ PA0001-WERKS. " Personalbereich
ENDSELECT.
TAB-TXT1 = T500P-NAME1.
* Selektieren des Textes des Personalteilbereiches =====================
SELECT * FROM T001P
WHERE BTRTL EQ PA0001-BTRTL. " Personalteilbereich
ENDSELECT.
TAB-TXT2 = T001P-BTEXT.
* Selektieren des Textes der Kostenstelle ==============================
SELECT * FROM CSKT
WHERE KOSTL EQ PA0001-KOSTL. " Kostenstelle
ENDSELECT.
TAB-TXT3 = CSKT-KTEXT.
* Selektieren der Stelle ===============================================
SELECT * FROM T513S
WHERE STELL EQ PA0001-STELL. " Stellenbezeichnung
ENDSELECT.
TAB-TXT4 = T513S-STLTX.
* Selektieren der Vertragsart ==========================================
SELECT * FROM T503T
WHERE PERSK EQ PA0001-PERSK. " Vertragsart
ENDSELECT.
TAB-PK = T503T-PTEXT.
* Selektieren des Namens ===============================================
MOVE P0002-NACHN TO TAB-NAME. " Name
MOVE P0002-VORNA TO TAB-NAME+25.
CONDENSE TAB-NAME.
* Selektieren des Geburtsdatum =========================================
WRITE P0002-GBPAS TO TAB-GEBTG. " Geburtsdatum
* Selektieren der Strasse ==============================================
WRITE P0006-STRAS TO TAB-STRAS. " Strasse
* Selektieren der PLZ ==================================================
WRITE P0006-PSTLZ TO TAB-PSTLZ. " Postleitzahl
* Selektieren des Ortes ================================================
WRITE P0006-ORT01 TO TAB-ORT01. " Wohnort
* Selektieren des Eintrittsdatums ======================================
WRITE P0016-EINDT TO TAB-EINDT. " Eintrittsdatum IT 0016
* Selektieren des Sachbearbeiters ======================================
WRITE P0001-SACHA TO TAB-SACHA. " Sachbearbeiter Abrechnung
* Selektieren des Arbeitszeitplanes ====================================
WRITE P0007-SCHKZ TO TAB-SCHKZ. " Arbeitszeitplan
* Selektieren des Beschäftigungsgrades =================================
SELECT * FROM PA0002 WHERE PERNR EQ PERNR-PERNR.
ENDSELECT.
SELECT * FROM PA0008 WHERE PERNR EQ PERNR-PERNR.
ENDSELECT.
WRITE P0008-BSGRD TO TAB-BSGRD. " Beschäftigungsgrad
* Selektieren des Tarifgebiets =========================================
WRITE P0008-TRFGB TO TAB-TRFGB. " Tarifgebiet
* Selektieren der Tarifgruppe ==========================================
WRITE P0008-TRFGR TO TAB-TRFGR. " Tarifgruppe
* Selektieren der Kostenstelle =========================================
WRITE P0001-KOSTL TO TAB-KOSTL. " Kostenstelle
* Selektieren der Summe Basisbezüge ====================================
* write q0008-sumbb to tab-sumbb. " Summe Basisbezüge
COLLECT TAB.
* Verarbeitung am Ende der Datenselektion
END-OF-SELECTION.
SORT TAB. " sortieren von Tab
LOOP AT TAB.
AT NEW BUKRS.
COMPANYCODE = TAB-BUKRS.
CALL FUNCTION 'HRCA_COMPANYCODE_GETDETAIL'
EXPORTING
COMPANYCODE = COMPANYCODE
LANGUAGE = SY-LANGU
IMPORTING
COMP_NAME = COMPANYTEXT
* CITY =
* COUNTRY =
* CURRENCY =
* LANGU =
* CHRT_ACCTS =
* FY_VARIANT =
* FI_MANAGEMENTAREA =
* JURISDICTION =
* RATE_DEVIATION =
* ADDRESS =
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
CLEAR COMPANYTEXT.
WRITE: / 'Text konnte nicht bestimmt werden'(001).
ENDIF.
*-----------------------------------------------------------------
* Drucken der Zeile
FORM TAB-ZEILE.
IF P_SORT EQ 'J'.
SORT TAB BY KOSTL.
ELSE.
SORT TAB BY PERNR.
ENDIF.
LOOP AT TAB.
*---------------------------------------------------------------------*
* FORM BASIC_LIST *
*---------------------------------------------------------------------*
FORM BASIC_LIST.
IF P_SORT EQ 'J'.
SORT TAB BY KOSTL.
ELSE.
SORT TAB BY PERNR.
ENDIF.
LOOP AT TAB.
MOVE-CORRESPONDING TAB TO TAB2.
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.