11-28-2008 11:11 AM
Hi Experts,
My requirement is,
I have kept a push button EDIT in screen and when ever a user presses the EDIT button by selecting one row in ALV grid dispay that row should be in change mode.
Please give reply.
Thanks in advance.
Regards,
Bala
11-28-2008 11:12 AM
Hi
go through the example BCALV_EDIT_01 to BCALV_EDIT_08
Thanks and regards
Ramchander Rao.K
01-30-2016 8:09 AM
11-28-2008 11:16 AM
you can make single row in alv edittable by specifying the style as enabled or disabled
please check the code below:
IF l_grid1-esid = text-023."c_total.
ls_stylerow-fieldname = 'DALLOC' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
ELSE.
ls_stylerow-fieldname = 'DALLOC' .
ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled.
ENDIF.
in this if the field name is 'total' the row will be non edittable otherwise it will be in edittable mode.
11-28-2008 11:49 AM
Hi Reshma,
Could you please explain clearly.
I am trying this but not getting.
PLz sent some code.
11-28-2008 12:00 PM
hi,
declare ls_stylerow as given below.
DATA ls_stylerow TYPE lvc_s_styl .
Also add new field to the internal table holding the data to be displayed in ALV .
data : begin of structure,
field1,
field2,
......,
......,
field_style TYPE lvc_t_styl,
end of structure.
then you fill the field catalog.
after filling the field catalog you check the condition for which you have to make the row edittable.
in your case,
loop at the internal table.
check whether the check box is selected for the field.
if check box is selected put the below code
ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled.
append ls_stylerow to <work area>-field_style.
modify internal table from work area.
else.
ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
append ls_stylerow to <work area>-field_style.
modify internal table from work area.
endif.
endloop.
i think this will help you.
12-01-2008 9:04 AM
11-28-2008 11:19 AM
hi
in resue_alv_list_display
you have layout variable will be there
it has following fields in its structure
no_colhead(1) type c, " no headings
no_hotspot(1) type c, " headings not as hotspot
zebra(1) type c, " striped pattern
no_vline(1) type c, " columns separated by space
no_hline(1) type c, "rows separated by space B20K8A0N5D
cell_merge(1) type c, " not suppress field replication
edit(1) type c, " for grid only
edit_mode(1) type c, " for grid only
numc_sum(1) type c, " totals for NUMC-Fields possib.
no_input(1) type c, " only display fields
f2code like sy-ucomm, "
reprep(1) type c, " report report interface active
no_keyfix(1) type c, " do not fix keycolumns
expand_all(1) type c, " Expand all positions
no_author(1) type c, " No standard authority check
PF-status
def_status(1) type c, " default status space or 'A'
item_text(20) type c, " Text for item button
countfname type lvc_fname,
so in this edit field is there
so populate its value as X
then u will be able to make it editable
11-28-2008 11:23 AM
Hi Bala,
May be you can program an EDIT button in your status GUI layout, so when the user selects one row and pushes that button, you have to "re-buid" the catalog setting INPUT field whith an X. You will have to do this for each field that you would like to be able to change.
DATA: ls_catalog TYPE slis_fieldcat_alv.
.....
.....
.....
ls_catalog-input = 'X'.
I hope it helps.
Regards,
MMP.
12-03-2008 12:22 PM
check this:
REPORT ZTEST_ALV_CHECK MESSAGE-ID ZZ .
TYPE-POOLS: SLIS.
DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
L_LAYOUT TYPE SLIS_LAYOUT_ALV,
X_EVENTS TYPE SLIS_ALV_EVENT,
IT_EVENTS TYPE SLIS_T_EVENT.
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
CHK(1),
color(4),
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
X_FIELDCAT-FIELDNAME = 'CHK'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 1.
X_FIELDCAT-INPUT = 'X'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-CHECKBOX = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-SELTEXT_L = 'VBELN'.
X_FIELDCAT-HOTSPOT = 'X'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 2.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-SELTEXT_L = 'POSNR'.
X_FIELDCAT-TABNAME = 'ITAB'.
X_FIELDCAT-COL_POS = 3.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_LAYOUT-info_fieldname = 'COLOR'.
*L_LAYOUT-ZEBRA = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IS_LAYOUT = L_LAYOUT
I_CALLBACK_PF_STATUS_SET = 'STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = IT_FIELDCAT
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.
*&----
*& Form STATUS
*&----
*text
*----
*-->P_EXTAB text
*----
FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
*Pf status
SET PF-STATUS 'STATUS'.
ENDFORM. " STATUS
*&----
*& Form USER_COMMAND
*&----
*text
*----
*-->R_UCOMM text
*-->RS_SELFIELD text
*----
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
DATA: GD_REPID LIKE SY-REPID, "Exists
REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
IF REF_GRID IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
E_GRID = REF_GRID.
ENDIF.
IF NOT REF_GRID IS INITIAL.
CALL METHOD REF_GRID->CHECK_CHANGED_DATA .
ENDIF.
loop at itab where chk = 'X'.
itab-color = 'C300'.
modify itab index sy-tabix transporting color.
endloop.
RS_SELFIELD-refresh = 'X'.
break-point.
ENDFORM. "USER_COMMAND
12-03-2008 12:43 PM
Hi Bala,
in the field catlog u give as below.
w_fact-row-no = 1.
w_fcat-edit = 'X'.
append w_fact to t_fcat.
Regards,
Flavya