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

Former Member
0 Likes
1,168

Hi ,

i working in upgrade from 4.5 to ECC6 . I hav an syntax error in the below select statement.

  • Authorisation Cheacks for Super User

 SELECT SINGLE * FROM USR02 WHERE BNAME = SY-UNAME
                               AND CLASS = 'RES_SUPERVIS'. 

Erro message :

<b> A target area must be declared either explicitly with an INTO clause or

implicitly with a TABLES statement. </b>

I feel that we hav create a work area.. but any other solution

Any suggestion for doing this...

regards,

sanjay

8 REPLIES 8
Read only

Former Member
0 Likes
1,040

in the starting of the program declare as

<b>TABLES: USR02.</b>

so, when u write the select statement as

  • Authorisation Cheacks for Super User

SELECT SINGLE * FROM USR02 WHERE BNAME = SY-UNAME

AND CLASS = 'RES_SUPERVIS'.

the data from USR02 will get stored in the workarea of USR02 as it is defined in the tables statement.

Read only

Former Member
0 Likes
1,040

Hi,

Use Tables Statement for USR02.

Regards,

Deepu.K

Read only

0 Likes
1,040

Declare the table..

Tables: USR02.

Read only

Former Member
0 Likes
1,040

Hi,

Yes u need to declare a work area for populating with the single record.

If u r using Non primary key in WHERE CONDITION, then U can use

TabLES: MARA

Select * from MARA upto 1 row where ersda = p_ersda.

end select.

In this case selected record will get poulated into workarea (mara) . As we uses TabLES statement, Workarea is decalred implicity and there si no need to declare work area explicitly.

Revrt back if any issues,

Reward with points if helpful.

Regards,

Naveen

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
1,040

Hi,

U might not have dfined USR02 in the tables statement.

The select statement requires an default workarea to store the value,so on declaring

TABLES: USR02.

It will create a default workarea..

and u problem will be solved..

Cheers,

Simha.

Reward all the helpful answers..

Read only

Former Member
0 Likes
1,040

Hi sanjay,

Creating a work area of line type USR02 would be the optimal solution.

Regards,

Basu.

Message was edited by:

Basavaraj P Umadi

Read only

Former Member
0 Likes
1,040

Hi,

There are two solutions

1) Create your own work area with same structure of USR02 & add into workarea i

in select statement

2) Declare statement Table USR02 at the start so all the data will be captured in USR02.

Thanks

Sandeep

Reward if helpful

Read only

Former Member
0 Likes
1,040

hi,

create a internal table with heaedr line as

data: itab like usr02 occurs 0 with header line.

give like this

SELECT SINGLE * FROM USR02 into table itab WHERE BNAME = SY-UNAME

AND CLASS = 'RES_SUPERVIS'.

if helpful reward some points.

with regards,

suresh babu aluri.