Skip to Content
0
Former Member
Jun 05, 2008 at 03:35 PM

abap-hr : error in retrieving employee's family dependent details

53 Views

Hi all,

while retreiving family dependent details of employee of subtype de01 its throwing up a dump

<REMOVED BY MODERATOR>

*&---------------------------------------------------------------------*
*& Report  ZABAP_HR                                                    *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZABAP_HR                                .

TABLES : PERNR.

INFOTYPES : 0000, 0001, 0002, 0006, 0105, 0021.

***********************************************
*         STRUCTURES
***********************************************
TYPES : BEGIN OF TY_EMP,
        PERNR(20)   TYPE  C,        "PERSONNEL NO
        NACHN   TYPE  NACHN,        "FIRST NAME
        VORNA   TYPE  VORNA,        "LAST NAME
*        ANSSA   TYPE  ANSSA,        "ADDRESS TYPE
        STRAS   TYPE  STRAS,        "STREET
        PSTLZ   TYPE  PSTLZ,        "POSTAL CODE
        ORT01   TYPE  ORT01,        "CITY
        LAND1   TYPE  LAND1,        "COUNTRY

        STRAS1   TYPE  STRAS,        "STREET
        PSTLZ1   TYPE  PSTLZ,        "POSTAL CODE
        ORT011   TYPE  ORT01,        "CITY
        LAND11   TYPE  LAND1,        "COUNTRY

        PLANS   TYPE  PLANS,        "POSITION
        EMAILID TYPE  COMM_ID_LONG, "EMAIL ID
        FAMSA   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR   TYPE  FAVOR,        "FIRST NAME
        FANAM   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA1   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR1   TYPE  FAVOR,        "FIRST NAME
        FANAM1   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA2   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR2   TYPE  FAVOR,        "FIRST NAME
        FANAM2   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA3   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR3   TYPE  FAVOR,        "FIRST NAME
        FANAM3   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA4   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR4   TYPE  FAVOR,        "FIRST NAME
        FANAM4   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA5   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR5   TYPE  FAVOR,        "FIRST NAME
        FANAM5   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA6   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR6   TYPE  FAVOR,        "FIRST NAME
        FANAM6   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA7   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR7   TYPE  FAVOR,        "FIRST NAME
        FANAM7   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA8   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR8   TYPE  FAVOR,        "FIRST NAME
        FANAM8   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA9   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR9   TYPE  FAVOR,        "FIRST NAME
        FANAM9   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA10   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR10   TYPE  FAVOR,        "FIRST NAME
        FANAM10   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA11   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR11   TYPE  FAVOR,        "FIRST NAME
        FANAM11   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA12   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR12   TYPE  FAVOR,        "FIRST NAME
        FANAM12   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA13   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR13   TYPE  FAVOR,        "FIRST NAME
        FANAM13   TYPE  PAD_NACHN,    "LAST NAME
        FAMSA14   TYPE  FAMSA,        "DEPENDENT TYPE
        FAVOR14   TYPE  FAVOR,        "FIRST NAME
        FANAM14   TYPE  PAD_NACHN,    "LAST NAME
        END OF TY_EMP.

**********************************************
*        INTERNAL TABLES
*********************************************
DATA  :  IT_EMP  TYPE STANDARD TABLE OF TY_EMP.

*********************************************
*        WORK AREAS
*********************************************
DATA : WA_EMP  TYPE  TY_EMP.

DATA : N TYPE I.
***********************************************
*       START-OF-SELECTION
***********************************************

START-OF-SELECTION.

GET PERNR.

***********************************************
*     SUBROUTINE TO FETCH DATA FROM INFOTYPES
***********************************************
  PERFORM FETCH_DATA_INFTY.

END-OF-SELECTION.

***********************************************
*    SUBROUTINE TO DISPLAY DATA
***********************************************
  PERFORM DISPLAY_DATA.
*&---------------------------------------------------------------------*
*&      Form  FETCH_DATA_INFTY
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
*PERSONAL DETAILS
  RP_PROVIDE_FROM_LAST P0002 SPACE  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-PERNR = P0002-PERNR.
    WA_EMP-NACHN = P0002-NACHN.
    WA_EMP-VORNA = P0002-VORNA.
  ENDIF.

*ORGANIZATIONAL DETAILS
  RP_PROVIDE_FROM_LAST P0001 SPACE  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-PLANS = P0001-PLANS.
  ENDIF.

*PERMANENT ADDRESS DETAILS
  RP_PROVIDE_FROM_LAST P0006 0001  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-STRAS = P0006-STRAS.
    WA_EMP-PSTLZ = P0006-PSTLZ.
    WA_EMP-ORT01 = P0006-ORT01.
    WA_EMP-LAND1 = P0006-LAND1.
  ENDIF.

