05-05-2005 7:26 PM
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
05-05-2005 7:47 PM
The reason is that the structure of the internal table I_T_DATA_IN is not known to the BADI, but once transported to the work area I_S_DATA_IN which has a defined structure that the BADI can recognize, the individual structure level checks are possible.
Rishi
05-05-2005 7:49 PM
Sandhya,
I think the rule is; during comparision the field on the left of the '=' should belong to the table(internal). Looking at your code, it doesn't belong to the table.
Kshitij
05-06-2005 5:15 AM
I would modify your code as follows.
method IF_EX_OPENHUB_TRANSFORM~TRANSFORM.
data: l_s_data_in type /BIC/CYZTRX.
data: l_s_data_out type /BIC/CZZTRX.
data: l_it_data type /BIC/CYZTRX occurs 0.
l_it_data[] = i_t_data_in[].
clear e_t_data_out.
loop at l_it_data 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.
Hope this helps.
Srinivas
05-06-2005 6:08 AM
Hi Sandhya,
You have not closed your . I hope that issue is not succesfully resolved. Can you please mark that thread as answered?
Coming to your current problem, in the first case, you seem to have forgotten to put the quotes around DO. Remember, 'DO' is a literal where as DO will be a variable. If this is not the cause for the error, please get back...
Regards,
Anand Mandalika.
05-06-2005 7:17 PM