Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Lost Focus Event - ALV CELL Conditionally Editable

former_member334499
Participant
0 Kudos
606

Team,

I have  a requirement . I have  a ALV grid having 5 fields .  A,B,C,D,E,F

The column F is non editable in the initial load itself.

The  cells of Column F needs to be  made editable for certain rows.

For Eg  In a row if the field E has value 200  the cell F of that row alone needs to be edited.

When user keys in data..Some what like a lost focus event  of  the CELL  E this needs to be done ...User type in value 200 and leave that cell

and then itself the cell F becomes editable

Can any suggest How this can be done.

Regards

Mandan

2 REPLIES 2

ray_houston
Discoverer
0 Kudos
155

In a nutshell, you need to add a field to your table, of type LVC_T_STYL. This field will be a table for each record of your table that you can populate with entries for multiple fields in your structure with indicators for various things, such as editable or not. You also have to "tell" the ALV about this field when initially calling the grid (FM or class.) (You don't have to add all table fields to this table, just those that need to have different attributes for a row than the default for the field/column.)

Search for LVC_T_STYL and LVC_S_STYL and you should find lots of posts on the topic. Here are two example posts:

Are you using function 'REUSE_ALV_GRID_DISPLAY_LVC' or class CL_GUI_ALV_GRID for your ALV?


If the function, then you can see example here:


Disable or Enable Input fields Conditionally In ALV - Code Gallery - SCN Wiki

If using class ALV, see example here:

ALV functionality using OOPS - Code Gallery - SCN Wiki

Note, if you need this to change on the fly as the user changes other fields, without waiting for a refresh event, you may need to look into the DATA_CHANGED event of the ALV grid.

Regards,

Ray

0 Kudos
155

Hi Ray/team,

I have two cells in ALV   myname , mydate

myname

one of them is editable initially and i have set it to non editable using style and using this  mc_style_disabled. The cell is disabled but allows input via search help

mydate

In second cell it is non editable initially  sing this  mc_style_disabled.

and it is enabled later  using  mc_style_enabled.

The value selected via associated search help doesn't come in to cell.

In field catalog the  as_fieldcat-edit = 'X'.

can  any  advise

Reg

Mandan