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

Getting Dump from a select query

Former Member
0 Likes
1,898

Dear All,

Am selecting records from KEKO and storing into E1KEKO internal table. But am getting dump error. I need to send those E1KEKO records as idoc. Kindly help me out how to fix this dump.


  SELECT * INTO CORRESPONDING FIELDS OF e1keko
    FROM keko
    WHERE keko~matnr = p_matnr
      AND keko~werks = p_werks
      AND keko~bwtar = 'Z06'
      AND keko~bwvar = 'Z06'.
    CLEAR t_idoc_data.
    t_idoc_data-segnam = c_segnam_e1keko.
    t_idoc_data-mandt = sy-mandt.
    t_idoc_data-sdata  = e1keko.
    APPEND t_idoc_data.
    CLEAR e1keph.
endselect

Thanks in advance.

Anandhan

17 REPLIES 17
Read only

Former Member
0 Likes
1,856

what kind of dump are you getting?

Your select doesnt look too bad so we need more information for a proper analysis.

regards

Read only

0 Likes
1,856

Hi,

If i use the below select query in a test program, that time also am getting the same dump.


DATA: e1keph TYPE e1keph,
      e1keko TYPE e1keko.

   SELECT * INTO CORRESPONDING FIELDS OF e1keko
    FROM keko
    WHERE keko~matnr = '000000000010801071'.
  endselect.
(code}

The dump showing the below message 


  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 no
  have the format required for the target field.

Thanks in advance

Anandhan

Read only

0 Likes
1,856

All fields on an IDoc are of type C. You cannot select fields from a database table and expect them to be put into type C fields. You should select into a structure of type KEKO then do a move-corresponding.

Read only

Former Member
0 Likes
1,856

Anadan,

Check the declaration of the data types you are passing in the where condition. In the declaration I have notices

Make shire you have declared p_werks as type WERKS_D not werks coz 'WERKS' is a structure.

Hope this helps,

Murthy

Read only

0 Likes
1,856

well if you are selecting * into a structure without the statement INTO CORRESPONDING FIELDS OF, you need to select into a structure of exactly the same linetype as the table.

declare your structure of type koke and all is fine.

Read only

Former Member
0 Likes
1,856

Your structure E1KEKO needs to have same number of fields with same name as KEKO since you have used * IN CORRESPONDING fields.

Declare E1KEKO TYPE STANDARD TABLE OF KEKO

Read only

0 Likes
1,856

Hi Sim,

>

> Your structure E1KEKO needs to have same number of fields with same name as KEKO since you have used * IN CORRESPONDING fields.

This is not correct. The only precondition is that fields with same name in database and internal table must have the same data type and length.

All other fields selected or present in INTO table are just not used.

The assumption he used data type werks instead of werks_d is quite probable.

Regards,

Clemens

Read only

Former Member
0 Likes
1,856

hello Balu ,

Copy paste your orignal code here . where you getting dump in query. so we can help you.

vanu.

Read only

0 Likes
1,856

Hi,

The below sample is my test program. I am getting dump in my original program so i tried a sample program. Here also am getting the same.

Friends, Just copy and past the below code. You also will get the same.


Report ztest123456.

DATA: e1keph TYPE e1keph,
      e1keko TYPE e1keko.

   SELECT * INTO CORRESPONDING FIELDS OF e1keko
    FROM keko
    WHERE keko~matnr = '000000000010801071'.
  endselect.
Write : / 'Test'.

Kindly help me out.

Anandhan

Read only

0 Likes
1,856

Are you not reading the advice you have been given. It doesn't matter if the queen executes the code, it will still fail.

Read only

0 Likes
1,856

This message was moderated.

Read only

0 Likes
1,856

This message was moderated.

Read only

0 Likes
1,856

Hi,

Structures are E1KEKO and KEKO are not same. Hence you are getting Dump.

LOSGR check this field - we have this field as QUAN 13, 3 in KEKO and as CHAR14 in E1KEKO. So even MOVE CORRESPONDING fails.

Thanks,

Naveen.I

Read only

0 Likes
1,856

This message was moderated.

Read only

Former Member
0 Likes
1,856

This message was moderated.

Read only

Former Member
0 Likes
1,856

This message was moderated.

Read only

Former Member
0 Likes
1,856

Hi,

if you try this, because you don't use inner join::


SELECT * INTO CORRESPONDING FIELDS OF e1keko
    FROM keko
    WHERE matnr = p_matnr "not keko~matnr
      AND werks = p_werks "not keko~werks
      AND bwtar = 'Z06' "not keko~bwtar
      AND bwvar = 'Z06'. "not keko~bwvar
    CLEAR t_idoc_data.
    t_idoc_data-segnam = c_segnam_e1keko.
    t_idoc_data-mandt = sy-mandt.
    t_idoc_data-sdata  = e1keko.
    APPEND t_idoc_data.
    CLEAR e1keph.
endselect

did you get also a dump?

Regards, Dieter