[SAP ABAP] - HR Funtion Module for Get Medical

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_MEDICAL


Field Data Element Data Type  Length Decimal Label Name
PERNR PERNR_D NUMC 8 0 Personnel Number
BEGDA BEGDA DATS 8 0 Start Date
ENDDA ENDDA DATS 8 0 End Date
SUBTY SUBTY CHAR 4 0 Subtype
STEXT SBTTX CHAR 40 0 Name of Subtype
EXDAT USDAT DATS 8 0 Examination date
LXDAT LXDAT DATS 8 0 Date of last examination
RESUL RESUL CHAR 2 0 Result
RSTXT RSTXT_D CHAR 20 0 Text for examination result
DIANR DIANR CHAR 8 0 Diagnosis number

FUNCTION ZSAPIFM_MEDICAL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(E_HISTORY) TYPE  CHAR1 OPTIONAL
*"  TABLES
*"      FT_PERNR STRUCTURE  ZSAPIST_SOPERNR OPTIONAL
*"      FT_MEDICAL STRUCTURE  ZSAPIST_MEDICAL OPTIONAL
*"  EXCEPTIONS
*"      NO_FOUND
*"----------------------------------------------------------------------

  DATA: T_T591S LIKE STANDARD TABLE OF T591S WITH HEADER LINE,
        T_T578Y LIKE STANDARD TABLE OF T578Y WITH HEADER LINE.

  DATA : LD_BEGDA LIKE PA0001-BEGDA,
         LD_ENDDA LIKE PA0001-ENDDA.

  LD_BEGDA = '18000101'.
  LD_ENDDA = '99991231'.

  SELECT * FROM T591S INTO TABLE T_T591S
           WHERE SPRSL = SY-LANGU AND
                 INFTY = '0028'.

  SELECT * FROM T578Y INTO TABLE T_T578Y
           WHERE SPRSL = SY-LANGU.

  IF E_HISTORY EQ 'X'.
    SELECT * FROM PA0028
    INTO CORRESPONDING FIELDS OF TABLE FT_MEDICAL
      WHERE PERNR IN FT_PERNR AND
            BEGDA GE LD_BEGDA AND
            ENDDA LE LD_ENDDA.
  ELSE.
    SELECT * FROM PA0028
    INTO CORRESPONDING FIELDS OF TABLE FT_MEDICAL
      WHERE PERNR IN FT_PERNR AND
            ENDDA EQ LD_ENDDA.
  ENDIF.

  IF FT_MEDICAL[] IS NOT INITIAL.

    LOOP AT FT_MEDICAL.

      READ TABLE T_T591S WITH KEY SUBTY = FT_MEDICAL-SUBTY.
      IF SY-SUBRC = 0.
        FT_MEDICAL-STEXT = T_T591S-STEXT.
      ENDIF.

      READ TABLE T_T578Y WITH KEY RESUL = FT_MEDICAL-RESUL.
      IF SY-SUBRC = 0.
        FT_MEDICAL-RSTXT = T_T578Y-RSTXT.
      ENDIF.

      MODIFY FT_MEDICAL.CLEAR FT_MEDICAL.

    ENDLOOP.

  ENDIF.


ENDFUNCTION.



Comments