cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Key Field Control

Former Member
0 Kudos

Hi Expert,

I would like to use my ALV Editable screen control as Table control, where all key field gets read-only at the time you press enter. Now entire row should still be editable but the key field. Also in editable ALV, if new entry is appended from its toolbar key field should not be the read-only field till the time user fill a valid entry.

Please help.

Thanks in Advance,

Pritam

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

make reference to these documents: All 3's are related and 1 and 2 are a continuation.

link: [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0625002-596c-2b10-46af-91cb31b71393]

link: [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b?quicklink=index&overridelayout=true ]

link: [https://wiki.sdn.sap.com/wiki/display/WDABAP/How%20to%20edit%20conditionally%20row%20of%20a%20ALV%20table%20in%20Web%20Dynpro%20for%20ABAP]

thanks!

Jason PV

Former Member
0 Kudos

Hi Pritam Kunal,

For this you simply insert a attribute (VALID_ENTRY) in same node of type WDY_BOOLEAN.

on enter check the entry and if the entries are valid make this attribute as abap_true.

In Method where you Initialize the alv bind the attibute property READ_ONLY for key field to that attribute.

This will make your key fields read only on pressing enter for all valid entries in ALV.



  lr_key_field1->set_read_only_fieldname( 'VALID_ENTRY' ).

Regards,

Nawal Kishor Mittal

Former Member
0 Kudos

Hello Nawal,

Thanks for the response. but i am unable to get the point how do we call the method set_read_only_fieldname. and lr_key_field is the instance of what? I dont think it is an alv instance.

If you can describe it in a bit more, it will be good..

Thanks in Advance,

Pritam Kunal

Former Member
0 Kudos

Hi Pritam ,

this code you have to write where you define your alv or you can say where you code for creating alv.

if your key field is of type input field say you have key fields named KEY_FIELD1 , KEY_FIELD2 ... .

make an additional attribute VALID_ENTRY of type WDY_BOOLEAN to same node on which ALV is created.



  DATA lr_key_field1  TYPE REF TO cl_salv_wd_uie_input_field.

* Get column of ALV
 lo_column = lo_column_settings->get_column( 'KEY_FIELD1' ).

* Make column of type input field
  CREATE OBJECT lr_key_field1
    EXPORTING
      value_fieldname = 'KEY_FIELD1'.

lo_column->set_cell_editor( lr_key_field1 ).

* Make column read only based on VALID_ENTRY attribute 
lr_key_field1->set_read_only_fieldname( 'VALID_ENTRY' ).

Make a method in same view with event ON_CELL_ACTION of ALV.

Now when you press enter the control goes to that method here you can write your code to valiudate data and set attribute VALID_ENTRY to abap_true for all valid entries which automatically makes your key fields as read only.

Hope you will achieve the desired result.

Regards,

Nawal Kishor Mittal