08-01-2006 4:03 PM
Can i make a field editable at runtime depending on the field value in some other field.
e.g. i have an internal table with fields A and B. and if value of field A is x then B should be editable if it is y then should not be.
08-01-2006 4:07 PM
Hi Amol Dubal ,
Good
Check out the following code
should work fine
report zk_ex008.
*
type-pools: slis.
TABLES : ZAK_EMPLIST.
Data to be displayed
data: itab_show type table of zak_emplist.
data: gs_layout type slis_layout_alv.
----
Selection
select * from zak_emplist into corresponding fields of table itab_show.
Eingabebereit
gs_layout-edit = 'X'.
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = 'ZK_EX008'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'ZAK_EMPLIST'
is_layout = gs_layout
tables
t_outtab = ITAB_SHOW.
form user_command using r_ucomm type sy-ucomm
rs_selfield type slis_selfield.
if r_ucomm = '&DATA_SAVE'.
message i000(0k) with text-001.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'ZAK_EMPLIST'
tables
t_outtab = ITAB_SHOW.
endif.
endform.
check out the following link for more information
[Removed by the moderator.]
Good luck and reward me for the same
Thanks
Ashok
08-01-2006 4:07 PM
Hi Amol Dubal ,
Good
Check out the following code
should work fine
report zk_ex008.
*
type-pools: slis.
TABLES : ZAK_EMPLIST.
Data to be displayed
data: itab_show type table of zak_emplist.
data: gs_layout type slis_layout_alv.
----
Selection
select * from zak_emplist into corresponding fields of table itab_show.
Eingabebereit
gs_layout-edit = 'X'.
Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = 'ZK_EX008'
i_callback_user_command = 'USER_COMMAND'
i_structure_name = 'ZAK_EMPLIST'
is_layout = gs_layout
tables
t_outtab = ITAB_SHOW.
form user_command using r_ucomm type sy-ucomm
rs_selfield type slis_selfield.
if r_ucomm = '&DATA_SAVE'.
message i000(0k) with text-001.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'ZAK_EMPLIST'
tables
t_outtab = ITAB_SHOW.
endif.
endform.
check out the following link for more information
[Removed by the moderator.]
Good luck and reward me for the same
Thanks
Ashok
08-01-2006 4:17 PM
Hi,
You can have a look at the example programs named <b>BCALV_EDIT_**.</b>
Regards,
Santosh
08-01-2006 4:11 PM
08-01-2006 4:32 PM
Hi ,
Yes you can do that. Just check this sample code, it will help you lot in this code i did it for row 6, but in your case for the rows which you want you have to do the same logic.
"{FOR DISABLE HERE 6ROW IS DISABLED
SY-TABIX = 6.
LS_EDIT-FIELDNAME = 'VBELN'.
LS_EDIT-STYLE = cl_gui_alv_grid=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 10.
INSERT LS_EDIT INTO TABLE LT_EDIT.
LS_EDIT-FIELDNAME = 'POSNR'.
LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
LS_EDIT-STYLE2 = SPACE.
LS_EDIT-STYLE3 = SPACE.
LS_EDIT-STYLE4 = SPACE.
LS_EDIT-MAXLEN = 6.
INSERT LS_EDIT INTO TABLE LT_EDIT.
INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB TRANSPORTING
HANDLE_STYLE .
X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
"} UP TO HERE
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT_LVC = X_LAYOUT
IT_FIELDCAT_LVC = IT_FIELDCAT
TABLES
T_OUTTAB = IT_VBAP[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.]]>
Regards
vijay D T T.