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: 

Join More than 2 tables

Former Member
0 Kudos

Hi,

What is the correct way of joining more than 2 tables?? How can i join other table with an internal table??

Regards,

Kit

8 REPLIES 8

gopi_narendra
Active Contributor
0 Kudos

You can make use of FOR ALL ENTRIES.

Do a F1 (HELP) on it.

Regards

Gopi

Former Member
0 Kudos

Hi,

Use<b> for all entries</b>

<b>Use of FOR ALL Entries</b>

Outer join can be created using this addition to the where clause in a select statement. It speeds up the performance tremendously, but the cons of using this variation are listed below

Duplicates are automatically removed from the resulting data set. Hence care should be taken that the unique key of the detail line items should be given in the select statement.

If the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty.

If the table on which the For All Entries IN clause is based is very large, the performance will go down instead of improving. Hence attempt should be made to keep the table size to a moderate level.

<b>Not Recommended</b>

Loop at int_cntry.

Select single * from zfligh into int_fligh

where cntry = int_cntry-cntry.

Append int_fligh.

Endloop.

<b>Recommended</b>

Select * from zfligh appending table int_fligh

For all entries in int_cntry

Where cntry = int_cntry-cntry.

Regards,

Maha

Former Member
0 Kudos

You can JOIN as many database tables as you want - but not with internal tables.

Rob

Former Member
0 Kudos

Hi

Inner Joins are made on DB tables,

If u want to refer with internal Table,..then use For All Entries ..

Hope it Helps.

Praveen

former_member1052991
Active Participant
0 Kudos

Hi kit,

You can use <b>FOR ALL ENTRIES</b>.

for all entries is more effecitve than inner join.

Former Member
0 Kudos

Hi Kit,

This is kiran kumar.G(Working on SAP). i will explain joins first and next i will tell the syntax of join.Joins are used to join two or more tables.

If u r satisfy with my answer plz give REWARD POINTS..

Syntax for TWO TABLES JOIN:

select vbeln "sales order no

erdat "date

posnr "sales order item

netwt "net value

from vbak as a

inner join vbap as b on avbeln = bvbeln

into table itab

where vbeln in s_vbeln.

Conditions:

1.There must be one field common in both table(JUST LIKE VBELN in the above example)

2.If u using select-options u use IN operator in WHERE clause

Here itab means internal table.

syntax for Joining 3 tables

select vbeln

erdat

posnr

rfsta

from vbak as a

inner join vbap as b on avbeln = bvbeln

inner join vbup as c on avbeln = cvbeln

where vbeln in s_vbeln.

U BETTER TO USE JOIN UPTO 4 TABLES.IF U GO BEYOND THAT UR PERFORMANCE OF THE PROGRAM IS DEGRATED.

AT THAT TIME U BETTER TO USE "FOR ALL ENTRIES"..

HAVE A NICE DAY..

Former Member
0 Kudos

Hi Kit,

I am sending simple code for applying joins on two tables .You will easily understand the code.For any problem revert back.

Reward if useful.

Thankx.

Here is an example of a JOIN over ekko, ekpo, and lfa1.

I hope it is useful, and if it's what your looking for.

Depending on the data you need to read, you may have to modify it.

-


REPORT zbc_temp.

  • Table declarations

TABLES: ekko, "Purchasing Document Header

ekpo, "Purchasing Document Item

lfa1. "Vendor Master (General Section)

  • Declaration of types:

TYPES: BEGIN OF ty_podata,

ebeln TYPE ebeln,

ebelp TYPE ebelp,

lifnr TYPE lifnr,

END OF ty_podata.

  • Declaration of internal tables and workareas:

DATA: ta_podata TYPE TABLE OF ty_podata WITH HEADER LINE.

DATA: wa_podata TYPE ty_podata.

*Selection screen:

PARAMETERS: p_lifnr TYPE lifnr.

  • Selection (JOIN):

START-OF-SELECTION.

SELECT lfa1lifnr ekkoebeln ekpo~ebelp

FROM lfa1 INNER JOIN ekko

ON lfa1lifnr = ekkolifnr

INNER JOIN ekpo ON ekkoebeln = ekpoebeln

