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: 

How to create Dynamic Fieldcatalog ?

Former Member
0 Kudos

Dear all

I want to create dyanamic fieldcatalog .

It is like this :

I have 15 Columns rem1 rem2 ..........................rem15 .

Like suppose filling the final internal table i have data in first 10 fields .

In tht case the empty columns i want to delete dyanamically . Is there any option avaibable while generating the field catalog . Please suggest .

Thanks

Aryan

6 REPLIES 6

Former Member
0 Kudos

Hi,

You can build the Field catalog in this way..

You need to find the number of fields you need to have in the field catalog..

DO N TIMES.  " N is the count of the fields in the table

CONCATENATE 'REM' SY-INDEX INTO FIELD.

APPEND field to field catalog.

ENDDO.

Former Member
0 Kudos

hi,

pls check this link

use dynamc internal table

CREATE DATA dyn_line LIKE LINE OF <dyn_table>.

ASSIGN dyn_line->* TO <dyn_wa>.

LOOP AT it_out_w.

MOVE-CORRESPONDING it_out_w TO <dyn_wa>.

APPEND <dyn_wa> TO <dyn_table>.

ENDLOOP.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = v_repid

is_layout = x_layout

it_fieldcat = it_fcat

it_sort = it_sort

it_events = it_event

i_save = 'A'

TABLES

t_outtab = <dyn_table>

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

0 Kudos

Dyanamic internal table is the right way i know but the thing is i have developed the whole report now making changes at this level not possible

Former Member
0 Kudos

Hi ,

You can Achieve this by using field symbols.

DO n times.

assign field value to field symbol.

and if it is found then you move and append this to a dynamic internal table.

Please let me know fi you still need any help.

Thanks and regards,

Rajeshwar.

Former Member
0 Kudos

hi,

go through the following link..

[Dynamic Fieldcatalog|;

hopes this helps

Regards

RItesh J

I355602
Advisor
Advisor
0 Kudos

Hi,

Refer:-

to create dynamic field catalog in alv use:-

https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/dynamic%252bfield%252bcatalog%252bin%252balv

Hope this helps you.

Regards,

Tarun