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

workarea cannot be used as internal table

Former Member
0 Likes
1,973
data :
       wa_itab type zempmasternish,

       itab type table of zempmasternish,

       wa_itab_sec type zdepartnish,

        itab_sec type TABLE OF zdepartnish,

       fieldcatalog type slis_t_fieldcat_alv with header line,
       v_prog_name type sy-repid.

 select empno deptno deptname from zdepartnish into itab_sec where empno = itab-empno.

i am getting an error that work area cannot be used as an internal table with the above select statement can you please help me out with this.

Edited by: Thomas Zloch on Apr 6, 2010 2:43 PM - tags added

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
997

What do you want to do? Read into a workarea? Use ... INTO wa_itab_sec ...

Read into an internal table? Use ... INTO TABLE itab_sec ...

Also study online help for SELECT statement which explains everything.

Thomas

data :
       wa_itab type zempmasternish,

       itab type table of zempmasternish,

       wa_itab_sec type zdepartnish,

        itab_sec type TABLE OF zdepartnish,

       fieldcatalog type slis_t_fieldcat_alv with header line,
       v_prog_name type sy-repid.

 select empno deptno deptname from zdepartnish into itab_sec where empno = itab-empno.

i am getting an error that work area cannot be used as an internal table with the above select statement can you please help me out with this.

Edited by: Thomas Zloch on Apr 6, 2010 2:43 PM - tags added

4 REPLIES 4
Read only

ThomasZloch
Active Contributor
0 Likes
998

What do you want to do? Read into a workarea? Use ... INTO wa_itab_sec ...

Read into an internal table? Use ... INTO TABLE itab_sec ...

Also study online help for SELECT statement which explains everything.

Thomas

Read only

Rocky1
Product and Topic Expert
Product and Topic Expert
0 Likes
997

Hi,

Either write

select empno deptno deptname from zdepartnish into table itab_sec where empno = wa_itab-empno.

or write

select empno deptno deptname from zdepartnish into wa_itab where empno = wa_itab-empno.

Thanks & Regards

Rocky

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
997

You are trying to use a table field in your WHERE clause w/o using FOR ALL ENTRIES.

Read only

Former Member
0 Likes
997

THE CORRECT CODE IS

SELECT EMPNO DEPTNO DEPTNAME FROM ZDEPARTNISH INTO TABLE ITAB_SEC WHERE EMPNO = WA_ITAB-EMPNO.

THE INCORRECT CODE IS :

SELECT EMPNO DEPTNO DEPTNAME FROM ZDEPARTNISH INTO ITAB_SEC WHERE EMPNO = WA_ITAB-EMPNO