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

problem with select statement

Former Member
0 Likes
863

hii frnds ,

when i am executingthis select statement theni am getint this sort of syntax error ,

The list "(T_AUFNR" after "INTO" is not of the form (f1, ...,fn), or contains an undefined field. excludes specification of a field list.

the select statement is

SELECT SINGLE

AUFNR

PRIOK

EQUNR

ILOAN

GEWRK

WARPL

LAUFN

INTO (T_AUFNR,T_PRIOK,T_EQUNR,T_ILOAN,T_GEWRK,T_WARPL,T_LAUFN)

FROM AFIH WHERE AUFNR = S_AUFNR .

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
819

Usually I would do it like this.



report zrich_0001.

data: begin of xafih,
      aufnr type afih-aufnr,
      priok type afih-priok,
      equnr type afih-equnr,
      iloan type afih-iloan,
      gewrk type afih-gewrk,
      warpl type afih-warpl,
      laufn type afih-laufn,
      end of xafih.

select-options: s_aufnr for xafih-aufnr.


select single aufnr priok equnr
              iloan gewrk warpl laufn
                 into xafih
                      from afih 
                          where aufnr = s_aufnr .

Regards

Rich Heilman

7 REPLIES 7
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
819

Make sure there are spaces after the comma.

SELECT SINGLE 
AUFNR
PRIOK
EQUNR
ILOAN
GEWRK
WARPL
LAUFN 
INTO (T_AUFNR, T_PRIOK, T_EQUNR, T_ILOAN, T_GEWRK, T_WARPL, T_LAUFN)
FROM AFIH WHERE AUFNR = S_AUFNR .

Regards,

RIch Heilman

Read only

Former Member
0 Likes
819

hii rich ,

its still notworking i am getting the same error now also ...

kindly provide some other solution ..

regards

rohit

Read only

0 Likes
819

Rohit,

Are you sure T_AUFNR, T_PRIOK, T_EQUNR, T_ILOAN, T_GEWRK, T_WARPL, T_LAUFN, are variables that you have declared explicitly.

To me it sounds like these are columns of a table. If that is the case then it should ITAB-AUFNR.

Either Make sure these are individual variables declared

Or replace with the names of the columns along with the workarea.

An easier way could be

DATA : WA_ORDER TYPE AFIH .

SELECT .... into corresponding fields of WA_ORDER ....

Regards,

Ravi

Note - Please mark all the helpful answers

Read only

0 Likes
819

well, this is syntaxically correct, it does have spaces after the comma and each field is defined. This isn't usually how I would do it, but it does work.



report zrich_0001.

data: t_aufnr type afih-aufnr,
      t_priok type afih-priok,
      t_equnr type afih-equnr,
      t_iloan type afih-iloan,
      t_gewrk type afih-gewrk,
      t_warpl type afih-warpl,
      t_laufn type afih-laufn.

select-options: s_aufnr for t_aufnr.


select single
aufnr
priok
equnr
iloan
gewrk
warpl
laufn
into (t_aufnr, t_priok, t_equnr, t_iloan, t_gewrk, t_warpl, t_laufn)
from afih where aufnr = s_aufnr .

Regards,

RIch Heilman

Read only

ferry_lianto
Active Contributor
0 Likes
819

Hi Rohit,

Please try this.


SELECT SINGLE 
AUFNR
PRIOK
EQUNR
ILOAN
GEWRK
WARPL
LAUFN 
INTO (AFIH-AUFNR, AFIH-PRIOK, AFIH-EQUNR, AFIH-ILOAN, AFIH-GEWRK, AFIH-WARPL, AFIH-LAUFN)
FROM AFIH WHERE AUFNR = S_AUFNR.

IF SY-SUBRC = 0
  T_AUFNR  = AFIH-AUFNR.
  T_PRIOK  = AFIH-PRIOK.
  T_EQUNR  = AFIH-EQUNR.
  T_ILOAN  = AFIH-ILOAN.
  T_GEWRK  = AFIH-GEWRK.
  T_WARPL  = AFIH-WARPL.
  T_LAUFN  = AFIH-LAUFN.
ENDIF.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
819

HII FRNDS THAN FOR HELP ITS WORKING NOW

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
820

Usually I would do it like this.



report zrich_0001.

data: begin of xafih,
      aufnr type afih-aufnr,
      priok type afih-priok,
      equnr type afih-equnr,
      iloan type afih-iloan,
      gewrk type afih-gewrk,
      warpl type afih-warpl,
      laufn type afih-laufn,
      end of xafih.

select-options: s_aufnr for xafih-aufnr.


select single aufnr priok equnr
              iloan gewrk warpl laufn
                 into xafih
                      from afih 
                          where aufnr = s_aufnr .

Regards

Rich Heilman