UP TO 100 ROWS

INTO CORRESPONDING FIELDS OF TABLE ta_podata

WHERE lfa1~lifnr = '0000100160'.

END-OF-SELECTION.

  • Main program logic:

LOOP AT ta_podata INTO wa_podata.

WRITE: / wa_podata-ebeln,

wa_podata-ebelp,

wa_podata-lifnr.

ENDLOOP.

Former Member
0 Kudos

HI

if you use more than two tables then better way is to use FOR ALL ENTRIES

if you use joins then up to the program execution the data base connection will exist which results in bad performnce

so use FOR ALL ENTRIES example here


**************DATA TYPES DECLARATION **********************

TABLES: HRP1001, HRP1026, HRP1000,PCHDY.
TYPE-POOLS SLIS.

TYPES :BEGIN OF ST_OUTPUT,
        COUNT TYPE STRING,
        OBJID TYPE HRP1001-OBJID,
        STEXT TYPE HRP1000-STEXT,
        BEGDA TYPE HRP1000-BEGDA,
        ENDDA TYPE HRP1000-ENDDA,
        CANCRT TYPE T77CRT-CANCRT,
        AEDTM TYPE HRP1026-AEDTM,
        UNAME TYPE HRP1026-UNAME,
        LSTEXT TYPE HRP1000-STEXT,
*        RINVT TYPE T777V-RINVT,
       END OF ST_OUTPUT.

TYPES: BEGIN OF ST_HRP1000,
        OBJID TYPE HRP1001-OBJID,
        STEXT TYPE HRP1000-STEXT,
       END OF ST_HRP1000.

TYPES : BEGIN OF ST_HRP1001,
         OTYPE TYPE HRP1001-OTYPE,
         OBJID TYPE HRP1001-OBJID,
         RELAT type hrp1001-RELAT,
         BEGDA TYPE HRP1001-BEGDA,
         ENDDA TYPE HRP1001-ENDDA,
         SCLAS TYPE HRP1001-SCLAS,
         SOBID TYPE HRP1001-SOBID,
        END OF ST_HRP1001.

TYPES : BEGIN OF ST_HRP1026,
         OTYPE TYPE HRP1026-OTYPE,
         OBJID TYPE HRP1001-OBJID,
         AEDTM TYPE HRP1026-AEDTM,
         UNAME TYPE HRP1026-UNAME,
         DELET TYPE HRP1026-DELET,
         CANCR TYPE HRP1026-CANCR,
        END OF ST_HRP1026.

TYPES : BEGIN OF ST_REASON,
         CANCR TYPE HRP1026-CANCR,
         CANCRT TYPE T77CRT-CANCRT,
        END OF ST_REASON.

TYPES : BEGIN OF ST_SOBID,
         OTYPE TYPE HRP1001-OTYPE,
         OBJID TYPE HRP1001-OBJID,
         RELAT type hrp1001-OBJID,
         BEGDA TYPE HRP1001-BEGDA,
         ENDDA TYPE HRP1001-ENDDA,
         SCLAS TYPE HRP1001-SCLAS,
         SOBID TYPE HRP1001-OBJID,
        END OF ST_SOBID.

TYPES : BEGIN OF ST_OBJID,
         OBJID TYPE HRP1001-OBJID,
        END OF ST_OBJID.

TYPES : BEGIN OF ST_LOCATION,
         OTYPE TYPE HRP1001-OTYPE,
         OBJID TYPE HRP1001-OBJID,
         RSIGN TYPE HRP1001-RSIGN,
         RELAT TYPE HRP1001-RELAT,
         SCLAS TYPE HRP1001-SCLAS,
         SOBID TYPE HRP1001-SOBID,
        END OF ST_LOCATION.

TYPES : BEGIN OF ST_LOCATION1,
         OTYPE TYPE HRP1001-OTYPE,
         OBJID TYPE HRP1001-OBJID,
         RSIGN TYPE HRP1001-RSIGN,
         RELAT TYPE HRP1001-RELAT,
         SCLAS TYPE HRP1001-SCLAS,
         SOBID TYPE HRP1001-OBJID,
        END OF ST_LOCATION1.

