Hi Dominic,
you have to use INNER JOIN in your Select statement, that is, in your code:
SELECT pernr reinr pdatv pdatb accdt pdvrs abrec
FROM ptrv_perio INNER JOIN the_other_table ON ptrv_perio~rel_key = the_other_table~rel_key1 and ....
INTO CORRESPONDING FIELDS OF TABLE lt_ptrv_perio
WHERE (ptrv_perio~abrec EQ '2'
ANDptrv_perio~pdatv GE pa_begda
ANDptrv_perio~pdatb LE pa_endda )
OR (ptrv_perio~abrec EQ '3'
AND the_other_table~accdt GE pa_begda
AND the_other_table~accdt LE pa_endda ).
Regards.
Good,
After INNER JOIN you have to use all the fields that make the relationship between the 2 tables,
In my opinion that will be better like that:
SELECTp~pernr p~reinr p~pdatv p~pdatb p~accdt p~pdvrs p~abrec FROM ptrv_perio AS p INNER JOIN ptrv_head AS h ON p~MANDT = h~MANDT and p~PERNR = h~PERNR and p~reinr = h~reinr INTO CORRESPONDING FIELDS OF TABLE lt_ptrv_perio WHERE(p~abrec EQ'2'ANDp~accdt GE pa_begda ANDp~accdt LE pa_endda )OR(p~abrec EQ'3'AND h~dates GE pa_begda AND h~dates LE pa_endda ).
Regards.
Add comment