*TEMPORARY ADDRESS DETAILS
  RP_PROVIDE_FROM_LAST P0006 0002  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-STRAS1 = P0006-STRAS.
    WA_EMP-PSTLZ1 = P0006-PSTLZ.
    WA_EMP-ORT011 = P0006-ORT01.
    WA_EMP-LAND11 = P0006-LAND1.
  ENDIF.

*COMMUNICATION DETAILS
  RP_PROVIDE_FROM_LAST P0105 0010  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-EMAILID = P0105-USRID_LONG.
  ENDIF.

*DEPENDANT DETAILS
FORM FETCH_DATA_INFTY .
  DATA : ITAB1  TYPE  P0021-FAMSA VALUE 'DE01'.
  DATA : ITAB  TYPE  I.
  MOVE ITAB1 TO ITAB.
*
  RP_PROVIDE_FROM_LAST P0021 0001  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA = P0021-FAMSA.
    WA_EMP-FAVOR = P0021-FAVOR.
    WA_EMP-FANAM = P0021-FANAM.
  ENDIF.

  RP_PROVIDE_FROM_LAST P0021 0002  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA1 = P0021-FAMSA.
    WA_EMP-FAVOR1 = P0021-FAVOR.
    WA_EMP-FANAM1 = P0021-FANAM.
  ENDIF.

  RP_PROVIDE_FROM_LAST P0021 0003  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA2 = P0021-FAMSA.
    WA_EMP-FAVOR2 = P0021-FAVOR.
    WA_EMP-FANAM2 = P0021-FANAM.
  ENDIF.

  RP_PROVIDE_FROM_LAST P0021 0004  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA3 = P0021-FAMSA.
    WA_EMP-FAVOR3 = P0021-FAVOR.
    WA_EMP-FANAM3 = P0021-FANAM.
  ENDIF.

  RP_PROVIDE_FROM_LAST P0021 0005  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA4 = P0021-FAMSA.
    WA_EMP-FAVOR4 = P0021-FAVOR.
    WA_EMP-FANAM4 = P0021-FANAM.
  ENDIF.
*
  RP_PROVIDE_FROM_LAST P0021 0006  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA5 = P0021-FAMSA.
    WA_EMP-FAVOR5 = P0021-FAVOR.
    WA_EMP-FANAM5 = P0021-FANAM.
  ENDIF.
*
  RP_PROVIDE_FROM_LAST P0021 0007  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA6 = P0021-FAMSA.
    WA_EMP-FAVOR6 = P0021-FAVOR.
    WA_EMP-FANAM6 = P0021-FANAM.
  ENDIF.
*
  RP_PROVIDE_FROM_LAST P0021 0008  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA7 = P0021-FAMSA.
    WA_EMP-FAVOR7 = P0021-FAVOR.
    WA_EMP-FANAM7 = P0021-FANAM.
  ENDIF.
*
  RP_PROVIDE_FROM_LAST P0021 0009  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA8 = P0021-FAMSA.
    WA_EMP-FAVOR8 = P0021-FAVOR.
    WA_EMP-FANAM8 = P0021-FANAM.
  ENDIF.

  RP_PROVIDE_FROM_LAST P0021 0010  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA9 = P0021-FAMSA.
    WA_EMP-FAVOR9 = P0021-FAVOR.
    WA_EMP-FANAM9 = P0021-FANAM.
  ENDIF.
*
  RP_PROVIDE_FROM_LAST P0021 0011  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA10 = P0021-FAMSA.
    WA_EMP-FAVOR10 = P0021-FAVOR.
    WA_EMP-FANAM10 = P0021-FANAM.
  ENDIF.
*
  RP_PROVIDE_FROM_LAST P0021 0012  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA11 = P0021-FAMSA.
    WA_EMP-FAVOR11 = P0021-FAVOR.
    WA_EMP-FANAM11 = P0021-FANAM.
  ENDIF.
*
  RP_PROVIDE_FROM_LAST P0021 0013  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA12 = P0021-FAMSA.
    WA_EMP-FAVOR12 = P0021-FAVOR.
    WA_EMP-FANAM12 = P0021-FANAM.
  ENDIF.
*
  RP_PROVIDE_FROM_LAST P0021 0014  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA13 = P0021-FAMSA.
    WA_EMP-FAVOR13 = P0021-FAVOR.
    WA_EMP-FANAM13 = P0021-FANAM.
  ENDIF.
