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 statement error.

Former Member
0 Likes
891

Hi all,

I have a select statement which will join 4 tables as shown below. Something is not working right in the select statement and caused the shortdump.

I really cannot figure out where is not right.

Please help.


TYPES:   
  BEGIN OF t_lips,
    matnr TYPE matnr,
    lfimg TYPE lfimg,
    meins TYPE meins,
    vbeln TYPE vbeln_vl,
    lfart TYPE lfart,
    vstel TYPE vstel,
    maktx TYPE maktx,
    werks TYPE werks_d,
    exnum TYPE exnum,
    posnr TYPE posnr_vl,
    uecha TYPE uecha,
    netwr TYPE netwr,
    waerk TYPE waerk,
    vgbel TYPE vgbel,
  END OF t_lips.

DATA: lt_lips      TYPE TABLE OF t_lips.
    
SELECT lips~matnr lfimg lips~vrkme lips~vbeln lfart
    vbap~vstel lips~arktx lips~werks exnum
    vbap~netwr vbap~waerk lips~vgbel
    lips~posnr lips~uecha
  INTO TABLE lt_lips
  FROM lips INNER JOIN vttp
    ON    vttp~vbeln = lips~vbeln
    INNER JOIN likp
    ON    lips~vbeln = likp~vbeln
    INNER JOIN VBAP
    ON lips~vgbel = vbap~vbeln
  WHERE vttp~tknum = ps_vttk-tknum
    AND   lfimg      <> 0.

Error analysis                                                                                
An exception occurred that is explained in detail below.                                      
    The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught                 
     in                                                                                
procedure "GET_DATA" "(FORM)", nor was it propagated by a RAISING clause.                     
    Since the caller of the procedure could not have anticipated that the                         
    exception would occur, the current program is terminated.                                     
    The reason for the exception is:                                                              
    In a SELECT access, the read file could not be placed in the target                           
    field provided.                                                                                
Either the conversion is not supported for the type of the target field,                      
    the target field is too small to include the value, or the data does not                      
    have the format required for the target field.                                                

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
837

Hi,

In the below code, where are you picking up value for LFIMG and LFART. Give the alias/table name for them also.

for ex. lips~lfimg....

SELECT lips~matnr lfimg lips~vrkme lips~vbeln lfart
    vbap~vstel lips~arktx lips~werks exnum
    vbap~netwr vbap~waerk lips~vgbel
    lips~posnr lips~uecha
  INTO TABLE lt_lips
  FROM lips INNER JOIN vttp
    ON    vttp~vbeln = lips~vbeln
    INNER JOIN likp
    ON    lips~vbeln = likp~vbeln
    INNER JOIN VBAP
    ON lips~vgbel = vbap~vbeln
  WHERE vttp~tknum = ps_vttk-tknum
    AND   lfimg       0.

Hope this is useful.

Also selection of records should be same as declared in table lt_lips otherwise use 'INTO CORRESPONDING TABLE LT_LIPS'

Regards,

Saba

Edited by: Saba Sayed on Oct 24, 2008 9:30 AM

6 REPLIES 6
Read only

Former Member
0 Likes
837

its because, u have to arrange the fields in the same order as in the database in ty_lips.

then try it.

regards,

padma

Read only

Former Member
0 Likes
837

Hi,

The target table does is not in the same order as the fields you are selecting, either use into corresponding fields of table or ensure they are in the same order.

Darren

Read only

Former Member
0 Likes
837

hi

select ..... into corresponding fields of table itab....

Edited by: Anil Kalive on Oct 24, 2008 12:57 PM

Read only

Former Member
0 Likes
837

HI myahsam wong,

This error states that, once the SELECT statement is executed, the retreived field is not matching the order of the internal table that you have declared.

You need to check the order for the fields in the internal table and that of your select query. They both need to be same.

I feel the third or fourth field is mismatching....Check it out.

Best Regards,

Ram.

Read only

Former Member
0 Likes
838

Hi,

In the below code, where are you picking up value for LFIMG and LFART. Give the alias/table name for them also.

for ex. lips~lfimg....

SELECT lips~matnr lfimg lips~vrkme lips~vbeln lfart
    vbap~vstel lips~arktx lips~werks exnum
    vbap~netwr vbap~waerk lips~vgbel
    lips~posnr lips~uecha
  INTO TABLE lt_lips
  FROM lips INNER JOIN vttp
    ON    vttp~vbeln = lips~vbeln
    INNER JOIN likp
    ON    lips~vbeln = likp~vbeln
    INNER JOIN VBAP
    ON lips~vgbel = vbap~vbeln
  WHERE vttp~tknum = ps_vttk-tknum
    AND   lfimg       0.

Hope this is useful.

Also selection of records should be same as declared in table lt_lips otherwise use 'INTO CORRESPONDING TABLE LT_LIPS'

Regards,

Saba

Edited by: Saba Sayed on Oct 24, 2008 9:30 AM

Read only

Former Member
0 Likes
837

Hi,

Just make sure that the order of fields in the select statement do match with the order of fields in your internal table.As it can be seen the order do not match, that is the reason why you are receiving a short dump.

Another way would be to use the 'into corresponding fields of table' clause instead of just the 'into table' clause. This will automatically match the names from your select list and place them into the matching fields of your internal table.

I hope this helps.

Thanks

Sachin