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: 

please

Former Member
0 Kudos

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

8 REPLIES 8

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

former_member386202
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

wa_i_ekkn should be declared as the structure of EKKN.

harikrishnan_m
Active Participant
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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