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: 

ALV Display order of columns

Former Member
0 Kudos

Hi All,

I am trying to disply my data using ALV. The problem which I am facing is, in the output....Columns are not in the order of my internal table. I want to maintain the order in which columns have to be displayed. How do I go about it?

Any help will be greatly appreciated.

Thanks,

Haritha

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can try setting the column number in the field catalog.

  clear: feild_cat.
  feild_cat-reptext    = 'Weight'.
  feild_cat-coltext    = 'Weight'.
  feild_cat-fieldname  = 'WEIGHT'.
  feild_cat-ref_table  = 'I_MESS'.
  feild_cat-outputlen  = '10'.
  feild_cat-col_pos    = 10.        "<----  THIS LINE
  append feild_cat to gt_fieldcat.

Regards,

RIch Heilman

11 REPLIES 11

Former Member
0 Kudos

In the Field catalog there is a Column number field, populate it with a predetermined sequence.

JozsefSzikszai
Active Contributor
0 Kudos

hi Haritha,

either you build up your fieldcatalog manually or by FM, the value in the col_pos field will show the position of the coloumn in the ALV list for each field in your internal table.

ec

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You can try setting the column number in the field catalog.

  clear: feild_cat.
  feild_cat-reptext    = 'Weight'.
  feild_cat-coltext    = 'Weight'.
  feild_cat-fieldname  = 'WEIGHT'.
  feild_cat-ref_table  = 'I_MESS'.
  feild_cat-outputlen  = '10'.
  feild_cat-col_pos    = 10.        "<----  THIS LINE
  append feild_cat to gt_fieldcat.

Regards,

RIch Heilman

0 Kudos

Hi,

Thanks for your reply.

I have done that before itself. Even then, the order is not in the way I wanted.

Any suggestions?

Thanks,

Haritha

0 Kudos

Hi,

there's another way, you save a variant and then in the call to the alv pass the variant with your order.

I've you need code sample just say.

0 Kudos

A default layout could be messing with you here. If there is a default layout which is being fired when you display the ALV, then this will override anything that you programmatically are setting in the field catalog. Go to the layout management and get rid of the default layout if there is one there unnecessarily.

Regards

RIch Heilman

0 Kudos

Hi Jamie,

Can you please provide me with sample code??

Thanks,

Haritha

0 Kudos

Hi Rilch,

How do we go to Layout Management and delete the default one?

Thanks,

Haritha.

0 Kudos

Run the program and when the ALV is displayed, choose from the menu, Settings -> Layout -> Layout Management, here you can delete the layout or not set it to default.

Regards,

Rich Heilman

0 Kudos

Hi All,

It is working fine with grid display.

The problem is only when I am using List Display.

Any help??

Thanks,

Haritha

0 Kudos

Hi All,

Thanks a lot for all your help.

I could solve the problem

Haritha.