‎2006 Dec 04 12:11 AM
Hi,
There are 2 structures (source and target structures). I appended 3 fields to the target structure and trying to populate these key figure fields from some key figure fields in the source structure. I executed this code and i extracted the data into a flat file. No values are populated for the 3 appended fields. Please let me know the problem in the code.
method IF_EX_OPENHUB_TRANSFORM~TRANSFORM.
data: l_s_data_in type /bic/cyytest_is,
l_s_data_out type /bic/czytest_is.
clear e_t_data_out.
loop at i_t_data_in into l_s_data_out.
l_s_data_out-/bic/ykf1 = l_s_data_in-/bic/yvvps2 +
l_s_data_in-/bic/yvvps4.
l_s_data_out-/bic/ykf2 = l_s_data_in-/bic/yvvps1 +
l_s_data_in-/bic/yvvps3.
l_s_data_out-/bic/ykf3 = l_s_data_in-/bic/yvvadb +
l_s_data_in-/BIC/yvvcpa..
insert l_s_data_out into table e_t_data_out.
endloop.
endmethod.
Thanks
‎2006 Dec 04 12:17 AM
The problem is that you are reading into a workarea, but trying to use values from the IN table. Try changing like so.
loop at i_t_data_in into l_s_data_out.
l_s_data_out-/bic/ykf1 = l_s_data_OUT-/bic/yvvps2 +
l_s_data_OUT-/bic/yvvps4.
l_s_data_out-/bic/ykf2 = l_s_data_OUT-/bic/yvvps1 +
l_s_data_OUT-/bic/yvvps3.
l_s_data_out-/bic/ykf3 = l_s_data_OUT-/bic/yvvadb +
l_s_data_OUT-/BIC/yvvcpa..
insert l_s_data_out into table e_t_data_out.
endloop.
When you say....
loop at i_t_data_in into l_s_data_out.
the values from I_T_DATA_IN are moved to L_S_DATA_OUT for each iteration of the loop. So I_S_DATA_IN is never being filled, this is why the values are not being added together.
Regards,
Rich Heilman
Message was edited by:
Rich Heilman
‎2006 Dec 04 12:17 AM
The problem is that you are reading into a workarea, but trying to use values from the IN table. Try changing like so.
loop at i_t_data_in into l_s_data_out.
l_s_data_out-/bic/ykf1 = l_s_data_OUT-/bic/yvvps2 +
l_s_data_OUT-/bic/yvvps4.
l_s_data_out-/bic/ykf2 = l_s_data_OUT-/bic/yvvps1 +
l_s_data_OUT-/bic/yvvps3.
l_s_data_out-/bic/ykf3 = l_s_data_OUT-/bic/yvvadb +
l_s_data_OUT-/BIC/yvvcpa..
insert l_s_data_out into table e_t_data_out.
endloop.
When you say....
loop at i_t_data_in into l_s_data_out.
the values from I_T_DATA_IN are moved to L_S_DATA_OUT for each iteration of the loop. So I_S_DATA_IN is never being filled, this is why the values are not being added together.
Regards,
Rich Heilman
Message was edited by:
Rich Heilman
‎2006 Dec 04 12:23 AM
Hi Rich,
Sorry, this reply was in response to your first reply. I will try according to your second reply and let you know.
But, the fields yvvps2, yvvps4, yvvps1, yvvps3, yvvadb and yvvcpa are available only in the IN structure. They are not available in the OUT structure
Thanks
Message was edited by:
Sachin Guptha
Second Reply
‎2006 Dec 04 12:27 AM
‎2006 Dec 04 12:59 AM
Hi Rich,
It worked. Thanks a lot.
Regards
Message was edited by:
Sachin Guptha
‎2006 Dec 04 12:21 AM
If the structures of L_S_DATA_IN and L_S_DATA_OUT are not the same, then maybe this is a better solution.
loop at i_t_data_in into l_s_data_in.
move-corresponding l_s_data_in to l_s_data_out.
l_s_data_out-/bic/ykf1 = l_s_data_in-/bic/yvvps2 +
l_s_data_in-/bic/yvvps4.
l_s_data_out-/bic/ykf2 = l_s_data_in-/bic/yvvps1 +
l_s_data_in-/bic/yvvps3.
l_s_data_out-/bic/ykf3 = l_s_data_in-/bic/yvvadb +
l_s_data_in-/BIC/yvvcpa..
insert l_s_data_out into table e_t_data_out.
endloop.
Regards,
Rich Heilman