Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ABAP join result not as expected


I have the following join and it does not return the expected values.  Please can you advise on a way to get the desired result.

For my example data when I run this I am getting 5 rows of data but I was expecting 1 row of data.  There are 5 rows in /utpif/prst_pod but there is only 1 row in /utpif/prst_hdr where proc_step_no = '400' OR st_hdr~proc_step_no = '200'.

Basically I want the output to only contain the row where proc_step_no = '400' OR st_hdr~proc_step_no = '200' and not the other rows also.


SELECT pod~proc_ref
  INTO TABLE li_utpif
  FROM /utpif/prst_pod AS pod
  JOIN /utpif/prst_hdr AS st_hdr
  ON pod~proc_ref = st_hdr~proc_ref
  WHERE pod~contr_ref EQ '123456'

  AND ( st_hdr~proc_step_no = '400' OR st_hdr~proc_step_no = '200' ).

Thanks in advance!


Helpful Answer

Not what you were looking for? View more on this topic or Ask a question