cancel
Showing results for 
Search instead for 
Did you mean: 

Table and TableColumn Alignment Issue

ged_hurst
Participant
0 Kudos

Hello everyone,

I've created 2 table in a webdynpro view and here's the coding in the WDMODIFYVIEW:


 tbl_alerts ?= view->get_element( 'TBL_ALERTS' ).
    tbl_alerts->set_fixed_table_layout( abap_true ).
    tbl_alerts->set_width( '1000px' ).
    tbl_alerts ?= view->get_element( 'TBL_CONTRACT_LIST' ).
    tbl_alerts->set_fixed_table_layout( abap_true ).
    tbl_alerts->set_width( '1000px' ).

    tbl_column ?= view->get_element( 'TBL_ALERTS_GROUPNO' ).
    tbl_column->set_width( '200px' ).
    tbl_column ?= view->get_element( 'TBL_ALERTS_BEZEI' ).
    tbl_column->set_width( '600px' ).
    tbl_column ?= view->get_element( 'TBL_ALERTS_QUANTITY' ).
    tbl_column->set_width( '200px' ).

    tbl_column ?= view->get_element( 'TBL_CONTRACT_LIST_DARTXT' ).
    tbl_column->set_width( '200px' ).
    tbl_column ?= view->get_element( 'TBL_CONTRACT_LIST_DOKNR' ).
    tbl_column->set_width( '600px' ).
    tbl_column ?= view->get_element( 'TBL_CONTRACT_LIST_DOKVR' ).
    tbl_column->set_width( '200px' ).

We have therefore two tables onto the screen and I'm trying to have their columns aligned.

However the columns of the first table are not aligned to the column of the second table.

Could anybody throw some light on this?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi.,

It depends on the Type of Data Element for the Column., Also Use the same Layout for both Tables., Keep it in same Container.,

check this wiki: [Create Dynamic UI in WDA.|http://wiki.sdn.sap.com/wiki/display/WDABAP/CreatingUIElementsDynamicallyinAbapWebdynpro+Application]

also check DEMODYNAMIC WD Application.

hope this helps u.,

Thanks & Regards,

Kiran

ged_hurst
Participant
0 Kudos

These tables have been created statically but their columns are changed dynamically in the modifyview just to make sure that their width is exactly as it's meant to be.

However their layout doesn't align at all.

The texteditor used by all of the cells in all of the tables is TextView and, obviously, being different table the column types are different. Can this be the problem?

Also, even if I set the width explicitly to 1000px for both the tables, they have different width at runtime. Why is that?

Edited by: Development Themis on May 27, 2011 10:04 AM

Lukas_Weigelt
Active Contributor
0 Kudos

does it even work with '1000px ? Shouldn't it be '1000' ?

ged_hurst
Participant
0 Kudos

Hi,

I'm afraid I can't make you out?

Lukas_Weigelt
Active Contributor
0 Kudos

Sorry for that half sentence

My point is, I have been doing what you try to accomplish and it does work for me (I'm unsure whether we have the exact same requrement though). Here's what I do:

DATA l_table TYPE REF TO cl_salv_wd_config_table.
  DATA l_column TYPE REF TO cl_salv_wd_column.
  DATA l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

  l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
  IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
  ENDIF.

  *l_column = l_table->if_salv_wd_column_settings~get_column( 'BEGDA' ).*
  *l_column->set_width( '90' ).*

  l_table->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).

Considering your code, I was merely confused whether it really works with the suffix px as in 1000 px instead of the mere number 1000 (like I do it).

hope this clarified )

regards, Lukas

Edited by: Lukas Weigelt on May 27, 2011 4:48 PM

ged_hurst
Participant
0 Kudos

Hi,

firstly I'm not using an ALV table; secondly whenever a fixed value is entered (like 1000) it's basic unit of measure is assumed to be pixels.

In any case my tables are still not aligning, they seem to have a mind of their own, which is pretty odd to me.

Any other ideas or suggestions to align two tables with 3 columns each (but different content / data types for their columns)?

Former Member
0 Kudos

Hi,

You can try setting with with as mentioned above using px. and

you can also use directly by like '1000' or '20%' like that you can try.

Cheers,

Kris.

ged_hurst
Participant
0 Kudos

Hi,

I've tried to set the width of the tables to 1000px or to 100%.

When I set the table width to 100% both tables span across the screen and have the same width (but their columns are not aligned even when I set the columns width to 200px-600px-200px or 20%-60%-20%)

When I set the table width to 1000px the tables have different width on the screen (I was expecting them to occupy the same estate because they have fixedLayout property set to true). How come? Isn't this a bug?

Lukas_Weigelt
Active Contributor
0 Kudos

Hi,

first of all, it's irrelevant whether it's ALV-Grid or a normal table, it's the same concept.

1. Set the width of the Column the way I stated it in my earlier post.

2. Set the TABLE SETTING LAYOUT FIXED (_not_ column settings layout fixed, it doesn't have any effect) TRUE as I also stated in my earlier post...

l_table->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).

this must work.

cheers, Lukas

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can do this by first setting the fixed table layout to true. The all the coloumns should have the same width. Do not try giving the table width. Just give the columns width for which u want to align.

Thanks

ROhit

Former Member
0 Kudos

I would not attempt to do that , i have not succeed in that. I wounder if it is possible at all.