TYPES : BEGIN OF ST_LSTEXT,
         OTYPE TYPE HRP1000-OTYPE,
         OBJID TYPE HRP1000-OBJID,
         LSTEXT TYPE HRP1000-STEXT,
        END OF ST_LSTEXT.

TYPES : BEGIN OF ST_OBJID_SH,
         OTYPE TYPE HRP1000-OTYPE,
         OBJID TYPE HRP1000-OBJID,
        END OF ST_OBJID_SH.

DATA : IT_OBJID_SH TYPE STANDARD TABLE OF ST_OBJID_SH.
DATA : WA_OBJID_SH TYPE ST_OBJID_SH.

DATA : IT_LSTEXT TYPE STANDARD TABLE OF ST_LSTEXT.              "TOS STORE THE TEXT OF COURCE LOCATION
DATA : WA_LSTEXT TYPE ST_LSTEXT.

DATA : IT_LOCATION TYPE STANDARD TABLE OF ST_LOCATION.          " TO STORE THE LOCATION OF COURCE
DATA : WA_LOCATION TYPE ST_LOCATION.


DATA : IT_LOCATION1 TYPE STANDARD TABLE OF ST_LOCATION1.        " TO CONVERT SOBID INTO OBJID FOR COURCE LOCATION
DATA : WA_LOCATION1 TYPE ST_LOCATION1.


DATA : IT_SOBID TYPE STANDARD TABLE OF ST_SOBID.                " TO CHANGE THE SOBID OF HRP1001 TO OBJID OF HRP1026
DATA : WA_SOBID TYPE ST_SOBID.                                   " BY USING FOR ALL ENTRIES

DATA : IT_REASON TYPE STANDARD TABLE OF ST_REASON.              "TO STORE T HE REASON FOR CANCELL TEXT
DATA : WA_REASON TYPE ST_REASON.

DATA : IT_OUTPUT TYPE STANDARD TABLE OF ST_OUTPUT.               "OUTPUT FEILDS OF REPORT.
DATA : WA_OUTPUT TYPE ST_OUTPUT.

DATA : IT_OUTPUT_1 TYPE STANDARD TABLE OF ST_OUTPUT.               " TEMP OUTPUT FEILDS OF REPORT.
DATA : WA_OUTPUT_1 TYPE ST_OUTPUT.


DATA : IT_HRP1000 TYPE STANDARD TABLE OF ST_HRP1000.             "DATA FROM HRP1000 TABLE
DATA : WA_HRP1000 TYPE ST_HRP1000.

DATA : IT_HRP1001 TYPE STANDARD TABLE OF ST_HRP1001.             "DATA FROM HRP1001 TABLE
DATA : WA_HRP1001 TYPE ST_HRP1001.


DATA : IT_HRP1026 TYPE STANDARD TABLE OF ST_HRP1026.              "DATA FROM HRP1026 TABLE
DATA : WA_HRP1026 TYPE ST_HRP1026.

DATA : IT_OBJID TYPE STANDARD TABLE OF ST_OBJID.                  " TO STORE THE OBJID OF HRP1001
DATA : WA_OBJID TYPE ST_OBJID.

DATA: WS_FCAT    TYPE SLIS_FIELDCAT_ALV .                         " FEILDCATALOG FOR ALV REPORT
DATA: IN_FCAT    TYPE SLIS_T_FIELDCAT_ALV.
DATA: W_LAYOUT   TYPE SLIS_LAYOUT_ALV.

DATA : LV_COUNT TYPE I.                                           "FEILD FOR SERIAL NUMBER


****************************END OF DATA DECLARATION*******************************************

************SELECTION SCREEN DESIGN************************

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

*SELECT-OPTIONS : S_OTYPE FOR HRP1001-OTYPE NO INTERVALS .
SELECT-OPTIONS : S_OBJID FOR HRP1001-OBJID NO INTERVALS .
SELECT-OPTIONS : DATE FOR SY-DATUM NO-EXTENSION OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1.

***********END OF SELECTION SCREEN DESIGN******************


