‎2007 Feb 08 5:14 AM
How to use inner join instead of select stat. so that I get all the required fields form both my tables link (lgnum ivnum lgtyp and uname) and linp (lgnum ivnum ivpos lgpla and idatu).
Thanks.
‎2007 Feb 08 5:18 AM
Hi,
Check this example..
DATA: BEGIN OF ITAB OCCURS 0,
LGNUM TYPE LINK-LGNUM,
IVNUM TYPE LINK-IVNUM,
IVPOS TYPE LINP-IVPOS,
END OF ITAB.
SELECT ALGNUM AIVNUM B~IVPOS
INTO TABLE ITAB
FROM LINK AS A INNER JOIN LINP AS B
ON ALGNUM = BLGNUM
AND AIVNUM = BIVNUM
WHERE A~LGNUM = '11221'.
THanks,
Naren
‎2007 Feb 08 5:22 AM
Use below code:
select linklgnum linkivnum linklgtyp linkuname linpivpos linplgpla linpidatu FROM link inner join linp on linklgnum = linp~lgnum
and linkivnum = linkivnum
into TABLE it_tab1 where lgnum = pa_lgnum AND ivnum IN s_ivnum.
Thanks
‎2007 Feb 08 5:32 AM
‎2007 Feb 08 5:39 AM
Shaheen,
In the given code I am assuming you have used below lines in your code from your previous threads:
PARAMETERS: pa_lgnum LIKE LINK-LGNUM.
SELECT-OPTIONS: s_ivnum FOR LINK-IVNUM.
If this used and still you are getting any error, please tell me the error description.
Thanks.
‎2007 Feb 08 6:03 AM
yes it's used. this is the error colunm name has two meanings
‎2007 Feb 08 6:06 AM
select linklgnum linkivnum linklgtyp linkuname linpivpos linplgpla linpidatu FROM link inner join linp on linklgnum = linp~lgnum
and linkivnum = linkivnum
into TABLE it_tab1
********Changes in where condition
where link~lgnum = pa_lgnum AND
link~ivnum IN s_ivnum.
‎2007 Feb 08 6:11 AM
Shaheen,
Please check if the internal table have below fields:
DATA: begin of it_tab1 occurs 0,
lgnum like link-lgnum,
ivnum like link-ivnum ,
lgtyp like link-lgtyp,
uname like link-uname ,
ivpos like linp-ivpos ,
lgpla like linp-lgpla ,
idatu like linp-idatu ,
end of it_tab1.
Please confirm.
Thanks
‎2007 Feb 08 6:41 AM
‎2007 Feb 08 5:23 AM
Hi
Both ur tables are header and item.
it is better to use JOIN instead of for all entries
performance will be very good in this case
Regards
Shiva
‎2007 Feb 08 5:34 AM
Hi,
Did you check my code..It is not giving any error..
DATA: BEGIN OF ITAB OCCURS 0,
LGNUM TYPE LINK-LGNUM,
IVNUM TYPE LINK-IVNUM,
IVPOS TYPE LINP-IVPOS,
END OF ITAB.
SELECT ALGNUM AIVNUM B~IVPOS
INTO TABLE ITAB
FROM LINK AS A INNER JOIN LINP AS B
ON ALGNUM = BLGNUM
AND AIVNUM = BIVNUM
WHERE A~LGNUM = '11221'.
Thanks,
Naren
‎2007 Feb 08 5:40 AM
hi
good
check this code and use accordingly
SELECT c~matnr "Material no.
c~werks "Plant
c~lvorm "Flag Mat.-Del. at Plant level
c~bwtty "Valuation category
c~kzkri "Indicator: Gritical part
c~dispr "Material: MRP profile
ADD Mike Krepcik TD 3363 02/01/05 D10K913640
c~dismm "MRP type
END TD 3363 02/01/05 D10K913640
c~plifz "Planned delivery time in days
c~perkz "Period indicator
c~minbe "Reorder point
c~mabst "Maximum stock level
c~umlmc "Stock in Tran. (plant to plant)
a~mtart "Material type
a~meins "Base unit of measure
k~spras "Language key
k~maktx "Material description
w~bwkey "Valuation area
w~bwtar "Valuation type
w~lbkum "Total value stock
w~salk3 "Value of total valuated stock
w~verpr "Moving ave. price/periodic unit
w~peinh "Price unit ADD D10K913194
FROM marc AS c LEFT OUTER JOIN mara AS a
ON cmatnr = amatnr
LEFT OUTER JOIN makt AS k
ON cmatnr = kmatnr
LEFT OUTER JOIN mbew AS w
ON cmatnr = wmatnr AND
cwerks = wbwkey
INTO TABLE i_splus
WHERE c~matnr IN s_matnr "Material no.
AND c~werks IN s_werks. "Plant
thanks
mrutyun^
‎2007 Feb 08 5:43 AM
Hi shaheen
create a <b>database view of these 2 tables.</b>
and write a select statement on this view.
it meets your requirement and also improves performance.
Regards,
MB
‎2007 Feb 08 6:43 AM
Hi,
Please post your select statement and your internal table declaration..So that it will be easier for us identify the error..
Thanks,
Naren
‎2007 Feb 08 7:02 AM
hi
plz chk this code
tables : link,linp.
DATA: begin of it_tab1 occurs 0,
lgnum like link-lgnum,
ivnum like link-ivnum ,
lgtyp like link-lgtyp,
uname like link-uname ,
ivpos like linp-ivpos ,
lgpla like linp-lgpla ,
idatu like linp-idatu ,
end of it_tab1.
*select linklgnum linkivnum linklgtyp linkuname linpivpos linplgpla linpidatu FROM link inner join linp on linklgnum = linp~lgnum
*and linkivnum = linkivnum
*into TABLE it_tab1 where lgnum = pa_lgnum AND ivnum IN s_ivnum.
select algnum aivnum algtyp auname bivpos blgpla b~idatu into table it_tab1
FROM link as a inner join linp as b
on algnum = blgnum and aivnum = bivnum.
regards.