‎2009 Sep 15 10:49 AM
hi experts
i have two internal tables of same structure
in itab1 i want all the fields to be displayed
in itab2 i want only 3 fields
say suppose if itab1 and itab2 has a record each
i dont want to display separetely as two records
i want the itab2 record in itab1 and displayed
.....
Below is the logic i hav used
declared 3rd int table of same stucture ....
it_finals[] = it_final[].
append lines of it_final1 to it_finals .
refresh it_final1.
loop at it_finals into wa_finals where hkont = gl_range-low .
read table it_final1 into wa_final1 with key hkont = wa_finals-hkont.
if sy-subrc = 0.
wa_finals-secamt = wa_final1-dmbtr.
wa_finals-secamt1 = wa_final1-dmbtr1.
wa_finals-secamt2 = wa_final1-dmbtr2.
endif.
modify it_finals from wa_finals transporting secamt secamt1 secamt2.
Endloop.
but still geting as 2 lines....
Thankz in advance
1,921,994.00 123,380.00 13,107,449.50- 29,092,556.50- 0.00 0.00 0.00
1,921,994.00 23,380.00 33, 137,930.50- 0.00 0.00 0.00 0.00
The second records should be displayed in first line itself where 0.00 is displayed
‎2009 Sep 15 10:55 AM
modify it_finals from wa_finals." transporting secamt secamt1 secamt2.remove the part which i commented
‎2009 Sep 15 10:58 AM
thanks
already tried with that .. but still not the problem is solved
..problem is when it comes to it_finals itself it bring two lines records......
‎2009 Sep 15 11:01 AM
Hi,
Try using the index specificatin and check,
modify it_finals from wa_finals index sy-tabix.
Regards,
Vikranth
‎2009 Sep 15 11:03 AM
‎2009 Sep 15 11:10 AM
arun,
i am not clear about your question.
if you have two records in itab1 why do you want to display only one record and one what basis.
if they are duplicate, use delete ADJACENT DUPLICATES FROM itab COMPARING xyz
‎2009 Sep 15 11:14 AM
no you havent got my question i think....
my first int tabl has a record
and a second int table has a record
i want all the fields from int1 and only 3 fields from int2 and want to display as a single records
not as 2 records as i have int1 and int2 ....thats y i have another int table as int3 so that i want to merge the int1 and int2 into int3 and display as one record.....
can u understand now....
i donno how to push only the 3 rec from int2 and take all fields frm int 1 and display as as single onle
i have tried with the code but my required output is not coming
thanks
‎2009 Sep 15 11:29 AM
Use this code hope your problem will be solved and comment the lines which i have done below
it_finals] = it_final[.
"append lines of it_final1 to it_finals .
"refresh it_final1.
loop at it_finals into wa_finals where hkont = gl_range-low .
read table it_final1 into wa_final1 with key hkont = wa_finals-hkont.
if sy-subrc = 0.
wa_finals-secamt = wa_final1-dmbtr.
wa_finals-secamt1 = wa_final1-dmbtr1.
wa_finals-secamt2 = wa_final1-dmbtr2.
endif.
modify it_finals from wa_finals transporting secamt secamt1 secamt2.
Endloop.
‎2009 Sep 15 11:30 AM
Hi,
Try this pseudo code,
lets consider itab1 and itab2 are the 2 intenal tables and it_final is the final table.
loop at itab1.
move-corresponding itab1 to it_final.
read table itab2 with key hkont = itab1-hkont.
if sy-subrc = 0.
it_final-secamt = itab2-dmbtr.
it_final-secamt1 = itab2-dmbtr1.
it_final-secamt2 = itab2-dmbtr2.
endif.
append it_final.
clear it_final.
endloop.
Change this pseudo code as per ur requirement and try
Regards,
Vikranth
‎2009 Sep 15 11:36 AM
it_finals[] = it_final[]. "===>one entry passed
append lines of it_final1 to it_finals ."==>passed one more recordsee arun,
this part of code is creating two entries.
so just remove of of them.
it_finals[] = it_final[]. ==>keep only this
‎2009 Sep 15 11:39 AM
y iam do that append lines is cos i want the 3 field value in that record so iam appending to the it_finals table ..........
‎2009 Sep 15 11:41 AM
Hi Arun,
Try this approach. sample code below.
TYPES: BEGIN OF ty_itab,
val1 TYPE char5,
val2 TYPE char5,
END OF ty_itab.
TYPES: BEGIN OF ty_itab1,
val1 TYPE char5,
val2 TYPE char5,
val3 TYPE char5,
END OF ty_itab1.
DATA: itab1 TYPE TABLE OF ty_itab,
wa_itab1 LIKE LINE OF itab1,
itab2 TYPE TABLE OF ty_itab1,
wa_itab2 LIKE LINE OF itab2,
itab3 TYPE TABLE OF ty_itab1,
wa_itab3 LIKE LINE OF itab3.
wa_itab1-val1 = 'hai'.
wa_itab1-val2 = 'ram'.
APPEND wa_itab1 TO itab1.
CLEAR wa_itab1.
wa_itab2-val1 = 'hai'.
wa_itab2-val2 = 'ABC'.
wa_itab2-val3 = '100'.
APPEND wa_itab2 TO itab2.
CLEAR wa_itab2.
LOOP AT itab1 INTO wa_itab1.
READ TABLE itab2 INTO wa_itab2 WITH KEY val1 = wa_itab1-val1.
IF sy-subrc = 0.
wa_itab3-val1 = wa_itab1-val1.
wa_itab3-val2 = wa_itab1-val2.
wa_itab3-val3 = wa_itab2-val3.
APPEND wa_itab3 TO itab3.
CLEAR wa_itab3.
ENDIF.
ENDLOOP.
LOOP at itab3 INTO wa_itab3.
WRITE:/ wa_itab3-val1, wa_itab3-val2, wa_itab3-val3.
ENDLOOP.
Regards,
parameswaran.K
‎2009 Sep 15 12:02 PM
arun,
you need values in it_finals right?
it_finals[] = it_final[]. "===>one entry passed , NOW YOU HAVE TO modify this not appened any more lines,
append lines of it_final1 to it_finals ."==>passed one more record..NOT NEEDED, as we will do this in loop,
so..
it_finals[] = it_final[]. "one record pass
loop at it_finals into wa_finals where hkont = gl_range-low .
read table it_final1 into wa_final1 with key hkont = wa_finals-hkont.
if sy-subrc = 0.
wa_finals-secamt = wa_final1-dmbtr.
wa_finals-secamt1 = wa_final1-dmbtr1.
wa_finals-secamt2 = wa_final1-dmbtr2.
endif.
modify it_finals from wa_finals. "one record modified
clear : wa_finals
Endloop.
‎2009 Sep 15 12:37 PM
Hi Rachel,
loop at itab1 into watab1.
read table itab2 into watab2 where field1 eq watab1-field1.
if sy-subrc eq 0.
for extra fields from internal table 2
watab3-field3 = watab2-field3.
watab3-field4 = watab2-field4.
watab3-field5 = watab2-field5.
move corresponding watab1 into watab3.
endif.
endloop.
regards,
Gopalakrishnan Ulagajothi