cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro for ABAP Tutorial 7 - Column Coloring in ALV

Former Member
0 Kudos

Hi Dear All,

When I go through this tutorial to get the knowledge of ALV, I encounter some issues. Could any one give me some hints. Thank you so much.

   I do not find ' Method Call' in Wizard in the method WDDOINIT. As the screen shot below, in my code wizard I can not find it.

   So I write the codes as in the tutorial, like

   DATA: lv_columns TYPE salv_wd_t_column_ref.

   DATA: wa_cols    TYPE salv_wd_s_column_ref.

   CALL METHOD lv_value->if_salv_wd_column_settings~get_columns

     RECEIVING

       value = lv_columns.


But when I tried to change the color of the column it informs me the error message 'Type "CL_WD_TABLE_COLMUN" is unknown'


   LOOP AT lv_columns INTO wa_cols.

     CASE wa_cols-id.

       WHEN 'MATNR'.

         CALL METHOD wa_cols-r_column->set_cell_design

           EXPORTING 

             value = cl_wd_table_colmun=>e_cell_design-one.

     ENDCASE.

   ENDLOOP.


Regards

Jay



Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Jay,

There is spelling mistake, So the error

        CALL METHOD wa_cols-r_column->set_cell_design

           EXPORTING

             value = cl_wd_table_colmun=>e_cell_design-one.


Modify as below


        CALL METHOD wa_cols-r_column->set_cell_design

           EXPORTING

             value = cl_wd_table_column=>e_cell_design-one.

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

Thank you for your help. You are right, it is a spelling mistake. May I ask you one more question. I set the itab to have three fields to be displayed. Also in the context of componentcontroler, I just put three fields, but when I test it, it has all the fileds of MARA.  I'm not sure anything I missed?

Regards

Jay

ramakrishnappa
Active Contributor
0 Kudos

Hi Jay,

As you are used MARA structure for context node creation, alv component picks up all its fields as columns.

I suggest you the below points

Option1:

  • Go to component controller's context tab
  • Click on Node and delete the structure name as shown below

    

Now, alv should have only the attributes which you have added in the context node.

Option 2:

          You can hide other columns by using code while alv configuration

          Sample:


   LOOP AT lv_columns INTO wa_cols.

     CASE wa_cols-id.

       WHEN 'MATNR'.

         CALL METHOD wa_cols-r_column->set_cell_design

           EXPORTING

             value = cl_wd_table_colmun=>e_cell_design-one.


      WHEN 'MTART' OR 'MATKL'.


     WHEN others.

               wa_cols-r_column->set_visible( value = CL_WD_UIELEMENT=>E_VISIBLE-NONE ).

     ENDCASE.

   ENDLOOP.

The above code hides which are not required.

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

It works for both two solutions.   Thank you so much!

Regards

Jay

ramakrishnappa
Active Contributor
0 Kudos

Good to hear

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi,

Which Netweaver version you are on?

use the type of column as cl_salv_wd_column

data lr_column type ref to cl_salv_wd_column.

LOOP AT lv_columns INTO wa_cols.

  lr_column = wa_cols-r_column.   " Convert ref to cl_salv_wd_column

     CASE wa_cols-id.

       WHEN 'MATNR'.

         CALL METHOD lr_column->set_cell_design

           EXPORTING

             value = cl_wd_table_column=>e_cell_design-one.

     ENDCASE.

   ENDLOOP.

hope this helps,

Regards,

Kiran