Alv hotspot event

Hi guys ,
I have created an ALV report using the CAll function " REUSE alv grid display "
I want the functionality that on double clicking the doc nr ( belnr of table bseg ) the doc should open .
I have found the folowing cod from sdn
FORM dis_data.
g_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = g_repid
i_callback_user_command = 'USER_COMMAND'
i_grid_title = 'Interactive ALV'
it_fieldcat = fcat
it_events = eve
TABLES
t_outtab = itab
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. "dis_data
FORM user_command USING u_com LIKE sy-ucomm sel_field TYPE slis_selfield.
CLEAR fcat1.
CASE u_com.
WHEN '&IC1'.
READ TABLE itab INDEX sel_field-tabindex.
IF sy-subrc = 0.
t_doc = itab-vbeln.
SET PARAMETER ID 'AUN' FIELD t_doc.
CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM. "user_command
In the above code there is an event eve .. does someone kno what is this. also what is t_doc here .
Which parameter id should i set .
Thanks & Regards
Ashish

Hi Ashish,
let's go step by step:
1. "eve" is an internal table that holds the list events you would like to handle. A typical example could be:
  DATA: eve         TYPE slis_t_event.
  DATA: le_events   TYPE slis_alv_event.
  le_events-name = 'TOP_OF_PAGE'.
  le_events-form = 'PRINT_TOP'.
  APPEND le_events TO eve.
  le_events-name = 'END_OF_LIST'.
  le_events-form = 'PRINT_SELECTIONS'.
  APPEND le_events TO eve.
...where PRINT_TOP and PRINT_SELECTIONS are FORMs that carry out some headers and some footers of the listing.
2. "t_doc" seems to me to be a variable that stores a sales document number (VBELN), which is then passed to a SET/GET parameter 'AUN'.
I strongly recommend you to have a llok at the documentation of the parameters of function module REUSE_ALV_GRID_DISPLAY, it is VERY complete and helpful.
I hope this helps. Best regards,
Alvaro

