Skip to Content
0
Former Member
May 05, 2005 at 06:26 PM

loop at with where statement why not possible

27 Views

Hello Experts,

This is part of the code for the BADI.

When I use the below code I get the error "in Loop..Where the line type should be statically defined"

Error Code:

method IF_EX_OPENHUB_TRANSFORM~TRANSFORM.

data: l_s_data_in type /BIC/CYZTRX.

data: l_s_data_out type /BIC/CZZTRX.

clear e_t_data_out.

loop at i_t_data_in into l_s_data_in

where /BIC/ZI_MARKET EQ SPACE

and SOURSYSTEM EQ DO

and /BIC/ZGN_SLDTO NE SPACE.

move-corresponding l_s_data_in to l_s_data_out.

insert l_s_data_out into table e_t_data_out.

endloop.

endmethod.

Code with no Check error:

method IF_EX_OPENHUB_TRANSFORM~TRANSFORM.

data: l_s_data_in type /BIC/CYZTRX.

data: l_s_data_out type /BIC/CZZTRX.

clear e_t_data_out.

loop at i_t_data_in into l_s_data_in.

if l_s_data_in-/BIC/ZI_MARKET EQ SPACE

and l_s_data_in-SOURSYSTEM EQ 'DO'

and l_s_data_in-/BIC/ZGN_SLDTO NE SPACE.

move-corresponding l_s_data_in to l_s_data_out.

insert l_s_data_out into table e_t_data_out.

else.

continue.

endif.

endloop.

endmethod.

I would like to use the logic in the Where statment instead of writing it as a seperate IF statement. Wondering if there is any error in the first code. Is there any other method of acheving this. Please suggest.

Many thx in adv.

Sandhya