SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Lists qualifications or expired qualifications



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Wed Nov 07, 2007 10:46 pm    Post subject: Lists qualifications or expired qualifications Reply with quote

Author: guest999
Original: http://www.sapfans.com/forums/viewtopic.php?t=58159

SAP has a function that you can use rather than having to gather up all the data from the several tables (you can look at the function for the tables, if you require them). SAP also has a expired qualifications report, 'RHXPE_EXPIRED_QUALI', which may meet your needs. Following is a simple test example of cutom code, which lists qualifications or expired qualifications.

Code:
REPORT  YZZQUALI LINE-SIZE 170 LINE-COUNT 58.

TABLES:  PERNR, HRP1000, SSCRFIELDS.

INFOTYPES: 0000, 0001, 0105.

CONSTANTS: YES(1) VALUE 'X'.

DATA: PERSONS LIKE HRSOBID OCCURS 0 WITH HEADER LINE,
      QUALI LIKE HRPE_PROFQ OCCURS 0 WITH HEADER LINE,
      BEGIN OF EMP OCCURS 0,
        PERNR        LIKE PERNR-PERNR,
        PLANS        LIKE P0001-PLANS,
        EMAIL        LIKE P0105-USRID_LONG,
      END OF EMP,
      SNAME        LIKE P0001-ENAME,
      SPERNR       LIKE PERNR-PERNR,
      SPLANS       LIKE P0001-PLANS,
      SEMAIL       LIKE P0105-USRID_LONG.

INCLUDE <ICON>.

SELECTION-SCREEN BEGIN OF BLOCK QUAL_FILTER WITH FRAME TITLE TEXT-101.
SELECT-OPTIONS: S_QUAL FOR HRP1000-OBJID NO-DISPLAY.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(15) TEXT-C01.
SELECTION-SCREEN PUSHBUTTON 17(4) QUAL USER-COMMAND QUAL.
SELECTION-SCREEN PUSHBUTTON 23(4) CLR  USER-COMMAND CLR.
SELECTION-SCREEN COMMENT 46(4) TEXT-C02.
PARAMETERS: P_FROM LIKE SY-DATUM OBLIGATORY.
SELECTION-SCREEN COMMENT 63(2) TEXT-C03.
PARAMETERS: P_TO LIKE SY-DATUM OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK X WITH FRAME.
PARAMETER P_EXPIRE RADIOBUTTON GROUP A DEFAULT 'X'.
PARAMETER P_SEARCH RADIOBUTTON GROUP A.
SELECTION-SCREEN END OF BLOCK X.
SELECTION-SCREEN END OF BLOCK QUAL_FILTER.

INITIALIZATION.
  PNPTIMED = 'D'.
  CLEAR PNPSTAT2.
  MOVE 'I' TO PNPSTAT2-SIGN.
  MOVE 'EQ' TO PNPSTAT2-OPTION.
  MOVE '3' TO PNPSTAT2-LOW.
  APPEND PNPSTAT2.
  P_FROM = SY-DATUM + 45.
  P_TO = P_FROM.

AT SELECTION-SCREEN OUTPUT.
  WRITE ICON_CANCEL AS ICON TO CLR.
  DESCRIBE TABLE S_QUAL LINES SY-TFILL.
  IF SY-TFILL GT 0.
    WRITE ICON_DISPLAY_MORE AS ICON TO QUAL.
  ELSE.
    WRITE ICON_ENTER_MORE AS ICON TO QUAL.
    LOOP AT SCREEN.
      IF SCREEN-NAME = 'CLR'.
        SCREEN-ACTIVE = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

AT SELECTION-SCREEN.
  CASE SSCRFIELDS-UCOMM.
    WHEN 'QUAL'.
      PERFORM DISPLAY_TREE.
    WHEN 'CLR'.
      REFRESH S_QUAL.
  ENDCASE.

