cancel
Showing results for 
Search instead for 
Did you mean: 

Hide date in ALV when its value is initial...

Former Member
0 Kudos

Hi,

When the date is initial, I would like to hide the content of the cell:

The date is of type TIMESTAMP.

Any clues?

Thanks!

Regards,

Serge.

Accepted Solutions (0)

Answers (2)

Answers (2)

prajeshdesai
Contributor
0 Kudos

You may try wdy_attribute_format_prop,

set ls_att_format-null_as_blank = 'X'.

also have a look at Suppress leading zeros for ALV column | SCN

Hope this helps.

Former Member
0 Kudos

Hi Prajesh,

Where do you get this structure?

Thanks,

Serge.

prajeshdesai
Contributor
0 Kudos

I already gives you link,


data:

        lr_node_contract_items      TYPE REF TO if_wd_context_node,

        lr_node_info                TYPE REF TO if_wd_context_node_info.

data:

        ls_att_format               TYPE wdy_attribute_format_prop.

lr_node_contract_items = wd_context->get_child_node( name = if_componentcontroller=>wdctx_contract_items ).

lr_node_info = lr_node_contract_items->get_node_info( ).

ls_att_format-null_as_blank = 'X'.

lr_node_info->set_attribute_format_props(

    name = 'FIELDNAME'

    format_properties = ls_att_format

  ).

Hope this helps.

Former Member
0 Kudos

Hi Prajesh,

Unfortunately, it doesn't seem to work .

Thanks anyway,

Serge.

vinita_kasliwal
Active Contributor
0 Kudos

Hi Serge

You mean you want to hide content of that particular column or you want to hide the entire row ?

If the entire row then use delete where date is initial ?

Regards

Vinita

Former Member
0 Kudos

Hi Vinita,

No, I just want the cell to not display the value.

Thanks,

Serge.

vinita_kasliwal
Active Contributor
0 Kudos

Hi Serge

If field_name = '0000:00 ...'

clear field_name .

ENDIF

This does not work either?

Regards

Vinita

0 Kudos

Hi Serge,

Create a new attribute CELL type  WDUI_VISIBILITY in alv output node.

Then compare below code with your exisitng code  in WDDOINIT or WDDOMODIFYVIEW of view

LOOP AT lt_column INTO ls_column  .

     lo_column = ls_column-r_column.                        .

     CASE ls_column-id                                        .

       WHEN 'ERZET'  .

         l_column_header = lo_column->get_header( .

         CALL METHOD l_column_header->set_text

           EXPORTING

             value = 'Date'.

         CALL METHOD lo_column->create_header

           RECEIVING

             value = temp.

         CALL METHOD lv_value->if_salv_wd_column_settings~set_column_header_splitter

           EXPORTING

             value = '1'.

         DATA : lo_cell_v TYPE REF TO cl_salv_wd_uie.

         l_column_header->set_ddic_binding_field(

            if_salv_wd_c_column_settings=>ddic_bind_none )     .

         lo_cell_v = ls_column-r_column->get_cell_editor( ).

         CALL METHOD lo_cell_v->set_visible_fieldname

           EXPORTING

             value = 'CELL'.

       WHEN 'CELL'.

         CALL METHOD lo_column->set_visible(

           EXPORTING

             value = '00'

                     ).

     ENDCASE.

   ENDLOOP.

   DATA lo_nd_vbak TYPE REF TO if_wd_context_node.

   DATA lt_vbak TYPE wd_this->elements_vbak.

   DATA ls_vbak TYPE wd_this->element_vbak.

   lo_nd_vbak = wd_context->get_child_node( name = wd_this->wdctx_vbak ).

   lo_nd_vbak->get_static_attributes_table( IMPORTING table = lt_vbak ).

   LOOP AT lt_vbak INTO ls_vbak.

     IF ls_vbak-bnddt <> '20070930'.

       ls_vbak-cell = '02'.

     ENDIF.

     MODIFY lt_vbak FROM ls_vbak INDEX sy-tabix.

   ENDLOOP.

   lo_nd_vbak->bind_table( new_items = lt_vbak set_initial_elements = abap_true ).


Please check highlighted part...



Former Member
0 Kudos

Hi Vinita,

The field is of type TIMESTAMP, you cannot clear it .

Cheers,

Serge.

Former Member
0 Kudos

Hi Pranav,

If I got your code well, you're using a second property to control the visibility of the date column?

Funny! I would expect that Web Dynpro better handles this scenario.

If this is the only solution, it wouldn't be the first dirty coding I would provide to make it work instead of having it standard to the product!

Thanks!

Lind regards,

Serge.

0 Kudos

Hi Serge

Then change the output attribute type from TIMESTAMP to STRING.