Join 

A join processes records from two or more infotypes. The data from these infotypes is provided for a specific partial period.

We would like to know in which time period an employee worked at which job and at which address he or she resided during this time.

The following address data is available:

January - June

Hamburg

June - December

Munich


The following work center data is available:

January - April

Programmer

May - December

Course instructor


If the address and work center data are provided for specific partial periods, the following cases result:

January - April

Hamburg / programmer

May - June

Hamburg / course instructor

July - December

Munich / Course instructor


The ABAP syntax of this join is as follows:

PROVIDE * FROM Pmmmm
        * FROM Pnnnn
        BETWEEN PN-BEGDA AND PN-ENDDA.

The partial periods for infotypes Pmmmm and Pnnnn as well as for all other infotypes of the join are defined in the fields BEGDA and ENDDA .

The data of each infotype in the join must be available during the entire validity period of the infotype. The time periods of infotype records may not overlap; therefore, the join may not contain infotypes with time constraint "three".

The time periods of records overlap if an infotype is read without any subtype restrictions. For example, the Address infotype has the subtypes Permanent residence, Temporary residence and Home address.

Time periods will ultimately overlap if all addresses are read. Therefore, you must always select a subtype for a join, and this subtype may not have the time constraint "three".

The program code for the above join for work center and address data is as follows:

REPORT RPABAP03.
TABLES: PERNR.
INFOTYPES: 0001, 0006.
GET PERNR.
  PROVIDE * FROM P0001
          * FROM P0006 BETWEEN PN-BEGDA AND PN-ENDDA
          WHERE P0006-SUBTY eq '1'.
    WRITE: / PERNR-PERNR, P0001-STELL,
             P0006-STRAS, P0006-BEGDA,P0006-ENDDA.
  ENDPROVIDE.

Sometimes no data is available for a particular infotype in the selected partial period. Infotype validity periods may not overlap but gaps are permitted.

For example, gaps can occur when personal data is joined with address data:

Personal data

January 1960 - May 1998

Miller

May 1998 - December 1998

Smith


Address data:

January 1998 - December 1998

Hamburg


A join for personal and address data is presented as follows:

January 1960 - December 1997

Miller

January 1998 - April 1998

Miller / Hamburg

May 1998 - December 1998

Smith / Hamburg


Only personal data is available in the first partial period. Since the record does not provide the required information, the join's function of providing data from all associated infotypes has not been fulfilled.

The variables Pnnnn_VALID recognize that only incomplete data is available for a particular partial period.

This variable is formed when the report is run for each Pnnnn infotype included in a join.

If data exists in the partial period for the Pnnnn infotype, the variable Pnnnn_VALID is filled with X.

These variables are evaluated as follows:

REPORT RPDEMO03.
TABLES: PERNR.
INFOTYPES:  0002,
            0006.
GET PERNR.
  PROVIDE * FROM P0002
          * FROM P0006 BETWEEN PN-BEGDA AND PN-ENDDA
          WHERE P0006-SUBTY = '1'.
    IF P0006_VALID EQ 'X'.
      WRITE:  /  PERNR-PERNR,
                 P0002-BEGDA DD/MM/YYYY,
                 P0002-ENDDA DD/MM/YYYY,
                 P0002-NACHN,
                 P0006-ORT01.
    ENDIF.
  ENDPROVIDE.

A list is generated only if address data is available. The first partial period, for which only personal data is available, is suppressed.