04-09-2008 10:54 AM
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 . .
04-09-2008 10: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
04-09-2008 10: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.
04-09-2008 10: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
04-09-2008 11: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.
04-09-2008 11:01 AM
04-09-2008 11: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....
04-09-2008 11: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
04-09-2008 3: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