Similar Messages

  • ALV diaply : hotspot event

    Hi ,
         I am using CL_GUI_ALV_GRID for displaying data in ALV grid format.
    Lets say my data is displyed as under the following fields :
    EQUNR   AB             BIS
    000001  21012001       21022002
    000002  21012001       21022002
    When I click on EQUNR '000001'.
    It should again display the following information in a separate ALV grid display.
    EQUNR    DEVLOC MATNR
    000001   0012   MAT1
    I am using hotspot event of ALV and on click I would like to fetch EQUNR to display the next ALV information.
    How do I get the value of the current cell , in this case '000001' when I click on value '000001' of EQUNR ?
    I am using get_current_cell and get_selected_cells methods of class CL_GUI_ALV_GRID but of no use .
    Can you please suggest ?
    Thanks and regards,
    S Das

    hi sudipta,
    You have to code as follows in class definition and implementation.
    METHODS : HANDLE_HOTSPOT_CLICK
                       FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                       IMPORTING E_ROW_ID E_COLUMN_ID.
    METHOD  HANDLE_HOTSPOT_CLICK.
    CASE E_COLUMN_ID-FIELDNAME.
               WHEN 'EQUNR'.
                           READ GT_ALVTAB INTO GS_ALVTAB INDEX E_ROW_ID-INDEX.
                           " ADD LOGIC HERE TO DISPLAY THE CORRESPONDING DATA.
    ENDCASE.
    ENDMETHOD.
    Regards,
    Karthik D

  • ALV + HOTSPOT + DOWNLOAD ALV O/P to a file  Querry ??

    Hi All
    I have the following requirement in my SAP-ABAP prog which is as under:
    <b>>></b>Hotspot click to be provided on EBELN field then call ME23 tcode skipping the first screen.
    <b>>></b>Hotspot click to be provided on VBELN field then call VF03 tcode skipping the first screen.
    <b>>></b>If check box marked save the data displayed on the report as a file to a presentation server
    <b>>></b> and please let me the Field catalogue table name which exists in dic
    As such ther's no inconsistency in my prog. But when i execute my prog , the ALV  O/p shows no data .
    And regarding the Hotspot click , if you are telling me to use SET parameter Id statement , thn plz specify how to use it.
    i mean in the statement
    e.g
      SET PARAMETER ID 'EBE' FIELD ACC_TAB-EBELN.
    when i double click on EBE , it does not allows me to specify EBE as parameter for field EBELN.
    I can provide you with the prog which i have made , if needed.
    So do help. Helpful entries will be rewarded.
    Thanks
    Gaurav
    Message was edited by:
            Gaurav Verma

    Hi
    <b>please go through this Program it was handled by Hot spot only .</b>
    report zbnstest.
    * TABLES AND DATA DECLARATION.
    *TABLES: mara,makt.",marc.
    data syrepid like sy-repid.
    data sydatum(10). " LIKE sy-datum.
    data sypagno(3) type n.
    * WHEN USING MORE THAN ONE TABLE IN ALV WE NEEED TO DECLARE THE TYPE
    * GROUP (TYPE-POOLS--------->SLIS)
    type-pools : slis.
    * INTERNAL TABLE DECLARATION.
    * INTERNAL TABLE TO HOLD THE VALUES FROM THE MARA TABLE
    data: begin of t_mara occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    mtart like mara-mtart,
    matkl like mara-matkl,
    end of t_mara.
    * INTERNAL TABLE TO HOLD THE CONTENTS FROM THE EKKO TABLE
    data : begin of t_marc occurs 0,
    matnr like mara-matnr,
    werks like marc-werks,
    minbe like marc-minbe.
    data: end of t_marc.
    * INTERNAL TABLE TO HOLD THE VALUES FROM MAKT TABLE.
    data : begin of t_makt occurs 0,
    matnr like mara-matnr,
    maktx like makt-maktx,
    spras like makt-spras,
    end of t_makt.
    * INTERNAL TABLE WHICH ACTUALLY MERGES ALL THE OTHER INTERNAL TABLES.
    data: begin of itab1 occurs 0,
    matnr like mara-matnr,
    meins like mara-meins,
    maktx like makt-maktx,
    spras like makt-spras,
    werks like marc-werks,
    minbe like marc-minbe,
    end of itab1.
    * THE FOLLOWING DECLARATION IS USED FOR DEFINING THE FIELDCAT
    * AND THE LAYOUT FOR THE ALV.
    * HERE AS slis_t_fieldcat_alv IS A INTERNAL TABLE WITHOUT A HEADER LINE
    * WE EXPLICITELY DEFINE AN INTERNAL TABLE OF THE SAME STRUCTURE AS THAT
    * OF slis_t_fieldcat_alv BUT WITH A HEADER LINE IN THE DEFINITION.
    * THIS IS DONE TO MAKE THE CODE SIMPLER.
    * OTHERWISE WE MAY HAVE TO DEFINE THE STRUCTURE AS IN THE NORMAL SAP
    * PROGRAMS.
    * IN THE FIELDCATALOG TABLE WE ACTUALLY PASS THE FIELDS FROM ONE OR
    * MORE TABLES AND CREATE A STRUCTURE
    * IN THE LAYOUT STRUCTURE WE BASICALLY DEFINE THE FORMATTING OPTIONS
    * LIKE DISPLAY IN THE ZEBRA PATTERN ,THE HOTSPOT OPTIONS ETC.
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    fieldlayout type slis_layout_alv.
    * DECLARING THE EVENTTABLE INTERNL TABLE FOR USING EVENTS LIKE
    * TOP-OF-PAGE ETC.
    data : eventstab type slis_t_event with header line.
    * DECLARING AN INTERNAL TABLE TO HOLD THE DATA FOR THE TOP-OF-PAGE
    data : heading type slis_t_listheader with header line.
    data : heading1 type slis_t_listheader with header line.
    data : heading2 type slis_t_listheader with header line.
    data : heading3 type slis_t_listheader with header line.
    data : heading4 type slis_t_listheader with header line.
    data : heading5 type slis_t_listheader with header line.
    data : heading6 type slis_t_listheader with header line.
    data : heading7 type slis_t_listheader with header line.
    data : heading8 type slis_t_listheader with header line.
    * STRUCTURE TO PASS THE COLOR ATTRIBUTES FOR DISPLAY.
    data : colorstruct type slis_coltypes.
    * INITIALIZATION. *
    initialization.
    syrepid = sy-repid.
    sypagno = sy-pagno.
    clear fieldcatalog.
    * START-OF-SELECTION. *
    start-of-selection.
    * SUBROUTINE TO POPULATE THE COLORSTRUCT
    perform fill_colorstruct using colorstruct.
    * SUBROUTINE TO POPULATE THE FIELDS OF THE FIELD CATALOGUE
    perform populate_fieldcatalog.
    * SUBROUTINE TO SELECT DATA FROM VARIOUS TABLES AND POPULATE IT IN THE
    * INTERNAL TABLE.
    perform selectdata_and_sort.
    * SUBROUTINE TO POPULATE THE LAYOUT STRUCTURE.
    perform populate_layout using fieldlayout.
    * SUBROUTINE TO CALL THE FUNCTION MERGE TO ENSURE PROPER DISPLAY.
    perform merge_fieldcatalog.
    * SUBROUTINE TO POPULATE THE EVENTSTAB.
    perform fill_eventstab tables eventstab.
    * SUBROUTINE TO POPULATE THE HEADING TABLES.
    perform fill_headingtable tables heading using 'HEADING'.
    perform fill_headingtable tables heading1 using 'HEADING1'.
    perform fill_headingtable tables heading2 using 'HEADING2'.
    perform fill_headingtable tables heading3 using 'HEADING3'.
    perform fill_headingtable tables heading4 using 'HEADING4'.
    perform fill_headingtable tables heading5 using 'HEADING5'.
    perform fill_headingtable tables heading6 using 'HEADING6'.
    perform fill_headingtable tables heading7 using 'HEADING7'.
    perform fill_headingtable tables heading8 using 'HEADING8'.
    * SUBROUTINE TO DISPLAY THE LIST.
    perform display_alv_list.
    * FORMS
    * IN THIS SUBROUTINE WE POPULATE THE FIELDCATALOG TABLE WITH THE NAMES
    * OF THE TABLE,FIELDNAME,WHETHER IT IS KEY FIELD OR NOT,HEADING AND
    * COLUMN JUSTIFICATION.
    form populate_fieldcatalog.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATNR' 'X' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MEINS' ' '.
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MAKTX' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MTART' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MATKL' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'SPRAS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'WERKS' ' ' .
    perform fill_fields_of_fieldcatalog tables fieldcatalog
    using 'ITAB1' 'MINBE' ' ' .
    endform. " POPULATE_FIELDCATALOG
    * FORM FILL_FIELDS_OF_FIELDCATALOG *
    * --> FIELDCATALOG *
    * --> P_TABNAME *
    * --> P_FIELDNAME *
    * --> P_KEY *
    * --> P_KEY *
    form fill_fields_of_fieldcatalog tables fieldcatalog
    structure fieldcatalog
    using p_tabname
    p_fieldname
    p_key.
    * p_no_out.
    fieldcatalog-tabname = p_tabname.
    fieldcatalog-fieldname = p_fieldname.
    fieldcatalog-key = p_key.
    fieldcatalog-emphasize = '1234'.
    *fieldcatalog-no_out = p_no_out.
    append fieldcatalog.
    endform. " FILL_FIELDSOFFIELDCATALOG
    * FORM POPULATE_LAYOUT *
    * --> FIELDLAYOUT *
    form populate_layout using fieldlayout type slis_layout_alv.
    fieldlayout-f2code = '&ETA' .
    fieldlayout-zebra = 'X'.
    * FOR THE WINDOW TITLE.
    fieldlayout-window_titlebar = 'ALV with Events'.
    fieldlayout-colwidth_optimize = 'X'.
    fieldlayout-no_vline = ' '.
    *fieldlayout-no_input = 'X'.
    fieldlayout-confirmation_prompt = ''.
    fieldlayout-key_hotspot = 'X'.
    * This removes the column headings if the flag is set to 'X'
    fieldlayout-no_colhead = ' '.
    *fieldlayout-hotspot_fieldname = 'MAKTX'.
    fieldlayout-detail_popup = 'X'.
    * fieldlayout-coltab_fieldname = 'X'.
    endform. " POPULATE_LAYOUT
    * FORM SELECTDATA_AND_SORT *
    form selectdata_and_sort.
    select matnr meins mtart matkl from mara
    into corresponding fields of t_mara
    up to 500 rows .
    select matnr maktx spras from makt
    into corresponding fields of t_makt
    where matnr = t_mara-matnr and
    spras = sy-langu.
    select matnr werks minbe from marc
    into corresponding fields of t_marc
    where matnr = t_mara-matnr.
    append t_marc.
    endselect.
    append t_makt.
    endselect.
    append t_mara.
    endselect.
    perform populate_itab1.
    sort itab1 by matnr.
    endform. " SELECTDATA_AND_SORT
    * FORM MERGE_FIELDCATALOG *
    form merge_fieldcatalog.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
    i_program_name = syrepid
    i_internal_tabname = 'ITAB1'
    * i_structure_name = 'COLORSTRUCT'
    * I_CLIENT_NEVER_DISPLAY = 'X'
    i_inclname = syrepid
    changing
    ct_fieldcat = fieldcatalog[]
    exceptions
    inconsistent_interface = 1
    program_error = 2
    others = 3.
    endform. " MERGE_FIELDCATALOG
    * IN THIS FUNCTION THE MINIMUM PARAMETERS THAT WE NEED TO PASS IS AS
    * FOLLOWS:-
    * i_callback_program --> CALLING PROGRAM NAME
    * i_structure_name --> STRUCTURE NAME.
    * is_layout --> LAYOUT NAME.
    * it_fieldcat ---> BODY OF THE FIELD CATALOGUE INTERNAL TABLE
    form display_alv_list.
    call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
    * I_INTERFACE_CHECK = ' '
    i_callback_program = syrepid
    * I_CALLBACK_PF_STATUS_SET = ' '
    * I_CALLBACK_USER_COMMAND = ' '
    i_structure_name = 'ITAB1'
    is_layout = fieldlayout
    it_fieldcat = fieldcatalog[]
    * IT_EXCLUDING =
    * IT_SPECIAL_GROUPS =
    * IT_SORT =
    * IT_FILTER =
    * IS_SEL_HIDE =
    * I_DEFAULT = 'X'
    * THE FOLLOWING PARAMETER IS SET AS 'A' INORDER TO DISPLAY THE STANDARD
    * TOOL BAR
    i_save = 'A'
    * IS_VARIANT = ' '
    it_events = eventstab[]
    * IT_EVENT_EXIT =
    * IS_PRINT =
    * I_SCREEN_START_COLUMN = 0
    * I_SCREEN_START_LINE = 0
    * I_SCREEN_END_COLUMN = 0
    * I_SCREEN_END_LINE = 0
    * IMPORTING
    * E_EXIT_CAUSED_BY_CALLER =
    * ES_EXIT_CAUSED_BY_USER =
    tables
    t_outtab = itab1
    exceptions
    program_error = 1
    others = 2.
    endform. " DISPLAY_ALV_LIST
    *& Form POPULATE_ITAB1
    * text
    * --> p1 text
    * <-- p2 text
    form populate_itab1.
    loop at t_mara.
    loop at t_makt where matnr = t_mara-matnr.
    loop at t_marc where matnr = t_mara-matnr.
    move-corresponding t_mara to itab1.
    move-corresponding t_makt to itab1.
    move-corresponding t_marc to itab1.
    append itab1.
    endloop.
    endloop.
    endloop.
    endform. " POPULATE_ITAB1
    *& Form FILL_EVENTSTAB
    * text
    * -->P_EVENTSTAB text *
    form fill_eventstab tables p_eventstab structure eventstab.
    * WHEN THE FOLLOWING FUNCTION IS CALLED THE SYSTEM POPULATES THE
    * INTERNAL TABLE EVENTSTAB WITH A LIST OF EVENTS NAME.
    * AS SHOWN BELOW WHEN USING I_LIST_TYPE = 0 THE FUNCTION RETURNS 14
    * EVENTS NAME.
    call function 'REUSE_ALV_EVENTS_GET'
    exporting
    i_list_type = 0
    importing
    et_events = p_eventstab[]
    exceptions
    list_type_wrong = 1
    others = 2.
    * BY CALLING THE ABOVE FUNCTION WE FIRST POPULATE THE EVENTSTAB WITH
    * THE PREDEFINED EVENTS AND THEN WE MOVE THE FORM NAME AS SHOWN BELOW.
    * WE ASSIGN A FORM NAME TO THE EVENT AS REQUIRED BY THE USER.
    * FORM NAME CAN BE ANYTHING.THE PERFORM STATEMENT FOR THIS FORM
    * IS DYNAMICALY CALLED.
    read table p_eventstab with key name = slis_ev_top_of_page.
    if sy-subrc = 0 .
    move 'TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_coverpage.
    if sy-subrc = 0 .
    move 'TOP_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_coverpage .
    if sy-subrc = 0 .
    move 'END_OF_COVERPAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_top_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_TOP_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_foreign_end_of_page.
    if sy-subrc = 0 .
    move 'FOREIGN_END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_list_modify.
    if sy-subrc = 0 .
    move 'LIST_MODIFY' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_top_of_list.
    if sy-subrc = 0 .
    move 'TOP_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_page.
    if sy-subrc = 0 .
    move 'END_OF_PAGE' to p_eventstab-form.
    append p_eventstab.
    endif.
    read table p_eventstab with key name = slis_ev_end_of_list .
    if sy-subrc = 0 .
    move 'END_OF_LIST' to p_eventstab-form.
    append p_eventstab.
    endif.
    endform. " FILL_EVENTSTAB
    *& Form FILL_HEADINGTABLE
    * text
    * -->P_HEADING text *
    form fill_headingtable tables p_heading structure heading
    using tablename.
    case tablename.
    when 'HEADING'.
    p_heading-typ = 'H'.
    concatenate
    ' REPORT NAME:-' syrepid
    ' ABB Industry Pte Ltd' into p_heading-info.
    append p_heading.
    write sy-datum using edit mask '__/__/____' to sydatum.
    concatenate
    ' DATE:-' sydatum ' USER: ' sy-uname 'PAGE NO:' sypagno
    into p_heading-info.
    append p_heading.
    when 'HEADING1'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING2'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-COVER-PAGE'.
    append p_heading.
    when 'HEADING3'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-TOP-OF-PAGE'.
    append p_heading.
    when 'HEADING4'.
    p_heading-typ = 'H'.
    p_heading-info = 'FOREIGN-END-OF-PAGE'.
    append p_heading.
    * WHEN 'HEADING5'.
    * P_HEADING-TYP = 'H'.
    * P_HEADING-INFO = 'LIST-MODIFY'.
    * APPEND P_HEADING.
    when 'HEADING6'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-PAGE'.
    append p_heading.
    when 'HEADING7'.
    p_heading-typ = 'H'.
    p_heading-info = 'END-OF-LIST'.
    append p_heading.
    when 'HEADING8'.
    p_heading-typ = 'H'.
    p_heading-info = 'TOP-OF-LIST'.
    append p_heading.
    endcase.
    endform. " FILL_HEADINGTABLE
    * FORM TOP_OF_PAGE *
    form top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading[]
    exceptions
    others = 1.
    endform.
    *& Form FILL_COLORSTRUCT
    * text
    * -->P_COLORSTRUCT text *
    form fill_colorstruct using p_colorstruct type slis_coltypes .
    p_colorstruct-heacolfir-col = 6.
    p_colorstruct-heacolfir-int = 1.
    p_colorstruct-heacolfir-inv = 1.
    endform. " FILL_COLORSTRUCT
    * FORM TOP_OF_COVERPAGE *
    form top_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading1[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_COVERPAGE *
    form end_of_coverpage.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading2[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_TOP_OF_PAGE *
    form foreign_top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading3[]
    exceptions
    others = 1.
    endform.
    * FORM FOREIGN_END_OF_PAGE *
    form foreign_end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading4[]
    exceptions
    others = 1.
    endform.
    * FORM LIST_MODIFY *
    *FORM LIST_MODIFY.
    * CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    * EXPORTING
    * IT_LIST_COMMENTARY = HEADING5[]
    * EXCEPTIONS
    * OTHERS = 1.
    *ENDFORM.
    * FORM END_OF_PAGE *
    form end_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading6[]
    exceptions
    others = 1.
    endform.
    * FORM END_OF_LIST *
    form end_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading7[]
    exceptions
    others = 1.
    endform.
    * FORM TOP_OF_LIST *
    form top_of_list.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
    it_list_commentary = heading8[]
    exceptions
    others = 1.
    endform.
    *--- End of Program
    make use of there FMs
    SAP_CONVERT_TO_XLS_FORMAT
    -> MS_EXCEL_OLE_STANDARD_DAT
    -> RSPO_DOWNLOAD_SPOOLJOB
    RH_START_EXCEL_WITH_DATA
    but , Header Description length will be based on the Field length.
    <b>Reward if usefull</b>

  • Table Name in OOPS ALV HotSpot click

    Hi Team,
    I am displaying 3 ALVs in a single screen using set_table_for_first_display (say Table A , table B , Table C).
    In the screen i have used 3 custom controls to display each ALV.
    Now i have a need to put a hotspot event for some fields in each ALV.
    I want to know the internal table name / custom control name on which the user clicks so that I can write the respective code .
    I am able to get the field name through e_column_id-fieldname but since all the 3 internal tables have the same column names it doesnt help.
    Can someone help me how to get the name of the internal table/custom control ?
    Thanks.
    R Adarsh

    Hi,
    It is not possible to get the Internal table name and container used in displaying the ALV.
    But while populating the Fieldcatalog if you are passing the internal table name then you can try this way..
    1. In the User command Subroutine...you can call the grid method GET_FRONTEND_FIELDCATALOG which returns the fieldcatalog which is used..from which you can find the table whcih is used.

  • ALV Grid event handlers

    Hello Friends;
    I have a problem with event handlers. I have defined events for double_click, data_change and hotspot_click. At first run of the program everything runs fine but when I make a change at the screen (like pressing Enter or entering a value at a screen field) the handlers seem to be called a couple of times. For example at a hotspot click I call an accounting document display and when I want to return with back button the program seems to be stuck at document display. Actually it calls event handler over and over again. How can I solve this problem? Can refreshing grid be a solution?
    Thx in advance
    Ali

    Hello Ali
    The problem is that after handling the hotspot event the current cell is still on the field with the hotspot. Thus, when you push ENTER the ALV grid checks the current cell which has a hotspot defined which, in turn, raises event HOTSPOT_CLICK.
    Therefore, you have to move the current cell to another cell that has no hotspot defined. Have a look at the implementation of the event handler method. The hotspot is on field KUNNR. After calling transaction XD03 I shift the current cell to field BUKRS.
    If you comment these lines you will see the same behaviour of the report as you described.
    *& Report  ZUS_SDN_TWO_ALV_GRIDS
    REPORT  ZUS_SDN_ALVGRID_EVENTS.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    PARAMETERS:
      p_bukrs      TYPE bukrs  DEFAULT '1000'  OBLIGATORY.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_hotspot_click.
    *   define local data
        DATA:
          ls_knb1     TYPE knb1,
          ls_col_id   type lvc_s_col.
        READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
        CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
        SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
        SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
        CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
    *   Set active cell to field BUKRS otherwise the focus is still on
    *   field KUNNR which will always raise event HOTSPOT_CLICK
        ls_col_id-fieldname = 'BUKRS'.
        CALL METHOD go_grid1->set_current_cell_via_id
          EXPORTING
            IS_ROW_ID    = e_row_id
            IS_COLUMN_ID = ls_col_id.
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT        * FROM  knb1 INTO TABLE gt_knb1
             WHERE  bukrs  = p_bukrs.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          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 ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          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.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog_knb1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        CHANGING
          it_outtab       = gt_knb1
          it_fieldcatalog = gt_fcat
        EXCEPTIONS
          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.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          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.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  BUILD_FIELDCATALOG_KNB1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog_knb1 .
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'KNB1'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 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.
      READ TABLE gt_fcat INTO ls_fcat
           WITH KEY fieldname = 'KUNNR'.
      IF ( syst-subrc = 0 ).
        ls_fcat-hotspot = abap_true.
        MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
      ENDIF.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    Regards
      Uwe

  • In ALV End_of_list Event  Scrolling Option

    Hi Experts,
    In ALV END_OF_LIST Event if I want to display more records approx:50 .
    iam able to display using Reuse_Alv_Commentary_Write But .Due to high volume of Records Its Overlaping Main List  I need to drag Manually.
    My Question : is There any option where Scrolling is Available for Reuse_Alv_Commentary.
    Thank You.Please Reply.

    Hi,
    Use do_sum = 'X', in the fieldcatalog for the fields for which you need to do the summation.
    Best Regards,
    Durga Naresh Bayireddy

  • ALV  ONF4 event

    Hi All,
    I have used the ALV onF4 event for F4 help for a field in an ALV display....But the problem is that this is not getting triggered on pressing F4.....
    What might be the problem..
    I have referred the program : BCALV_EDIT_08.
    -SatyaPriya

    Hi ,
      Please check whether you have created the class to handle events and also set the handlers for it.
    Regards
    Arun

  • ALV Print event in Custom Button

    Hi,
    I have requirement to call ALV print event in Custom Button after some condition. Can anyone give me the solution or link to achieve this requirement.
    Thank in advance.

    Hi Mani,
    On that ALV button event, write the following code.
      DATA lo_component TYPE REF TO if_wd_component.
      DATA lo_appl      TYPE REF TO if_wd_application.
      lo_component = wd_comp_controller->wd_get_api( ).
      lo_appl      = lo_component->get_application( ).
      lo_appl->print_page( ).
      DATA lo_app_info TYPE REF TO if_wd_rr_application .
      lo_app_info = lo_appl->get_application_info( ).
      DATA lv_app_name TYPE string .
      lv_app_name = lo_app_info->get_name( ).
    It helps you to print the table contents. Hope this helps you.
    Thanks
    KH

  • Wrong messagetype while processing in an alv grid event

    Hello,
    a brief discription of my problem:
    I am processing a standard SAP form "PERIODE_PRUEFEN" which calls the function "READ_CUSTOMIZED_MESSAGE". The routine is called inside an event-handler of the ALV Grid event 'user_command'. The messagetype is selected from a customising table 'T100C'. Despite the messagetype 'W' the program is always aborted with an 'E' message.
    What I have tried so far:
    1. I debugged the SAP standard transaction 'fb08' which runs exactly the same functions with the same values and it works.
    2. I changed the messagetype in the debugger - no success
    3. I searched the SAP notes, but theres nothing about my problem
    I guess the problem is somewhere in the ALV Grid event, because this is the only difference between the SAP standard an my program. Maybe the message is processed wrong while beeing called within an event.
    It would be great to get some useful hints to solve this problem

    Hi,
    The ABAP runtime environment handles messages according to the type declared in the MESSAGE statement and the context in which the message was sent.
    The behaviour of message type 'W' in a dialog is different from a report program.
    Run demo program DEMO_MESSAGES, select Main Program, Type 'W' and execute. You will get an error message instead of warning message.
    This behaviour is well documeneted in the on-line help for MESSAGE statement.
    Regards,
    Rao A

  • ALV Tree event registration doesn't work

    Hello Experts,
    the following is the registration-form which shall register a item-double-click event to my alv-tree-object. when doing the double-click it doesn't open my own methods in the event-handler class but the standard ones and nothing happens further.
    Any ideas?
    Many thanks in advance!
    Tobias
    FORM register_events.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
      CALL METHOD g_alv_tree->get_registered_events
        IMPORTING
          events = lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO lt_events.
      CALL METHOD g_alv_tree->set_registered_events
        EXPORTING
          events                    = lt_events
        EXCEPTIONS
          cntl_error                = 1
          cntl_system_error         = 2
          illegal_event_combination = 3.
      IF sy-subrc <> 0.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
      CREATE OBJECT event_handler.
      SET HANDLER event_handler->handle_item_double_click FOR g_alv_tree.
    ENDFORM.

    It doesn't matter where I place my double-click. The standard event handling "handle_event" is called.
    Instead of this I would like to have my coding.....
    Changing the cl_gui_alv_tree to cl_gui_column_tree doesn't work since my tree isn't a reference of column_tree but of alv_tree. So I would have to rebuild nearly the entire tree. This cannot be a solution since I guess the double-click item should work anyway.
    What I am wondering furthermore is my button declaration not being displayed. The following is my fieldcatalog declaration:
    FORM create_tree_fc.
      DATA: ls_fc TYPE lvc_s_fcat.
      DATA: lo_descrref   TYPE REF TO cl_abap_typedescr.
      DATA: lo_tableref TYPE REF TO cl_abap_tabledescr.
      DATA: lo_structref TYPE REF TO cl_abap_structdescr.
      FIELD-SYMBOLS: <fs_str> TYPE abap_compdescr.
      lo_tableref ?= cl_abap_tabledescr=>describe_by_data( lt_report_tree ).
      lo_descrref ?= lo_tableref->get_table_line_type( ).
      lo_structref ?= lo_descrref.
      CLEAR gt_fc[].
      LOOP AT lo_structref->components ASSIGNING <fs_str>.
        CLEAR ls_fc.
        ls_fc-fieldname = <fs_str>-name.
        ls_fc-intlen = <fs_str>-length.
        ls_fc-inttype = <fs_str>-type_kind.
        ls_fc-decimals = <fs_str>-decimals.
        CASE <fs_str>-name.
          WHEN 'PROCESS_TYPE'.
            ls_fc-tooltip = 'Process Type'.
            ls_fc-coltext = 'Process Type'.
            ls_fc-emphasize = 'C110'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = cl_gui_column_tree=>item_class_button.
            ls_fc-outputlen = 20.
          WHEN 'SMI_PROJECT'.
            ls_fc-tooltip = 'Project Relation'.
            ls_fc-coltext = 'Project'.
            ls_fc-hotspot = 'X'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            ls_fc-outputlen = <fs_str>-length.
          WHEN 'TRORDER_NUMBER'.
            ls_fc-tooltip = 'ID of Transport Request'.
            ls_fc-coltext = 'Transport Request'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT.
            ls_fc-outputlen = 30.
        ENDCASE.
        APPEND ls_fc TO gt_fc.
      ENDLOOP.
    ENDFORM.
    Edited by: Tobias Fickinger on Jun 10, 2009 9:59 AM
    Edited by: Tobias Fickinger on Jun 10, 2009 10:00 AM
    Edited by: Tobias Fickinger on Jun 10, 2009 10:03 AM

  • ALV GRID - EVENT HANDLING

    Hi all,
       Please let me know how to hanldle  event handling , making a cell in editable mode ,double click and hotspot creation,colorign a single cell,calling a transatcion when clicked on hotspot in a alv grid display program (not using OO   concepts).
    Looikng forward for a positive response.
    Reagrds,
    Mohinder.

    Hi,
    You can create your own custom status and asign it to your
    ALV GRID. Here is a sample code to add custom status and handling events.
    http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • Refresh the screen after a ALV hotspot click

    I have a value type I painted on my screen, i wan it to be updated after i trigger the hotspot click on my ALV list. How to do refresh the value on the screen?Because hotspot click does not update the screen for the latest value.

    Hello Lai
    I trigger PAI in the event handler method using the following coding:
    *   Trigger PAI
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = e_ucomm
    *      IMPORTING
    *        rc       =
    When you are at PAI you can do all kinds of refreshing your ALV list before displaying it again. For an example see thread
    Blanking values on ALV Grid Row Duplicate
    Regards
      Uwe

  • Drop Down List in ALV with Event handler

    Hi All ,
    I have created an ALV grid with a dropdown as one of the columns. This all works fine, except that I want to be able to react to a change in the value of each line's dropdown the next column values should change according to the user selection in the 1st column .
    Is this possible?
    As an example, I have a table of records with one column as a dropdown called " Replace Function Module "   and in 2nd column i have call function of that Replace Function Module , If a  change in " Replace Function Module " should change the call function of in the 2nd column .
    I am using these objects lvc_t_drop , lvc_s_drop and  the method  " set_drop_down_table ",
    Please Can any 1 tel me how to do this with any event handler ar any other way !

    Hi,
    You need to use event handler for this. Check if the below link gives some direction.
    [http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]
    I guess you should create a method inside which you call the FM using the FM name from the selected cell in ALV.
    I have not tried it out, but its worth a try.
    Hope this helps!
    Regards,
    Saumya

  • Capturing the ALV Grid Event

    Hi Experts,
    I am working on ALV Grid , Data is Displayed in Grid well , But Can Any one please tell me how can i capture the event (back,exit and cancel) which is persent on standard toolbar on ALV Gried output .
    Rgds,
    Premraj

    Hello PremRaj ,
    Please find an dummy program to capture the events below:
    TYPE-POOLS slis.
    DATA: ITAB_EVENTS TYPE slis_t_event,
          WA_EVENTS TYPE SLIS_ALV_EVENT.
    DATA: IT_END TYPE SLIS_T_LISTHEADER,
          WA_END TYPE SLIS_LISTHEADER.
    ** This function module will get all the events present in alv into internal table itab_events*
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = ITAB_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 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.
    ** With this read table statement itab_events is read for the desired event*+
    READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
      wa_eventS-form = 'END'.
      MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
      CLEAR wa_eventS.
    *Pass the ITAB_EVENTS created in this Function Module
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
        IT_EVENTS                         = ITAB_EVENTS
    IMPORTING
       E_EXIT_CAUSED_BY_CALLER           =
       ES_EXIT_CAUSED_BY_USER            =
       TABLES
         t_outtab                          = it_tab
    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.
    *READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.
    wa_eventS-form = 'END'.
    MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.
    CLEAR wa_eventS.
    *in these statements ,the second line will automatically try to call subroutine with name end.
    FORM END.
    WA_END-TYP = 'S'.
    WA_END-KEY = TEXT-004.
    WA_END-INFO = SY-DATUM.
    APPEND WA_end TO IT_END.
    CLEAR WA_END.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = IT_END
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    Hope it helps you.
    Thanks Mansi
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 11:02 AM
    Edited by: MANSI  ASNANI on Jan 9, 2009 7:31 AM

  • ALV hotspot new window problem

    Hi all,
       I have an problem. in alv list, there is a field with hotspot, after I click it, it should popup a new window with some text. But now I can't popup a new window. Look at some of my codes:
    FORM user_command USING p_ucomm    LIKE sy-ucomm
                            lw_selfield TYPE slis_selfield. 
    DATA: LW_HOTSPOT TYPE ZV_TAX_G_TIPP.
      IF p_ucomm = c_ic1.
        IF lw_selfield-fieldname = 'TYPE_DECL'.
          WINDOW STARTING AT 5 120
                 ENDING AT   5 7.
         call SCREEN 1001 starting at 5 10
                         ENDING AT 5 7.
    WINDOW STARTING AT  can't act on ALV???
    when I replace window with call screen, but I don't know how to code in detail. Could you please help me?

    Hi,
    See this code,
    TABLES KNA1.
    START-OF-SELECTION.
      SELECT * FROM KNA1.
        WRITE / KNA1-KUNNR HOTSPOT ON.
      ENDSELECT.
    AT LINE-SELECTION.
      WINDOW STARTING AT 10 10
             ENDING   AT 40 25.
      WRITE:/ 'Hi'.
    Regards,
    Vijay

Maybe you are looking for

  • Modifying video chat in flash with actionscript

    Hi, I have develop an application wherein i have 2 avpresence,1 connectionlight,1 simpleconnect,1 peoplelist and 1 chat component on the stage.now i want that when particular user is selected from the peoplelist only then his video should be displaye

  • How to copy a section of a web page? Shift command  ?

    Cannot remember the key combination to copy a small section of any web page. The result ends up on the desk top and can be printed from there. Thanks Jack

  • The cursor in a web page isn't shown

    Hi, I'm developing a form that has several tab pages. Also I have a button that calls another window (in the same form). When I taste it in the web, if the second window isn't modal it just appears a second and I can do nothing. So I change it to mod

  • Cannot get Ipod Touch 8 GB to update to newer software

    I have a 8 GB Ipod touch. The software version is currently 2.2.1. All of my apps will no longer sync to my Ipod because it says they require the Iphone 3.0 software update. I have tried to update my software several times, but it says I have the cur

  • Displaying Data in a Form field

    Hi, We have a requirement, where we have to display the value in one of the field as "Header_number.Line_number" where as the backend value will have only the Line_number. We have Header_number in a Materialized View. I am going to fetch line_number