Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi jerry,

Change your itab decleration to the below..

DATA : ITAB(4) TYPE c.

This will solve the problem , i just checked...

Have Fun!!

Ira!!

9 REPLIES 9

venkat_o
Active Contributor
0 Kudos

Hi, you have written code like below .

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.
but itab above has been declared as integer. and ITAB is being passed as subtype which should have length 4. Integer length is different . try to declare itab type c length 4. data itab type char4. It works. Regards, Venkat.O

Former Member
0 Kudos

Hi venkat,

Even though I declare itab as char of size 4 am getting run time error as '' unable to interpret de04 as number''.

Regards

John

Former Member
0 Kudos

Hi jerry,

Change your itab decleration to the below..

DATA : ITAB(4) TYPE c.

This will solve the problem , i just checked...

Have Fun!!

Ira!!

0 Kudos

Hi Ira , thanks for your help.......... I checked it but still getting the same error as unable to interpret de04 as number....see the below code..........this I am executing for all active employees.....

regards

John

&----


*& 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

----


FORM FETCH_DATA_INFTY .

*PERSONAL DETAILS

RP_PROVIDE_FROM_LAST P0002 SPACE PN-BEGDA PN-ENDDA.

IF PNP-SW-FOUND = 1.

WA_EMP-PERNR = P0002-PERNR.

WA_EMP-VORNA = P0002-VORNA.

WA_EMP-NACHN = P0002-NACHN.

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

    • DATA : ITAB1 TYPE P0021-FAMSA VALUE 'DE01'.

DATA : ITAB(4) TYPE C .

    • 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.

*

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

0 Kudos

Hi, Just check ur modified code. it is working .



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  char4. """""""""""""""Variable declaration has been changed here
  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
Regards, Venkat.O

0 Kudos

Hi Venkat, I appreciate your help.....have you executed this code because still it is showing the same error for active employees as "unable to interpret de04 as number"........

regards

Jerry

0 Kudos

H i venkat,

For one employee its not throwing any runtime error but if I executing it for all employees am getting run time error as "unable to interpret de01 as number".

regards

Jerry

0 Kudos

Use as follows ...

RP_PROVIDE_FROM_LAST P0021 'DE01' PN-BEGDA PN-ENDDA.

instead of ..

RP_PROVIDE_FROM_LAST P0021 ITAB PN-BEGDA PN-ENDDA.

Former Member
0 Kudos

Hi Jerry,

Thats strange , I just executed this pogram and its not showing any dumps ....

Just copy this into se38 and chk again..

&----


*& Report ZTSET1

*&

&----


*&

*&

&----


REPORT ZTSET1.

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(4) TYPE c.

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