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

select single

Former Member
0 Likes
986

hi experts,

select single matnr netpr into table it_ekpo from ekpo where matnr = '1234' .

its coming error can u correct me.

10 REPLIES 10
Read only

Former Member
0 Likes
951

Use work area instead of table in select query.

Regards,

Aparna

Read only

Former Member
0 Likes
951

Hi,

Do not use Select Single it you want a set of records, just use Select matnr etc into table ....

Select single statment will give u one record (workarea) and not table.

Best Regards.

Read only

Former Member
0 Likes
951

Dear Ravi

you have selected only single field i'e matnr , but in target you have mentioned it_ekpo that is your internal table...

you have to specify the field ..

you can either declare a variable or pass toit_ekpo-matnr field..

select single matnr into it_ekpo-matnr like this..

Read only

Former Member
0 Likes
951

hi ravi,

u cant use select single for retreiving multiple records, here is the code below

types: begin of ty_material,

matnr like mara-matnr,

matkl like mara-matkl,

end of ty_material.

data: wa_material type ty_material.

select single matnr matkl from mara into wa_material where matnr = '1234'.

try the above code.

Read only

Former Member
0 Likes
951

Hi Ravi,

The number of fields you are selecting should be equal to the number of fields in your internal table into which you are selecting the data or else you can also use INTO CORRESSPONDING FIELDS OF table ITAB.

For more details on Select Single.

[http://www.sap-img.com/abap/difference-between-select-single-and-select-upto-one-rows.htm]

To see performance tuning for select statement.

[Select Statement|http://www.sap-img.com/abap/performance-tuning-for-data-selection-statement.htm]

Regards,

Amit.

Read only

Former Member
0 Likes
951

Hi

Please use as follows and revert back if it works fine.


select single *
into table it_ekpo 
from ekpo 
where matnr = '1234' .

Please revert

Regards

Winnie

Read only

former_member206439
Contributor
0 Likes
951

Hi Ravi,

for Select single statment into table is not required that is main problem for your error

remove that table option then it works fine

select single matnr netpr

into it_ekpo

from ekpo

where matnr = '1234' .

Read only

Former Member
0 Likes
951

hi

use the following code it will solve ur problem

data : wa_ekpo like line of it_ekpo.

select single matnr netpr into corresponding fileds of wa_ekpo from ekpo where matnr = '1234' .

Read only

Former Member
0 Likes
951

If any of the above solutions is not working, then let us know what is the error you are getting along with your code to declare the internal table.

Read only

Former Member
0 Likes
951

Hi,

When we use single keyword in select statement..we can not use table keyword in it.

It will give you an error.

Try it like this.

select single matnr netpr

into it_ekpo

from ekpo where matnr = '1234' .

Revert back in case of any query.

Thanks

Rajesh Kumar