Standard F4 help in ALV  Grid

Hi Experts,
I have created an ALV grid using classes. I need to bring standard F4 help in the ALV Grid.
Also the value that user enters should be returned back to the ALV.
Please provide some inputs.
Thanks.

Hi,
cosider the below steps :
1.in Fieldcatalog set the field as editable like for eg.
WA_FIELDCAT-COL_POS    = L_LIN.
    WA_FIELDCAT-FIELDNAME  = 'DATAB'.
    WA_FIELDCAT-DATATYPE   = 'DATS'.
    WA_FIELDCAT-REPTEXT    = 'Valid From'(T06).
    WA_FIELDCAT-F4AVAILABL = 'X'.
    WA_FIELDCAT-EDIT       = 'X'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
2. Define F4 on the fields you want:
DATA:
* Line of  F4 table
  L_S_F4 TYPE LVC_S_F4,
* Table for F4 relevant fields
  L_T_F4 TYPE LVC_T_F4.
* F4 on datab
  L_S_F4-FIELDNAME  = 'DATAB'.
  L_S_F4-REGISTER   = 'X'.
  L_S_F4-GETBEFORE  = SPACE.
  L_S_F4-CHNGEAFTER = SPACE.
  APPEND L_S_F4 TO L_T_F4.
  CLEAR L_S_F4.
similarly you can add other fields on which you want to provide F4
  CALL METHOD P_G_ALV_GRID->REGISTER_F4_FOR_FIELDS
    EXPORTING
      IT_F4 = L_T_F4[].
3.Implement the metohds for Event handler:
METHOD HANDLE_ONF4.
   <here you can call the F4 help>
Regards,
Neha

