F4 help for REUSE ALV grid

Hi,
I am doing an ALV report using REUSE_ALV_GRID_DISPLAY . This is my requirement
If user press F4 in field in WERKS then i need to get values from table T001W and also from my custom table YT001W and display, so user can select from the f4 list.
How to do this.
Your help is appreciated
Sa_R

DATA : alvgrid TYPE REF TO cl_gui_alv_grid,
custom_container TYPE REF TO cl_gui_custom_container,
fieldcatalog TYPE lvc_t_fcat.
table to contain fields that require f4...............................
DATA : lt_f4 TYPE lvc_t_f4 WITH HEADER LINE.
ok_code declaration...................................................
DATA : ok_code TYPE sy-ucomm.
Tables declaration....................................................
TABLES : zaemp.
Types declaration.....................................................
TYPES : BEGIN OF ty_emp,
code LIKE zaemp-code,
designation LIKE zaemp-designation,
END OF ty_emp.
Internal table declaration............................................
DATA : i_emp TYPE TABLE OF ty_emp.
Workarea declaration..................................................
DATA : wa_emp TYPE ty_emp.
Selection screen parameters...........................................
SELECT-OPTIONS : s_code FOR zaemp-code.
CLASS lcl_event_handler DEFINITION
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS :
handle_on_f1 FOR EVENT onf1 OF cl_gui_alv_grid
IMPORTING e_fieldname es_row_no er_event_data,
handle_on_f4 for event onf4 of cl_gui_alv_grid
importing e_fieldname es_row_no er_event_data
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_on_f1.
custom f1 help for code field.......................................
IF e_fieldname = 'code'.
CALL SCREEN 3001.
ENDIF.
to prevent processing of standard f1 help............................
er_event_data->m_event_handled = 'X'.
ENDMETHOD.
Method handle_on_f4.
standard f4 help will be invoked......................................
endmethod.
ENDCLASS.
start of selection....................................................
START-OF-SELECTION.
SELECT code designation FROM zaemp
INTO CORRESPONDING FIELDS OF TABLE i_emp
WHERE code IN s_code.
CALL SCREEN 3000.
*& Module STATUS_3000 OUTPUT
text
MODULE status_3000 OUTPUT.
SET PF-STATUS 'ZTOOL'.
SET TITLEBAR 'ZTITLE'.
IF alvgrid IS INITIAL.
CREATE OBJECT custom_container
EXPORTING
container_name = 'ZCONTAINER'.
CREATE OBJECT alvgrid
EXPORTING
i_parent = custom_container.
PERFORM prepare_f4.
CALL METHOD alvgrid->register_f4_for_fields
EXPORTING
it_f4 = lt_f4[]
creating instance for event handler..................................
DATA : event_handler TYPE REF TO lcl_event_handler.
CREATE OBJECT event_handler.
SET HANDLER event_handler->handle_on_f1 FOR alvgrid.
SET HANDLER event_handler->handle_on_f4 FOR alvgrid.
preparing field catalog..............................................
PERFORM prepare_fieldcatalog CHANGING fieldcatalog.
CALL METHOD alvgrid->set_table_for_first_display
EXPORTING
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
I_CONSISTENCY_CHECK =
I_STRUCTURE_NAME =
IS_VARIANT =
I_SAVE =
I_DEFAULT = 'X'
IS_LAYOUT =
IS_PRINT =
IT_SPECIAL_GROUPS =
IT_TOOLBAR_EXCLUDING =
IT_HYPERLINK =
IT_ALV_GRAPHICS =
IT_EXCEPT_QINFO =
CHANGING
it_outtab = i_emp
it_fieldcatalog = fieldcatalog
IT_SORT =
IT_FILTER =
EXCEPTIONS
INVALID_PARAMETER_COMBINATION = 1
PROGRAM_ERROR = 2
TOO_MANY_LINES = 3
others = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDMODULE. " STATUS_3000 OUTPUT
preparing field catalog...............................................
FORM prepare_fieldcatalog CHANGING i_fieldcatalog TYPE lvc_t_fcat.
DATA : ls_fcat TYPE lvc_s_fcat.
ls_fcat-fieldname = 'code'.
ls_fcat-ref_table = 'zaemp'.
ls_fcat-coltext = 'EMPLOYEE ID'.
APPEND ls_fcat TO i_fieldcatalog.
CLEAR ls_fcat.
ls_fcat-fieldname = 'designation'.
ls_fcat-ref_table = 'zaemp'.
ls_fcat-coltext = 'EMPLOYEE NAME'.
APPEND ls_fcat TO i_fieldcatalog.
ENDFORM.
*& Module USER_COMMAND_3000 INPUT
text
MODULE user_command_3000 INPUT.
CASE ok_code.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_3000 INPUT
*& Module USER_COMMAND_3001 INPUT
text
MODULE user_command_3001 INPUT.
CASE ok_code.
WHEN 'SAVE'.
LEAVE TO SCREEN 0.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_3001 INPUT
*& Module STATUS_3001 OUTPUT
text
MODULE status_3001 OUTPUT.
SET PF-STATUS 'GUI'.
SET TITLEBAR 'TITLE'.
ENDMODULE. " STATUS_3001 OUTPUT
preparing fields to be registered for f4 help.........................
FORM prepare_f4.
lt_f4-fieldname = 'designation'.
lt_f4-register = 'X'.
lt_f4-getbefore = 'X'.
lt_f4-chngeafter = 'X'.
APPEND lt_f4.
ENDFORM.
Hi
For creating the F4 Help see the sample code and do accordingly
See the following ex:
TYPES: BEGIN OF TY_MBLNR,
MBLNR LIKE MKPF-MBLNR,
END OF TY_MBLNR.
DATA: IT_MBLNR TYPE STANDARD TABLE OF TY_MBLNR WITH HEADER LINE.
data: it_ret like ddshretval occurs 0 with header line.
At selection-screen on value-request for s_mat-low.
Select MBLNR from mkpf into table it_mblnr.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'MBLNR'
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = IT_MBLNR
FIELD_TAB =
RETURN_TAB = IT_RET
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF SY-SUBRC = 0.
read table it_ret index 1.
move it_ret-fieldval to S_mat-low.
ENDIF.
Go through the test program.
REPORT Ztest_HELP .
TABLES : MARA.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_MATNR(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
SELECT MATNR
FROM MARA
INTO TABLE ITAB
UP TO 10 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATERIAL NUMBER'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = ITAB
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
F4 help -- on editable alv field.
The specified item was not found.
Message was edited by:
        Karthikeyan Pandurangan

Similar Messages

  • F4 help for OO ALV Grid

    Hi,
    I want to implement F4 search help for some cells in ALV grid. I added the necessary class methods and the program runs fine and displays the list of values to be chosen. The relevant fields are editable and F4 enabled in the field catalogue.The function (F4IF_INT_TABLE_VALUE_REQUEST) returns a value but the cell in ALV grid is not updated.  How can I pass the returned value to the cell in ALV grid?
    Thx
    Ali

    Hello Kasinath,
    Here is the code for my F4 processing event. I know I have to add some code after the fm and tried to update the cell using modify_cell method of er_data_changed but it did not work and gave an error.
    FORM on_f4  USING    P_E_FIELDNAME
                         ROW_ID
                         P_ER_EVENT_DATA
                         P_ET_BAD_CELLS
                         P_E_DISPLAY
                         IR_DATA_CHANGED
                                  TYPE REF TO cl_alv_changed_data_protocol.
      DATA: BEGIN OF value_charg OCCURS 0,
                     charg like zpp_kpduzelt-charg,
      END OF value_charg.
      DATA: charg like gt_list-charg,
            lgort like gt_list-lgort.
      DATA : ls_mod_cell TYPE lvc_s_modi ,
             ls_del_cell TYPE lvc_s_moce  ,
             lv_value TYPE lvc_value .
      DATA : ls_mod_row like line of gt_list.
    *§5 define fields and field-symbols for data-update
      field-symbols:  type lvc_t_modi.
      data: ls_modi type lvc_s_modi.
    *§6 assign the cell table fieldsymbol to the dereferenced data table and
      fill the table.
         assign p_er_event_data->m_data->* to <itab>.
    SORT ir_data_changed->mt_mod_cells BY row_id .
    LOOP AT ir_data_changed->mt_mod_cells
    INTO ls_mod_cell.
    ENDLOOP.
      case p_e_fieldname.
        when 'CHARG'.
          read table gt_list index row_id.
          select mcha~charg into value_charg-charg
          from mcha
          where werks = werks and
                matnr = gt_list-matnr.
            append value_charg.
          endselect.
          CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
            EXPORTING
              retfield        = 'CHARG'
              value_org       = 'S'
         DYNPPROG        = SY-REPID
         DYNPNR          = SY-DYNNR
         DYNPROFIELD     = 'PRUEFLOS'
            TABLES
              value_tab       = value_charg
         field_tab       = field_tab
              return_tab      = return_tab
            EXCEPTIONS
              parameter_error = 1
              no_values_found = 2
              OTHERS          = 3.
          IF sy-subrc = 0.
            move return_tab-fieldval to charg.
           ls_mod_cell-row_id    = row_id.
           ls_mod_cell-fieldname = 'CHARG'.
            move charg to lv_value.
          ENDIF.
        when 'LGORT'.
      endcase.
    ENDFORM.  
    Thanks in advance
    Ali

  • F4 Help for Classical ALV Grid ( REUSE_ALV_GRID_DISPLAY_LVC)

    Hi All,
    We have an ABAP program that displays data using REUSE_ALV_GRID_DISPLAY_LVC. There is an editable column in the report for which we need to display F4 help. The functionality of the F4 help will completely user-defined.
    Please let me know how to provide custom F4 help for editable column in ALV.
    Thanks,
    sathish.

    Hi satish,
    Use ' F4IF_INT_TABLE_VALUE_REQUEST' function module after PROCESS ON VALUE-REQUEST event.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
              retfield         = 'LAND1'
    *       PVALKEY          = ' '
             dynpprog         = sy-repid
             dynpnr           = sy-dynnr
             dynprofield      = 'T_LCDETAILS-DEST_COUNTRY'
             callback_program = sy-repid
             value_org        = 'S'
           TABLES
             value_tab        = t_country
           EXCEPTIONS
             parameter_error  = 1
             no_values_found  = 2
             OTHERS           = 3.
         IF sy-subrc <> 0.
    * Implement suitable error handling here
         ENDIF.
    Regards,
    Venkat.

  • Change Layout in Selection Screen for OO ALV-Grid

    Hello everyone,
    I got a problem regarding layouts for objectoriented ALV Grid. I want to make it possible that user can take the layout for ALV he wants to on the selection screen. So far thats no problem and it works. But there are some little problems which I do not know how to fix them. But first the facts:
    (1) I got my parameter for layout
    PARAMETER: p_vari  TYPE disvariant-variant.
    (2) I fill my global layout structure in initialization
    INITIALIZATION.
    * Variante vorbelegen
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ENDIF.
    (3) I got my handling for F4-value help on variant parameter
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
       CALL FUNCTION 'LVC_VARIANT_F4'
         EXPORTING
           is_variant    = gs_variant
           i_save        = 'A'
         IMPORTING
           es_variant    = gs_variant
         EXCEPTIONS
           not_found     = 1
           program_error = 2
           OTHERS        = 3.
       IF sy-subrc <> 0.
         MESSAGE text-m01 TYPE 'S'.
       ELSE.
         p_vari = gs_variant-variant.
       ENDIF.
    (4) I give back my parameters content into the variant structure at start of selection
    START-OF-SELECTION.
       gs_variant-username = sy-uname.
       gs_variant-report   = sy-repid.
       gs_variant-variant  = p_vari.
    This works all fine but I got some problems when using default variants/layouts. For example I got a default variant only for me. When starting the selection screen it works fine that the default layout was written. It is displayed automatically in the variant parameter. But I want that if i I empty the content (blank it out) from my variant parameter, that report should start with "normal" layout how it was written in the report and NOT with default layout.
    When I clear the gs_variant it works like I want it, but then the alv layout button looks like (without functions for layout), because I do not have the reference to my report.
    So what to do? :-)
    Regards
    Michael

    Wow that was fast, works great, thanks :-)
    I did not use this parameter in set table method but now I fill it dynamically.
    Ok next problem, one step harder ;-)
    Now I have one selection screen for one ALV-Grid, but four radio buttons which control with which data the ALV gets filled (four different fieldcats, data tables and so on). Each Grid got an own HANDLE so that the layouts can be separated in four categories.
    Now I want that by changing the radio button the individual standard layout for the chosen alv grid is getting filled.
    This works fine when using it in selection screen output.
    AT SELECTION-SCREEN OUTPUT.
       CLEAR gs_variant.
    * Layout-Handles individuell für Klausel-Radiobuttons setzen
       IF     p_py IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLPY'.
       ELSEIF p_rh IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLRH'.
       ELSEIF p_aj IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLAJ'.
       ELSEIF p_sr IS NOT INITIAL.
         gs_variant-username = sy-uname.
         gs_variant-report   = sy-repid.
         gs_variant-handle   = 'KLSR'.
       ENDIF.
    * Layout holen
       CALL FUNCTION 'LVC_VARIANT_DEFAULT_GET'
         EXPORTING
           i_save        = 'A'
         CHANGING
           cs_variant    = gs_variant
         EXCEPTIONS
           wrong_input   = 1
           not_found     = 2
           program_error = 3
           OTHERS        = 4.
       IF sy-subrc = 0.
         p_vari = gs_variant-variant.
       ELSE.
         CLEAR p_vari.
       ENDIF.
    But unfortunately selection screen output is getting passed by EACH changing in the selection screen. This means when I try to clear the default layout in my parameter field, it gets refilled automatically with default layout. If I do a condition around the filling (only if not initial) the default value filling does not work fine in every case, e.g. when clearing the parameters field and then change the radiobutton -> then it does not get filled automatically.

  • Drill down capabilities for an alv grid display field using oops concept

    Hi All,
    could anyone help me in how to achieve the drill down capabilities for an alv grid display field using oops concept.
    Thanks & Regards,
    padmasri.

    padmasri,
    Hope your requirement is something like, when you click on a sales order number it should display that order (VA03), in a grid output displayed using set_table_for_first_display.
    you can acheive it using event double click.
    *&            L O C A L  C L A S S E S   -   D E F I N I T O N         *
    class lcl_event_receiver: local class to handle event DOUBLE_CLICK
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS:
        HANDLE_DOUBLE_CLICK
            FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW E_COLUMN.
      PRIVATE SECTION.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *&    L O C A L  C L A S S E S   -   I M P L E M E N T A T I O N       *
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
      METHOD HANDLE_DOUBLE_CLICK.
        PERFORM HANDLE_DOUBLE_CLICK USING E_ROW
                                          E_COLUMN.
      ENDMETHOD.                           "handle_double_click
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    FORM HANDLE_DOUBLE_CLICK USING E_ROW    TYPE LVC_S_ROW
                                   E_COLUMN TYPE LVC_S_COL.
      DATA: LS_DETAIL LIKE LINE OF T_OUTPUT.
          WHEN 'T_OUTPUT'.
            READ TABLE T_OUTPUT   INDEX E_ROW-INDEX INTO LS_DETAIL.
    If clicked on PO Number or PO Item, call ME23
        IF E_COLUMN-FIELDNAME = 'EBELN' OR
           E_COLUMN-FIELDNAME = 'EBELP' .
          SET PARAMETER ID 'BES' FIELD LS_DETAIL-EBELN.
          SET PARAMETER ID 'BSP' FIELD LS_DETAIL-EBELP.
          CALL TRANSACTION 'ME23' AND SKIP FIRST SCREEN.
    If clicked on sales order number or item, call VA03
        ELSEIF E_COLUMN-FIELDNAME = 'VBELN' OR
               E_COLUMN-FIELDNAME = 'POSNR'.
          SET PARAMETER ID 'AUN' FIELD LS_DETAIL-VBELN.
          SET PARAMETER ID 'APO' FIELD LS_DETAIL-POSNR.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
    Hope this helps

  • Exception while creating f4 help for editable alv field

         hi experts
    i have created search help for editable alv field by following link
    http://scn.sap.com/docs/DOC-39832
    But i m getting an exception :  Field symbol has not yet been assigned.
    exception area code
       read table <tab1> into <ls_wa> index i_row_id.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    first read statement is giving sy-subrc =4.
    PS: exception from method..:IS_READY_FOR_INPUT
    kindly help

    Hello Ankush,
    read table <tab1>  ASSIGNING <ls_wa> index i_row_id.
    IF  <ls_wa> IS ASSIGNED.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    ENDIF.
    Regards,
    TP

  • Help needed for editable alv grid program

    hi,
    Can you please tell me how to set a ‘update’ button in application toolbar of alv griv without suppressing it and how to write the code for that update button so that if I change my editable column data and press the update button my updated data should be stored in my database table.
    the code what i wrote is:
    TABLES: vbak,vbap.
    TYPE-POOLS: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_final,
    vbeln LIKE vbak-vbeln,
    erdat LIKE vbak-erdat,
    matnr LIKE vbap-matnr,
    posnr LIKE vbap-posnr,
    END OF t_final.
    DATA: i_final TYPE STANDARD TABLE OF t_final INITIAL SIZE 0,
    wa_final TYPE t_final.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    •     Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    fieldcatalog-fieldname = 'VBELN'.
    fieldcatalog-seltext_m = 'sales order'.
    fieldcatalog-col_pos = 0.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'ERDAT'.
    fieldcatalog-seltext_m = 'date'.
    fieldcatalog-col_pos = 1.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'material no.'.
    fieldcatalog-col_pos = 2.
    fieldcatalog-edit = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'POSNR'.
    fieldcatalog-seltext_m = 'line item no.'.
    fieldcatalog-col_pos = 3.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    •     Build layout for ALV grid report
    FORM build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    •     gd_layout-totals_only = 'X'.
    •     gd_layout-f2code = 'DISP'. "Sets fcode for when double
    •     "click(press f2)
    •     gd_layout-zebra = 'X'.
    •     gd_layout-group_change_edit = 'X'.
    •     gd_layout-header_text = 'helllllo'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    •     Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = gd_repid
    •     i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    •     it_special_groups = gd_tabgroup
    •     IT_EVENTS = GT_XEVENTS
    i_save = 'X'
    •     is_variant = z_template
    TABLES
    t_outtab = i_final
    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.
    ENDFORM. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    •     Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    SELECT avbeln aerdat bmatnr bposnr FROM vbak AS a
    INNER JOIN vbap AS b ON avbeln = bvbeln
    INTO TABLE i_final WHERE avbeln = bvbeln.
    •     ENDFORM. " DATA_RETRIEVAL
    thanks in advance.

    hi sudhir,
    thanks for ur reply.
    after seeing the code u send to me i made changes to my program.but still when i click on update button,nothing is happening.can u please suggest me an idea.
    TABLES: vbak,vbap.
    TYPE-POOLS: slis.                                 "ALV Declarations
    TYPES: BEGIN OF t_final,
         vbeln LIKE vbak-vbeln,
         erdat LIKE vbak-erdat,
         matnr LIKE vbap-matnr,
         posnr LIKE vbap-posnr,
         END OF t_final.
    DATA: i_final TYPE STANDARD TABLE OF t_final WITH HEADER LINE,
          wa_final TYPE t_final.
    *DATA:i_final LIKE vbap OCCURS 0.
    *DATA:wa_final LIKE vbap.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE slis_layout_alv,
          gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      fieldcatalog-fieldname   = 'VBELN'.
      fieldcatalog-seltext_m   = 'sales order'.
      fieldcatalog-col_pos     = 0.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'ERDAT'.
      fieldcatalog-seltext_m   = 'date'.
      fieldcatalog-col_pos     = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'material no.'.
      fieldcatalog-col_pos     = 2.
      fieldcatalog-edit        = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
      fieldcatalog-fieldname   = 'POSNR'.
      fieldcatalog-seltext_m   = 'line item no.'.
      fieldcatalog-col_pos     = 3.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR  fieldcatalog.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
                i_callback_pf_status_set = 'GUI_STAT'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               it_events                = it_events
                i_save                  = 'X'
               is_variant              = z_template
           TABLES
                t_outtab                = i_final
           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.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT avbeln aerdat bmatnr bposnr FROM vbak AS a
      INNER JOIN vbap AS b ON avbeln = bvbeln
      INTO TABLE i_final WHERE avbeln = bvbeln.
    ENDFORM.                    " DATA_RETRIEVAL
          FORM GUI_STAT                                                 *
    -->  RT_EXTAB                                                      *
    FORM gui_stat USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'UPDATE' EXCLUDING rt_extab.
    ENDFORM.
          FORM USER_COMMAND                                             *
    -->  U_COMM                                                        *
    -->  RS_SELFIELD                                                   *
    FORM user_command USING u_comm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
      DATA:selfield TYPE slis_selfield.
      CASE u_comm.
        WHEN 'UPDATE'.
          LOOP AT i_final ."into wa_final.
            i_final-matnr = vbap-matnr.
            update (vbap) from table i_final.
            IF sy-subrc = 0.
              MESSAGE s000(0) WITH 'records updated successfully'.
            ENDIF.
          ENDLOOP.
      ENDCASE.
    ENDFORM.

  • Kindly help to develop alv grid display

    Hi ,
    I have a requirement in which I need to display ALV GRID display and in its tool bar 4 butons are required. In the same view down to alv display i want to develop a tabstrip and its functionalities.I have designed classic alv using SALV_WD_TABLE component. I want a good GRID Display, not like flat field names that comes in list display, looking for bulged fields(like what comes for ALV GRID in normal abap)  display with print version etc hidden and buttons at the top of ALV.  Kindly help
    Highly rewarded
    Kindly help
    Regards,
    Lakshmi
    Edited by: Lakshmi Menon on Nov 27, 2008 4:49 PM

    Well Web Dynpro is generally output in HTML so the output formatting is never going to quite look like a desktop application (which is the case with the ALV Grid).  You have very little control over the look of the column headers.  In fact you can only manipulate what is available via the Portal Theme. 
    There is a new Tradeshow Plus theme available in NetWeaver 7.01 which uses a gradiant background for the column headers.  This gives them a little more depth:
    http://www.flickr.com/photos/tjung/3068850120/
    The other option is next year when NetWeaver Business Client version 3.0 comes out, you will be able to render Web Dynpro applications using the NWBC Smart Client Rendering.  This will render Web Dynpro applications using desktop libraries instead of HTML/Browser. This gives Web Dynpro a more SAPGUI/Desktop appears of course.
    http://www.flickr.com/photos/tjung/2685619882/in/set-72157606418550143/

  • Runtime error while trying to execute custom F4 help in OOP ALV grid.

    Dear All,
    I am trying to add custom search help for one of my column in ALV grid. I'm using OOP ALV, when i click for search help for that column, the system shows runtime error like below.
    I am new to OOP concept and tried to follow program BCALV_EDIT_03. But not getting this error occur. Please help me.
    With regards.

    Hi,
    In order to be able to provide a search help for a field in an ALV you must do the following things.
    1) The field where F4 help need to be attached needs to be made editable.
    2) Create an event handler class to handle the ONF4 event. You can refer the following code:
        CLASS lcl_alv1_handler DEFINITION.
        PUBLIC SECTION.
           "Tohandle F4 helps
           METHODS handle_f4 FOR EVENT onf4 OF cl_gui_alv_grid
                   IMPORTING e_fieldname e_fieldvalue es_row_no er_event_data
                             et_bad_cells e_display.
        ENDCLASS.
       CLASS lcl_alv1_handler IMPLEMENTATION.
          METHOD handle_f4.
    CASE e_fieldname.
         WHEN 'LIFNR'.               "Set F4 for courier vendor
             SELECT lifnr name1 FROM lfa1 INTO TABLE lt_lifnr.
           IF lt_lifnr IS NOT INITIAL.
             CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
               EXPORTING
                 retfield           = 'LIFNR'
                 window_title   = 'Vendors'
                 value_org       = 'S'
               TABLES
                 value_tab       = lt_lifnr
                 return_tab      = lt_return
               EXCEPTIONS
                 parameter_error = 1
                 no_values_found = 2
                 OTHERS          = 3.
             IF sy-subrc = 0.
               READ TABLE gt_final INTO wa_final_t INDEX es_row_no-row_id.
               IF sy-subrc = 0.
                 READ TABLE lt_return INTO wa_return INDEX 1.
                 IF sy-subrc = 0.
                   CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
                     EXPORTING
                       input  = wa_return-fieldval
                     IMPORTING
                       output = lv_lifnr.
                   wa_final_t-lifnr  = lv_lifnr.
                   MODIFY gt_final FROM wa_final_t INDEX es_row_no-row_id.
                 ENDIF.
               ENDIF.
             ENDIF.
           ENDIF.
          ENDCASE.
             CALL METHOD o_alv->refresh_table_display.
          ENDMETHOD.
       ENDCLASS.
        In the above method, GT_FINAL-LIFNR is being overwritten by the LIFNR you had selected       from F4 help. So we will call the refresh_table_display after it to see the result in the ALV.
    3) After creating the ALV object, add the fields to which the F4 has to be added. For this you
        need to declare an internal table based on  lvc_t_f4. Use the following code. Here O_ALV is    my ALV object.:
       CREATE OBJECT o_container
           EXPORTING
             container_name              = 'CUSTCON'
           EXCEPTIONS
             cntl_error                  = 1
             cntl_system_error           = 2
             create_error                = 3
             lifetime_error              = 4
             lifetime_dynpro_dynpro_link = 5
             OTHERS                      = 6.
         IF sy-subrc <> 0.
    *     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
         CREATE OBJECT o_alv
           EXPORTING
             i_parent          = o_container
           EXCEPTIONS
             error_cntl_create = 1
             error_cntl_init   = 2
             error_cntl_link   = 3
             error_dp_create   = 4
             OTHERS            = 5.
         IF sy-subrc <> 0.
    *     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
       CLEAR : gt_f4, wa_f4.
       wa_f4-fieldname   = 'LIFNR'.
       wa_f4-register    = 'X'.
       wa_f4-getbefore   = space.
       wa_f4-chngeafter  = space.
       APPEND wa_f4 TO gt_f4.
       Here I am assigning F4 to LIFNR field in the final internal table that is displayed using ALV.
       After this register this field for F4.
        CALL METHOD o_alv->register_f4_for_fields
           EXPORTING
              it_f4 = gt_f4.
       CREATE OBJECT o_alv_handler.
       SET HANDLER : o_alv_handler->handle_f4 FOR o_alv1.
       The object o_alv_handler is created based on the event handler class.
    I hope that this will solve your issue. Revert if this is solved.
    Rgards,
    Abijith

  • F4 help before save - ALV Grid in Module Pool

    Hi,
       I am calling an ALV Grid using CL_GUI_A;V_GRID. When I create a new record, I need F4 help for a particular field based on the entries in 2 other fields. Thing is I can't use DATA_CHANGED event coz then I won't be able to display the F4 button. And F4 option doesn't pass the data that has been changed(ER_CHANGED_DATA table). So frustrating. Can anyone help me plz???
    Thanks in advance,
    Poornima L Nathan

    Hi ,
    i think you are missing one params while registering your F4 fields..
      ls_f4-register   = 'X'.
      ls_f4-getbefore  = 'X'.
      ls_f4-chngeafter = 'X'.
    Documentatin of SAP program *BCALV_EDIT_08*
    *   1b. If the value range in your f4 help depends on other
    *       values of cells that are input enabled, set the
    *       GETBEFORE parameter.
    now you can use row_indx no to read your internal table
    regards
    Prabhu
    Edited by: Prabhu Peram on Aug 23, 2011 2:11 PM

  • Simple tutorial for using alv-grid for data entry into table, please!

    Hi friends,
    I urgently need a basic, simple tutorial or step-by-step or sample code on the following:
    I want to have a alv-grid like entry list where i can add/remove additional lines/entries that then are saved into an internal table. Please help me with that, as i studied already some documents but do not really get the idea of how to do - <REMOVED BY MODERATOR>
    Thanks in advance,
    Edited by: Alvaro Tejada Galindo on Jan 11, 2008 6:18 PM

    hi clemens,
    follow this link it may be useful to u
    http://www.sap-basis-abap.com/sapab033.htm
    http://www.abapprogramming.blogspot.com/2007/04/alv-details.html
    for tutorial on alv:
    http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
    i have pdf material also ican give it to you if u give your email id.
    hope this helps you
    regards,
    sravanthi

  • Help search in alv grid field

    Hello.
    How to assign a help search to a field of an alv grid control?
    I would like to use another help search different form the field reference.
    Thanks!!!
    Alberto

    Check the sample code:
        handle_on_f4             FOR EVENT onf4 OF cl_gui_alv_grid
                                 IMPORTING sender e_fieldname e_fieldvalue
                                           es_row_no er_event_data
                                           et_bad_cells e_display.
      METHOD handle_on_f4.
        IF e_fieldname = text-027. "Date
          PERFORM f4_date USING sender e_fieldname e_fieldvalue es_row_no
                                       er_event_data et_bad_cells e_display.
        ENDIF.
      ENDMETHOD.                    "handle_On_f4
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    *&      Form  F4_contact_id
          F4 for Contact ID
    FORM f4_date  USING    sender        TYPE REF TO cl_gui_alv_grid
                           e_fieldname   TYPE lvc_fname
                           e_fieldvalue  TYPE lvc_value
                           es_row_no     TYPE lvc_s_roid
                           er_event_data TYPE REF TO cl_alv_event_data
                           et_bad_cells  TYPE lvc_t_modi
                           e_display     TYPE c.
      DATA: lv_anlage TYPE anlage.
      FIELD-SYMBOLS: <itab> TYPE lvc_t_modi.
      DATA: ls_modi TYPE lvc_s_modi.
      DATA : wa_field_tab TYPE  dfies,
             lws_date TYPE scal-date.
      DATA: lws_row_id TYPE lvc_s_roid,
            lws_tabix TYPE sy-tabix.
      DATA: li_ret_tab LIKE  ddshretval OCCURS 0 WITH HEADER LINE.
      CLEAR: ls_modi, lv_anlage, li_ret_tab, wa_final, wa_field_tab,
             lws_date, lws_row_id, lws_tabix.
      REFRESH: li_ret_tab.
      IF NOT er_event_data->m_event_handled = c_x.
        ws_f4_handle = c_x.
        MOVE es_row_no-row_id TO lws_tabix.
        READ TABLE i_final INTO wa_final INDEX lws_tabix.
        CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
          EXPORTING
            tabname           = text-012              "I_FINAL
            fieldname         = text-027              "DATE
            searchhelp        = text-038              "BU_DATE_CHAR
          TABLES
            return_tab        = li_ret_tab
          EXCEPTIONS
            field_not_found   = 1
            no_help_for_field = 2
            inconsistent_help = 3
            no_values_found   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        ASSIGN er_event_data->m_data->* TO <itab>.
        CONCATENATE li_ret_tab-fieldval+6(4)
                    li_ret_tab-fieldval+3(2)
                    li_ret_tab-fieldval+0(2) INTO lws_date.
        IF lws_date NE ''.
          IF lws_date > sy-datum.
            IF wa_final-zzmod_eff_code EQ c_03 OR
               wa_final-zzmod_eff_code EQ c_04 OR
               wa_final-zzmod_eff_code EQ c_05.
              wa_final-date = lws_date.
              MODIFY i_final FROM wa_final INDEX lws_tabix.
              PERFORM no_edit_for_date TABLES i_final.
              PERFORM alv_refresh.
            ENDIF.
          ELSE.
            wa_final-date = ''.
            MODIFY i_final FROM wa_final INDEX lws_tabix.
            PERFORM no_edit_for_date TABLES i_final.
            PERFORM alv_refresh.
            MESSAGE s001(zesspa) WITH text-037.
            EXIT.
          ENDIF.
        ENDIF.
        er_event_data->m_event_handled = c_x.
      ENDIF.
    ENDFORM.                                                    " f4_date
    Check the standard program <b>BCALV_EDIT_08</b>
    Regards,
    Prakash.

  • Table Display in for OO ALV Grid

    Hello All,
    I have an internal table with the following setup:
    DATA:  BEGIN OF mat_locs OCCURS 0,
              matid      LIKE /sapapo/matloc-matid,
              locid      LIKE /sapapo/matloc-locid,
              pegids     TYPE /sapapo/om_pegid_tab,
           END OF mat_locs.
    The PEGIDS is a Table of GUIDs.  It is possible that the PEGIDS table can have more than one entry for each MATID and LOCID.  Currently, I am only able to have one line item appear in the ALV grid when there are two in PEGIDS.  Is there a setting that I am missing to display this correctly? Thanks for your help in advance.
    John

    Hi,
    I am not sure how to display second level internal table in an ALV grid..
    But I can suggest you one thing..
    Create an internal table with the following fields..
    DATA: BEGIN OF ITAB OCCURS 0,
            matid LIKE /sapapo/matloc-matid,
            locid LIKE /sapapo/matloc-locid.
            INCLUDE STRUCTURE /sapapo/om_pegid. "GIVE THE STRUCTURE and not the table type..
    DATA: END OF ITAB.
    Populate the data..
    Create a sort order for the fields matid & locid..And then display the records..
    Thanks,
    Naren

  • Filter option is not working in Reuse alv grid

    Hi all,
    Filter option is not working in alv grid properly.
    if i choose one particular field for filter option .it is working .but another field it is not working though it contains different values.please give the answer.whether i have to pass filter option throuogh reuse_alv _grid or not.thanks in advance
    raj

    Hi raja,
    1. The search/filter is
       CASE SENSITIVE
    2. U can give *
       to search for pattern.
      (IN THAT CASE, it is NOT Case Sensitive)
    regards,
    amit m.

  • Problem with same layout (variant) for two ALV Grid and ALV Tree

    Hello!
    I have two docking containers on the screen. On the left i have cl_gui_alv_tree, on the right cl_salv_table.
    When a user set a default layout for ALV Grid (or ALV Tree), raport starts and sets this layout in both objects (tree and grid).
    How to avoid this?

    Hi,
    Take Two radio buttons.
    First radion button display the two containers in grid format,
    second radio button display the two containers in tree format base on user selection.
    CREATE OBJECT G_DOCING_CONTAINER
        EXPORTING PARENT = G_CUSTOM_CONTAINER."G_CONTAINER.
    DISPLAY THE DATA IN GRID FORMATA
    CREATE OBJECT r_grid
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    DISPLAY THE GRID DATA IN SECOND CONTAINER
    CREATE OBJECT r_grid1
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    OTHERWISE WE CAN DISPLAY THE TWO CONTAINERS DATA IN A GRID FORMAT
    CREATE OBJECT g_tree
        EXPORTING
          parent                = g_docing_container"g_custom_container
    IF R1 = 'X'.  "FOR GRID DISPLAY
    CALL METHOD r_grid1->set_table_for_first_display
    CALL METHOD r_grid2->set_table_for_first_display
    ELSE.
    ************TREE DISPLAY
    ENDIF.
    regards,
    muralii

