Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regarding select query

Former Member
0 Likes
1,169

i want to select the matnr, and material description unit of measurement , from mara and makt. the select query used is

select single amatnr ameins bmaktx from mara as a inner join makt as b on bmatnr = amatnr and bspras eq 'EN' into

corresponding fields of it_bitem1 where a~matnr = matnr.

Here in the internal table no values are fetched . What is the error in this .

Thanks in advance.

11 REPLIES 11
Read only

Former Member
0 Likes
1,145

Hi,

Error is <b>Leading Zeros are missing in MATNR</b>.

Use FM <b>'Conversion_exit_aplha_input'</b> for <b>MANTR</b> before u pass it to Select. i.e.

<b>CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = matnr

IMPORTING

output = matnr.</b>

select single amatnr ameins bmaktx from mara as a inner join makt as b on bmatnr = amatnr and bspras eq 'EN' into

corresponding fields of it_bitem1 where a~matnr = matnr.

Reward points if the answer is helpful.

Regards,

Mukul

Message was edited by:

Mukul R. Kulkarni

Read only

Former Member
0 Likes
1,145

hi,

rewrite your query like this:

select a~matnr

a~meins

b~maktx

into table it_bitem1

from mara as a inner join makt as b

on amatnr eq bmatnr.

if you got any select-option or parameter then specify it in the where condition.

if you are having matnr as select-option then write in

where condition a~matnr in s_matnr

or if it is parameter then write

where a~matnr eq p_matnr.

Read only

Former Member
0 Likes
1,145

change to this and checkout if it works

declare workare for it_bitem1 .

data : wa_bitem1 type it_bitem1 .

select single a~matnr a~meins b~maktx from mara as a inner join makt as b on a~matnr = b~matnr and b~spras eq 'EN' into
corresponding fields of wa_bitem1 where a~matnr = matnr.

Read only

Former Member
0 Likes
1,145

hi,

try tis...

select single a~matnr

a~meins

bmaktx from mara as a inner join makt as b on bmatnr = amatnr into corresponding fields of it_bitem1 where amatnr = matnr and b~spras eq 'EN' .

siva

Read only

hermanoclaro
Participant
0 Likes
1,145

Hi there,

Maybe the problem is the spras at the on statement.

Try the select like this:


select single a~matnr a~meins b~maktx
from mara as a inner join
        makt as b
on b~matnr = a~matnr
into corresponding fields of it_bitem1
where a~matnr = matnr
    and b~spras eq 'EN'.

Hope this helps.

Read only

Former Member
0 Likes
1,145

change SPRAS as EN to E as in MAKT length of SPRAS is only 1

<b>b~spras eq 'E'</b>

Read only

Former Member
0 Likes
1,145

hi,

rewrite your query like this:

<b>select a~matnr

a~meins

b~maktx

into table it_bitem1

from mara as a inner join makt as b

on amatnr eq bmatnr

where spras eq 'EN'.</b>

if you got any select-option or parameter then specify it in the where condition.

if you are having matnr as select-option then write in

where condition a~matnr in s_matnr

or if it is parameter then write

where a~matnr eq p_matnr.

Read only

Former Member
0 Likes
1,145

reward points all useful answers,if ur problem get solved...

Read only

Former Member
0 Likes
1,145

Hi ,

I have faced the similar problems too . And Using the Function Module ''CONVERSION_EXIT_ALPHA_INPUT' solved the problem . As the material number is a 16 digit the select query expects the full 16 digit number . Hence usage of the above given FM converts the material number into a 16 digit number and your select statement would returns the correct number of records.

Regards,

Sowmya.

Read only

Former Member
0 Likes
1,145

Thanks for all your replies ,

i have tried all these choices but i cant able to solve the problem. still it doesn't fetch any datas

Read only

0 Likes
1,145

Hi,

I've tried your piece of code here and everything is fine as follows:

DATA: BEGIN OF it_bitem1,
        matnr type mara-matnr,
        meins type mara-meins,
        maktx type makt-maktx,
      END OF it_bitem1,
      matnr type mara-matnr
        value '000000000000000142'.

select single a~matnr a~meins b~maktx
from mara as a inner join
     makt as b
on a~matnr = b~matnr
into corresponding fields of it_bitem1
where a~matnr = matnr
    and b~spras eq 'E'.

break-point.

What can be happening for you is:

1. Veriable matnr in where statement could be a select-options and must be declared as a~matnr IN matnr.

2. There's none data in one of these tables (since it's inner join) with the spras you are using (deppending would be nice to change the hardcode 'E' for sy-langu).

3. The variable matnr is a parameter and is empty.

Check these possibilities.

Hope this helps you out.