cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic amount of visible rows in ALV

former_member94854
Participant
0 Kudos

Hi there,

I would like to have an ALV displaying the row amount according to the amount of entries (10 entries in the list -> 10 visible rows). So no ALV-Scrolling is needed. Is there a possibility how to achieve that? The best would be if there is already existing ALV functionality which has to be swithed of via a flag or something like that. Can you provide any help?

Kind regards,

Albert

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Albert,

in "Quick tips and tricks on Web Dynpro for ABAP u2013 How to use ALV and Pop ups"

there is a way how you can set it. Have a look at page 4 -> "Automatically set number of visible rows to number of items."

[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4]


DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
u201Dget reference of table settings by cast
 lr_table_settings ?= wd_this->r_table .
 lr_table_settings->set_visible_row_count( -1 ). 
 lr_table_settings->set_footer_visible( 0 ).

Maybe this can help you.

Regards,

Andreas

Former Member
0 Kudos

Yeah, you can do that using the method set_visible_row_count in the interface if_salv_wd_table_settings. When you get the data to be bound to the ALV, you can get a count of the rows in the internal table and pass that to this method.

Regards,

Nithya

former_member94854
Participant
0 Kudos

Hi Hithya,

I know that there is this possiblity, but I need something different. It shouldn't be triggered by my component, but from the ALV itself. That would be the best. Imagine the following scenario:

I have a sperate component using the alv. Another component uses my alv encapsulation. The context has an interface node which is filled by the using component. So every time it is filled, the using component would have to set the row amount, or I would define a logic in my ALV encapsulation in the WDDOMODIFYVIEW which changes the alv setting every time the amount of the entries changes.

So in my opinion it would better or more centralized if the alv would provide such a functionality. Can you see my point of view.

Kind regards,

Albert

Former Member
0 Kudos

Have the reference to the ALV model (cl_salv_wd_config_table) as an attribute in the component controller, and set it when you initialize the ALV. Define an interface method in your component SET_ROW_COUNT or something like that, which will call the set_visible_row_count method on the ALV model. Call this interface method from your using component. I hope this is what you are looking for.

Regards,

Nithya

former_member94854
Participant
0 Kudos

Hi Nithay,

this is all manual setting of the visible row count, but I don't want that, because I have many places and many alv encapsulations. I don't want to set amount manually. I would be great if the ALV interface would provide a possiblity to activate or deactivate such a function, which is handled then by the ALV itself.

Kind regards,

Albert

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi Nithay,

>

> this is all manual setting of the visible row count, but I don't want that, because I have many places and many alv encapsulations. I don't want to set amount manually. I would be great if the ALV interface would provide a possiblity to activate or deactivate such a function, which is handled then by the ALV itself.

>

> Kind regards,

> Albert

Be it as it may, that functionality simply doesn't exist within the ALV currently. You are left to code such functionality yourself as already described.