Application Development 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: 

Select statement

Former Member
0 Kudos

Hi gurus,

I have used following select statemenet and I ma getting this error, <b>The work area "IT_T158B" is not long enough .</b>can you please tell me what is the problem :

data : begin of it_t158b occurs 0,

tcode like t158b-tcode,

bwart like t158b-bwart,

end of it_t158b.

SELECT single * FROM T158B

into it_t158b WHERE TCODE = MIGO

AND BWART = 261.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Rajeev,

Try this code and I hope it will work 4 u...

reward points if helpful....

data : begin of it_t158b occurs 0,

tcode like t158b-tcode,

bwart like t158b-bwart,

end of it_t158b.

SELECT single tcode bwart FROM T158B

into it_t158b WHERE TCODE = MIGO

AND BWART = 261.

Thanks,

Ashish

7 REPLIES 7

Former Member
0 Kudos

Hi

It should be

U should declare a work area not internal table like

data : it_t158b like T158B.

SELECT single * FROM T158B

into it_t158b WHERE TCODE = MIGO

AND BWART = 261.

Thanks

Vasudha

Message was edited by:

Vasudha L

Message was edited by:

Vasudha L

0 Kudos

HI thanks for the reply but now i am getting this error:

<b>Field "TABLE" is unknown. It is neither in one of the specified tables </b>

Thanks

Rajeev

0 Kudos

Hi

Declare it as a work area as i have edited and in the declaration part of ur prgram add this:

TABLES: T158B.

Thanks

Vasudha

Reward points if found useful.

Message was edited by:

Vasudha L

Former Member
0 Kudos

structure miss match

data : begin of it_t158b occurs 0,

tcode like t158b-tcode,

bwart like t158b-bwart,

end of it_t158b.

<b>

this correct one</b>

SELECT single tcode bwart FROM T158B

into it_t158b WHERE TCODE = MIGO

AND BWART = 261.

gopi_narendra
Active Contributor
0 Kudos

If you are using single * you can not use into table


data : IS_T158B type T158B.
SELECT single * FROM T158B
into IS_t158b WHERE TCODE = MIGO
AND BWART = 261.

Regards

Gopi

Former Member
0 Kudos

Hi Rajeev,

Try this code and I hope it will work 4 u...

reward points if helpful....

data : begin of it_t158b occurs 0,

tcode like t158b-tcode,

bwart like t158b-bwart,

end of it_t158b.

SELECT single tcode bwart FROM T158B

into it_t158b WHERE TCODE = MIGO

AND BWART = 261.

Thanks,

Ashish

Former Member
0 Kudos

Hi Rajeev,

Delete the occurs 0 statement from data declaration

Change the code to the following:

data : begin of wa_t158b,

tcode type t158b-tcode,

bwart type t158b-bwart,

end of wa_t158b.

SELECT SINGLE tcode bwart

FROM T158B

INTO wa_t158b

WHERE TCODE = MIGO

AND BWART = 261.

The first error occurs because you use "*" in the select clause, it will cause all fields to be selected, while the structure you defined only containes two fields which is TCODE and BWART. The structure and what is selected must match.

The second error, since you are using select single, which is only going to result in one record, you cannot put the result in a table, simply put it in a structure by omitting the "TABLE" from your select statement.