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: 

Dynamic Fieldcatlog

Former Member
0 Kudos

hi all,

IN final internal table we have the data as

YEAR/MONTH BUKRS BELNR GJAHR WRBTR

JAN/2008 0005 10001 2008 101

FEB/2008 0005 10001 2008 102

MAR/2008 0005 10001 2008 210

APR/2008 0005 10001 2008 310

I need to get the output as below

BUKRS BELNR GJAHR JAN/2008 FEB/2008 MAR/2008 APR/2008

0005 10001 2008 101 102 210 310

to get as above i am using dynamic fieldcatlog.

LOOP AT lt_final.

l_index = sy-tabix.

ASSIGN COMPONENT l_index OF STRUCTURE <f_line> TO <f_field>.

<f_field> = lt_final-wrbtr.

ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <f_line> TO <f_field>.

<f_field> = lt_final-bukrs.

ASSIGN COMPONENT 'BELNR' OF STRUCTURE <f_line> TO <f_field>.

<f_field> = lt_final-belnr.

AT LAST.

INSERT <f_line> INTO TABLE <f_tab>.

ENDAT.

ENDLOOP.

i am not getting amount value in the output. if i remove the assign component for bukrs and belnr

in the above then we are able to see amount values in the output.

please let me know what to do to get bukrs and belnr data along with amount data.

3 REPLIES 3

Former Member
0 Kudos

Hi Sree,

Prepare an new internal table with fields for the BUKRS, BELNR and year(JAN/2008) and amount.

BUKRS BELNR GJAHR JAN/2008 FEB/2008 MAR/2008 APR/2008

when you loop your final internal table, you have the value(JAN/2008 or FEB/2008) right.

use the value as a where condition for the new internal table and move the amount value while using the Assign statement.

Hope this might help you.

Regards,

Phani.

Former Member
0 Kudos

Hi,

In the below statement u have use the 'WRBTR' Instead of I_index . If u know the position of the coloumn then u can take it into varible and assign it. otherwise use the field name to assign..

Wrong case:

I_index contains which record is looping.

ASSIGN COMPONENT l_index OF STRUCTURE <f_line> TO <f_field>.

<f_field> = lt_final-wrbtr.

correct one:

ASSIGN COMPONENT OF 'WRBTR' STRUCTURE <f_line> TO <f_field>.

<f_field> = lt_final-wrbtr.

Regards,

Srinivas.

Former Member
0 Kudos

dynamic creation is ok.. but i have one question...

if you are sure that for each month you are going to have only one value... then why go for dynamic field catalog here?

you can just prepare the catalog and keep the names(seltext_l) changing with the value in the first field.. if you have value there.. make that field catalog table entry.. else.. dont..

this makes the process easy.. wont it?