2007 Sep 04 8:33 PM
Is it possible to edit a cell in the ALV grid display using function modules.?Or Abap objects are the only option.
I have a big internal table and , the user should be able to view it and also enter value in an empty field and the program should get the entered value perform a simple subtraction and then display the new value.
2007 Sep 04 8:37 PM
Yes it is possible for an edidtable ALV report and you would not need any special coding.
The normal function modules will take care of it.
Shrerekant
2007 Sep 04 8:37 PM
Hi Krish,
When you are preparing the field catalog for the ALV, in the export parameters, you will get a flag for input enabled..
You will need to check that flag for the field which you want to make input enabled..
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 04 8:37 PM
Yes it is possible for an edidtable ALV report and you would not need any special coding.
The normal function modules will take care of it.
Shrerekant
2007 Sep 04 8:46 PM
Hi,
Use this function module:
'REUSE_ALV_LIST_DISPLAY'
In the fieldcat parameter pass the field catalog table..
When appending a field to the field catalog table.. do this:
Workarea for table i_fieldcat
DATA : e_fieldcat TYPE slis_fieldcat_alv.
Clear table header and work area
CLEAR : e_fieldcat .
Append the values
e_fieldcat-col_pos = p_pos .
e_fieldcat-fieldname = p_field .
e_fieldcat-seltext_l = p_lable .
e_fieldcat-seltext_m = p_lable .
e_fieldcat-seltext_s = p_lable .
e_fieldcat-input = 'X'.
e_fieldcat-outputlen = p_len .
APPEND e_fieldcat TO i_fieldcat.
Thanks and Best Regards,
Vikas Bittera.
2007 Sep 04 9:13 PM
Thankyou Vikas ,
It seems that it can be edited, but a question , how to retrieve what has been entered - perform validations and then again display it on screen.
If you can share your knowledge on this , it will be great
2007 Sep 04 9:18 PM
you can do all your validation in the user command.
*----------------------------------------------------------------------*
* call the ABAP list viewer *
*----------------------------------------------------------------------*
FORM list_display TABLES a_output.
pgm = disvariant-report = sy-repid.
disvariant-variant = variant.
* call list viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = pgm
i_callback_pf_status_set = 'SET_PF_STATUS'
it_fieldcat = fieldcat
is_variant = disvariant
is_layout = layout
is_print = print
i_save = 'A'
it_events = eventcat
it_sort = sortcat
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = a_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. "LIST_DISPLAY
**---------------------------------------------------------------------*
** FORM SET_PF_STATUS *
**---------------------------------------------------------------------*
*FORM set_pf_status USING extab TYPE slis_t_extab.
* SET PF-STATUS 'STATUS1'.
*ENDFORM. "set_pf_status
FORM set_pf_status USING extab TYPE slis_t_extab.
SET PF-STATUS 'ZZSTD'.
ENDFORM. "set_pf_status
**---------------------------------------------------------------------*
** FORM USER_COMMAND *
**---------------------------------------------------------------------*
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
DATA t_difference TYPE i.
CASE ucomm.
WHEN 'COPY'.
LOOP AT t_output INTO wa_output.
IF wa_output-chkbox = 'X'.
wa_output-zzcastqtyactual = 0.
wa_output-zcastqty = 0.
wa_output-plnum = ''.
wa_output-zzgsmng = 0.
IF v_tabix NE sy-tabix.
v_tabix = sy-tabix + 1.
INSERT wa_output INTO t_output INDEX v_tabix.
ENDIF.
ENDIF.
ENDLOOP.
WHEN 'DELETE'.
DELETE t_output WHERE chkbox = 'X'.
WHEN 'SELA'.
LOOP AT t_output.
t_output-chkbox = 'X'.
MODIFY t_output INDEX sy-tabix.
ENDLOOP.You might have to add buttons on the screen and assign a function code to it and use them in the program.
Hope this helps and let me know if you need additional help or a demo code.
Shreekant
2007 Sep 04 11:37 PM
Hi Shreekant.
Thanks for the code. It not totally clear for me right now as how to perform validations. If you can mail me a complete source code , it will be great.
Thanks
Krish