2009 Mar 20 11:28 AM
Hi All,
Could You please tell hwo to handle line by line processing in ALV using OPPS.
I want to make some fields editable and not editable based on some other field value and show in output.
Thanks in Advance.
Regards,
Deepak
2009 Mar 20 11:42 AM
using field style u can do it
refer this sample program
LOOP AT it_ekko INTO wa_ekko.
IF wa_ekko-netpr is initial.
ls_stylerow-fieldname = 'NETPR' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
"set field to disabled
APPEND ls_stylerow TO wa_ekko-field_style.
MODIFY it_ekko FROM wa_ekko.
ENDIF.
ENDLOOP.
2009 Mar 20 12:30 PM
Declare one of the field of output table as , celltab TYPE lvc_t_styl.
Types : begin of t_output,
field 1....
field 2....
celltab TYPE lvc_t_styl, " Cell Properties
end of t_output.
Data : i_output type standard table of t_output, "internal table to display output
wa_output like line of i_output.
i_celltab TYPE lvc_t_styl, "internal table to enable or disable the fields
wa_celltab TYPE lvc_s_styl.
According to your condtion fill the i_celltab table.
wa_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
wa_celltab-fieldname = g_field. "Here pass the name of the field you want to disable
INSERT wa_celltab INTO TABLE i_celltab.
MOVE i_celltab TO wa_output-celltab.
WHILE PREPARING A LAYOUT ,PUT
grid_layout-stylefname = 'CELLTAB'.
CALL METHOD grid1->set_table_for_first_display
EXPORTING
is_layout = grid_layout
is_variant = g_variant
i_save = 'A'
CHANGING
it_outtab = i_output[]
it_fieldcatalog = i_fieldcat.
2009 Mar 20 1:16 PM
Hello Deepak
You may have a look at sample report ZUS_SDN_ALV_GRID_EDIT_1 in thread
Regards
Uwe