[SAP ABAP] - HR Funtion Module for Get Organizational Management (OM)

SE11 -> Structure 


  • ZSAPIST_SOPERNR



Field Data Element Data Type  Length Decimal Label Name
SIGN CHAR1 CHAR 1 0 Single-Character Indicator
OPTION CHAR2 CHAR 2 0 Version Number Component
LOW PERNR_D NUMC 8 0 Personnel Number
HIGH PERNR_D NUMC 8 0 Personnel Number


  • ZSAPIST_OM



Field Data Element Data Type  Length Decimal Label Name
PERNR PERNR_D NUMC 8 0 Personnel Number
CNAME CNAME CHAR 25 0 Address Supplement (c/o)
BEGDA BEGDA DATS 8 0 Start Date
ENDDA ENDDA DATS 8 0 End Date
PLANS PLANS NUMC 8 0 Position
PLSTX SHORT_D CHAR 12 0 Object Abbreviation
WERKS PERSA CHAR 4 0 Personnel Area
PBTXT PBTXT CHAR 30 0 Personnel Area Text
BTRTL BTRTL CHAR 4 0 Personnel Subarea
BTRTX BTRTX CHAR 15 0 Personnel Subarea Text
PERSG PERSG CHAR 1 0 Employee Group
PGTXT PGTXT CHAR 20 0 Name of Employee Group
PERSK PERSK CHAR 2 0 Employee Subgroup
PKTXT PKTXT CHAR 20 0 Name of Employee Subgroup
ABKRS ABKRS CHAR 2 0 Payroll Area
ABKTX ABKTX CHAR 20 0 Payroll Area Text
JAMID PID_JAMID CHAR 15 0 JAMSOSTEK ID
TAXID TAXID CHAR 15 0 Tax ID


FUNCTION zsapifm_om.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(E_HISTORY) TYPE  CHAR1 OPTIONAL
*"  TABLES
*"      FT_PERNR STRUCTURE  ZSAPIST_SOPERNR OPTIONAL
*"      FT_OM STRUCTURE  ZSAPIST_OM OPTIONAL
*"  EXCEPTIONS
*"      NO_FOUND
*"----------------------------------------------------------------------

  DATA : lt_i0241 LIKE p0241 OCCURS 0 WITH HEADER LINE,
         lt_i0242 LIKE p0242 OCCURS 0 WITH HEADER LINE.

  DATA : ld_begda LIKE pa0001-begda,
         ld_endda LIKE pa0001-endda.

  ld_begda = '18000101'.
  ld_endda = '99991231'.

  IF e_history EQ 'X'.
    SELECT * FROM pa0001
    INTO CORRESPONDING FIELDS OF TABLE ft_om
      WHERE pernr IN ft_pernr AND
            begda GE ld_begda AND
            endda LE ld_endda.
  ELSE.
    SELECT * FROM pa0001
    INTO CORRESPONDING FIELDS OF TABLE ft_om
      WHERE pernr IN ft_pernr AND
            endda EQ ld_endda.
  ENDIF.

  IF ft_om[] IS NOT INITIAL.

    LOOP AT ft_om.
      REFRESH : lt_i0241, lt_i0242.
      CLEAR : lt_i0241, lt_i0242.
*Get Text

      CALL FUNCTION 'ZSAPIFM_GET_TEXT'
        EXPORTING
*    e_bukrs       =
          e_werks       = ft_om-werks
          e_btrtl       = ft_om-btrtl
          e_abkrs       = ft_om-abkrs
          e_plans       = ft_om-plans
          e_persg       = ft_om-persg
          e_persk       = ft_om-persk
          e_begda       = ft_om-begda
          e_endda       = ft_om-endda
       IMPORTING
*   I_BUTXT       =
         i_pbtxt       = ft_om-pbtxt
         i_btrtx       = ft_om-btrtx
         i_abktx       = ft_om-abktx
         i_plstx       = ft_om-plstx
         i_pgtxt       = ft_om-pgtxt
         i_pktxt       = ft_om-pktxt.

*Get NPWP
      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
          tclas           = 'A'
          pernr           = ft_om-pernr
          infty           = '0241'
          begda           = ft_om-begda
          endda           = ft_om-endda
        TABLES
          infty_tab       = lt_i0241
        EXCEPTIONS
          infty_not_found = 1
          OTHERS          = 2.

      READ TABLE lt_i0241 INDEX 1.
      ft_om-taxid = lt_i0241-taxid.

*GET Jamsostek ID
      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
          tclas           = 'A'
          pernr           = ft_om-pernr
          infty           = '0241'
          begda           = ft_om-begda
          endda           = ft_om-endda
        TABLES
          infty_tab       = lt_i0242
        EXCEPTIONS
          infty_not_found = 1
          OTHERS          = 2.

      READ TABLE lt_i0242 INDEX 1.
      ft_om-jamid = lt_i0242-jamid.

      MODIFY ft_om.CLEAR ft_om.

    ENDLOOP.

  ENDIF.


ENDFUNCTION.

Comments