Similar Messages

  • How to get f4 help in alv grid in container-urgent

    hi,
    how to get f4 help in alv grid in container using abap objects
    ganesh

    Hi Ganesh,
    Did you have a look at sample report BCALV_TEST_GRID_F4_HELP ?
    Here is part of the header documentation:
    *& Report  BCALV_GRID_F4_HELP                                          *
    Purpose:
    ~~~~~~~~
    This report illustrates the use of f4-Help in an alv grid control.
    Background:
    ~~~~~~~~~~~
    There a two possibilities to implement an f4-Help in the alv grid
    control: one can either use standard f4-help or write one by Hand.
    For the former there is nothing to do at all. This report shows how
    to implement user-defined f4-help.
    I am sure you will find within this report the solution you are looking for.
    Reward points if this Helps.
    Manish

  • F4 help in ALV grid using existing search help

    Hi All,
    It would be appreciable , if some help on problem. Thanks in advance.
    How to provide user defined F4 help in ALV grid using existing search help?
    ALV grid has developed using OOPS concept.
    Thanks,
    Sudhakar.

    Hi,
    if you already developed using OO concept, it should be possible to:
    create a handler for event ONF4
    The interface will tell you actual field name and value where F4 is pressed. This will enable you to call your own routine (see FM F4-IF....).
    Please check how the standard handles F4  - if you have standard and customer-F4 mixed you shouldtake care that the standard handling is triggered.
    Regards,
    Clemens

  • F4 Help in ALV GRID class based

    hi
    you have any idea about how to invoke the F4 help in ALV GRID Class based program.,
    if u have any other related document or program using F4 function in ALV GRId please send to me for reference
    Thanks & Regards
    K.G

    hi for what kind of fields you need to give f4.
    are they std or custom...
    please let me know about the fields..
    try to check my logic which i gave in the below post..
    it will give f4 help to the fields(if thet are standard table fieldS)
    Message was edited by: Vijay Babu Dudla

  • Search Help In ALV Grid

    What is shortest way to attach particular Search Help in ALV grid using OOPS ?

    Thanks Gurpreet,
    Through search helps attached to data element it is possible but is there any other way to attach searchhelp differet from from the search help attached to the data element ? The new search-elp is not customized search help as given in the above threads ?
    Eg. - If I want to attach MAT2 to a field named MATNR in the table instead of the MAT1 which is standard.
    Thanks in advance

  • F4 help in ALV grid by using function module?

    Hi,
    I need to get f4 search help in ALV grid for a certain fields by using function module method.
    Please guide me.
    Thank You.

    Hi
    F4IF_INT_TABLE_VALUE_REQUEST  use this fm to get f4 search help for a certain fields .
    Regards
    Divya

  • How clear own f4 help in ALV GRID OO

    Hi experts,
    I have to create OWN F4 Help for 4 different cells in a ALV Grid list. I create one and it works.
    But how can I create the another ones without copy all the abapcode? (dynpro, classes, methods, etc.)
    To create one I use de BCALV_EDIT_08 standard report by example.
    Please help me.
    Thanks in advance.
    Oscar.

    Hi Ganesh,
    Did you have a look at sample report BCALV_TEST_GRID_F4_HELP ?
    Here is part of the header documentation:
    *& Report  BCALV_GRID_F4_HELP                                          *
    Purpose:
    ~~~~~~~~
    This report illustrates the use of f4-Help in an alv grid control.
    Background:
    ~~~~~~~~~~~
    There a two possibilities to implement an f4-Help in the alv grid
    control: one can either use standard f4-help or write one by Hand.
    For the former there is nothing to do at all. This report shows how
    to implement user-defined f4-help.
    I am sure you will find within this report the solution you are looking for.
    Reward points if this Helps.
    Manish

  • Problems with F4 help in ALV grid

    Hi all,
    I am trying to create a F4 help for the field Payee number in my reprot output (ALV Grid OO), i am able to get the window for selection of the value in the F4 help , but i am unable to pass the value back on to the screen.
    I need to insert the selected value from the F4 help and aslo need to populate the Name of the payee into the Payee field.
    Can some one help me in finding what error have i done in the code.
    Thanks in advance for all.
    I have the following code
    *&  Include      ZRMM_ALV_TOP                *
    data: gc_control100 type  ref to cl_gui_custom_container,
          gc_control101 type  ref to cl_gui_custom_container.
    data: gi_outtab100  type  table of ty_purchase.
    data: g_cont0100    type  ref to cl_gui_custom_container,
          g_grid0100    type  ref to cl_gui_alv_grid, " For Screen 100 Grid
          gi_fcat0100   type  lvc_t_fcat,  " Field Catalog for Screen 100
          gi_sort0100   type  lvc_t_sort,
          g_lout0100    type  lvc_s_layo.
    data: okcode_100    like  sy-ucomm,
          save_0100     like  sy-ucomm,
          okcode_200    like  sy-ucomm,
          save_0200     like  sy-ucomm.
    types: begin of f4_itab_type,
                  LIFNR type lifnr,
                  BUKRS type name1,
               end of f4_itab_type.
    data: f4_itab type table of f4_itab_type,
          ls_f4_itab type f4_itab_type.
    data : it_IZEMTAB type table of IZEMTAB,
           wa_IZEMTAB type IZEMTAB.
    Class Definitions.
    class event_receiver_0100 definition.
      PUBLIC SECTION.
        types: begin of onf4_event_parameters_type,
                  c_fieldname     type lvc_fname,
                  cs_row_no       type lvc_s_roid,
                  cr_event_data   type ref to cl_alv_event_data,
                  ct_bad_cells    type lvc_t_modi,
                  c_display       type char01,
                end of onf4_event_parameters_type.
        data: fieldcatalog type lvc_t_fcat.
        data :   f4_alv  type ref to cl_gui_alv_grid,
                 f4_cont type ref to cl_gui_custom_container.
        data: f4_params type onf4_event_parameters_type.
        METHODS:
           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.
      on_data_changed for event
                       data_changed of cl_gui_alv_grid
            importing e_onf4
                      e_onf4_before
                      e_onf4_after
                      er_data_changed
                      e_ucomm
                      sender.
    endclass.                    "lcl_event_receiver DEFINITION
    data: gs_variant type disvariant,
          gc_save    value 'A',
          gs_toolbar  TYPE stb_button,
          gs_toolbar1 type stb_button,
          gs_toolbar2 type stb_button.
    DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.
    DATA : event_receiver_0100 TYPE REF TO EVENT_RECEIVER_0100.
    Class Implementation.
    class event_receiver_0100  implementation.
    For f4 help.
      method on_f4.
    data: ls_outtab type ty_purchase.
    field-symbols <itab> type lvc_t_modi.
    data: ls_modi type lvc_s_modi,
          ls_f4_itab type f4_itab_type.
        f4_params-c_fieldname   = e_fieldname.
        f4_params-cs_row_no     = es_row_no.
        f4_params-cr_event_data = er_event_data.
        f4_params-ct_bad_cells  = et_bad_cells.
        f4_params-c_display     = e_display.
    read table it_purchase into ls_outtab index f4_params-cs_row_no-row_id.
    Clear f4_itab[].
    CALL FUNCTION 'FI_VENDOR_ALTERN_PAYERS_READ'
      EXPORTING
        I_LIFNR                  = ls_outtab-lifnr
        I_BUKRS                  = ls_outtab-bukrs
      TABLES
        T_ZEMTAB                 = it_izemtab.
         clear f4_itab[].
        if not ls_outtab-lifnr is initial.
        loop at it_izemtab into wa_izemtab.
          ls_f4_itab-LIFNR = wa_izemtab-empfb.
          ls_f4_itab-BUKRS = wa_izemtab-name1.
          append ls_f4_itab to f4_itab.
        endloop.
        endif.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
       RETFIELD              = 'LIFNR'
       DYNPPROG              = sy-repid
       DYNPNR                = '100'
       WINDOW_TITLE          = 'f4 help for PAYEE'
       VALUE_ORG             = 'S'
      TABLES
        VALUE_TAB            = f4_itab
        RETURN_TAB           = T_RETURN.
    IF SY-SUBRC <> 0.
    ENDIF.
    assign f4_params-cr_event_data->m_data->* to <itab>.
    ls_modi-row_id = f4_params-cs_row_no-row_id.
        read table f4_itab into ls_f4_itab index es_row_no-row_id.
        if not f4_itab is initial.
           ls_modi-row_id    = es_row_no-row_id.
           ls_modi-value     = ls_f4_itab-LIFNR.
           ls_modi-FIELDNAME = 'LIFNR'.
           append ls_modi to <itab>.
           ls_modi-row_id    = es_row_no-row_id.
           ls_modi-value     = ls_f4_itab-BUKRS.
           ls_modi-FIELDNAME = 'NAME1'.
           append ls_modi to <itab>.
        endif.
       er_event_data->m_event_handled = 'X'.
    ENDMETHOD.                           
    *--ENDMETHOD SHOW_F4--
    endclass.    "lcl_event_receiver IMPLEMENTATION

    I have used the following FM for F4 help on editable ALV grid column and it worked fine.Try the below.
    Call function for Input helps
        CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
             EXPORTING
                  i_title               = text-049
                  i_selection           = c_check
                  i_zebra               = c_check
                  i_screen_start_column = 55
                  i_screen_end_column   = 125
                  i_screen_start_line   = 10
                  i_screen_end_line     = 20
                  i_tabname             = c_fcat_str
                  it_fieldcat           = tl_fieldcat
             IMPORTING
                  es_selfield           = wal_selfield
             TABLES
                  t_outtab              = tl_code
             EXCEPTIONS
                  program_error         = 1
                  OTHERS                = 2.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSEIF sy-subrc = 0 AND NOT wal_selfield IS INITIAL.
          wl_index = wal_selfield-tabindex.
          READ TABLE tl_code ASSIGNING <l_code>
          INDEX wl_index.
          IF sy-subrc = 0.
            <l_fgis_lots>-status   = <l_code>.
          ENDIF.
        ENDIF.
      ENDIF.

  • Help in ALV grid

    Hi collegues,
    I am developing an OO ALV grid. This grid contains editable fields too. If I want to use the help function in these fields, it doesn't work at all times fine. The help for 'material number' is OK, but in all other fields (for instance 'currency') the chosen value will be set always in the first row (not in the row help function was started). Do You know the reason ? Can You give me advices to avoid this attitude ?
    Thanks a lot in advance
    Peter

    Hey,
    For proper F1 help, the fields should refer to the standard data element.
    For e.g. you need to define material as matnr like mara-matnr and not matnr(18) type C. Check the definition of the currency field.
    For F4 help the 1st condition is that the fields should refer to the standard data element. 2nd condition is the domain assigned to the data element should have a value table OR a search help should be assigned to the field.
    If you check the domain for MATNR it would have a value table MARA OR if you double click on the field MATNR you would see a search help assigned to the field.
    -Kiran
    *Please reward useful answers

  • F4 help in ALV Grid Control (using classes)

    Hi All,
        I have created a report using ALV Grid control (using classes). I need to provide F4 help for some of the fields in the Grid control.  I couldn't understand the standard demo program BCALV_GRID_F4_HELP. So Can anyone please provide me sample code for the same.
    Regards
    Jaker.

    hi check this..programs also
    BCALV_GRID_EDIT_DELTA
    BCALV_TEST_GRID_F4_HELP
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/how%2bto%2bimplement%2bf4%2bsearch%2bhelp%2bin%2boo%2balv%2bgrid
    Struggling with f4 handling in ALV grid - Minisap 46D
    regards,
    venkat

  • Need to help in alv grid graph

    Hi All,
       I made alv grid report.I put graph button in screen using pf status(&graph).
    Now when I execute the report output come and my graph button is also working fine.But when I click
    the graph button, the graph shows defalut column wise.Now I right click on graph and select chart type and then select LINES wise then graph shows LINES wise. Can we do default LINES wise so that
    when I click on graph button then it should come LINES wise default.
    Thanks,
    Rakesh

    HI,
    You can do this using the FM GFW_PRES_SHOW
    Check the sample program : DEMO_GFW_PRES_SHOW.
    For more infomation:
    refer to links:
    Re: How to plot graph in ALV?
    http://help.sap.com/saphelp_erp2005/helpdata/en/7e/daf830b46411d2961200a0c9308b1f/frameset.htm
    hope this infromation helps you.
    Thanks!

  • Problem in linking F4 help in alv grid display.

    Hi,
         I am linking F4 help in my program.My program gets activated properly but i am getting runtime error as : DYNPRO_NOT_FOUND and short text as
    Dynpor existiert nicht.Please help me in removing this error.Below is the simple code in which i am getting the error for ur reference:
    Thanks.
    REPORT  ZALVF4.
    Global data definitions for ALV.......................................
    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 : zharry.
    Types declaration.....................................................
    TYPES : BEGIN OF ty_emp,
      empid LIKE zharry-student,
      empname LIKE zharry-sname,
    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_sno FOR zharry-student.
          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 empid field.......................................
        IF e_fieldname = 'STUDENT'.
          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 STUDENT SNAME FROM ZHARRY
                           INTO CORRESPONDING FIELDS OF TABLE i_emp
                           WHERE student IN s_sno.
      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 = 'STUDENT'.
      ls_fcat-ref_table = 'ZHARRY'.
      ls_fcat-coltext = 'STUDENT NO'.
      APPEND ls_fcat TO i_fieldcatalog.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'SNAME'.
      ls_fcat-ref_table = 'ZHARRY'.
      ls_fcat-coltext = 'STUDENT 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 = 'EMPNAME'.
      lt_f4-register = 'X'.
      lt_f4-getbefore = 'X'.
      lt_f4-chngeafter = 'X'.
      APPEND lt_f4.
    ENDFORM.

    Hi,
         I am linking F4 help in my program.My program gets activated properly but i am getting runtime error as : DYNPRO_NOT_FOUND and short text as
    Dynpor existiert nicht.Please help me in removing this error.Below is the simple code in which i am getting the error for ur reference:
    Thanks.
    REPORT  ZALVF4.
    Global data definitions for ALV.......................................
    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 : zharry.
    Types declaration.....................................................
    TYPES : BEGIN OF ty_emp,
      empid LIKE zharry-student,
      empname LIKE zharry-sname,
    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_sno FOR zharry-student.
          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 empid field.......................................
        IF e_fieldname = 'STUDENT'.
          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 STUDENT SNAME FROM ZHARRY
                           INTO CORRESPONDING FIELDS OF TABLE i_emp
                           WHERE student IN s_sno.
      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 = 'STUDENT'.
      ls_fcat-ref_table = 'ZHARRY'.
      ls_fcat-coltext = 'STUDENT NO'.
      APPEND ls_fcat TO i_fieldcatalog.
      CLEAR ls_fcat.
      ls_fcat-fieldname = 'SNAME'.
      ls_fcat-ref_table = 'ZHARRY'.
      ls_fcat-coltext = 'STUDENT 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 = 'EMPNAME'.
      lt_f4-register = 'X'.
      lt_f4-getbefore = 'X'.
      lt_f4-chngeafter = 'X'.
      APPEND lt_f4.
    ENDFORM.

  • Need help with ALV Grid

    Hi,
    I am displaying Header and Item details in an ALV Grid. The first row will be having Header info and the next rows contains Item Details. I want to hide some of the columns of the first record only. The titles and the Item Details should remain same.
    Can any body help me.
    Regards,
    Srinivas

    Hello,
    That cannot be done as you are displaying the header and item level data together. Let the fields you do not want to display be blank while you display.
    Hope it helps.
    Thanks,
    Jayant

  • Help with alv grid

    Hi guys !!
    Do you have any good manual or tutorial on how to create a alv grid, including all the steps for the abap program and the screen painter.
    Thanks a lot !

    Javier,
    http://www.geocities.com/mpioud/Abap_programs.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    Don't forget to reward if useful....

  • Help on ALV GRID display outputting format for 2 internal tables

    Hi,
        I have requirement in ALV GRID where I need to display the data from 2 internal tables. The first internal table has the content of Delivery due list data and second the internal table has the corresponding stock transfer data of the Delivery Due list. I have a checbox on my selection screen, when unchecked it should output the 1st internal table data, i.e for Delivery due list. When it is checked then it should output 1st Internal table data + 2nd internal table data of stock transfer. For example, 1 document delivery due list data and 2nd line for that document should show the stock transfer data. You can also check the transaction code VL10E for that will show a delivery due list...and for stock tranfer,you need to check with Purchase order in in the USer Role tabstrip. Pls suggest.
    Regards,
    Mira

    Hi,
    U can try out this code
    REPORT zzz_test NO STANDARD PAGE HEADING
                           MESSAGE-ID zz.
    The Data Declarations
    INCLUDE zzm_test_alv_data.
    The Selection Screen Definition
    INCLUDE zzm_test_alv_selscrn.
    The definition and implementation of the event reciever class
    INCLUDE zzm_test_alv_class.
    START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM f1000_load_itabs.
    END-OF-SELECTION
    END-OF-SELECTION.
      IF NOT cb_disp IS INITIAL.
        CALL SCREEN 9001.
      ENDIF.
    Include for getting data
      INCLUDE zzm_test_alv_forms.
    Include for PAI and PBO of screen
      INCLUDE zzm_test_alv_screen.
      INCLUDE ZZM_TEST_ALV_DATA                                          *
    This include has all the data declaration defined
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    Table Declarations:
    TABLES: mara,
            makt.
    Internal Tables:
    The following structure type must be defined in the data dictionary
    DATA:  i_fieldcat  TYPE lvc_t_fcat,
           i_fieldcat1 TYPE lvc_t_fcat,
           i_output1   TYPE STANDARD TABLE OF mara,
           i_output2   TYPE STANDARD TABLE OF makt,
    Work Areas:
           w_output1   TYPE STANDARD TABLE OF mara,
           w_output2   TYPE STANDARD TABLE OF makt.
    Variable:
    DATA: lv_repid    LIKE sy-repid.
    lv_repid = sy-repid.
      INCLUDE ZZM_TEST_ALV_SELSCRN                                       *
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: cb_disp AS CHECKBOX.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN END OF BLOCK b_main.
      INCLUDE ZZM_TEST_ALV_CLASS                                         *
    This include has all the data declaration defined for ALV
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    INCLUDE <icon>.
    Predefine a local class for event handling to allow the
    declaration of a reference variable before the class is defined.
    DATA : o_alvgrid1 TYPE REF TO cl_gui_alv_grid ,
           o_alvgrid2 TYPE REF TO cl_gui_alv_grid ,
           cont_for_cognos1   TYPE scrfname VALUE 'BCALC_GRID_01_9100',
           cont_for_cognos2   TYPE scrfname VALUE 'BCALC_GRID_01_9200',
           custom_container1 TYPE REF TO cl_gui_custom_container,
           custom_container2 TYPE REF TO cl_gui_custom_container,
          Work Area
           w_layout TYPE lvc_s_layo ,
           w_variant TYPE disvariant.
          Constants
    CONSTANTS : c_lay(1) TYPE c VALUE 'A' .                  " All Layouts
    CONSTANTS: BEGIN OF c_main_tab,
               tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1',   "
               tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2',   "
               END OF c_main_tab.
      INCLUDE ZZM_TEST_ALV_FORMS                                         *
    This Include has the various forms used in the program
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    *&      Form  f9001_build_field_cat
          To Build Field Catalog
         -->P_I_FIELDCAT  text
         -->P_0021   text
    FORM f9001_build_field_cat TABLES   p_fieldcat STRUCTURE lvc_s_fcat
                          USING value(p_structure).
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                i_structure_name       = p_structure
           CHANGING
                ct_fieldcat            = p_fieldcat[]
           EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE i005 WITH 'Error in ALV field catalogue creation'.
                                                                " text-e05.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " f9001_build_field_cat
    *&      Form  f9000_objects_create
          For creating Custom Containers
    -->  p1        text
    <--  p2        text
    FORM f9000_objects_create.
      CREATE OBJECT custom_container1
          EXPORTING
              container_name = cont_for_cognos1
          EXCEPTIONS
              cntl_error = 1
              cntl_system_error = 2
              create_error = 3
              lifetime_error = 4
              lifetime_dynpro_dynpro_link = 5.
      CREATE OBJECT custom_container2
          EXPORTING
              container_name = cont_for_cognos2
          EXCEPTIONS
              cntl_error = 1
              cntl_system_error = 2
              create_error = 3
              lifetime_error = 4
              lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc NE 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = lv_repid
                  txt2  = sy-subrc
                  txt1  = 'The control could not be created'(510).
      ENDIF.
      CREATE OBJECT o_alvgrid1
           EXPORTING i_parent = custom_container1.
      CREATE OBJECT o_alvgrid2
           EXPORTING i_parent = custom_container2.
    ENDFORM.                    " f9000_objects_create
    *&      Form  f9003_layout
          To define the layout
         -->P_SY_TITLE  text
         -->P_0030   text
         -->P_0031   text
         -->P_0032   text
    FORM f9003_layout USING  value(ptitle)
                             value(pzebra)
                             value(pmode)
                             value(pwidth).
      w_layout-grid_title  = ptitle.
      w_layout-zebra       = pzebra.
      w_layout-sel_mode    = pmode.
      w_layout-cwidth_opt  = pwidth.
      w_variant-report     = sy-repid.
    ENDFORM.                    " f9003_layout
    *&      Form  f9006_error_handle
         To handle event
         -->P_PTEXT  text
    FORM f9006_error_handle USING value(ptext).
      IF sy-subrc NE 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = text-e03 " Error Note
                  txt2  = sy-subrc
                  txt1  = ptext.
      ENDIF.
    ENDFORM.                    " f9006_error_handle
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      CALL METHOD custom_container1->free.
      CALL METHOD custom_container2->free.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc NE 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = lv_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in FLush'(500).
      ENDIF.
    ENDFORM.
    *&      Form  f1000_load_itabs
          Select from Database
    -->  p1        text
    <--  p2        text
    form f1000_load_itabs.
      SELECT * FROM mara
               INTO TABLE i_output1
               UP TO 50 rows.
      SELECT * FROM makt
               INTO TABLE i_output2
               UP TO 50 rows.
    endform.                    " f1000_load_itabs
      INCLUDE ZZM_TEST_ALV_SCREEN                                        *
    2/ Description / Include functions
    This include contains PBO and PAI events for the screen of report
    ZZZJJ_TEST_ALV
    3/ Responsibility
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    DATA FOR TABSTRIP 'MAIN_TAB'
    CONTROLS:  main_tab TYPE TABSTRIP.
    DATA:      BEGIN OF i_main_tab,
                 subscreen   LIKE sy-dynnr,
                 prog        LIKE sy-repid VALUE
                                  'ZZZ_TEST',
                 pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
               END OF i_main_tab.
    *&      Module  STATUS_9001  OUTPUT
          text
    MODULE status_9001 OUTPUT.
    IF custom_container1 IS INITIAL.
      SET PF-STATUS 'ZSTATUS'.
      SET TITLEBAR 'ZTITLE'.
      Creating Object
        PERFORM f9000_objects_create.
      Building the field catalog
        PERFORM f9001_build_field_cat TABLES i_fieldcat
                                USING 'MARA'.
        PERFORM f9001_build_field_cat TABLES i_fieldcat1
                                USING 'MAKT'.
      Modifying the field catalog
       PERFORM f9002_modify_field_cat TABLES i_fieldcat.
      For Layout
        PERFORM f9003_layout USING sy-title 'X' 'B' 'X'.
    ENDIF.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&      Module  MAIN_TAB_ACTIVE_TAB_SET  OUTPUT
          Call method to display in the output grid
    MODULE main_tab_active_tab_set OUTPUT.
      main_tab-activetab = i_main_tab-pressed_tab.
      CASE i_main_tab-pressed_tab.
        WHEN c_main_tab-tab1.
      To display report
         i_main_tab-subscreen = '9100'.
          CALL METHOD o_alvgrid1->set_table_for_first_display
          EXPORTING
             is_variant                    = w_variant
             i_save                        = c_lay
             is_layout                     = w_layout
          CHANGING
             it_outtab                     = i_output1[]
             it_fieldcatalog               = i_fieldcat[]
          EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE i000 WITH text-e06."Error in ALV report display
        LEAVE LIST-PROCESSING.
      ENDIF.
        WHEN c_main_tab-tab2.
      To display report
          i_main_tab-subscreen = '9200'.
          CALL METHOD o_alvgrid2->set_table_for_first_display
          EXPORTING
             is_variant                    = w_variant
             i_save                        = c_lay
             is_layout                     = w_layout
          CHANGING
             it_outtab                     = i_output2[]
             it_fieldcatalog               = i_fieldcat1[]
          EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE i005 WITH text-e06."Error in ALV report display
        LEAVE LIST-PROCESSING.
      ENDIF.
    WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET OUTPUT
    *&      Module MAIN_TAB_ACTIVE_TAB_GET INPUT
          Check & Process the selected Tab
    MODULE main_tab_active_tab_get INPUT.
      CASE sy-ucomm.
        WHEN c_main_tab-tab1.
          i_main_tab-pressed_tab = c_main_tab-tab1.
        WHEN c_main_tab-tab2.
          i_main_tab-pressed_tab = c_main_tab-tab2.
        WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_GET INPUT
    *&      Module USER_COMMAND_9001 INPUT
          User Command
    MODULE user_command_9001 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          PERFORM exit_program.
          SET SCREEN '0'.
        WHEN 'EXIT' OR  'CANC'.
          PERFORM exit_program.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 “USER_COMMAND_9000 INPUT
    *&      Module MAIN_TAB_ACTIVE_TAB_SET INPUT
          Set sunscreen
    MODULE main_tab_active_tab_set INPUT.
      main_tab-activetab = i_main_tab-pressed_tab.
      CASE i_main_tab-pressed_tab.
        WHEN c_main_tab-tab1.
            i_main_tab-subscreen = '9100'.
        WHEN c_main_tab-tab2.
            i_main_tab-subscreen = '9200'.
        WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET INPUT
    Thanks & Regards,
    Judith.

Maybe you are looking for