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: 

SELECT OPTIONS use in select statement

Former Member
0 Kudos
14,246

hi,

I have defined my selection screen in the main program.

selection-screen begin of screen 0101 as subscreen.

selection-screen begin of block b1.

select-options: S_KUNNR for KNA1-KUNNR,

selection-screen end of block b1.

selection-screen end of screen 0101.

then in an include in the same module pool, i try to use this in select statement

SELECT * INTO CORRESPONDING FIELDS OF XXX FROM ZPPP WHERE KUNNR IN S_KUNNR.

I get an error saying " the IN operator with S_KUNNR is neither followed by an internal table nor by a valuelist "..what does this mean ?

thks

1 ACCEPTED SOLUTION

Former Member
0 Kudos
3,770

HI ,

you are getting this message because you are writing the select statement before you defined the selection screen.

all you need to do is place the include after the selection screen definition.

for ex: see this code when you execute this code you will get the same message

Tables: kna1.

data: i_tab like kna1 occurs 0 with header line.

SELECT * INTO CORRESPONDING FIELDS OF TABLE I_TAB FROM kna1 WHERE KUNNR IN S_KUNNR.

selection-screen begin of screen 0101 as subscreen.

selection-screen begin of block b1.

select-options: S_KUNNR for kna1-KUNNR.

selection-screen end of block b1.

selection-screen end of screen 0101.

so replace the code with

Tables: kna1.

data: i_tab like kna1 occurs 0 with header line.

selection-screen begin of screen 0101 as subscreen.

selection-screen begin of block b1.

select-options: S_KUNNR for kna1-KUNNR.

selection-screen end of block b1.

selection-screen end of screen 0101.

SELECT * INTO CORRESPONDING FIELDS OF TABLE I_TAB FROM kna1 WHERE KUNNR IN S_KUNNR.

then it will work..

Regards,

Kiran

Edited by: Kiran Kumar kanda on Jul 28, 2008 9:50 PM

9 REPLIES 9

Former Member
0 Kudos
3,770

Corrected code

SELECT *
  INTO CORRESPONDING FIELDS OF TABLE  XXXX
 FROM ZPPP 
WHERE KUNNR IN S_KUNNR.

Table missing

Former Member
0 Kudos
3,770

SELECT * FROM ZPPP

INTO CORRESPONDING FIELDS OF it_zpp

WHERE KUNNR IN S_KUNNR.

Former Member
0 Kudos
3,770

it works for me:

report zamit_0001.
TABLES:kna1.
selection-screen begin of screen 0101 as subscreen.
selection-screen begin of block b1.
select-options: S_KUNNR for KNA1-KUNNR.
selection-screen end of block b1.
selection-screen end of screen 0101.
START-OF-SELECTION.
data:BEGIN OF itab OCCURS 0,
  kunnr type KUNNR,
  END OF itab.
  
SELECT * INTO CORRESPONDING FIELDS OF TABLE itab FROM kna1 WHERE KUNNR IN S_KUNNR.

Amit.

Former Member
0 Kudos
3,770

You have missed table in the statement

INTO CORRESPONDING FIELDS OF TABLE XXXX

and also try to give this..

SELECT *

INTO CORRESPONDING FIELDS OF TABLE XXXX

FROM ZPPP

WHERE KUNNR IN S_KUNNR[].

0 Kudos
3,770

I tried all ur suggestions, still not resolved.. Please check..

Tables: ZXXX.

selection-screen begin of screen 0101 as subscreen.

selection-screen begin of block b1.

select-options: S_KUNNR for ZXXX-KUNNR,

selection-screen end of block b1.

selection-screen end of screen 0101.

SELECT * INTO CORRESPONDING FIELDS OF TABLE I_TAB FROM ZXXX WHERE KUNNR IN S_KUNNR.

Vijay I also tried S_KUNNR[] but it was not accepted !!

I am lost !!

Former Member
0 Kudos
3,770

Check the sample code...

REPORT  ztest_mod.

DATA: kunnr TYPE kunnr.

* Custom Selection Screen 0200
SELECTION-SCREEN BEGIN OF SCREEN 0200 AS SUBSCREEN.
SELECT-OPTIONS: s_kunnr FOR  kunnr.
SELECTION-SCREEN END OF SCREEN 0200.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_kunnr-low.
  BREAK-POINT.

START-OF-SELECTION.
  "in this screen i have a button with function code 'SEARCH'
" and a subscreen area with name sub
  CALL SCREEN 100.

*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS'.
ENDMODULE.                    "status_0100 OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
  DATA: it_kunnr TYPE TABLE OF kna1.
  CASE sy-ucomm.
    WHEN 'SEARCH'.
      SELECT * FROM kna1
      INTO TABLE it_kunnr
      WHERE kunnr IN s_kunnr.
    WHEN 'BACK'.
      LEAVE TO SCREEN 0.
  ENDCASE.
ENDMODULE.                    "user_command_0100 INPUT

in the flow logic..

PROCESS BEFORE OUTPUT.
*
  MODULE status_0100.
*
  CALL SUBSCREEN sub INCLUDING sy-repid '0200'.
*
PROCESS AFTER INPUT.
*
  MODULE user_command_0100.

Regards

Vijay Babu Dudla

Former Member
0 Kudos
3,770

hi check this example..

Parameters: p_name like sy-uname,

p_pas like sy-uname lower case.

SELECTION-SCREEN skip 1.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 2(70) text-001.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF SCREEN 500.

title = 'HAI VENKAT LOGIN PLEASE'.

CALL SELECTION-SCREEN '0500' STARTING AT 10 10 ending at 70 14.

data: begin of it_user occurs 0,

name like sy-uname,

password like sy-uname,

end of it_user.

it_user-name = 'venkat'.

it_user-password = 'venkat'.

append it_user.

AT SELECTION-SCREEN OUTPUT.

loop at screen.

check screen-name eq 'P_PAS'.

move: 1 to screen-invisible.

modify screen.

endloop.

start-of-selection.

if p_pas = 'venkat'.

write:/ 'this is working'.

endif.

Former Member
0 Kudos
3,771

HI ,

you are getting this message because you are writing the select statement before you defined the selection screen.

all you need to do is place the include after the selection screen definition.

for ex: see this code when you execute this code you will get the same message

Tables: kna1.

data: i_tab like kna1 occurs 0 with header line.

SELECT * INTO CORRESPONDING FIELDS OF TABLE I_TAB FROM kna1 WHERE KUNNR IN S_KUNNR.

selection-screen begin of screen 0101 as subscreen.

selection-screen begin of block b1.

select-options: S_KUNNR for kna1-KUNNR.

selection-screen end of block b1.

selection-screen end of screen 0101.

so replace the code with

Tables: kna1.

data: i_tab like kna1 occurs 0 with header line.

selection-screen begin of screen 0101 as subscreen.

selection-screen begin of block b1.

select-options: S_KUNNR for kna1-KUNNR.

selection-screen end of block b1.

selection-screen end of screen 0101.

SELECT * INTO CORRESPONDING FIELDS OF TABLE I_TAB FROM kna1 WHERE KUNNR IN S_KUNNR.

then it will work..

Regards,

Kiran

Edited by: Kiran Kumar kanda on Jul 28, 2008 9:50 PM

0 Kudos
3,770

yes Kiran, u were absolutely right !! I moved the Include containing my modules(select) after the selection screen definition statements and it worked.. thanks a ton