on 06-25-2008 4:59 PM
Hi,
I want to make cell alignment in ALV.
I could able to do left and center alignment but not right alignment.
How to do the right alignment??
I'm using the below code:
data lr_salv_column type ref to cl_salv_wd_column.
lr_salv_column->SET_H_ALIGN( value = 1 ). "0 - right/ 1- center
Thankx,
Suba
Hi,
Please check these code:
DATA: LR_IF_CONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE,
LR_CMDL TYPE REF TO CL_SALV_WD_CONFIG_TABLE,
LR_COL TYPE REF TO CL_SALV_WD_COLUMN.
* get reference to the ALV model
LR_IF_CONTROLLER = WD_THIS->WD_CPIFC_ALV( ).
LR_CMDL = LR_IF_CONTROLLER->GET_MODEL( ).
* get column
LR_COL = LR_CMDL->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'ENDDA' ).
* set h.alignment
LR_COL->SET_H_ALIGN( '06' ).
Notes:
'06' = FORCED RIGHT
'05' = END OF LINE
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> Hi,
>
> .....
> * set h.alignment
> LR_COL->SET_H_ALIGN( '06' ).
>
>
>
> Notes:
> '06' = FORCED RIGHT
> '05' = END OF LINE
>
> Regards,{quote}
Just a word of warning. You should avoid coding the values directly. SAP can change these values at any time and we won't applogize if that breaks your application. 🙂 You should always use the class constants. This also makes your coding much more readable and maintainable. It also makes it easy to forward navigate and find all the possible values. For this example the class constants are CL_WD_TABLE_COLUMN=>E_H_ALIGN
Type defintion from CL_WD_TABLE_COLUMN:
begin of e_h_align,
auto type wdy_uie_library_enum_type value '00', " TableColumnHAlign.auto
center type wdy_uie_library_enum_type value '01', " TableColumnHAlign.center
forced_left type wdy_uie_library_enum_type value '04', " TableColumnHAlign.forcedLeft
end_of_line type wdy_uie_library_enum_type value '05', " TableColumnHAlign.endOfLine
forced_right type wdy_uie_library_enum_type value '06', " TableColumnHAlign.forcedRight
begin_of_line type wdy_uie_library_enum_type value '07', " TableColumnHAlign.beginOfLine
end of e_h_align .
So your coding should be:
LR_COL->SET_H_ALIGN( CL_WD_TABLE_COLUMN=>E_H_ALIGN-FORCED_RIGHT ).
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.