*****INITIALIZATION VENT TO ASIGN DEFAULT VALUES TO OTYPE
*INITIALIZATION.
*  S_OTYPE-LOW = 'D'.
*  S_OTYPE-SIGN = 'I'.
*  S_OTYPE-OPTION = 'EQ'.
*  APPEND S_OTYPE.
*  CLEAR S_OTYPE.
**************END OF EVENT INITIALIZATION******************

**********VALIDATION FOR SCREEN FIELDS*********************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.

*  IF S_OBJID IS NOT INITIAL.

    SELECT OTYPE OBJID FROM HRP1000
                 INTO TABLE IT_OBJID_SH
                 WHERE OTYPE = 'D'.

 IF SY-SUBRC EQ 0.

* SEARCH HELP FOR QUALIFICATION.

    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
*              DDIC_STRUCTURE         = ' '
        RETFIELD               =  'OBJID'
*              PVALKEY                = ' '
       DYNPPROG               = SY-REPID
       DYNPNR                 = SY-DYNNR
       DYNPROFIELD            = 'S_OBJID'
*              STEPL                  = 0
*              WINDOW_TITLE           =
*              VALUE                  = ' '
       VALUE_ORG              = 'S'
*              MULTIPLE_CHOICE        = ' '
*              DISPLAY                = ' '
*              CALLBACK_PROGRAM       = ' '
*              CALLBACK_FORM          = ' '
*              MARK_TAB               =
*            IMPORTING
*              USER_RESET             =
      TABLES
        VALUE_TAB              =  IT_OBJID_SH
*              FIELD_TAB              =
*              RETURN_TAB             = RETURN_TAB
*              DYNPFLD_MAPPING        =
*            EXCEPTIONS
*              PARAMETER_ERROR        = 1
*              NO_VALUES_FOUND        = 2
*              OTHERS                 = 3
              .
    IF SY-SUBRC <> 0.
*           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
  ENDIF.

              .

*    IF SY-SUBRC NE 0.
*      MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA.' TYPE 'E'.
*    ENDIF.
*
*  ENDIF.
*  REFRESH IT_OBJID.

****************VALIDATION OF SCREEN FIELDS ENDS************

*****************START OF SELECTION ************************

START-OF-SELECTION.

  SELECT OTYPE
         OBJID
         RELAT
         BEGDA
         ENDDA
         SCLAS
         SOBID FROM HRP1001 INTO TABLE IT_HRP1001
                    WHERE OTYPE = 'D'
                        AND OBJID IN S_OBJID
                        AND BEGDA GE DATE-LOW
                        AND ENDDA LE DATE-HIGH
                        AND ( SCLAS = 'E' OR SCLAS = 'ET' ).

  IF SY-SUBRC NE 0.
    MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
  ENDIF.

  LOOP AT IT_HRP1001 INTO WA_HRP1001.

    WA_SOBID-OTYPE = WA_HRP1001-OTYPE.
    WA_SOBID-OBJID = WA_HRP1001-OBJID.
    WA_SOBID-RELAT = WA_HRP1001-RELAT.
    WA_SOBID-BEGDA = WA_HRP1001-BEGDA.
    WA_SOBID-ENDDA = WA_HRP1001-ENDDA.
    WA_SOBID-SCLAS = WA_HRP1001-SCLAS.
    WA_SOBID-SOBID = WA_HRP1001-SOBID.
    APPEND WA_SOBID TO IT_SOBID.

  ENDLOOP.

  SELECT OTYPE
         OBJID
         AEDTM
         UNAME
         DELET
         CANCR
*         NCONT
          FROM HRP1026
          INTO TABLE IT_HRP1026
          FOR ALL ENTRIES IN IT_SOBID
             WHERE OBJID = IT_SOBID-SOBID
             AND ( OTYPE = 'E' OR OTYPE = 'ET' )
                 AND DELET = 'X' AND
                 BEGDA GE DATE-LOW  AND
                 ENDDA LE DATE-HIGH.

  IF SY-SUBRC EQ 0.

    SELECT OBJID
           STEXT
           FROM HRP1000
           INTO TABLE IT_HRP1000
           FOR ALL ENTRIES IN IT_SOBID
              WHERE OBJID = IT_SOBID-SOBID AND
                    BEGDA GE DATE-LOW  AND
                    ENDDA LE DATE-HIGH.

    SELECT CANCR
           CANCRT
           FROM T77CRT
           INTO TABLE IT_REASON
           FOR ALL ENTRIES IN IT_HRP1026
           WHERE CANCR = IT_HRP1026-CANCR
             AND LANGU = 'E' .

