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: 

Fieldcat for OO ALV in container

Former Member
0 Kudos

I am working on a program based on following codes:

[http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html|http://help-abap.blogspot.com/2008/10/dispaly-alv-report-output-in-same.html]

When I used custom internal table as ALV data source, there's no column header. How can I customize the fieldcat? I have not used OO ALV before

Thanks!

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Either you can create dictonary structure via SE11 same as your output structure & create internal table to be displayed using that structure or use methods in SALV for example

data:ir_alv type ref to cl_salv_table,

ir_columns type ref to cl_salv_columns_table,

ir_column type ref to cl_salv_column,

*get all the columns that are in the output list

call method ir_alv->get_columns

receiving

value = ir_columns.

ir_column = ir_columns->get_column( 'KONNR' ).

text_m = 'Contract No'(003).

ir_column->set_medium_text( text_m ).

4 REPLIES 4

satyajit_mohapatra
Active Contributor
0 Kudos

If you are using data elements in the internal table, for which labels have been already maintained, the labels will be displayed in ALV also.

Otherwise, if you are using LVC_S_FCAT structure populate the fields SCRTEXT_L, SCRTEXT_M,

SCRTEXT_S with required desciptions based on their lengths.

0 Kudos

Thanks for the reply.

My internal table is mainly type "C / String" so there's no existing label.

By the way, I just don't know where to insert structure like LVC_S_FCAT. Please refer to the code in link.

SuhaSaha
Advisor
Advisor
0 Kudos

You can use the class CL_SALV_COLUMN to set the colun attributes. The methods of interest would be SET_LONG_TEXT, SET_MEDIUM_TEXT & SET_SHORT_TEXT.

You can refer to the program SALV_TEST_TABLE_COLUMNS.

@ Satyajit: You do not pass the fieldcatalog to SALV class.

BR,

SUhas

Former Member
0 Kudos

Hi,

Either you can create dictonary structure via SE11 same as your output structure & create internal table to be displayed using that structure or use methods in SALV for example

data:ir_alv type ref to cl_salv_table,

ir_columns type ref to cl_salv_columns_table,

ir_column type ref to cl_salv_column,

*get all the columns that are in the output list

call method ir_alv->get_columns

receiving

value = ir_columns.

ir_column = ir_columns->get_column( 'KONNR' ).

text_m = 'Contract No'(003).

ir_column->set_medium_text( text_m ).