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 query run time exception.

Former Member
0 Likes
654

TYPES : BEGIN OF it_bsis,

BELNR type BELNR_D,

BUDAT type BUDAT,

BLDAT type BLDAT,

XBLNR type XBLNR1,

END OF it_bsis.

select BLDAT BELNR into table it_bsis1 from bsis.

When I execute the select statement I get a runtime exception. Do you see anything wrong with this sql query.

Thanks!

Surya.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
633

HI,

How u have declared ur internal table it_bsis1.?

See this sample code....

TYPES : BEGIN OF ty_bsis,

BELNR type BELNR_D,

BUDAT type BUDAT,

BLDAT type BLDAT,

XBLNR type XBLNR1,

END OF ty_bsis.

data : itab type table of ty_bsis,

fs type ty_bsis.

select BELNR BLDAT from bsis into corresponding fields of table itab.

It will work...

<REMOVED BY MODERATOR>

Regards,

Shanthi.

Edited by: Shanthi on Mar 5, 2008 2:59 PM

Edited by: Alvaro Tejada Galindo on Mar 5, 2008 6:18 PM

5 REPLIES 5
Read only

Former Member
0 Likes
634

HI,

How u have declared ur internal table it_bsis1.?

See this sample code....

TYPES : BEGIN OF ty_bsis,

BELNR type BELNR_D,

BUDAT type BUDAT,

BLDAT type BLDAT,

XBLNR type XBLNR1,

END OF ty_bsis.

data : itab type table of ty_bsis,

fs type ty_bsis.

select BELNR BLDAT from bsis into corresponding fields of table itab.

It will work...

<REMOVED BY MODERATOR>

Regards,

Shanthi.

Edited by: Shanthi on Mar 5, 2008 2:59 PM

Edited by: Alvaro Tejada Galindo on Mar 5, 2008 6:18 PM

Read only

former_member386202
Active Contributor
0 Likes
633

Hi,

do like this

select BLDAT BELNR into corresponding fields of table it_bsis1 from bsis.

becoz ur declaring 4 fields in internla table and selecting only 2 thats why getting error.

Regards,

Prashant

Read only

Former Member
0 Likes
633

HI,

YOU SHOULD FETCH THE FEILDS IN THE DEFINED ORDER WHILE USING SELECT QUERY...


TYPES : BEGIN OF IT_BSIS,
BELNR TYPE BELNR_D,
BUDAT TYPE BUDAT,
BLDAT TYPE BLDAT,
XBLNR TYPE XBLNR1,
END OF IT_BSIS.

DATA:INT_BSIS TYPE STANDARD TABLE OF IT_BSIS,
     WA_BSIS TYPE IT_BSIS.

SELECT BELNR BUDAT BLDAT XBLNR INTO TABLE INT_BSIS FROM BSIS.

<REMOVED BY MODERATOR>

Edited by: Alvaro Tejada Galindo on Mar 5, 2008 6:19 PM

Read only

Former Member
0 Likes
633

Hi

U can write like this:

TYPES : BEGIN OF it_bsis,

BELNR type BELNR_D,

BUDAT type BUDAT,

BLDAT type BLDAT,

XBLNR type XBLNR1,

END OF it_bsis.

data:it_bsis1 type table of it_bsis with header line.

select BLDAT BELNR into corresponding fields of table it_bsis1 from bsis.

In this use into corresponding fileds instead of into table.BSIS table have 77 fields.But u need to retrive 2 fields . In this case into correspondig fields of keyword is suitable one.

<REMOVED BY MODERATOR>

Regards

Pratap.M

Edited by: Alvaro Tejada Galindo on Mar 5, 2008 6:19 PM

Read only

RaymondGiuseppi
Active Contributor
0 Likes
633

You have defined a type, you have to create an internal table before selecting data. Then select the fields in the exact order of appearance in the internal table, or use a INTO CORRESPONDING FIELDS OF.

TYPES : BEGIN OF it_bsis,
  belnr TYPE belnr_d,
  budat TYPE budat,
  bldat TYPE bldat,
  xblnr TYPE xblnr,
END OF it_bsis.

DATA it_bsis1 TYPE TABLE OF it_bsis.

SELECT belnr budat bldat xblnr INTO TABLE it_bsis1 FROM bsis
  UP TO 100 ROWS.

Regards