Skip to Content
author's profile photo Former Member
Former Member

please

Hi,

LOOP AT i_ekko INTO wa_i_ekko.

SELECT * FROM ekkn INTO wa_i_ekkn WHERE

ebeln EQ wa_i_ekko-ebeln.

APPEND wa_i_ekkn TO i_ekkn.

ENDSELECT.

ENDLOOP.

I got error is The work area "WA_I_EKKN" is not long enough . .

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 09:58 AM

    Hi,

    declaration of wa_i_ekkn must be:

    data: wa_i_ekkn like ekkn.

    LOOP AT i_ekko INTO wa_i_ekko.

    SELECT * FROM ekkn INTO wa_i_ekkn WHERE

    ebeln EQ wa_i_ekko-ebeln.

    APPEND wa_i_ekkn TO i_ekkn.

    ENDSELECT.

    ENDLOOP.

    reward points

    james lising

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 09:58 AM

    HI,

    do like this

    
    DATA:wa_i_ekkn LIKE LINE OF I_EKKN.
    LOOP AT i_ekko INTO wa_i_ekko.
    SELECT * FROM ekkn INTO CORRESPONDING FIELDS OF wa_i_ekkn WHERE
    ebeln EQ wa_i_ekko-ebeln.
    APPEND wa_i_ekkn TO i_ekkn.
    ENDSELECT.
    ENDLOOP.
    

    rgds,

    bharat.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 09:59 AM

    Hi,

    Do like this

    LOOP AT i_ekko INTO wa_i_ekko.

    SELECT * FROM ekkn WHERE

    ebeln EQ wa_i_ekko-ebeln.

    APPEND ekkn TO i_ekkn.

    ENDSELECT.

    ENDLOOP.

    but try to remove select endselect and select within loop becoz its performance wise slow.

    Regards,

    Prashant

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 10:00 AM

    Hi this is not the right way to select

    LOOP AT i_ekko INTO wa_i_ekko.

    SELECT * FROM ekkn INTO wa_i_ekkn WHERE

    ebeln EQ wa_i_ekko-ebeln.

    APPEND wa_i_ekkn TO i_ekkn.

    ENDSELECT.

    ENDLOOP

    you didnot mentioned how you have declarred wa_i_ekko

    and also use select single * instead select *

    because you are using select * , it will think that w_i_ekkn is an internal table. but actually it is a structure

    so use select single *

    but that is not the correct way to do so .

    use this

    if i_ekko[] is not initial.

    select * from ekkn into table i_ekkn

    for all entries in i_ekko

    where ebeln eq i_ekko-ebeln.

    if sy-subrc eq 0.

    endif.

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 10:01 AM

    wa_i_ekkn should be declared as the structure of EKKN.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 09, 2008 at 10:07 AM

    Hi,

    First of all u need to declare wa_i_ekko of type EKKN i.e,

    DATA : wa_i_ekko TYPE EKKN.

    Second thing instead, of this code u can followthe below mentioned code...u can avoid select inside a loop.

    SELECT * FROM EKKO INTO TABLE I_EKKN

    FOR ALL ENTRIES IN I_EKKO

    WHERE EBELN = I-EKKO-EBELN.

    ....Try this out if found Ok....

    Reward if useful....

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 10:08 AM

    Hi,

    First of all one suggestion to you dont keep select in the loop which causes effect to performance ok...

    coming to your problem....

    first find in the declaration statements ok

    i will give u sample code example ok...

    data: i_ekko type standard table of ekko,

    wa_ekko type ekko,

    i_ekkn type standard table of ekkn,

    wa_ekkn type ekkn.

    loop at i_ekko into wa_ekko.

    SELECT * FROM ekkn INTO wa_ekkn WHERE

    ebeln EQ wa_ekko-ebeln.

    APPEND wa_ekkn TO i_ekkn.

    ENDSELECT.

    ENDLOOP.

    in performance point of view try to code select statement above the loop

    SELECT * FROM ekkn INTO table i_ekkn.

    loop at i_ekko into wa_ekko.

    read table i_ekkn with key ebeln EQ wa_ekko-ebeln.

    and perform your manipulations like if sy-subrc = 0.

    then do this like that finally move data into some internal table ok

    reward me if helpful...

    Cheers,

    Brahma

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2008 at 02:07 PM

    Hi,

    Declare like this,

    data:wa_i_ekkn like ekkn occurs 0.

    because i thought u declared some of the fields only in wa_i_ekkn..thatsy u got this error....

    Thank u,

    Manjula Devi.D

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.