Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

field symbols

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

1 REPLY 1

Former Member
0 Kudos

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