How to Create Inner Joins between tables using SE16H
The situation: We want to execute the PO number, line items, Company Code, the asset code, Asset description, Material Document Number, and Movement type for a PO that has 4 line items and has Account Assignment (A) for Asset.
All of these details in a table similar to this one.
![](https://static.wixstatic.com/media/3e37e4_5922955b8da04dc98b6a7de5e9b91f5a~mv2.png/v1/fill/w_49,h_22,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_5922955b8da04dc98b6a7de5e9b91f5a~mv2.png)
Steps: Type the primary table [EKPO] into Se16h, then click the icon for maintaining outer join relationships (2).
![](https://static.wixstatic.com/media/3e37e4_102fd5a5c0d34b458f5e68e6793f08e7~mv2.png/v1/fill/w_49,h_22,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_102fd5a5c0d34b458f5e68e6793f08e7~mv2.png)
2- Give the join a name and a description, then create (2).
![](https://static.wixstatic.com/media/3e37e4_cf5648d34fd1484fb5c13ca003952d7d~mv2.png/v1/fill/w_49,h_20,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_cf5648d34fd1484fb5c13ca003952d7d~mv2.png)
3- We'll enter the first JOIN table (EKKN) and use the output to decide which fields to execute.
![](https://static.wixstatic.com/media/3e37e4_2c0eb08ac7b74fd994985c0f85c43c41~mv2.png/v1/fill/w_49,h_17,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_2c0eb08ac7b74fd994985c0f85c43c41~mv2.png)
4- We will execute after selecting the Asset Number field (ANLN1).
![](https://static.wixstatic.com/media/3e37e4_0db4e4a0a15142418e6730fa001d9640~mv2.png/v1/fill/w_49,h_36,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_0db4e4a0a15142418e6730fa001d9640~mv2.png)
5- Select the Line of table, then press the icon in the square to add table for join creation; the table name will display in the selected secondary table field on the right.
![](https://static.wixstatic.com/media/3e37e4_07ead3deb78b46b5827fd0d5a73f92cd~mv2.png/v1/fill/w_49,h_25,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_07ead3deb78b46b5827fd0d5a73f92cd~mv2.png)
6- Now, click the create icon (page left down) to add the fields that will be used to retrieve data from the connected table.
Hint: this point is similar to the specification we give to the ABAPER to get the data, in a simple way, we have a po number in EKKO, to get the right asset number for a specific line item in po, we want to enter EKKN table with PO number and PO line item number, so we will use the fields EBELN & EBELP as our primary keys here to get the right data without duplication. You may also utilize the fields as a constant Value to filter.
![](https://static.wixstatic.com/media/3e37e4_76c80387e1c74a0eac8f5c536252f5b9~mv2.png/v1/fill/w_49,h_25,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_76c80387e1c74a0eac8f5c536252f5b9~mv2.png)
![](https://static.wixstatic.com/media/3e37e4_ed471480b3d343c2aed19c39e8cc73a7~mv2.png/v1/fill/w_49,h_25,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_ed471480b3d343c2aed19c39e8cc73a7~mv2.png)
7- We will create a new join table (ANLA) Asset master record table to obtain the description of the Asset number.
![](https://static.wixstatic.com/media/3e37e4_70275038434c4036ba0b53eb5cf37007~mv2.png/v1/fill/w_49,h_24,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_70275038434c4036ba0b53eb5cf37007~mv2.png)
8- We will run after selecting the Description field from the ANLA output.
![](https://static.wixstatic.com/media/3e37e4_e83184a5c85e4c8cbb502140c49c34b5~mv2.png/v1/fill/w_49,h_28,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_e83184a5c85e4c8cbb502140c49c34b5~mv2.png)
9- Select the table line and add the fields as we did in the previous steps.
![](https://static.wixstatic.com/media/3e37e4_5887252114bf46e19d7abfa7f2003fa4~mv2.png/v1/fill/w_49,h_23,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_5887252114bf46e19d7abfa7f2003fa4~mv2.png)
![](https://static.wixstatic.com/media/3e37e4_db6568abbc94443e9e9fb2336feae87e~mv2.png/v1/fill/w_49,h_24,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_db6568abbc94443e9e9fb2336feae87e~mv2.png)
10- We will enter the Asset number (ANLN1) and the Company code (BUKRS) into the ANLA table to acquire the description of the Asset number.
![](https://static.wixstatic.com/media/3e37e4_28dc1cafee1a47fda613d3006e8213ab~mv2.png/v1/fill/w_49,h_24,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_28dc1cafee1a47fda613d3006e8213ab~mv2.png)
11- To obtain the Material Document numbers, we will create a new join table (MSEG). and the sort of movement.
![](https://static.wixstatic.com/media/3e37e4_0e2d522b34d24e48bb254c26007cca88~mv2.png/v1/fill/w_49,h_17,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_0e2d522b34d24e48bb254c26007cca88~mv2.png)
12- We will enter the PO number, PO item line, and Company Code into the MSEG table.
![](https://static.wixstatic.com/media/3e37e4_259d1cc0ac9b40118fcd17a9c735096b~mv2.png/v1/fill/w_49,h_28,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_259d1cc0ac9b40118fcd17a9c735096b~mv2.png)
Hint: Before saving, double-check the Sequence number for the linked tables.
![](https://static.wixstatic.com/media/3e37e4_b21a9b55719846e39124e838e144fc5d~mv2.png/v1/fill/w_49,h_14,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_b21a9b55719846e39124e838e144fc5d~mv2.png)
13- Double-check that you have selected the outer joined you saved; you can now execute. Executed table:
![](https://static.wixstatic.com/media/3e37e4_6c9cfe20183043719ae129486a596941~mv2.png/v1/fill/w_49,h_20,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_6c9cfe20183043719ae129486a596941~mv2.png)
Executed table:
![](https://static.wixstatic.com/media/3e37e4_3b8ab647c60c403b9c2696ffeed8423c~mv2.png/v1/fill/w_49,h_22,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/3e37e4_3b8ab647c60c403b9c2696ffeed8423c~mv2.png)