‎2011 Mar 09 12:16 PM
HI EXPERTS,
BELOW IS THE CODE WRITTEN TO MOVE THE VALUES FROM ONE INTERNAL TABLE TO ANOTHER. BUT WHEN I MOVE, THE VALUE IN THE SECOND LOOP GETS APPENDS IN THE 2 ND ROW. CAN YOU PLEASE HELP ME TO STORE THE VALUES IN THE SAME ROW. BOTH THE TABLES DONT HAVE ANY FIELDS IN COMMON.
THAT IS THE LS_INPUT HAS A AND B FIELDS, LT_PHASE HAS C AND D FIELDS. WANT THE VALUES OF ALL THE FIELDS IN THE SAME ROW IF LT_PROPOSAL. PLEASE HELP OUT
loop at ls_input into wa_input.
clear wa_input_pro.
move-corresponding wa_input to wa_input_pro.
append wa_input_pro to lt_proposal.
endloop.
loop at lt_phase into wa_phase.
clear wa_phase_pro.
move-corresponding wa_phase to wa_phase_pro.
append wa_phase_pro to lt_proposal.
endloop.
‎2011 Mar 09 12:27 PM
Hi Vadiv,
I think you need to use KEY FIELD reference.
Cheers,
Kris.
‎2011 Mar 09 12:46 PM
Well right now you are doing an append so of course you are getting double the number of rows. Are the number of rows in ls_input always the same as the number of rows in lt_phase ? If so as you loop through lt_phase, instead of appending a record to lt_proposal use a read with index. Give the command the same index as the current record in the loop of lt_phase. That way you will be reading the corresponding record to the same position in ls_input. Without keys in common, the record position in the table is about the only way to match up any data.
That said, this isn't a Web Dynpro ABAP specific question. Please only post questions in this forum directly related to aspects of Web Dynpro ABAP. I am moving this question to the ABAP General Forum.
‎2011 Mar 09 2:02 PM
Hi,
As mentioned..
BOTH THE TABLES DONT HAVE ANY FIELDS IN COMMON
.
In the 2nd loop instead of using append use Modify statement and check in debug mode.
Try it once.
Thanks
Arbind