Hi all,
I have a requirement in which I have 6 inputs project no, wbs no, cost center no, plant no, purchasing group, po creation date. I need to bring the po details as the report. I have coded a select query joining all the 4 tables involved in the input as below.Is it correct ? will I get the desired output for any combinations of input if i join? because all the inputs are optional.
SELECT a~ebeln
a~bsart
a~lifnr
a~ekgrp
a~bedat
a~waers
b~werks
c~ps_psp_pnr
c~kostl
d~psphi
INTO CORRESPONDING FIELDS OF TABLE t_po_hdr
FROM ekko as a
JOIN ekpo as b ON aebeln = bebeln
JOIN ekkn as c ON aebeln = cebeln
JOIN prps as d ON cps_psp_pnr = dpspnr
WHERE a~bsart IN ('PO','EBP')
AND a~ekgrp IN s_pg_no
AND a~bedat IN s_po_dt
AND b~werks IN s_pl_no
AND c~ps_psp_pnr IN s_wbs_no
AND c~kostl IN s_cc_no
AND d~psphi IN s_proj.