0
votes

I am currently working on an application which requires all equipments from the EQUI table. When I look at the table via SE11, there are 225 entries.

When I try to select the equipments through a function module, I get a very different result.

  SELECT E~EQUNR, E~EQART, I~BEBER, Q~IWERK, I~TPLNR, K~EQKTX, K~SPRAS, E~GERNR, X~PLTXT
  FROM EQUI AS E
  INNER JOIN EQKT AS K ON K~EQUNR EQ E~EQUNR
  INNER JOIN EQUZ AS Q ON Q~EQUNR EQ E~EQUNR
  INNER JOIN ILOA AS I ON I~ILOAN EQ Q~ILOAN
  INNER JOIN IFLOTX AS X on X~TPLNR EQ I~TPLNR
  WHERE E~EQUNR LIKE @P_EQUNR
  AND I~BEBER LIKE @P_BEBER
  AND I~TPLNR LIKE @P_TPLNR
  AND Q~IWERK LIKE @P_IWERK
  AND E~GERNR LIKE @P_GERNR
  AND K~SPRAS EQ @IV_SPRAS
  AND X~SPRAS EQ @IV_SPRAS
  INTO TABLE @ET_EQUIPS.

When I query them with this select statement, I do get the same amount of results as the EQUI table, but without the other data I require.

  SELECT E~EQUNR, E~EQART
  FROM EQUI AS E
  INNER JOIN JEST AS J ON J~OBJNR EQ E~OBJNR
  INNER JOIN TJ02T AS T on T~ISTAT EQ J~STAT
  WHERE INACT NE 'X'
  AND J~STAT NE 'I0320'
  AND J~STAT NE 'I0076'
  INTO TABLE @ET_EQUIPS.

Any help on how to get the same amount of results with all the other data as well?

1
Try to exclude all the WHEREs consequently and turn the joins into LEFT OUTER JOIN. Simple! - Suncatcher
I'll try that! Thanks! - Matthijs Mennens
Exactly what I needed! If you want, you can answer the question and I'll accept. - Matthijs Mennens
Added the answer. - Suncatcher

1 Answers

0
votes

Typically it happens when some of your conditions are not met or the recordset is not presented in one of the joined tables. Try to use LEFT OUTER JOIN and check all your WHERE conditions one by one.

You can start with the following statement:

SELECT E~EQUNR, E~EQART, I~BEBER, Q~IWERK, I~TPLNR, K~EQKTX, K~SPRAS, E~GERNR, X~PLTXT
  FROM EQUI AS E
 LEFT OUTER JOIN EQKT AS K ON K~EQUNR EQ E~EQUNR
 LEFT OUTER JOIN EQUZ AS Q ON Q~EQUNR EQ E~EQUNR
 LEFT OUTER JOIN ILOA AS I ON I~ILOAN EQ Q~ILOAN
 LEFT OUTER JOIN IFLOTX AS X on X~TPLNR EQ I~TPLNR