Maybe you are looking for

  • USB 6009 thermocouple noise

    I'm using NI-DAQmx 7.5, Labview 7.0, and a USB-6009. I'm trying to get a more accurate reading from my j-type thermocouple.  It is now distorted with noise and jumps rapidly +/- 20 degrees around room temp without any heat being applied.  When heat i

  • Not able to display the Node context attributes to table

    Hi Friends, Issue: Currently i am reading the Node parameters and assigning the parameters to the Context of the mainView. Then displaying the attributes into table here i am using a iterator to fetch the attributes. But its reading only one record t

  • Field Modification while down payment for vendor

    Hello Gurus, While doing down payment in F-48, in the Post Vendor Down Payment Display Overview screen when we double click the line item, it will go to item screen here i have to disable the amount field, I have tried some search but didn't find any

  • Error in ESS iveiw

    Dear All, I have tried to use the iview provided by SAP for Employee Self Service from portal content area. When i click on all the iview (in ESS), i am getting error as user doesn't exist for this period. can any one help me to resolve this issue? w

  • DSL Highspeed Internet Disconnects same time everyday.

    Hello, I have DSL Highspeed Internet with a D90-327W15-06 modem. I have a computer that uses a wire that connects to the modem through the ethernet slot as well as laptops that use Wifi.My internet ALWAYS disconnects 2:27 P.M EVERYDAY. I've called Ve