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 with fewer columns than in struct

former_member457420
Participant
0 Kudos

Hi all,

I do have to create a structure in ABAP dictionary with 26 fields.Apart from the first 2 fields all others are numeric fields of type int.

The reasoning behind such a structure is the rest of the 24 field are months from say years -2008 and 2009 (Jan-Dec)

An itab is created with regard to this structure.

The first 2 fields in the itab will always be filled.

Have to pass this structure and the itab created from it to ALV(cl_gui_alv_grid) for display and situations could arise so that

- all these itab fields are filled.So naturally I want to display all the fields in ALV display. Could that be a problem?

- Could also be possible that after the first 2 fields in the itab is filled, the itab columns are filled intermittantly(That is to say only some fields or months are filled and some not for the whole of itab).

Then when the ALV is displayed I want to see only columns or months that are filled in the itab?How could that be possible.

- want to change the ALV col headers dynamically(at runtime).Is there a way to do it?

If I have to change the field catalog for these things,which is the field in the field catalog that I should take care of.....

Thanks

P

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

If the internal table has some empty fields that values will be empty when displayed in the alv. so that will not be a problem. then displaying only fields that has value, i donot think will be possible in alv b'coz field a will have value for record a, but field b will have value only for record b and not record a. so when u display it on alv, both fields will be displayed and value for field a for record b will be empty only.

there r options if u donot want to display in alv. hope that helps.

Regards,

Kavitha Kraj

5 REPLIES 5

Former Member
0 Kudos

Hi,

If the internal table has some empty fields that values will be empty when displayed in the alv. so that will not be a problem. then displaying only fields that has value, i donot think will be possible in alv b'coz field a will have value for record a, but field b will have value only for record b and not record a. so when u display it on alv, both fields will be displayed and value for field a for record b will be empty only.

there r options if u donot want to display in alv. hope that helps.

Regards,

Kavitha Kraj

Former Member
0 Kudos

Hi,

All that you have asked for can be coded using some logic that can be applied on the internal table. You can check if a particular column is completely empty or if a row has the other 24 fields filled or empty.

You could probably then hide those columns using the no_out attribute of the field catalog.

0 Kudos

"no_out attribute" in field catalog .Thats what I wanted thanks....

Is it possible to change the col header also using the field catalog?

0 Kudos

Hi, You can use COLTEXT component to set column heading of your ALV. NO_OUT can be used to hide a particular column in ALV.Check out lvc_t_fcat for more . lvc_t_fcat is a table type. It refers to structure LVC_S_FCAT .You will be having all the components in this structure using which you can play with ALV. Regards, Lakshman.

Edited by: Lakshman N on Mar 11, 2010 11:28 AM

0 Kudos

Thanks .....