Friday, 23 March 2012

(OM) Organization Management in HR-ABAP

* USING RH_READ_INFTY_1000 
*       RH_READ_INFTY_1001 

REPORT  ZCLASS_H17 LINE-SIZE 200.

TABLES PERNR.

INFOTYPES: 1001, 1000.

DATA G_OBJID TYPE P1001-OBJID.

START-OF-SELECTION.

GET PERNR.
CALL FUNCTION 'RH_READ_INFTY_1000'
 EXPORTING
*   AUTHORITY              = 'DISP'
*   WITH_STRU_AUTH         = 'X'
   PLVAR                  = '01'
   OTYPE                  = 'S'
   OBJID                  = PERNR-PLANS
*   ISTAT                  = ' '
*   EXTEND                 = 'X'
   BEGDA                  = PN-BEGDA
   ENDDA                  = PN-ENDDA
*   CONDITION              = '00000'
*   SORT                   = 'X'
  TABLES
    I1000                  = P1000
*   OBJECTS                =
* EXCEPTIONS
*   NOTHING_FOUND          = 1
*   WRONG_CONDITION        = 2
*   WRONG_PARAMETERS       = 3
*   OTHERS                 = 4
  .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

G_OBJID = PERNR-PLANS.

CALL FUNCTION 'RH_READ_INFTY_1001'
 EXPORTING
*   AUTHORITY              = 'DISP'
*   WITH_STRU_AUTH         = 'X'
   PLVAR                  = '01'
   OTYPE                  = 'S'
   OBJID                  = G_OBJID
*   ISTAT                  = ' '
*   EXTEND                 = 'X'
*   SUBTY                  = ' '
*   BEGDA                  = '19000101'
*   ENDDA                  = '99991231'
*   CONDITION              = '00000'
*   SORT                   = 'X'
*   WITH_EV                = ' '
*   ADATA                  = 'X'
*   AUTH_SOBID             = ' '
  TABLES
    I1001                  = P1001
*   OBJECTS                =
* EXCEPTIONS
*   NOTHING_FOUND          = 1
*   WRONG_CONDITION        = 2
*   WRONG_PARAMETERS       = 3
*   OTHERS                 = 4
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

READ TABLE P1001 WITH KEY RSIGN = 'A'

                          RELAT = '002'.
*READ TABLE P1001 WITH KEY RSIGN = 'A'
*                          RELAT = '008'.

READ TABLE P1000 WITH KEY LANGU = SY-LANGU.

WRITE:/ PERNR-PERNR, PERNR-ENAME, PERNR-PLANS, P1000-STEXT, P1001-SOBID, PERNR-BUKRS.