‎2007 Aug 01 8:13 AM
I have one internal table with data
a 1
b 1
c 1
d 2
e 2
and another internal table with data
A 1
B 1
C 2
D 2
E 2
Now my requirement is i want to combine these 2 tables to get the result like
a 1 A
b 1 B
c 1 -
d 2 C
e 2 D
- 2 E
can anyone tell me how to write the code to get this
‎2007 Aug 01 11:57 AM
‎2007 Aug 01 12:06 PM
data : begin of itab1 occurs 0,
field1 type c,
field2 type c,
end of itab1 .
data : begin of itab2 occurs 0,
field1 type c,
field2 type c,
end of itab2 .
data : begin of itab3 occurs 0,
field1 type c,
field2 type c,
field2 type c,
end of itab3 .
....get the values to itab1 and 2...
loop at itab1.
read table itab2 ignoring case with key field1 = itab1-field1 field2 = itab1-field2 ignoring case .
if sy-subrc = 0.
itab3-field3 = itab2-field1.
endif.
itab3-field1 = itab1-field1.
itab3-field2 = itab1-field1.
append itab3.
cleat itab3.
delete itab1.
endloop.
loop at itab2.
read table itab3 with key field3 = itab2-field1 field2 = itab2-field2 .
if sy-subrc <> 0
itab3-field2 = itab2-fiedld2.
itab3-field3 = itab2-fiedld1.
append itab3.
clear itab3.
endif.
endloop.
Message was edited by:
Arjun Puthuruthy