Search This Blog

Search This Blog

OM Program in HR ABAP


REPORT  ZHR_D213_AS12 LINE-SIZE 300.

TABLES PERNR.

INFOTYPES: 1000,1001.
INFOTYPES 0001 MODE N.

DATA SOBID TYPE  PLOG-OBJID.

DATA: BEGIN OF IT_T500P OCCURS 0,
      PERSA TYPE T500P-PERSA,
      NAME1 TYPE T500P-NAME1,
  END OF IT_T500P.

DATA: BEGIN OF IT_T501T OCCURS 0,
      PERSG TYPE T501T-PERSG,
      PTEXT TYPE T501T-PTEXT,
  END OF IT_T501T.

DATA: BEGIN OF IT_T527X OCCURS 0,
      ORGEH TYPE T527X-ORGEH,
      ORGTX TYPE T527X-ORGTX,
  END OF IT_T527X.

DATA SOB(8) TYPE N.

START-OF-SELECTION.

  SELECT PERSA NAME1 FROM T500P INTO TABLE IT_T500P.

  SELECT PERSG PTEXT FROM T501T INTO TABLE IT_T501T WHERE SPRSL = SY-LANGU.

  SELECT ORGEH ORGTX FROM T527X INTO TABLE IT_T527X WHERE SPRSL = SY-LANGU.

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                  = '19000101'
*   ENDDA                  = '99991231'
*   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.

  CALL FUNCTION 'RH_READ_INFTY_1001'
   EXPORTING
*   AUTHORITY              = 'DISP'
*   WITH_STRU_AUTH         = 'X'
     PLVAR                  = '01'
     OTYPE                  = 'S'
     OBJID                  = PERNR-PLANS
*   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 IT_T500P WITH KEY PERSA = PERNR-WERKS .
  READ TABLE IT_T501T WITH KEY PERSG = PERNR-PERSG .
  READ TABLE IT_T527X WITH KEY ORGEH = PERNR-ORGEH .
 
  READ TABLE P1000 WITH KEY LANGU = SY-LANGU.
  READ TABLE P1001 WITH KEY RSIGN = 'B'
                            RELAT = '002'.
  SOBID = P1001-SOBID.
  REFRESH P1001[].

  CALL FUNCTION 'RH_READ_INFTY_1001'
   EXPORTING
*   AUTHORITY              = 'DISP'
*   WITH_STRU_AUTH         = 'X'
     PLVAR                  = '01'
     OTYPE                  = 'S'
     OBJID                  = SOBID
*   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 = '008'.
  SOB = P1001-SOBID.
 
  RP-READ-INFOTYPE SOB 0001 P0001 PN-BEGDA PN-ENDDA.
 
  WRITE: PERNR-PERNR, PERNR-SNAME,PERNR-WERKS,IT_T500P-NAME1,PERNR-PERSG,IT_T501T-PTEXT,PERNR-ORGEH,IT_T527X-ORGTX,PERNR-PLANS,P1000-STEXT,P0001-SNAME.