09-19-2006 11:06 AM
Hi All,
I have an internal table with hkont,kschl and dmbtr. Now I need a field symbol which has got the different g/l accounts(hkont) as the fields and the values of corresponding kschl and dmbtr should appear under each g/l account field.
My internal table is as follows:
hkont kschl dmbtr
a x 10000
b x 10
b y 20000
a y 20
I want this in a field symbol/field string as:
kschl a b
x 10000 10
y 20 20000
Message was edited by: Sushma Anuprava
Message was edited by: Sushma Anuprava
Message was edited by: Sushma Anuprava
09-19-2006 11:39 AM
My internal table is as follows:
hkont kschl dmbtr
a x 10000
b x 10
b y 20000
a y 20
I want this in a field symbol/field string as:
kschl a b
x 10000 10
y 20 20000
-Solution-
u need to have itab as kschl, hkont, dbmtr
ihkont can be of the same structure
ihkont[] = itab[].
sort ihkont by hkont.
delete adjacent duplicates from ihkont.
loop at itab.
at first.
move 'KSCHL' to istr-line.
loop at ihkont.
ctr = ctr + 10.
move ihonkt-hkont to istr-line+ctr(10).
endloop.
append istr.
endat.
move itab-kschl to istr-line(10).
read table ihkont with key hkont = itab-hkont.
if sy-subrc = 0.
ctr = sy-tabix * 10.
move itab-dmbtr to istr-line+ctr(10).
endif.
at end of kschl.
append istr.
endat.
endloop.
Message was edited by: Anurag Bankley
09-19-2006 11:39 AM
My internal table is as follows:
hkont kschl dmbtr
a x 10000
b x 10
b y 20000
a y 20
I want this in a field symbol/field string as:
kschl a b
x 10000 10
y 20 20000
-Solution-
u need to have itab as kschl, hkont, dbmtr
ihkont can be of the same structure
ihkont[] = itab[].
sort ihkont by hkont.
delete adjacent duplicates from ihkont.
loop at itab.
at first.
move 'KSCHL' to istr-line.
loop at ihkont.
ctr = ctr + 10.
move ihonkt-hkont to istr-line+ctr(10).
endloop.
append istr.
endat.
move itab-kschl to istr-line(10).
read table ihkont with key hkont = itab-hkont.
if sy-subrc = 0.
ctr = sy-tabix * 10.
move itab-dmbtr to istr-line+ctr(10).
endif.
at end of kschl.
append istr.
endat.
endloop.
Message was edited by: Anurag Bankley