2012 Oct 10 5:56 PM
Hello Experts, I’m trying to write a JOIN SELECT statement on VBAK and VBAP tables but having challenge to get information which I need. Following is the select statement. I’ve provided as many filters as I could and two of them (b~kdmat and a~bstdk pv_ship_date) are taken from input parameters.
SELECT a~vbeln a~audat a~vbtyp a~auart a~faksk a~bsark a~bstdk a~zzshch
b~posnr b~kdmat b~cuobj
INTO TABLE t_sales_order
FROM vbak AS a INNER JOIN vbap AS b ON a~vbeln = b~vbeln
where a~vbtyp = lc_vbtyp
and ( a~auart = lc_zlcy or a~auart = lc_zshp )
and ( a~augru = lc_sh or a~augru = lc_lc )
and ( a~bsark = lc_zonl or a~bsark eq lc_zpws or a~bsark = lc_zoff or a~bsark = lc_zedi or a~bsark = lc_zotb )
and b~kdmat = pv_pin_number
and a~bstdk eq pv_ship_date.
Based on input parameter when I look into the tables VBAK and VBAP then I can find records (one each) in both tables but the above statement doesn’t fetch it and SY-SUBRC value becomes 4. Can anybody see what’s wrong with this statement? Many thanks in Advance. Best Regards.
2012 Oct 10 6:23 PM
hello,
On first look my suggestion would be convert the ( a~auart = lc_zlcy or a~auart = lc_zshp ) into a a~auart in lc_all where lc_all is a range and has values contained in lc_zlcy and lc_zshp. do it for all the remaining also.
Let me know if this helps.
best regards,
swanand
hello,
On first look my suggestion would be convert the ( a~auart = lc_zlcy or a~auart = lc_zshp ) into a a~auart in lc_all where lc_all is a range and has values contained in lc_zlcy and lc_zshp. do it for all the remaining also.
Let me know if this helps.
best regards,
swanand
2012 Oct 10 6:23 PM
hello,
On first look my suggestion would be convert the ( a~auart = lc_zlcy or a~auart = lc_zshp ) into a a~auart in lc_all where lc_all is a range and has values contained in lc_zlcy and lc_zshp. do it for all the remaining also.
Let me know if this helps.
best regards,
swanand
2012 Oct 10 6:35 PM
Hello Swanand,
Many thanks for a great suggestion. Actually it was date parameter which was causing the issue as well as if date it not provided in input parameter. Now I've changed it keep in range type table which resolve the issue.
Many thanks again.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |