Application Development 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: 

run time error with select statement

Former Member
0 Kudos

BEGIN OF t_ve,

AUFNR type zownerpost-AUFNR,

zzpool type zownerpost-zzpool,

ZZOWNER type zownerpost-ZZOWNER,

zzvalid_fr type zownerpost-zzvalid_fr,

zzvalid_to type zownerpost-zzvalid_to,

starttot type p decimals 2,

endtot type p decimals 2,

variation type p decimals 2,

discrepancy(10) type c,

END OF t_ve.

data : i_ve1 type standard table of t_ve.

data : wa_i_ve1 type t_ve.

loop at itab_s into wa_itab_s.

SELECT zzpool zzvalid_fr AUFNR zzOWNER FROM zownerpost

INTO table i_ve1

FOR ALL ENTRIES IN Itab_s

WHERE

zzPOOL EQ Itab_s-ZZPOOL

AND zzVALID_FR EQ Itab_s-ZZVALID_FR.

endloop.

it got activated, but when i tried to execute it,

it was giving the following error:

The following reason caused a runtime error:

In a select access, the read file could not be placed in the target field.

But as the above code i do not see any discrepancy.

can some one help.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi ferry,

thanks for the reply,

but the error didnot change,

it still says the same error:

'in the select access the read file could not be placed in the target field provided.

Either the conversion is not supported for the type of target field,

the target field is too small to include the value '

8 REPLIES 8

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


BEGIN OF t_ve,
AUFNR type zownerpost-AUFNR,
zzpool type zownerpost-zzpool,
ZZOWNER type zownerpost-ZZOWNER,
zzvalid_fr type zownerpost-zzvalid_fr,
zzvalid_to type zownerpost-zzvalid_to,
starttot type p decimals 2,
endtot type p decimals 2,
variation type p decimals 2,
discrepancy(10) type c,
END OF t_ve.

data : i_ve1 type standard table of t_ve.
data : wa_i_ve1 type t_ve.

IF NOT Itab_s[] IS INITIAL.
  SELECT zzpool zzvalid_fr AUFNR zzOWNER 
  FROM zownerpost
  INTO table i_ve1
  FOR ALL ENTRIES IN Itab_s
  WHERE zzPOOL EQ Itab_s-ZZPOOL
    AND zzVALID_FR EQ Itab_s-ZZVALID_FR.
ENDIF.

Regards,

Ferry Lianto

Former Member
0 Kudos

hi ferry,

thanks for the reply,

but the error didnot change,

it still says the same error:

'in the select access the read file could not be placed in the target field provided.

Either the conversion is not supported for the type of target field,

the target field is too small to include the value '

0 Kudos

Hi Saritha ,

Could you please try like this ?


  SELECT AUFNR zzpool zzowner zzvalid_fr zzvalid_to
  FROM zownerpost
  INTO  table i_ve1
  FOR ALL ENTRIES IN Itab_s
  WHERE zzPOOL EQ Itab_s-ZZPOOL
    AND zzVALID_FR EQ Itab_s-ZZVALID_FR.

Hope this helps

Regards

Caglar

0 Kudos

Change the SELECT to

SELECT zzpool zzvalid_fr AUFNR zzOWNER 
  FROM zownerpost
  INTO corresponding fields of table i_ve1
  FOR ALL ENTRIES IN Itab_s
  WHERE zzPOOL EQ Itab_s-ZZPOOL
    AND zzVALID_FR EQ Itab_s-ZZVALID_FR.

~Suresh

Former Member
0 Kudos

Hi Saritha change the query as

loop at itab_s into wa_itab_s.

SELECT zzpool zzvalid_fr AUFNR zzOWNER FROM zownerpost

INTO <b>CORRESPONDING FIELDS OF</b> table i_ve1

FOR ALL ENTRIES IN Itab_s

WHERE

zzPOOL EQ Itab_s-ZZPOOL

AND zzVALID_FR EQ Itab_s-ZZVALID_FR.

endloop.

Reward points if useful.

Regards,

Atish

Former Member
0 Kudos

Sarita,

A couple of errors in your approach. You are looping at itab_s yet you are using FOR ALL ENTRIES in your SELECT statement which is unnecessary. You either use the LOOP or the FOR ALL ENTRIES.

You are selecting the fields ZZPOOL ZZVALID_FR AUFNR ZZOWNER from the ZOWNERPOST table but you are moving them INTO TABLE i_ve1 which has the fields in different order. You cannot use INTO when the target fields are not of same type. Instead use INTO CORRESPONDING FIELDS OF TABLE or change the order you fields of the itab to match your SELECT statement.

If you are using LOOP instead of FOR ALL ENTRIES remember that your INTO TABLE will replace the contents of I_VE1 in every pass of the LOOP. In such cases you will have to use APPENDING TABLE or APPENDING CORRESPONDING FIELDS OF option.

Once you make these changes, the error should go away.

Former Member
0 Kudos

Hello Saritha,

either you arrange internal table properly ( I mean when you select the data what ever order is in internal table ,use same order in select query ) or into corresponding fields option.

Note : Into corresponding fields option is performance issue ,so use internal table order always.

Former Member
0 Kudos

HI saritha

Better to use the same field order in internal table as well as select statement.

Instead of using select in Loop, try to use for all entries. Because performance is faster in For all entries.

Regadrs

Ravi