09-28-2008 5:11 PM
Hi,
I am using ABAP OO to Write and ALV header list. How do we center the commentary written above?
*Write Header Commentary
DATA :
l_oref_grid TYPE REF TO cl_salv_form_layout_grid.
* Add text items for top of page
*CREATE OBJECT l_oref_grid.
perform get_coaddr changing l_tmpstr.
l_oref_grid->create_text(
row = 1 column = 1 text = l_tmpstr ).
l_tmpstr = TEXT-003.
l_oref_grid->create_text(
row = 2 column = 1 text = l_tmpstr ).
How do I modify the elements written to center it instead of the default Left-aligned?
09-28-2008 8:36 PM
Hello Mizan
Perhaps the following approach might work:
DATA: lo_column TYPE REF TO CL_SALV_FORM_GRID_COLUMN.
lo_column = l_oref_grid->get_column( column = 1 ).
CALL METHOD lo_column->set_h_align
EXPORTING
value = IF_SALV_FORM_C_H_ALIGN=>CENTER.
Regards
Uwe
09-28-2008 8:36 PM
Hello Mizan
Perhaps the following approach might work:
DATA: lo_column TYPE REF TO CL_SALV_FORM_GRID_COLUMN.
lo_column = l_oref_grid->get_column( column = 1 ).
CALL METHOD lo_column->set_h_align
EXPORTING
value = IF_SALV_FORM_C_H_ALIGN=>CENTER.
Regards
Uwe
09-28-2008 9:06 PM
Thank you Uwe,
That was just what I was looking for. was trying to figure out using SET_H_ALIGN from CL_SALV_FORM_LAYOUT_DATA_GRID but was not successful.
Regards,
Mizan.
09-29-2008 4:15 AM
Hello Mizan
I have never used these classes before but my instinct told me to search this way because in the new ALV object model virtually everything has become an object:
- centered text => column with this property => found GET_COLUMN method (CL_SALV_FORM_GRID_COLUMN)
=> and here I could not miss the reqiured method
This is a general approach will should be useful for the new ALV object model as well as other classes where we can expect class composition.
Regards
Uwe