Application Development 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: 

ALV F4 help

Bharathi_j
Explorer
0 Kudos
134

Hi All,

I have and editable field in the ALV Grid output... and i have f4 option for that..

when i do f4 and select a value and refresh the alvoutput with '&REFRESH' i am getting an error saying the value is not found in check table eventhough it is present in check table....i have given the refrence field and refrence table also in the fieldcatalog for this field..

helpful answers will be rewarded.\

Thans ,

Bharathi.

2 REPLIES 2

former_member188685
Active Contributor
0 Kudos
61

show your code, if it is not lenghty one and not involved Custom tables.

former_member188685
Active Contributor
0 Kudos
61

i coded and checked, It is working for me , here is the working example.

REPORT  ztest_alv.
TYPE-POOLS: slis.

DATA: it_fcat TYPE slis_t_fieldcat_alv,
      wa_fcat LIKE LINE OF it_fcat.

DATA: it_data TYPE vbap_t.


SELECT *
  FROM VBAP
  INTO TABLE it_data
  UP TO 20 ROWS.

wa_fcat-fieldname = 'VBELN'.
wa_fcat-tabname  = 'IT_DATA'.
wa_fcat-outputlen = 5.
wa_fcat-edit = 'X'.
wa_fcat-input = 'X'.
wa_fcat-ref_fieldname = 'VBELN'.
wa_fcat-ref_tabname = 'VBAK'.
wa_fcat-seltext_l = 'Sales Order'.
APPEND wa_fcat TO it_fcat.
clear wa_fcat .

wa_fcat-fieldname = 'POSNR'.
wa_fcat-tabname  = 'IT_DATA'.
wa_fcat-outputlen = 5.
wa_fcat-seltext_l = 'Item'.
APPEND wa_fcat TO it_fcat.

PERFORM display_data.

*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM user_command USING ucomm TYPE sy-ucomm
            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.

  CASE ucomm.
    WHEN '&DATA_SAVE'.
"  you capture the data and do some thing.
    
  ENDCASE.

ENDFORM.                    "user_command

*&---------------------------------------------------------------------*
*&      Form  display_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM display_data.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_interface_check       = sy-repid
      it_fieldcat             = it_fcat
      i_callback_user_command = 'USER_COMMAND'
    TABLES
      t_outtab                = it_data
    EXCEPTIONS
      program_error           = 1.
ENDFORM.                    "display_data