*********PERFORM FOR GETTING T HE LOCATION OF THE COURCE***

  PERFORM GET_LOCATION.
**************END OF LOCATION OF COURCE ******************

  ELSE.
    MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.

  ENDIF.

******PERFORM FOR GETTING DATA INTO THE FINAL INTERNAL TABLE IT_OUTPUT***

  PERFORM GET_DATA.

*********************************END OF PERFORM ET DATA ***************

***********LOGIC FOR PRONTING NUMBER OF RECORDS ***********************

  LV_COUNT = 0.
  LOOP  AT IT_OUTPUT INTO WA_OUTPUT.
    LV_COUNT = LV_COUNT + 1.
    WA_OUTPUT-COUNT = LV_COUNT.
    APPEND WA_OUTPUT TO IT_OUTPUT_1.
  ENDLOOP.
  REFRESH IT_OUTPUT.
  IT_OUTPUT = IT_OUTPUT_1.
********************END OF LOGIC FOR NUMBER OF RECORDS ***************

*****************DISPLAYING OUTPUT BY USEING GRID DISPLAY***********

  PERFORM ALV_DISPLAY.

****************************END OF PERFORM FOR DISPLAYING **********

*&---------------------------------------------------------------------*
*&      Form  PERFORM_ALV
*&---------------------------------------------------------------------*
* DISPLAY THE RECORDS IN ALV GRID FORMAT.
*----------------------------------------------------------------------*
FORM ALV_DISPLAY.

  PERFORM FIELD_CATALOG USING 'COUNT' 'Sr. No.'.
  PERFORM FIELD_CATALOG USING 'OBJID' 'COURCE ID.'.
  PERFORM FIELD_CATALOG USING 'STEXT' 'COURCE NAME'.
    PERFORM FIELD_CATALOG USING 'LSTEXT' 'COURCE LOATION'.
  PERFORM FIELD_CATALOG USING 'BEGDA' 'BEGIN DATE '.
  PERFORM FIELD_CATALOG USING 'ENDDA' 'END DATE '.
  PERFORM FIELD_CATALOG USING 'CANCRT' 'REASON'.
  PERFORM FIELD_CATALOG USING 'AEDTM' 'DATE Of CANCEL'.
*  PERFORM FIELD_CATALOG USING 'NCONT' 'NUMBER OF BOOKINGS'.
*  PERFORM FIELD_CATALOG USING 'LOCTX' 'COURCE LOCATION'.

  PERFORM FIELD_CATALOG USING 'UNAME' 'WHO CANCELLED'.
*  PERFORM FIELD_CATALOG USING 'LSTEXT' 'COURCE LOATION'.



  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_STRUCTURE_NAME = 'IT_OUTPUT'
      I_GRID_TITLE     = ' Cancelled courses with reason '
      IT_FIELDCAT      = IN_FCAT
    TABLES
      T_OUTTAB         = IT_OUTPUT.
  IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    "PERFORM_ALV




*&---------------------------------------------------------------------*
*&      Form  FIELD_CATALOG
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->FIELD_NAME text
*      -->DIS_TEXT   text
*----------------------------------------------------------------------*
FORM FIELD_CATALOG USING FIELD_NAME DIS_TEXT.


  CLEAR WS_FCAT.
  WS_FCAT-TABNAME = 'IT_OUTPUT'.
  WS_FCAT-FIELDNAME = FIELD_NAME.
  WS_FCAT-SELTEXT_M = DIS_TEXT.
  APPEND WS_FCAT TO IN_FCAT .

ENDFORM.                    "FIELD_CATALOG
*&---------------------------------------------------------------------*
*&      Form  GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM GET_DATA .

