‎2006 Aug 31 7:50 AM
Hi experts,
Please let me know inner join for following two queries, i am not able to write , it's giving error. Points will be given for sure.
1) Select customer menus associated with the retroactive pricing condition record
Select VBAP.VBELN (Contract #)
VBAP.POSNR (Item #)
Where KONV.KNUMH = KONH.KNUMH (Condition record number)
VBAK.KNUMV = KONV.KNUMV (Document condition number)
VBAK.AUART = ZMNU (Document Type)
VBAP.POSNR = KONV.KPOSN (Item #)
2) Select all customer menu and item combinations that are associated with each customer pricing contact that have an associated output condition record in table B504 (Customer Pricing Contact PARNR)
Select B504.PARNR (Contact #)
VBPA.VBELN (Contract #),
VBPA.POSNR (Item #)
Where VBPA.PARNR = B504.PARNR (Contact #)
VBPA.PARVW = Z8
VBAK.AUART = ZMNU
Inner Join VBAK.VBELN = VBPA.VBELN
‎2006 Aug 31 8:14 AM
Hi Anand,
Please find the queries.
1. SELECT <field list>
INTO <target list>
FROM
( ( VBAK JOIN VBAP ON VBAKVBELN = VBAPVBELN )
( KONH JOIN KONV ON KONHKNUMH = KONVKNUMH ) )
WHERE VBAKKNUMV = KONVKNUMV AND
VBAK~AUART = 'ZMNU' AND
VBAPPOSNR = KONVKPOSN.
2. SELECT <field list>
INTO <target list>
FROM
( ( VBAK JOIN VBPA ON VBAKVBELN = VBAPVBELN )
JOIN B504 ON VBPA.PARNR = B504.PARNR )
WHERE
VBPA.PARVW = 'Z8' AND
VBAK.AUART = 'ZMNU'.
Regards,
Prasanth
‎2006 Aug 31 8:03 AM
YOu want to have it in native SQL or in abap open SQL . Becosue what you have written here looks for native...
‎2006 Aug 31 8:04 AM
Hi
1) It should be like this:
DATA: BEGIN OF RESULT,
VBELN TYPE VBELN,
POSNR TYPE POSNR,
END OF RESULT.
SELECT AVBELN BPOSNR INTO RESULT
FROM VBAK AS A INNER JOIN VBAP AS B
ON AVBELN = BVBELN
WHERE A~AUART = 'ZMNU' .
WRITE: / RESULT-VBELN, RESULT-POSNR.
ENDSELECT.
You can't use the table KONV because it's a cluster table.
2- The second query will be similar.
Max
‎2006 Aug 31 5:13 PM
Thanx Max,
This has really helped alot.
I have written the code, it's final testing will be tomorrow, if some thing goes wrong i will again reply with queries, if goes right then i will close this thread.
Thanx for your help.
Anand
‎2006 Aug 31 8:14 AM
Hi Anand,
Please find the queries.
1. SELECT <field list>
INTO <target list>
FROM
( ( VBAK JOIN VBAP ON VBAKVBELN = VBAPVBELN )
( KONH JOIN KONV ON KONHKNUMH = KONVKNUMH ) )
WHERE VBAKKNUMV = KONVKNUMV AND
VBAK~AUART = 'ZMNU' AND
VBAPPOSNR = KONVKPOSN.
2. SELECT <field list>
INTO <target list>
FROM
( ( VBAK JOIN VBPA ON VBAKVBELN = VBAPVBELN )
JOIN B504 ON VBPA.PARNR = B504.PARNR )
WHERE
VBPA.PARVW = 'Z8' AND
VBAK.AUART = 'ZMNU'.
Regards,
Prasanth
‎2006 Aug 31 8:17 AM
SELECT AVBAK fields BVBAP fields INTO TABLE internal table
FROM VBAK AS A INNER JOIN VBAP AS B
ON AVBELN = BVBELN
WHERE A~AUART = Selection screen values .
‎2006 Aug 31 9:34 AM
1) Select customer menus associated with the retroactive pricing condition record
Select VBAP.VBELN (Contract #)
VBAP.POSNR (Item #)
Where KONV.KNUMH = KONH.KNUMH (Condition record number)
VBAK.KNUMV = KONV.KNUMV (Document condition number)
VBAK.AUART = ZMNU (Document Type)
VBAP.POSNR = KONV.KPOSN (Item #)
--> I did not get your point of using konh in the above.
select Avbeln Bposnr into table itab
from vbak as A inner join vbap as b on Avbeln = bvbeln
inner join konv as c on Aknumv = Cknumv
where bposnr = ckposn and A~auart = 'ZMNU'.
-XXX-
Select B504.PARNR (Contact #)
VBPA.VBELN (Contract #),
VBPA.POSNR (Item #)
Where VBPA.PARNR = B504.PARNR (Contact #)
VBPA.PARVW = Z8
VBAK.AUART = ZMNU
Inner Join VBAK.VBELN = VBPA.VBELN
-->
SELECT AVBELN APOSNR B~PARNR into table itab
from VBPA as A inner join VBAK as K on AVBELN = KVBELN
inner join B504 as B on APARNR = BPARNR
where APARVW = 'Z8' and KAUART = 'ZMNU'.
Message was edited by: Anurag Bankley
‎2006 Aug 31 5:16 PM
anurag u helped me lot, thanx
I have given points to every one & have given more points to you & max. As i replied to max that i have written the code & testing would be tomorrow, so unce evrything goes right i will close the thred or else i will post again with the queries.
thanx for help