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

Hi

Former Member
0 Likes
1,171

Hi,

I am getting the error that u cannot use Internal table as a work area. Plz tell why it is getting like that.

&----


*& Module Pool ZMP_TAB3

*&

&----


*&

*&

&----


PROGRAM ZMP_TAB3.

TABLES:

VBAK,

VBAP.

DATA:

IT_VBAP TYPE TABLE OF VBAP.

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE.

<b>SELECT * FROM VBAP INTO IT_VBAP WHERE VBELN EQ VBAK-VBELN.</b>

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,084

Hi Ram,

Check the code in bold.

&----


*& Module Pool ZMP_TAB3

*&

&----


*&

*&

&----


PROGRAM ZMP_TAB3.

TABLES:

VBAK,

VBAP.

DATA:

<b>IT_VBAP TYPE TABLE OF VBAP OCCURS 0 WITH HEADER LINE.</b>

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE.

SELECT * FROM VBAP <b>INTO TABLE IT_VBAP</b> WHERE VBELN EQ VBAK-VBELN.

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

Thanks,

Vinay

Hi,

I am getting the error that u cannot use Internal table as a work area. Plz tell why it is getting like that.

&----


*& Module Pool ZMP_TAB3

*&

&----


*&

*&

&----


PROGRAM ZMP_TAB3.

TABLES:

VBAK,

VBAP.

DATA:

IT_VBAP TYPE TABLE OF VBAP.

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE.

<b>SELECT * FROM VBAP INTO IT_VBAP WHERE VBELN EQ VBAK-VBELN.</b>

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

9 REPLIES 9
Read only

Former Member
0 Likes
1,084

Hi,

PROGRAM ZMP_TAB3.

TABLES:

VBAK,

VBAP.

DATA:

IT_VBAP like VBAP.

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE.

SELECT * FROM VBAP INTO IT_VBAP WHERE VBELN EQ VBAK-VBELN.

endselect.

endcase.endmodule.

regards

Nicole

Read only

Former Member
0 Likes
1,085

Hi Ram,

Check the code in bold.

&----


*& Module Pool ZMP_TAB3

*&

&----


*&

*&

&----


PROGRAM ZMP_TAB3.

TABLES:

VBAK,

VBAP.

DATA:

<b>IT_VBAP TYPE TABLE OF VBAP OCCURS 0 WITH HEADER LINE.</b>

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE.

SELECT * FROM VBAP <b>INTO TABLE IT_VBAP</b> WHERE VBELN EQ VBAK-VBELN.

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

Thanks,

Vinay

Read only

Former Member
0 Likes
1,084

Hi Ram

When you declare table with Tables statement it just provides work area and you cant use that directly for declaring internal table, better to declare with types statement and use it

Regards

sandhya

Read only

Former Member
0 Likes
1,084

hi,

Use either way ..

SELECT * FROM VBAP INTO <b>TABLE</b> IT_VBAP WHERE VBELN EQ VBAK-VBELN.

OR

SELECT * FROM VBAP INTO  IT_VBAP WHERE VBELN EQ VBAK-VBELN.
APPEND  IT_VBAP
CLEAR  IT_VBAP.
ENDSELECT.

Read only

Former Member
0 Likes
1,084

Change select stmt like

SELECT * FROM VBAP INTO <b>TABLE</b> IT_VBAP WHERE VBELN EQ VBAK-VBELN.

Read only

gopi_narendra
Active Contributor
0 Likes
1,084

The reason for the error is the table KEYWORD .

Please see few more corrections in my reply to your other thread


SELECT * FROM VBAP 
         INTO table IT_VBAP " table keyword
         WHERE VBELN EQ VBAK-VBELN.

Regards

Gopi

Read only

Former Member
0 Likes
1,084

hi,

TABLES:

VBAK,

VBAP.

DATA:

<b>IT_VBAP like VBAP.</b>

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE.

SELECT * FROM VBAP INTO IT_VBAP WHERE VBELN EQ VBAK-VBELN.

<b>endselect.</b>

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

REWARDS POINT

Read only

former_member189059
Active Contributor
0 Likes
1,084

You have 2 options

1. use

SELECT * FROM VBAP INTO <b>TABLE</b> IT_VBAP WHERE VBELN EQ VBAK-VBELN.

2. declare a work area of the same type and use the code you used before specifying the work area

then append that work area to the table and end it with the ENDSELECT statement

Read only

Former Member
0 Likes
1,084

hi,

Table of creates only work area for u so change that internal table declaration as

Data: it_vbap like standard table of vbap.

try it now.

SELECT * FROM VBAP INTO IT_VBAP WHERE VBELN EQ VBAK-VBELN.

if helpful reward some points.

with regards,

Suresh Aluri.