cancel
Showing results for 
Search instead for 
Did you mean: 

Custom ALV

Former Member
0 Kudos

Hi all,

I'm new to WDA and I'm trying to use ALV (SALV_WD_TABLE).

I have a few questions regarding customizing the display:

1. How do I show only part of the node attributes?

(The node has 5 attributes and I only want to show 3)

2. How do I change the default column headers?

3. How do I set the order of column appearance?

Tnx,

Aviad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Using the column settings you can hide the columns, set the column headers, and their positions also.

* Instantiate the used component
  DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
 
  lo_cmp_usage =   wd_this->wd_cpuse_usg_alv1( ).
  IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
  ENDIF.
 
* Get Model
  DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  lo_interfacecontroller =   wd_this->wd_cpifc_usg_alv1( ).
 
  DATA lo_value TYPE REF TO cl_salv_wd_config_table.
  lo_value = lo_interfacecontroller->get_model(
  ).

DATA  lt_column_settings TYPE REF TO if_salv_wd_column_settings.
  lt_column_settings ?= lo_value.


 DATA: lr_col_header  TYPE REF TO cl_salv_wd_column_header .

  DATA: lt_columns TYPE salv_wd_t_column_ref ,
              ls_columns TYPE salv_wd_s_column_ref ,
             lr_column type ref to cl_salv_wd_column.

   lt_columns = lt_column_settings->get_columns( )              .
 
  LOOP AT lt_columns INTO ls_columns .
  lr_column = = ls_columns-r_column.
    CASE ls_columns-id                                        .
      WHEN 'PERNR'                                            .
        lr_column_header = ls_columns-r_column->get_header( )  .
        lr_column_header->set_ddic_binding_field(
           if_salv_wd_c_column_settings=>ddic_bind_none )     .
         lr_column_header->set_text('Emp Id' )            . 
      lr_column->set_position( 1).

      WHEN' NAME1'.
      lr_column->set_position( 2).    "Set position
........ 

when 'NAME2'.
          CALL METHOD lr_column->set_visible
            EXPORTING
              value = cl_wd_uielement=>e_visible-none.    "Hide column
  

       WHEN OTHERS.
........
 
ENDLOOP.

Regards,

Lekha.

Answers (1)

Answers (1)

kkram
Contributor
0 Kudos

There were some blogs written by 'Claudia Dangers ' on how to use ALV model class to influence the behavior of the ALV, instead of using a mere component usage. Search for these blogs in SDN and you will understand the inner workings of ALV component. I am sure that would be more helpful than a sample code.

KK