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

Select-options

Former Member
0 Likes
600

hi all,

i write this logic but i get syntax error see my code

select-options carrid for spfli-carrid.

data itab type table of spfli.

select *

from spfli into table spfli where carrid in carrid.

if sy-subrc ne 0.

write / 'no records'.

endif.

plzz help what is the worng in my code it's urgent.

thanks

swapna rani

5 REPLIES 5
Read only

Former Member
0 Likes
552

Hi Swapna,

I think you didn't write tables before select-options see this.

tables spfli.

select-options s_carrid for spfli-carrid.

data itab type table of spfli.

select *

from spfli into table spfli where carrid in s_carrid.

if sy-subrc ne 0.

write / 'no records'.

endif.

Plzz Reward if it is useful,

Mahi.

Read only

Former Member
0 Likes
552

rani!!

first al data declarations at on place and that too on top.

next take it like this.

Data: d_carrid like splfi-carrid.

select-options carrid for d_carrid.

you wont get any more syntax errors.

Regards

Read only

Former Member
0 Likes
552

Hi Swapna,

you've declared the table as ITAB, but you r trying top store in spfli which has no existence in the program.

select *

from spfli into table ITAB where carrid in carrid.

Moreover TABLES statement is not a mandatory one. it just creates a work area in the same name of the tablename.

Reward if useful

Regards

ANUPAM

Read only

Former Member
0 Likes
552

Hi,

I think you have used 'into table spfli' instead of using 'into table itab', and that is the cause of error. Please try the code given below:

TABLES: spfli.

DATA itab TYPE TABLE OF spfli.

SELECT-OPTIONS carrid FOR spfli-carrid.

START-OF-SELECTION.

SELECT *

FROM spfli

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE carrid IN carrid.

IF sy-subrc NE 0.

WRITE / 'no records'.

ENDIF.

Please reward points if it works.

Regards,

Renjith Michael.

Read only

abdul_hakim
Active Contributor
0 Likes
552

tables spfli.

select-options carrid for spfli-carrid.

data itab like table of spfli.

select *

from spfli into table itab where carrid in carrid.

if sy-subrc ne 0.

write / 'no records'.

endif.

Cheers,

Hakim

Mark all useful answerss

Edited by: Abdul Hakim on Dec 31, 2007 3:35 AM