*sort it_sobid by objid.



  LOOP AT IT_SOBID INTO WA_SOBID." where otype eq s_otype and objid eq s_objid.

    READ TABLE IT_HRP1026 WITH KEY OBJID = WA_SOBID-SOBID OTYPE = WA_SOBID-SCLAS INTO WA_HRP1026.
    IF SY-SUBRC EQ 0.
      READ TABLE IT_HRP1000 WITH KEY OBJID = WA_SOBID-SOBID INTO WA_HRP1000.
*    READ TABLE IT_REASON WITH KEY CANCR = WA_HRP1026-CANCR INTO WA_REASON.


      WA_OUTPUT-OBJID = WA_HRP1026-OBJID.
      WA_OUTPUT-BEGDA = WA_SOBID-BEGDA.
      WA_OUTPUT-ENDDA = WA_SOBID-ENDDA.
      WA_OUTPUT-AEDTM = WA_HRP1026-AEDTM.
      WA_OUTPUT-UNAME = WA_HRP1026-UNAME.
*    WA_OUTPUT-NCONT = WA_HRP1026-NCONT.



*    READ TABLE IT_HRP1000 WITH KEY OBJID = WA_SOBID-SOBID INTO WA_HRP1000.


      WA_OUTPUT-STEXT = WA_HRP1000-STEXT.


      READ TABLE IT_REASON WITH KEY CANCR = WA_HRP1026-CANCR INTO WA_REASON.


      WA_OUTPUT-CANCRT = WA_REASON-CANCRT.
      CLEAR WA_REASON-CANCRT.

      READ TABLE IT_LOCATION1 WITH KEY OBJID = WA_HRP1026-OBJID INTO WA_LOCATION1..

      READ TABLE IT_LSTEXT WITH KEY OBJID = WA_LOCATION1-SOBID OTYPE = 'F' INTO WA_LSTEXT.

             WA_OUTPUT-LSTEXT = WA_LSTEXT-LSTEXT.
             CLEAR WA_LSTEXT-LSTEXT.


      APPEND WA_OUTPUT TO IT_OUTPUT.
      CLEAR WA_OUTPUT.
      CLEAR WA_OUTPUT-CANCRT.
    ENDIF.
  ENDLOOP.


ENDFORM.                    " GET_DATA
*&---------------------------------------------------------------------*
*&      Form  GET_LOCATION
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM GET_LOCATION .


SELECT OTYPE
       OBJID
       RSIGN
       RELAT
       SCLAS
      SOBID
      FROM HRP1001
      INTO TABLE IT_LOCATION
      FOR ALL ENTRIES IN IT_HRP1026
      WHERE OTYPE = 'E' AND OBJID = IT_HRP1026-OBJID
       AND RSIGN = 'A' AND RELAT = '024' AND SCLAS = 'F'
                AND BEGDA GE DATE-LOW AND ENDDA LE DATE-HIGH.

IF SY-SUBRC NE 0.
    MESSAGE 'NO RECORD FOUND FOR THE GIVEN SELECTION CRITERIA ' TYPE 'E'.
  ENDIF.

  LOOP AT IT_LOCATION INTO WA_LOCATION.

    WA_LOCATION1-OTYPE = WA_LOCATION-OTYPE.
    WA_LOCATION1-OBJID = WA_LOCATION-OBJID.
        WA_LOCATION1-RSIGN = WA_LOCATION-RSIGN.
    WA_LOCATION1-RELAT = WA_LOCATION-RELAT.
    WA_LOCATION1-SCLAS = WA_LOCATION-SCLAS.
    WA_LOCATION1-SOBID = WA_LOCATION-SOBID.
    APPEND WA_LOCATION1 TO IT_LOCATION1.
*    CLEAR WA_LOCATION1.
  ENDLOOP.



SELECT OTYPE
       OBJID
       STEXT
       FROM HRP1000
       INTO TABLE IT_LSTEXT
       FOR ALL ENTRIES IN IT_LOCATION1
       WHERE OBJID = IT_LOCATION1-SOBID
          AND OTYPE = 'F'.
*          AND BEGDA GE DATE-LOW
*          AND ENDDA LE DATE-HIGH.


ENDFORM.                    " GET_LOCATION