2012 Dec 20 5:22 AM
Hi !
My query is as below :
I am using FM "Reuse_alv_grid_display" for generating ALV. I have made few of my fields in ALV as editable. Now for a particular condition I need to grey out the editable fields. Please help.
Regards,
Madhwendra.
2012 Dec 20 6:58 AM
See the following example to put an cellof an alv editable.
http://wiki.sdn.sap.com/wiki/display/Snippets/ALV+-+Editable+grid+control
After understanding the example then modify your logic as based on logic given below.
if movemet type <> 104.
then make cell editable.
endif.
2012 Dec 20 5:24 AM
Hi!!
which fields u want's to Add in your Code ......
i Did n't Understand U query can u element me Actual What u want In Alv Report's
Warm's Regard
Mujeeb Ahmed
2012 Dec 20 5:30 AM
I have 8 ( like date, time, location, etc.) out of 30 fields of report as editable. There are two types of movement type 103 and 104. Now for movement type of 104 I want these 8 editable fields to be disabled, and user should not be able to fill in details in these. I hope it is clear now.
2012 Dec 20 5:34 AM
HI ,
use fieldcatalog as below.
wa_fieldcat-edit = 'X'
wa_fieldcat-outputlen = 10.
wa_fieldcat-f4availabl = 'X'.
wa_fieldcat-ref_table = 'BSEG'.
wa_fieldcat-ref_field = 'HKONT '.
use the required table we want to access data
DATA : it_fieldcat TYPE lvc_t_fcat, "SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
wa_fieldcat TYPE lvc_s_fcat,
gd_layout TYPE lvc_s_layo. "SLIS_LAYOUT_ALV,
DATA : lv_ref TYPE REF TO cl_gui_alv_grid,
gd_repid LIKE sy-repid.
DATA ls_stylerow TYPE lvc_s_styl . "WORKAREA
DATA lt_styletab TYPE TABLE OF lvc_s_styl . "LVC_T_STYL . "INTERNAL TABLE
CLEAR : ls_stylerow.
ls_stylerow-fieldname = 'COUNTRY' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "SET FIELD TO DISABLED
APPEND ls_stylerow TO lt_styletab.
CLEAR : ls_stylerow.
ls_stylerow-fieldname = 'PORTDISCHARGE' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "SET FIELD TO DISABLED
APPEND ls_stylerow TO lt_styletab.
CLEAR : ls_stylerow.
ls_stylerow-fieldname = 'INCOTERMS' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "SET FIELD TO DISABLED
APPEND ls_stylerow TO lt_styletab.
CLEAR : ls_stylerow.
ls_stylerow-fieldname = 'FORWARDER' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "SET FIELD TO DISABLED
APPEND ls_stylerow TO lt_styletab.
CLEAR : ls_stylerow.
ls_stylerow-fieldname = 'CHA' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "SET FIELD TO DISABLED
APPEND ls_stylerow TO lt_styletab.
CLEAR : ls_stylerow.
ls_stylerow-fieldname = 'SBNUM' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled. "SET FIELD TO DISABLED
APPEND ls_stylerow TO lt_styletab.
gd_layout-stylefname = 'FIELD_STYLE'.
gd_layout-zebra = 'X'.
use below function module with LVC
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'STATUS'
is_layout_lvc = gd_layout
it_fieldcat_lvc = it_fieldcat
i_save = 'X'
TABLES
t_outtab = it_j_1iexchdr
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.
E
2012 Dec 20 5:41 AM
hi,
in your itab add
line_color TYPE c LENGTH 4,
tstyle TYPE lvc_t_styl,
declare
DATA : g_style TYPE lvc_s_styl,
gs_layout TYPE lvc_s_layo.
LOOP AT itab.
IF your conditon
itab-line_color = 'C710'.
g_style-style = cl_gui_alv_grid=>mc_style_disabled.
APPEND g_style TO itab-tstyle.
MODIFY itab INDEX ind.
ENDIF.
ENDIF.
ENDLOOP.
layout should be
gs_layout-stylefname = 'TSTYLE'.
gs_layout-info_fname = 'LINE_COLOR'.
gs_layout-zebra = 'X'.
use
'REUSE_ALV_GRID_DISPLAY_LVC' to display.
for EX:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
i_callback_program = sy-repid
i_callback_pf_status_set = 'G_STATUS'
i_callback_user_command = 'USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout_lvc = gs_layout
it_fieldcat_lvc = it_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS_LVC =
it_sort_lvc = i_sort
* IT_FILTER_LVC =
* IT_HYPERLINK =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
is_variant = gs_variant
* IT_EVENTS =
* IT_EVENT_EXIT =
* IS_PRINT_LVC =
* IS_REPREP_ID_LVC =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP =
* I_HTML_HEIGHT_END =
* IT_ALV_GRAPHICS =
* IT_EXCEPT_QINFO_LVC =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab
* 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.
it works .
hope it helps,
Vinoth.
2012 Dec 21 6:07 AM
Hi Kumar,
Add field
DATA : field_style TYPE lvc_t_styl, "FOR DISABLE
in internal table to be displayed in ALV.
Then Set Layout attribues
gd_layout-stylefname = 'FIELD_STYLE'.
gd_layout-zebra = 'X'.
And below code before display of ALV using function module REUSE_ALV_GRID_DISPLAY_LVC
LOOP AT it INTO wa.
IF wa-mov_type EQ '104'.
** Below lines are repeated for all 8 fields
ls_stylerow-fieldname = 'A' . "A = field name
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
INSERT ls_stylerow INTO TABLE wa-field_style.
MODIFY it FROM wa.
ENDIF.
ENDLOOP.
2012 Dec 20 6:58 AM
See the following example to put an cellof an alv editable.
http://wiki.sdn.sap.com/wiki/display/Snippets/ALV+-+Editable+grid+control
After understanding the example then modify your logic as based on logic given below.
if movemet type <> 104.
then make cell editable.
endif.
2012 Dec 20 6:32 PM
Hi!!!
kindly check in Se 38 !!!! or call function module or else send me the screen short
with Standard reports
Warm's Regard ....
Mujeeb
2012 Dec 21 3:49 AM
Hello
Madhwendra
Better u can try to use AT EVENTS....in that u can set condition wt ever u want....
2012 Dec 21 4:24 PM
Hi Guys,
Thank you all for response. solutions provided are on OO ALV creation, but unfortunately I have build my report on classical ALV. If there is some availablein classical way, it would be more preferable.