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 - ENDSELECT statment error

Former Member
0 Likes
3,192

Hi Friends,

I got the following statement in my pgm .

I get a short dump at the following select statemenet . Please advise what is wrong .

SELECT erdat uzeit FROM ztable

INTO (w_date,w_time)

WHERE tknum = vttk-tknum

AND zindicator <> vttk-tplst.

ENDSELECT.

It does not allow me to use without endselect and when I use it I get a short dump .

In the ztable there may be more than 1 record but I need the one where zindicator <> vttk-tplst.

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
2,085

Hi,

Please try this.


SELECT SINGLE erdat uzeit 
FROM ztable
INTO (w_date, w_time)
WHERE tknum = vttk-tknum
AND zindicator <> vttk-tplst.

Regards,

Ferry Lianto

15 REPLIES 15
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,085

What does the dump say? You should try this. Use SINGLE and remove the ENDSELECT



SELECT SINGLE erdat uzeit
      FROM ztable
         INTO (w_date, w_time)
                   WHERE tknum   =   vttk-tknum
                       AND zindicator <> vttk-tplst.



Regards,

Rich Heilman

Read only

0 Likes
2,085

Hi Rich ,

It still give me the same short dump . I dont understand what could be wrong with the SELECT statement .

Thanks,

Hari

This is what i have in my code .

SELECT single erdat uzeit

FROM ztable

INTO (w_date, w_time)

WHERE tknum = vttk-tknum

AND zindicator <> vttk-tplst.

Read only

0 Likes
2,085

hi Hari,

Try it out in this way then

SELECT erdat uzeit up to 1 rows FROM ztable
INTO (w_date,w_time)
WHERE tknum = vttk-tknum
AND zindicator <> vttk-tplst.
ENDSELECT.

Read only

0 Likes
2,085

What does the short dump say?

REgards,

RIch Heilman

Read only

0 Likes
2,085

hi ,

May be zindicator and vttk-tplst are of not the same type and length. So to correct it use same type in where condition.

Regards,

Santosh

Read only

0 Likes
2,085

What is data type for w_date, w_time ?

Try to read Short Dump ,it will give breif message

Thanks

Seshu

Read only

0 Likes
2,085

Make sure that w_ fields are defined in this way.

data: w_date type sy-datum.
data: w_time type sy-uzeit.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
2,085

use select single statement

SELECT single erdat uzeit FROM ztable
INTO (w_date,w_time)
WHERE tknum = vttk-tknum
AND zindicator <> vttk-tplst.

Read only

ferry_lianto
Active Contributor
0 Likes
2,086

Hi,

Please try this.


SELECT SINGLE erdat uzeit 
FROM ztable
INTO (w_date, w_time)
WHERE tknum = vttk-tknum
AND zindicator <> vttk-tplst.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
2,085

HI,

U can use up to 1 rows..

SELECT erdat uzeit up to 1 rows FROM ztable

INTO (w_date,w_time)

WHERE tknum = vttk-tknum

AND zindicator <> vttk-tplst.

ENDSELECT.

cheers'

Mahesh

Read only

0 Likes
2,085

Error Analysis

Since the caller of the procedure could not have expected this exception

to occur, the running program was terminated.

The reason for the exception is:

The data read during a SELECT access could not be inserted into the

target field.

Either conversion is not supported for the target field's type or the

target field is too short to accept the value or the data are not in a

form that the target field can accept

Read only

0 Likes
2,085

HI Hari,

Check the data type of w_date, w_time they should be same as the erdat uzeit fields in the ztable.

Thanks

mahesh

Read only

0 Likes
2,085

Try like :

SELECT erdat uzeit up to 1 rows FROM ztable

INTO (<b>ztable-erdat,ztable-uzeit</b>)

WHERE tknum = vttk-tknum

AND zindicator <> vttk-tplst.

ENDSELECT.

Thanks

Seshu

Read only

ferry_lianto
Active Contributor
0 Likes
2,085

Hi,

How do you declare w_date, w_time?


data: w_date type ztable-erdat,
      w_time type ztable-uzeit.

Can you paste the whole coding?

Regards,

Ferry Lianto

Read only

marcelo_ramos1
SAP Mentor
SAP Mentor
0 Likes
2,085

Hi,

Look at this code, its similar to yours.

DATA: erdat TYPE erzet, "<b>Correct type -><u>erdat</u></b>

erzet TYPE erzet.

START-OF-SELECTION.

SELECT single erdat erzet

FROM vbak

INTO (erdat, erzet)

WHERE vbeln = '0000000004'.

This generated the same dump as below.

<b>The data read during a SELECT access could not be inserted into the

target field.

Either conversion is not supported for the target field's type or the

target field is too short to accept the value or the data are not in a

form that the target field can accept </b>

You already know what to do ? No ? Ok !

<b>- Check the fields's types of the internal tables !</b>

<u>This error occurs whenever a type conflict occurs, that is, the field's type of the BD table is different of the type declared in the internal table</u>

The correct code is:

DATA: erdat TYPE erdat,

erzet TYPE erzet.

I hope that my tip be useful for you !

Regards .

Marcelo Ramos