‎2012 Mar 09 1:48 PM
Hi,
I have a scenario that I am trying to work on:
I have three internal tables itab1 itab2 and itab3, all three internal tables have same fields in them but might be different values:
All the internal tables have three rows of data and in each row there are five fields VAL1 VAL2 VAL3 VAL4 VAL5.The requirement is I need to compare all these three tables as below:
Compare all the fields of itab1 with itab2, if they are same then skip and if not then compare each field of itab1 to itab3, if they are same then skip and if not replace the value of itab1 field (which is different with the one on itab3)with the itab3 field value.
can you please help me with this?
Moderator message : Requirements dumping not allowed, show the work you have already done. Thread locked.
Edited by: Vinod Kumar on Mar 9, 2012 7:37 PM
‎2012 Mar 09 1:55 PM
Hi
Have you tried the logic yourself and did you get struck in any particular point? This can be done in many ways so if you are struck in any specific error / issue then post that instead of posting your requirement.
Br
Vijay V
‎2012 Mar 09 2:02 PM
Hi Vijay,
I started writing the code as below:
loop at itab1 into wa_itab1.
READ TABLE itab2 INDEX sy-index into waA_itab2.
READ TABLE itab3 INDEX sy-index into wa_itab3.
if wa_itab1-val1 = wa_itab2-val1.
skip.
else.
if_wa_tab1-val1 = wa_itab3-val1.
skip.
else.
wa_tab1-val1 = wa_itab3-val1.
endif.
endif.
if wa_itab2-val1 = wa_itab2-val2.
skip.
else.
if_wa_tab2-val1 = wa_itab3-val2.
skip.
else.
wa_tab1-val2 = wa_itab3-val2.
endif.
endif.
if wa_itab1-val3 = wa_itab2-val3.
skip.
else.
if_wa_tab1-val3 = wa_itab3-val3.
skip.
else.
wa_tab1-val3 = wa_itab3-val3.
endif.
endif.
if wa_itab1-val4 = wa_itab2-val4.
skip.
else.
if_wa_tab1-va4l = wa_itab3-val4.
skip.
else.
wa_tab1-val4 = wa_itab3-val4.
endif.
endif.
ENDLOOP.but I am not sure if whatever I have written is correct.
‎2012 Mar 09 2:06 PM
At the end of the process, what should your test table(s) contain? Do you know that? Then, upon executing with debug, what does the result show you? Problems in code? incorrect values in table? IMHO, posting on the forum is not a suitable substitution for actually doing the unit testing and debugging. After that, post if you don't understand how to fix a specific piece of code.
‎2012 Mar 09 2:04 PM
Hi,
Please ask your question little clear..
And which table you are fetching the records and also based on what ??
why you are comparing those internal tables and what you have to acheive?????
Thanks,
Pradeep.