*
*DATA : DE01  LIKE P0021-FAMSA.
*DATA : ITAB  TYPE  I.
*DATA : DE01(4)  TYPE  C.

  RP_PROVIDE_FROM_LAST P0021 ITAB  PN-BEGDA  PN-ENDDA.
  IF PNP-SW-FOUND = 1.
    WA_EMP-FAMSA14 = P0021-FAMSA.
    WA_EMP-FAVOR14 = P0021-FAVOR.
    WA_EMP-FANAM14 = P0021-FANAM.
  ENDIF.
*
  APPEND WA_EMP TO IT_EMP.
  CLEAR WA_EMP.

ENDFORM.                    " FETCH_DATA_INFTY
*&---------------------------------------------------------------------*
*&      Form  DISPLAY_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM DISPLAY_DATA .

  LOOP AT IT_EMP INTO WA_EMP.

    AT FIRST.
      WRITE : /02 'PERSONNELNO',
               15 'FIRSTNAME',
               25 'LASTNAME',
               35 'POSITION',
               45 'PERMANENT ADDRESS : ',
               65 'STREET',
               80 'POSTALCODE',
               93 'CITY',
              100 'COUNTRY',
              110 'EMAILID',
              130 'DEP TYPE : ',
              147 'DEP FIRSTNAME',
              160 'DEP LASTNAME'.
      ULINE.

    ENDAT.

    WRITE : /02  WA_EMP-PERNR,
             15  WA_EMP-NACHN,
             25  WA_EMP-VORNA,
             35  WA_EMP-PLANS,
             65  WA_EMP-STRAS,
             80  WA_EMP-PSTLZ,
             90  WA_EMP-ORT01,
            100  WA_EMP-LAND1,
            110  WA_EMP-EMAILID,
            137  WA_EMP-FAMSA,
            147  WA_EMP-FAVOR,
            160  WA_EMP-FANAM.
    WRITE :  /137  WA_EMP-FAMSA1,
              147  WA_EMP-FAVOR1,
              160  WA_EMP-FANAM1.
    WRITE :  /137  WA_EMP-FAMSA2,
              147  WA_EMP-FAVOR2,
              160  WA_EMP-FANAM2.
    WRITE :  /137  WA_EMP-FAMSA3,
              147  WA_EMP-FAVOR3,
              160  WA_EMP-FANAM3.
    WRITE :  /137  WA_EMP-FAMSA4,
              147  WA_EMP-FAVOR4,
              160  WA_EMP-FANAM4.
    WRITE :  /137  WA_EMP-FAMSA5,
              147  WA_EMP-FAVOR5,
              160  WA_EMP-FANAM5.
    WRITE :  /137  WA_EMP-FAMSA6,
              147  WA_EMP-FAVOR6,
              160  WA_EMP-FANAM6.
    WRITE :  /137  WA_EMP-FAMSA7,
              147  WA_EMP-FAVOR7,
              160  WA_EMP-FANAM7.
    WRITE :  /137  WA_EMP-FAMSA8,
              147  WA_EMP-FAVOR8,
              160  WA_EMP-FANAM8.
    WRITE :  /137  WA_EMP-FAMSA9,
              147  WA_EMP-FAVOR9,
              160  WA_EMP-FANAM9.
    WRITE :  /137  WA_EMP-FAMSA10,
              147  WA_EMP-FAVOR10,
              160  WA_EMP-FANAM10.
    WRITE :  /137  WA_EMP-FAMSA11,
              147  WA_EMP-FAVOR11,
              160  WA_EMP-FANAM11.
    WRITE :  /137  WA_EMP-FAMSA12,
              147  WA_EMP-FAVOR12,
              160  WA_EMP-FANAM12.
    WRITE :  /137  WA_EMP-FAMSA13,
              147  WA_EMP-FAVOR13,
              160  WA_EMP-FANAM13.
    WRITE :  /137  WA_EMP-FAMSA14,
              147  WA_EMP-FAVOR14,
              160  WA_EMP-FANAM14.

    ULINE.

    AT FIRST.
      WRITE : /45 'TEMPORARY ADDRESS : ',
               65 'STREET',
               87 'POSTALCODE',
              100 'CITY',
              120 'COUNTRY'.
      ULINE.
    ENDAT.

    WRITE : /65 WA_EMP-STRAS1,
             87 WA_EMP-PSTLZ1,
            100 WA_EMP-ORT011,
            120 WA_EMP-LAND11.

  ENDLOOP.

ENDFORM.                    " DISPLAY_DATA

Thanks & Regards

Jerry

Code Formatted by: Alvaro Tejada Galindo on Jun 5, 2008 11:36 AM