Application Development and Automation 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: 
Read only

Function Module to edit the ALV Output

Former Member
0 Kudos
970

Hi,

I have an ALV report output.I need the edit values based on some conditions in the ALV output and

save the changes. Is there any function module to edit the output and proceed further.

Thanks in advance.

Regards,

Navas

6 REPLIES 6
Read only

naveen_inuganti2
Active Contributor
0 Kudos
356

This message was moderated.

Read only

Former Member
0 Kudos
356

This message was moderated.

Read only

Former Member
0 Kudos
356

at fieldcatalog level u can give edit = 'X'.

if the value is correct then u can give the code as

ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.

please reply if u need further details

Edited by: Jansi Dorai on Apr 3, 2009 9:31 AM

Read only

Former Member
0 Kudos
356

hi !

you can try one thing while creating field give the condition and with that if that codition speified

then in that fieldcat give ls_fieldcat-edit = 'X'.

it is used to edit that field only

and to save the ghanges in your internal table use following code

data : ref_grid type ref to cl_gui_alv_grid. "new

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.

Read only

Former Member
0 Kudos
356

hi,

please see this demo program

bcalv_edit_04

thanks

Read only

sarbajitm
Contributor
0 Kudos
356

First create the field catalog of the field that you want to edit in this way

WA_fieldcat-fieldname = 'MENGE'.

WA_fieldcat-qfieldname = 'MEINS'.

WA_fieldcat-seltext_m = 'PO Quan.'

WA_fieldcat-edit = 'X' .

Secondly you keep a custom button like 'SAVE' in the toolbar and also try to keep a checkbox in your ALV.

for checkbox you have to keep a following code snippet in your finallly displayed interanal table:

chk(1) TYPE c, and in the fieldcatalog you have to write following piece of code

WA_fieldcat-fieldname = 'CHK'.

WA_fieldcat-seltext_m = 'CheckBox'.

WA_fieldcat-checkbox = 'X'.

WA_fieldcat-edit = 'X' .

WA_fieldcat-input = 'X'.

WA_fieldcat-tabname = 'IT_FINAL'.

WA_fieldcat-col_pos = 1.

then you have to set the parameter i_callback_user_command = 'USER_COMMAND'

of FM REUSE_ALV_GRID_DISPLAY.

Then write a subroutine like the following one to handle the SAVE operation

FORM user_command USING I_r_ucomm LIKE sy-ucomm

rs_selfield TYPE slis_selfield.

DATA:l_cntr TYPE i.

CASE I_r_ucomm.

WHEN '&ZXZ'.

CLEAR l_cntr.

CLEAR WA_final.

LOOP AT IT_final INTO WA_final.

IF WA_final-chk = 'X'.

l_cntr = l_cntr + 1.

ENDIF.

ENDLOOP.

IF l_cntr GT 1.

MESSAGE i011.

ELSEIF l_cntr = 1.

READ TABLE IT_final INTO WA_final WITH KEY chk = 'X'.

MODIFY IT_final FROM WA_final TRANSPORTING menge

WHERE chk = 'X'.

CLEAR WA_final.

PERFORM disp_alv. <<<This is to display the refreshed alv after saving your data

endif.

ENDCASE.

ENDFORM.