Application Development and Automation 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: 
Read only

Inner joing is not fetching any data

Raxph
Participant
0 Likes
1,073

Hi together,

I am having some issues with the inner join select statement, as even though I checked on the tables that are used in the select statement, it is not fetching any data.

 SELECT k~plnnr k~plnal z~ktext
  FROM eapl AS k
  INNER JOIN plko AS z
  ON k~plnnr EQ z~plnnr
  AND k~plnal EQ z~plnal
  INTO TABLE g_t_join
  WHERE k~equnr EQ gv_equipment.

The variable gv_equipment is filled as I checked via debugging. Does anyone know whether I have done any mistake in the select statement?

Thank you all in advance!

1 ACCEPTED SOLUTION
Read only

venkateswaran_k
Active Contributor
0 Likes
1,027

Hi

Please use the following code. It may be because the equipment number is to be in in the internal format.

** conversion exit function.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = gv_equipment
 IMPORTING
   OUTPUT        = gv_equipment.

SELECT k~plnnr k~plnal z~ktext
  FROM eapl AS k
  INNER JOIN plko AS z ON ( k~plnnr EQ z~plnnr  AND k~plnal EQ z~plnal )
  INTO TABLE g_t_join
  WHERE k~equnr EQ gv_equipment.

Regards,

Venkat

4 REPLIES 4
Read only

venkateswaran_k
Active Contributor
0 Likes
1,028

Hi

Please use the following code. It may be because the equipment number is to be in in the internal format.

** conversion exit function.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    input         = gv_equipment
 IMPORTING
   OUTPUT        = gv_equipment.

SELECT k~plnnr k~plnal z~ktext
  FROM eapl AS k
  INNER JOIN plko AS z ON ( k~plnnr EQ z~plnnr  AND k~plnal EQ z~plnal )
  INTO TABLE g_t_join
  WHERE k~equnr EQ gv_equipment.

Regards,

Venkat

Read only

0 Likes
1,027

Yes that was the issue. Many thanks!!

Read only

1,027

or

gv_equipment = |{ gv_equipment ALPHA = IN }|.
Read only

Sandra_Rossi
Active Contributor
0 Likes
1,027

When you have such issues, you need to split your query to identify the cause of the issue, like first trying:

SELECT k~plnnr, k~plnal
  FROM eapl AS k
  INTO TABLE @data(dummy)
  WHERE k~equnr EQ @gv_equipment.

If it returns nothing, you know that the issue is not about the join, but due to the value in the WHERE (or you're in the wrong client).