cancel
Showing results for 
Search instead for 
Did you mean: 

editable field should be come to non-editable(display) mode after action in alv

former_member223446
Active Participant
0 Kudos

Hi

I am using Editable ALV  in my application in webdynpro,date fields are editable .So I entered dates and   I click on Save  button.

I want to be date fields should come to non-editable.

code as below

*  Declare ALV config table

   DATA: alv_config_table  TYPE REF TO cl_salv_wd_config_table.

   DATA: wd_table_usage TYPE REF TO if_wd_component_usage.

* Create an instance of ALV component created ALV_COMP is usage name

   wd_table_usage = wd_this->wd_cpuse_alv_task( ).

   IF wd_table_usage->has_active_component( ) IS INITIAL.

     wd_table_usage->create_component( ).

   ENDIF.

*ALV Settings.

* Get ALV component

   DATA: wd_table TYPE REF TO iwci_salv_wd_table.

   wd_table = wd_this->wd_cpifc_alv_task( ).

   alv_config_table = wd_table->get_model( ).

* Declare variable to store column details

   DATA: column_settings TYPE REF TO if_salv_wd_column_settings,

         column          TYPE REF TO cl_salv_wd_column.

   column_settings ?= alv_config_table.



DATA lr_input TYPE REF TO cl_salv_wd_uie_input_field.

   CREATE OBJECT lr_input

     EXPORTING

       value_fieldname = 'PLANNEDSTARTDATE'.

   column = column_settings->get_column( 'PLANNEDSTARTDATE' ).

   column->set_cell_editor( value = lr_input ).

*


Accepted Solutions (0)

Answers (2)

Answers (2)

vinita_kasliwal
Active Contributor
0 Kudos

Hi Kiran

I am not sure on how the system would know that the user has finished editing ?

Generally I use a EDIT button to make the fields editable and a Save button which when clicked should make the fields read only

Is that an option for you ?

Regards

Vinita

Szczerbowski
Active Participant
0 Kudos

Well, you confirm with Enter key, or the roundtrip occurs because of another event (button pressed etc).

former_member223446
Active Participant
0 Kudos

Hi

As shown in the figure.after the enter the date values in start date and end date and select the line in alv and then press save button.

so data saved in database table..here i want both dates fields should be non-editable.

hope this clears the requirement.

and also i want to know how to select all rows in alv at atime.

Szczerbowski
Active Participant
0 Kudos

Then you have the answer in my earlier post.

Szczerbowski
Active Participant
0 Kudos

Or you can also check out method SET_READ_ONLY of the  if_salv_wd_table_settings interface:

  lr_table_settings ?=  wd_this->wd_cpifc_result_table( )->get_model( ).

  lr_table_settings->set_read_only( abap_true ).

former_member307359
Participant
0 Kudos

Then in method SAVE you can write the below code.

Get all ALV report data. Loop it, if (start date and end date is not initial)


lr_input->set_read_only_fieldname( name ='READONLY' ).


For reference use it


Szczerbowski
Active Participant
0 Kudos

Then you can create an Read-only attribute in the structure where you keep the data value with the same name for example DATE_RO, bind it to the readonly control of the field:

lr_input->set_read_only_fieldname(  'DATE_RO' ).

And later when the value of DATE is not initial control the value of this field readonly field:

           lr_element->set_attribute( EXPORTING name  =     'DATE_RO'

                                                value =     lv_readonly ).  " true/false