START-OF-SELECTION.
  PERSONS-PLVAR = '01'.
  PERSONS-OTYPE = 'P'.
GET PERNR.
  CLEAR EMP.
  RP-PROVIDE-FROM-LAST: P0000  SPACE    PN-BEGDA PN-ENDDA,
                        P0001  SPACE    PN-BEGDA PN-ENDDA,
                        P0105  '0010'   PN-BEGDA PN-ENDDA.
  EMP-PERNR = PERNR-PERNR.
  EMP-PLANS = P0001-PLANS.
  EMP-EMAIL = P0105-USRID_LONG.
  PERSONS-SOBID = PERNR-PERNR.
  APPEND: EMP, PERSONS.

END-OF-SELECTION.
  PERFORM GET-QUALIFICATIONS.
  PERFORM WRITE-REPORT.


*---------------------------------------------------------------------*
*       FORM GET-QUALIFICATIONS                                       *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM GET-QUALIFICATIONS.
  CALL FUNCTION 'RHPP_Q_PROFILE_READ'
       EXPORTING
            BEGDA   = P_FROM
            ENDDA   = P_TO
       TABLES
            OBJECTS = PERSONS
            PROFILE = QUALI
       EXCEPTIONS
            OTHERS  = 5.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM WRITE-REPORT                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM WRITE-REPORT.
  LOOP AT QUALI WHERE TTYPE = 'Q' AND TBJID IN S_QUAL.
    IF P_EXPIRE = YES.
      CHECK QUALI-VENDD BETWEEN P_FROM AND P_TO.
    ENDIF.
    READ TABLE EMP WITH KEY PERNR = QUALI-SOBID.
    CHECK SY-SUBRC = 0.
    ON CHANGE OF EMP-PERNR. SKIP. ENDON.
    PERFORM $GET_SUPERVISOR IN PROGRAM ZHR_SUBROUTINE_POOL
            USING SNAME SPERNR SPLANS EMP-PLANS PN-BEGDA 'F'.
    PERFORM $GET_COMMUNICATION_DIRECT IN PROGRAM ZHR_SUBROUTINE_POOL
            USING SEMAIL SPERNR PN-BEGDA '0010'.
    WRITE: /(20) QUALI-STEXT, QUALI-TBJID, (20) QUALI-TTEXT,
           (25) QUALI-PROFC_TEXT, (20) EMP-EMAIL, (20) SNAME,
           (20) SEMAIL, QUALI-VBEGD, QUALI-VENDD.
  ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
*       FORM display_tree                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM DISPLAY_TREE.
  DATA: SEL_OBJECTS LIKE OBJEC OCCURS 0 WITH HEADER LINE,
        MARK_OBJECTS LIKE HRSOBID OCCURS 0 WITH HEADER LINE.
  REFRESH: SEL_OBJECTS, MARK_OBJECTS.
  CLEAR: SEL_OBJECTS, MARK_OBJECTS.
  LOOP AT S_QUAL.
    MARK_OBJECTS-PLVAR = '01'.
    MARK_OBJECTS-OTYPE = 'Q'.
    MARK_OBJECTS-SOBID = S_QUAL-LOW.
    APPEND MARK_OBJECTS.
  ENDLOOP.
  CALL FUNCTION 'RH_OBJID_REQUEST'
       EXPORTING
            PLVAR          = '01'
            OTYPE          = 'Q'
            SEARK          = '*'
            SET_MODE       = 'X'
       TABLES
            SEL_OBJECTS    = SEL_OBJECTS
            MARKED_OBJECTS = MARK_OBJECTS.
  REFRESH S_QUAL.
  CLEAR S_QUAL.
  LOOP AT SEL_OBJECTS.
    S_QUAL-SIGN = 'I'.
    S_QUAL-OPTION = 'EQ'.
    S_QUAL-LOW = SEL_OBJECTS-OBJID.
    APPEND S_QUAL.
  ENDLOOP.
ENDFORM.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
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.