‎2011 Feb 22 10:28 AM
hey guys,
i've used a select query to get details from KNA1, KNVV, ADRC, KNVP, pa0002. tables by joining. but i'm getting only about 170 records. there are more than 3000 records in the database. for each tables. here is my select query
SELECT KNA1KUNNR KNA1NAME1 KNA1NAME2 ADRCSTR_SUPPL1 ADRCSTR_SUPPL2 ADRCSTR_SUPPL3 ADRCCITY1 KNVVVWERK KNVPPERNR PA0002VORNA PA0002NACHN KNVVVKBUR KNVVKDGRP KNA1STCD1 KNA1~STCEG
INTO CORRESPONDING FIELDS OF TABLE IT_FINAL FROM KNA1
INNER JOIN KNVV ON KNA1KUNNR = KNVVKUNNR
INNER JOIN ADRC ON KNA1ADRNR = ADRCADDRNUMBER
INNER JOIN KNVP ON KNA1KUNNR = KNVPKUNNR
INNER JOIN PA0002 ON KNVPPERNR = PA0002PERNR
WHERE KNA1KUNNR IN S_KUNNR AND KNVVVWERK in P_VWERK AND PA0002PERNR IN S_PERNR AND KNVVVKBUR IN S_VKBUR AND KNVV~KDGRP IN S_KDGRP.
can anyone tell me the problem in the above query.
thanks.
‎2011 Feb 22 11:15 AM
Hi
you are using tables KNA1, KNVV, ADRC, KNVP, pa0002.
Create internal table for each table mentioned above with all the primary keys and find the links between them
then select data in one table and select data from another table into your internal table for all the entries exists in firs internal table.
go for below links.
http://www.sapdev.co.uk/abap/commands/select_forallentries.htm
http://wiki.sdn.sap.com/wiki/display/ABAP/FORALLENTRIES-Home+page
http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_ITAB.htm
Thanks
lalit
‎2011 Feb 22 10:54 AM
‎2011 Feb 22 11:00 AM
Hi
First avoid joining more than 3 table
instead you can use for all entries.
search on for all entries
it will surely resolve your issue.
thanks
Lalit Gupta
‎2011 Feb 22 11:02 AM
how to search on for all entries? can u explain it further more?
‎2011 Feb 22 11:01 AM
HI,
don't know why your join is not working but you can analyse that.
Use SQVI (Quick viewer) and join the first 2 tables and view the result with a data record that is veryfied to be ok.
Now add always one additional table to the join and check which join causes and why you loose the data record.
Best regards, Christian
‎2011 Feb 22 1:54 PM
Dear Christian ,
Could you please tell me , how to check the entries in the Transaction 'SQVI' by using the Data record.
Thanking You All.
‎2011 Feb 22 11:15 AM
Hi
you are using tables KNA1, KNVV, ADRC, KNVP, pa0002.
Create internal table for each table mentioned above with all the primary keys and find the links between them
then select data in one table and select data from another table into your internal table for all the entries exists in firs internal table.
go for below links.
http://www.sapdev.co.uk/abap/commands/select_forallentries.htm
http://wiki.sdn.sap.com/wiki/display/ABAP/FORALLENTRIES-Home+page
http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_ITAB.htm
Thanks
lalit