Copyright 2024 - BV TallVision IT

When a JOIN is used, the soul purpose wil be involving multiple tables in a single select action. The result will most likely be an internal table with columns from several tables. You can set up your internal table with fieldnames that do not match the fieldname in the original table - see the example:

 

    SELECT
      factuurkop~belnr AS factuur_belnr
      factuurkop~bldat AS factuur_bldat
      factuurkop~budat AS factuur_budat
      factuuritem~buzei AS factuur_buzei
      factuuritem~ebeln AS order_ebeln
      factuuritem~ebelp AS order_ebelp
      factuuritem~matnr AS factuur_matnr
      factuuritem~sgtxt AS factuur_sgtxt
      factuuritem~werks AS factuur_werks
      bestelkop~bukrs AS order_bukrs
      bestelkop~bsart AS order_bsart
      bestelkop~aedat AS order_aedat
      bestelitem~loekz AS order_loekz
      bestelitem~matnr AS order_matnr
      bestelitem~menge AS order_menge
      bestelitem~meins AS order_meins
      material~matkl AS material_matkl
      bestelitem~TXZ01 as order_TXZ01
      material~mtart AS material_mtart
      materialtext~maktx AS material_maktx

      FROM rbkp AS factuurkop
      INNER JOIN rseg AS factuuritem
      ON factuuritem~belnr = factuurkop~belnr AND
         factuuritem~gjahr = factuurkop~gjahr
         INNER JOIN ekko AS bestelkop
         ON bestelkop~ebeln = factuuritem~ebeln
           INNER JOIN ekpo AS bestelitem
           ON bestelitem~ebeln = factuuritem~ebeln AND
             bestelitem~ebelp = factuuritem~ebelp
             INNER JOIN mara AS material
             ON material~matnr = factuuritem~matnr
               INNER JOIN makt AS materialtext
               ON materialtext~matnr = factuuritem~matnr AND
                  materialtext~spras = sy-langu
                  INTO CORRESPONDING FIELDS OF TABLE gt_overview
                  WHERE factuurkop~belnr  IN so_belnr AND
                        factuurkop~bukrs  IN so_bukrs AND
                        factuurkop~gjahr  IN so_gjahr AND
                        factuurkop~budat  IN so_budat AND
                        factuurkop~xblnr  IN so_xblnr AND
                        bestelkop~bukrs   IN so_bukr2 and
                        bestelitem~werks  IN so_werks.

The results of the selection will be held on table GT_OVERVIEW which holds fields with a custom name, factuur_belnr, factuur_bldat and so on.

Is your join not working as expected ? Here's a limitation I've come across: table EKBE holds fields that reference other tables, where the item number BUZEI is to be references against the item number on LIPS. However the field content is a match, the field definitions are different. The Abap coding generates and there is no mention of any issues on the code inspector, yet there are also no results in the selection. Field types should match for a valid ON definition.