cancel
Showing results for 
Search instead for 
Did you mean: 

Hi

Former Member
0 Kudos
59

Hi,

Why Iam getting the error that TABLE is Unknown in this program.

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 SINGLE * FROM VBAP INTO table IT_VBAP WHERE VBELN EQ</b> VBAK-VBELN.

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,


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.
SELECT *  FROM VBAP INTO table IT_VBAP WHERE VBELN EQ VBAK-VBELN. "Cannot use SINGLE and INTO TABLE together.

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT 

Regards,

Sesh

Answers (12)

Answers (12)

Former Member
0 Kudos

hi rams,

see this...

TABLES: VBAK,VBAP.

DATA: IT_VBAP TYPE TABLE OF VBAP.

*DATA: IT_VBAP TYPE STANDARD TABLE OF VBAP WITH HEADER LINE.

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE.

SELECT * FROM VBAP INTO corresponding fields of table IT_VBAP WHERE VBELN EQ VBAK-VBELN.

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

Plz Reward points if contents are useful....

Regards,

Mandeep.

Former Member
0 Kudos

hi,

try this

tables : vbak.

data : itab_vbak like vbak occurs 0 with header line.

select single * from vbak into corresponding fields of itab_vbak

where detid = zdepartment-detid.

Reward with points if useful.

gopi_narendra
Active Contributor
0 Kudos

Hi Rams,

Other than <b>select *</b> few corrections in your code if you dont mind.

1. Always use the Exit Command in a seperate module. It should be the first module in the PAI of the screen.

2. While defining the PF-Status for the screen make sure you use the command type as E instead of ' ' (Space).

3. Its not suggested to write a select query in the USER_COMMAND. Write it in the PAI modules (other than User Command).

4. Its not even suggested to raise an error msg in USER_COMMAND, which means you can not use Chain Endchain in USER_COMMAND.


process after input.

  module EXIT_COMMAND_0100 at exit-command.

  " MODULE in the main program.
*&---------------------------------------------------------------------*
*&      Module  EXIT-COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module EXIT_COMMAND_0100 input.

  case SY-UCOMM.
    when 'BACK'
      or 'CANC'
      or 'EXIT'.
      leave program.
  endcase.

endmodule.                 " EXIT_COMMAND_0100  INPUT

Regards

Gopi

Former Member
0 Kudos

TABLES:

VBAK,VBAP.

DATA:IT_VBAP TYPE standard TABLE OF VBAP with header line.

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE. " select" not used space

select single onto corresponding fileds of table IT_VBAP WHERE VBELN EQ VBAK-vbeln

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

Former Member
0 Kudos

Hi,

even AFTER CHANGING THIS i am getting this error.You cannot use an internal table as a work area. What is the difference between using Sinle * and Just *.

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

Ram

Former Member
0 Kudos

Hi,

make the changes based on your requirement..

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 table IT_VBAP WHERE VBELN EQ VBAK-VBELN.</b>

*or

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

*append it_vbap.

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

All the best !!

Regards

Aparna

Former Member
0 Kudos

Hi,

It will not work with select single because If SINGLE is specified, the resulting set has a single line. If the remaining additions to the SELECT command select more than one line from the database, the first line that is found is entered into the resulting set. The data objects specified after INTO may not be internal tables, and the APPENDING addition may not be used.

Try like this :

TABLES:

VBAK,

VBAP.

DATA:

IT_VBAP TYPE TABLE OF VBAP with header line.

&----


*& Module USER_COMMAND_9001 INPUT

&----


  • text

----


MODULE USER_COMMAND_9001 INPUT.

CASE SY-UCOMM.

WHEN 'EXIT'.

LEAVE PROGRAM.

WHEN SPACE.

SELECT * FROM VBAP INTO table IT_VBAP

WHERE VBELN

EQ VBAK-VBELN.

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

Regards,

Himanshu

Message was edited by:

Himanshu Verma

Former Member
0 Kudos

hi,

tables:VBAK,VBAP.

<b>DATA:IT_VBAP like 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.

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

ENDCASE.

ENDMODULE. " USER_COMMAND_9001 INPUT

<b>REWARDS POINT</b>

Vijay
Active Contributor
0 Kudos

hi

SELECT SINGLE * FROM VBAP INTO corresponding fields of table IT_VBAP WHERE VBELN EQ VBAK-VBELN.

regards

vijay

<b>reward if use4ful</b>

Former Member
0 Kudos

Hi

declare the internal tables as

DATA: IT_VBAP TYPE STANDARD TABLE OF VBAP <b>WITH HEADER LINE</b>.

and see

<b>Reward points for useful Answers</b>

Regards

Anji

Former Member
0 Kudos

Hi,

you can't use select SINGLE with INTO.

Regards

Nicole

Former Member
0 Kudos

Hi

Use this

SELECT * FROM VBAP INTO corresponding fields of table IT_VBAP WHERE VBELN EQ VBAK-VBELN.

Regards

Ravish Garg