‎2010 Apr 14 2:58 PM
select
mara~matnr
mara~mtart
mara~matkl
mara~bmatn
mara~bismt
mara~meins
mara~mfrpn
mara~mfrnr
makt~maktx
lfa1~lifnr
lfa1~name1
into table lt_output
from mara
inner join makt on mara~matnr = makt~matnr
inner join lfa1 on mara~mfrnr = lfa1~lifnr
where
mara~matnr in s_matnr and
mtart in s_mtart and
matkl in s_matkl and
bmatn in s_bmatn and
bismt in s_bismt and
meins in s_meins and
mfrpn in s_mfrpn and
mfrnr in s_mfrnr.when I inner join these three tables am getting 34 records in the output table but when I enter material number matnr and check it, no records was showing up....I think inner join was failed can any one help me
Edited by: Thomas Zloch on Apr 14, 2010 4:21 PM - tags added
‎2010 Apr 14 6:10 PM
Did you intend to omit the table names in this part of WHERE?
mtart in s_mtart and
matkl in s_matkl and
bmatn in s_bmatn and
bismt in s_bismt and
meins in s_meins and
mfrpn in s_mfrpn and
mfrnr in s_mfrnr. I've never tried without supplying the mara~, etc.
Trying deconstructing...see if you get values in SE11 from MARA only , with the where clause (that applies to MARA), then LFA1, etc.
‎2010 Apr 15 2:44 AM
>
>
select > mara~matnr > mara~mtart > mara~matkl > mara~bmatn > mara~bismt > mara~meins > mara~mfrpn > mara~mfrnr > makt~maktx > lfa1~lifnr > lfa1~name1 > into table lt_output > from mara > inner join makt on mara~matnr = makt~matnr > inner join lfa1 on mara~mfrnr = lfa1~lifnr > where > mara~matnr in s_matnr and > mtart in s_mtart and > matkl in s_matkl and > bmatn in s_bmatn and > bismt in s_bismt and > meins in s_meins and > mfrpn in s_mfrpn and > mfrnr in s_mfrnr.> when I inner join these three tables am getting 34 records in the output table but when I enter material number matnr and check it, no records was showing up....I think inner join was failed can any one help me
>
> Edited by: Thomas Zloch on Apr 14, 2010 4:21 PM - tags added
Hi,
Please change your WHERE condition like this,(Give the Table Alias along with field name )
where
> mara~matnr in s_matnr and
> mara~mtart in s_mtart and
> mara~matkl in s_matkl and
> mara~bmatn in s_bmatn and
> mara~bismt in s_bismt and
> mara~meins in s_meins and
> mara~mfrpn in s_mfrpn and
> mara~mfrnr in s_mfrn
‎2010 Apr 15 5:46 AM
I've tried with thata too same answer...if I give material no no record is printing
‎2010 Apr 15 6:24 AM
Hi
I think you are not giving valid material so u r not getting the result.
Try with the Valid material range becaus eu r using all AND condtion .
Fot that particualer material what u have given in where condtions it should also satisfy.
Check wheather in where condtion it is AND or OR.
Ask for the valid Test data to functional consultant.
Regards,
Pravin
‎2010 Apr 15 6:25 AM
Let's first of all get rid of the myth that the table names are required in the join when specifying field names: This is only necessary, when the given field/column appears in more than one of the join's database tables. In certain cases it is still good practice though, because if for some strange reason one of the tables would be changed and now you'd actually have duplicate field names across tables, the SQL statement would no longer be syntactically correct.
Now to your problem, which I'm not sure I understand, so let me rephrase. When you run the join without any restrictions you get 34 records, but when entering a condition on material number you get 0 records. If that's the case then most likely your problem is that you used the wrong reference for defining your select-option <em>s_matnr</em>, which has to be of type <em>matnr</em> (or similar) to ensure that the correct conversion exit <em>matn1</em> gets applied.
Otherwise if your system is configured to store material numbers with leading zeros, you won't get any match if you search for material number 1, when you actually should have looked for 000000000001. By using the right type you ensure that this conversion happens as it should.
You can also quickly check this in SE16 or SE16N, just make sure to switch off the conversion exits in the settings for the transaction (that way you see the non-numeric data as it is stored on the database rather than how it's displayed for the user).
And as Nehruu mentioned, either select the language or add a condition on language. Otherwise you'll end up with duplicate records if your system stores material descriptions in more than one language.
‎2010 Apr 15 6:10 AM
Hi
You have to pass the logon Language Key to MAKT~SPRAS = sy-langu you can get correct output.
Regards
Nehruu
‎2010 Apr 15 1:20 PM
This is the complete code I've used to print this report....I tried tomake changes suggested by you guys but the same reply
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Rob Burbank on Apr 15, 2010 2:54 PM
‎2010 Apr 15 1:24 PM
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Rob Burbank on Apr 15, 2010 2:57 PM
‎2010 Apr 15 1:26 PM
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Rob Burbank on Apr 15, 2010 2:56 PM
‎2010 Apr 15 1:27 PM
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Rob Burbank on Apr 15, 2010 2:57 PM
‎2010 Apr 15 1:28 PM
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Rob Burbank on Apr 15, 2010 2:57 PM
‎2010 Apr 15 1:29 PM
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Rob Burbank on Apr 15, 2010 2:58 PM
‎2010 Apr 15 1:29 PM
Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code
Edited by: Rob Burbank on Apr 15, 2010 2:58 PM
‎2010 Apr 15 1:31 PM
i AM REALLY SORRY GUYS I HAVE POSTED SO MANYMESSAGES....THAT IS THE CODE I USED TO PRINT THE OUTPUT. I HAVE ALSO TRIED UR SUGGESSIONS. PLEASE LET ME KNOW IF IHAVE TO MAKE ANY MODIFICATIONS.
Moderator message - Please do not try to get around the limit by making multiple posts. Much of what you posted was code that was commented out. Please alo do not use all caps. Rob
Edited by: Rob Burbank on Apr 15, 2010 2:59 PM
‎2010 Apr 15 3:05 PM
Hi I think you need a slight modification to your code.
select
mara~matnr
mara~mtart
mara~matkl
mara~bmatn
mara~bismt
mara~meins
mara~mfrpn
mara~mfrnr
makt~maktx
lfa1~lifnr
lfa1~name1
into table lt_output
from mara
inner join makt on maramatnr = maktmatnr
inner join lfa1 on maramfrnr = lfa1lifnr
where
maramatnr = maktmatnr and
maramfrnr = lfa1lifnr and
mara~matnr in s_matnr and
mtart in s_mtart and
matkl in s_matkl and
bmatn in s_bmatn and
bismt in s_bismt and
meins in s_meins and
mfrpn in s_mfrpn and
mfrnr in s_mfrnr.
I hope this will solve your problem..
Please revert back in case of any issues..
‎2010 Apr 15 7:45 PM
Try with JOIN instead of INNER JOIN.
And you must check MAKT-SPRAS value. Remember there is a description for every language that you've been installed. Maybe the output will result on several records of the same material.
‎2010 Apr 15 8:21 PM
Try to run your SQL statement without joining the lfa1 table and check the output.
Yasin.
‎2010 Apr 16 5:30 AM
I have tried to remove join for lfa1 and retrived the data from different sql statement...same result.....and where should i pass the spars language key