Alv-hotspot

hi to all,
i am having a dought in alv plz help me.
in alv output list i am having 15 fields displaying with alv grid display.my requirement is when we click on first field ie sales order field it should display the remaining fields in vertical way.
plz help me in this issue
for example
sales order no netweith amount currency
100000          20g      20     inr
i nee to display it as this way
sales order no 100000
netweight      20g
amount        20
currency     inr
hi vasanth i have returned tthis code but it is not working and the display button on left side is there but
my requirement is for only double clicking the sales order.
Thanks ®ards
Kranthi.
Message was edited by: kranthi reddy
Message was edited by: kranthi reddy

Hello Kranthi,
U can do this very easily.
Use this code to activate the Double click on the sales order.
*&      Form  ALV_DISPLAY
      text
-->  p1        text
<--  p2        text
FORM ALV_DISPLAY.
  DATA: IT_VARIANT LIKE DISVARIANT,
        G_S_SORT  LIKE LINE OF IT_SORT.
  DATA: IT_EVENTS TYPE SLIS_T_EVENT,
        WA_EVENTS LIKE LINE OF IT_EVENTS.
  REFRESH: IT_EVENTS.
  CLEAR: WA_EVENTS,IT_EVENTS.
  WA_EVENTS-NAME = 'PF_STATUS_SET'.
  WA_EVENTS-FORM = 'STATUS'.
  APPEND WA_EVENTS TO IT_EVENTS .
<b> CLEAR WA_EVENTS.
  WA_EVENTS-NAME = 'USER_COMMAND'.
  WA_EVENTS-FORM = 'USER_COMMAND'.
  APPEND WA_EVENTS TO IT_EVENTS .</b>
  REFRESH IT_SORT.
  CLEAR: G_S_SORT,G_S_SORT.
  G_S_SORT-SPOS      = 1.
  G_S_SORT-FIELDNAME = 'EBELN'.
  G_S_SORT-UP        = 'X'.
  G_S_SORT-DOWN      = ' '.
  G_S_SORT-SUBTOT    = ' '.
  G_S_SORT-EXPA      = ' '.
  APPEND G_S_SORT TO IT_SORT.
For storing the variant layout
  IT_VARIANT-REPORT  = SY-REPID.
  SY-TITLE = TEXT-033.
  CLEAR G_T_OUTTAB.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            I_CALLBACK_PROGRAM      = IT_VARIANT-REPORT
            I_CALLBACK_TOP_OF_PAGE  = 'TOP_OF_PAGE'
     <b>       I_CALLBACK_USER_COMMAND = 'USER_COMMAND'</b>            IT_FIELDCAT             = IT_FIELDCAT
            I_SAVE                  = 'A'
            IS_VARIANT              = IT_VARIANT
            IT_SORT                 = IT_SORT
            IT_EVENTS               = IT_EVENTS
       TABLES
            T_OUTTAB                = G_T_OUTTAB
       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.                    " ALV_DISPLAY
      FORM user_command                                             *
FORM USER_COMMAND USING UCOMM LIKE SY-UCOMM
                        SELFIELD TYPE SLIS_SELFIELD.
  DATA: REPORT LIKE SY-REPID,
        CODE LIKE SY-UCOMM.
  REPORT = SY-REPID.
<b>The field SELFIELD-VALUE will have the selected VBELN.</b>
Write Your code here.
  ENDFORM.
If the left hand side of the application toolbar.. there will be a display buttton which does the sane operation as that of u. Put the same code inside the USER command FIeld.
If helps reward.
Vasanth

Similar Messages

  • 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 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

  • ALV Hotspot Problem

    Hi,
    I have a ALV that displays fine. I am trying to enable hotspot at two of the columns BELNR(RBKP) and EBELN(RSEG). There is also a status field (RBKP-RBSTAT).
    The hotspot that has been defined with EBELN works great. However, when I try to click the EBELN column, it goes to the MIR7 screen, without prefilling the doc number(which is BELNR).
    Further as an added complexity, depending on the status (RBKP-RBSTAT), the called transaction should be either MIRO or MIR7.
    Would appreciate if anybody has done anything on this before. I am using the classifical ALV.
    Rajib
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'BELNR'.
        Read data table, using index of row user clicked on
          READ TABLE it_alldata_f INTO
          wa_it_alldata INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'RBN' FIELD wa_it_alldata-belnr.
        Execute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'MIR6' AND SKIP FIRST SCREEN.
        ELSEIF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
          READ TABLE it_alldata_f INTO
          wa_it_alldata INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_it_alldata-ebeln.
        Execute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.

    Hi Everybody,
    I am beginner in ABAP.
    I try to create a report using hotspot in core ABAP.
    Please help me how to do it.
    My scenario is,
    I should display the header detail of purchase order.
    And to define hotspot for purchase doc no- EBELN.
    If once i clicked the pur. doc. no the Item details should be displayed.
    I wnt to get clear about the types to be declared and how to merge it.
    I completed the code for purchase order header using grid dispaly.
    Here is the code.
    *& Report  ZTASK1
    REPORT  ZTASK1 no standard page heading message-id 001.
    tables ekko.
    type-pools slis.
    data : begin of str occurs 0,
            ebeln type ebeln,
            aedat type erdat,
            ernam type ernam,
            lifnr type elifn,
            bukrs type bukrs,
       end of str.
    select-options: pa_pur for ekko-ebeln obligatory,
                     pa_date for ekko-aedat no intervals no-extension.
    data: wa_fct TYPE slis_fieldcat_alv,
            it_fct TYPE slis_t_fieldcat_alv.
    select ebeln aedat ernam lifnr bukrs from ekko into table str where ebeln in pa_pur.
              wa_fct-row_pos        = '1'.
              wa_fct-col_pos        = '1'.
              wa_fct-fieldname      = 'EBELN'.
              wa_fct-tabname        = 'EKKO'.
              wa_fct-seltext_m      = 'Puchase Doc. No.'.
              append wa_fct to it_fct.
              CLEAR WA_FCT.
              wa_fct-row_pos        = '1'.
              wa_fct-col_pos        = '2'.
              wa_fct-fieldname      = 'ERDAT'.
              wa_fct-tabname        = 'EKKO'.
              wa_fct-seltext_m      = 'Created Date'.
              append wa_fct to it_fct.
              CLEAR WA_FCT.
               wa_fct-row_pos        = '1'.
              wa_fct-col_pos        = '3'.
              wa_fct-fieldname      = 'ERNAM'.
              wa_fct-tabname        = 'EKKO'.
              wa_fct-seltext_m      = 'Created By'.
              append wa_fct to it_fct.
              CLEAR WA_FCT.
              wa_fct-row_pos        = '1'.
              wa_fct-col_pos        = '4'.
              wa_fct-fieldname      = 'LIFNR'.
              wa_fct-tabname        = 'EKKO'.
              wa_fct-seltext_m      = 'Vendor'.
              append wa_fct to it_fct.
              CLEAR WA_FCT.
              wa_fct-row_pos        = '1'.
              wa_fct-col_pos        = '5'.
              wa_fct-fieldname      = 'BUKRS'.
              wa_fct-tabname        = 'EKKO'.
              wa_fct-seltext_m      = 'Company Code'.
              append wa_fct to it_fct.
              CLEAR WA_FCT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM                = SY-REPID
        IT_FIELDCAT                       = IT_FCT
    TABLES
         t_outtab                          = STR
      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.

  • 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

  • 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

  • OO ALV hotspot creation not working with Multiple Methods.

    Hi,
    I create a Test Report for Hotspot creation - It works. Code is  as -->
    class my_event_handler definition.
      public section.
      methods :
      handle_hotspot_click for event hotspot_click of cl_gui_alv_grid importing e_row.
      endclass.
      class my_event_handler implementation.
        method handle_double_click.
          read table itab index e_row-index into wa.
          if sy-subrc = 0.
           set PARAMETER ID 'ANR' FIELD order
    call transaction IW33.         
    endif.
      endclass.
    BUT - When I take multiple methods in PUBLIC SECTION. & Call it from START-OF-SELECTION the HotSpot is NOT WORKING
    CLASS get_details DEFINITION.
      PUBLIC SECTION.
        METHODS:  data_gathering,
                  display_alv.
                  handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid IMPORTING e_row .
      PRIVATE SECTION.
        CLASS-METHODS: get_data,
                       merge_data,
                       set_header IMPORTING er_table TYPE REF TO cl_salv_table,
                       set_coloum IMPORTING pr_columns TYPE REF TO cl_salv_columns_table.
    ENDCLASS.       
    CLASS IMPLEMENTATION - IS SAME AS ABOVE.
    START-OF-SELECTION.
      CREATE OBJECT lr_details.
      lr_details->data_gathering( ).
      IF gi_final IS NOT INITIAL.
        lr_details->display_alv( ).
    *    lr_details->handle_hotspot_click( EXPORTING row = ?  ).  " What to take?
      ELSE.
        MESSAGE 'No Data for the Selection Critaria' TYPE 'S' DISPLAY LIKE 'E'.
      ENDIF.
    How get Hotspot in this Case, Do I need to take the Method in START-OF-SELECTION ?
    if YES - then what to Export ? If NO - then how to create Hotspot in this case?

    Thanks Neil. Now it's working.
    For this One line clue - I really searched a lot.
    Thank you so much.
    If checking this link For Reference -->
    Search 'SET HANDLER' in Google for sample programs.
    * Before Class Defination
    CLASS get_details DEFINITION DEFERRED.
    DATA: event_receiver1  TYPE REF TO get_details,
    * At the End of Method display_alv (Check question for Methods)
    CREATE OBJECT event_receiver1.
    SET HANDLER event_receiver1->handle_hotspot_click FOR ALL INSTANCES.

  • Problem with CALL TRANSACTION  SKIP FIRST SCREEN

    Hi Experts,
    I am having a functionality where in if i click the hotspot i go the specified transaction..I am able to do that using --
    CALL TRANSACTION 'CAA3' AND SKIP FIRST SCREEN
    Now if i press the back button on the standard transaction i am coming to the first screen of the CAA3 transaction..
    Can i come back to my original ALV display instead of coming to the first screen of the CAA3 transaction which i have skipped while going there..
    I have searched in all forums. But i couldn't get the proper solution.
    Please Help me !!!
    Regards,
    Rajesh

    Hi friends,
    What do you think the results?
    I used alv hotspot.
    FORM user USING  r_ucomm LIKE sy-ucomm rs_selfield
                              TYPE slis_selfield .
       READ TABLE gt_alv INTO gs_alv INDEX rs_selfield-tabindex.
       IF rs_selfield-fieldname EQ 'BELGE'.
         SET PARAMETER ID '80B' FIELD gs_alv-belge.
         CALL TRANSACTION 'FPE3' AND SKIP FIRST SCREEN.
       ELSEIF rs_selfield-fieldname EQ 'GPART'.
         SET PARAMETER ID 'BPA' FIELD gs_alv-gpart.
         CALL TRANSACTION 'FPP3' AND SKIP FIRST SCREEN.
       ELSEIF rs_selfield-fieldname EQ 'VKONT'.
         SET PARAMETER ID 'KT0' FIELD gs_alv-vkont.
         CALL TRANSACTION 'CAA3' AND SKIP FIRST SCREEN.
       ENDIF.
    FPE3 and FPP3 is running. But CAA3 is incorrect.
    is the correct answer enhancement ?

  • HOW TO CLEAR PARAMETER ID?

    Hey experts,
    I use alv hotspot to call transaction tm_53 as follows:
      SET PARAMETER ID 'BUK' FIELD P_CCODE .
      SET PARAMETER ID 'FAN' FIELD P_LIST-DEAL_NUMBER .
      CALL TRANSACTION 'TM_53' .
    the first P_LIST-DEAL_NUMBER = 11.
    and it is successed.
    the second time the P_LIST-DEAL_NUMBER = 12.
    but  in the screen of tm_53,
    the field P_LIST-DEAL_NUMBER is also 11.
    how can i do?
    i used free momery id P_LIST-DEAL_NUMBER ,
    but it's not gone.
    thanks.

    hi,
    check this link
    clear the field you are using in the SET PARAMETER statement
    Clearing Parameter ID
    regards
    lakshmi

  • View activity by clicking hotspot on ALV report

    Hi,
    I have a report with a ALV grid as output. This output cells represent different activities in CRM. By clicking on one cell, the hotspot gets activated and the selected activity should be opened.
    How can I implement to go into the selected activity?
    I already have implemented by method for the hotspot processing.
    What function do I have to use to jump into the activity?
    Thanks for your help!
    Caroline

    Hi,
    1. hotspot definition.
       **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    2.implementation
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW_ID.
        V_COLUMN = E_COLUMN_ID.
        V_ROW_NUM = ES_ROW_NO.
      PERFORM HANDLE_HOTSPOT_CLICK USING E_ROW_ID E_COLUMN_ID ES_ROW_NO .
      ENDMETHOD.                    "lcl_event_handler
    FORM HANDLE_HOTSPOT_CLICK USING I_ROW_ID TYPE LVC_S_ROW
                                    I_COLUMN_ID TYPE LVC_S_COL
                                    IS_ROW_NO TYPE LVC_S_ROID.
      READ TABLE IT_FINAL INDEX I_ROW_ID  .
      IF SY-SUBRC = 0.
        IF I_COLUMN_ID-FIELDNAME = 'VGBEL'
                  AND NOT IT_FINAL-VGBEL IS INITIAL.
          PERFORM FORM_REFRESH.
          SET PARAMETER ID 'AUN' FIELD IT_FINAL-VGBEL.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
        ENDIF.
    **if user clicks on Delivery
        IF I_COLUMN_ID-FIELDNAME = 'VBELN'
                AND NOT IT_FINAL-VBELN IS INITIAL.
          PERFORM FORM_REFRESH.
          SET PARAMETER ID 'VL' FIELD IT_FINAL-VBELN.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        ENDIF.
    **if user clicks on Vendor Name
        IF I_COLUMN_ID-FIELDNAME = 'NAME'
                 AND NOT IT_FINAL-EBELN IS INITIAL.
          PERFORM FORM_REFRESH.
          SET PARAMETER ID 'BES' FIELD IT_FINAL-EBELN.
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDIF.
    ENDFORM.
    you need to use set_handler for hot_spot.
    regards
    vijay

  • Hotspot on more than one fields in ALV Report

    I want to add Hotspot on more than one field in ALV,
      one field is Vbeln , one is BSTNK, one is matnr and so on.
    i have used form user_command.and have written coding for Vbeln (on vbeln i am showing transaction VA02)
    i want to pass an eror mesaage when user clicks on bstnk or matnr.
    Thanks

    Hi Lovleen,
    *Global definitions  *
    Data Types
    type-pools: slis.
    types: begin of tp_data,
    ebeln like ekko-ebeln,
    *matnr like ekko-matnr,
    *meins like ekko-meins,
    lifnr like lfa1-lifnr,
    chk1,
           end of tp_data,
           tp_tbl_data type standard table of tp_data.
    Constants
    Data objects (variable declarations and definitions)
    Report data to be shown.
    data: it_data type standard table of tp_data.
    Heading of the report.
    data: t_heading type slis_t_listheader.
    ======================= Selection Screen ==========================
    selection-screen: begin of block b1 with frame title text-t01.
    DATA: w_aux_ebeln like ekko-ebeln.
    SELECT-OPTIONS s_ebeln for w_aux_ebeln
    DEFAULT 1000 .
    DATA: w_aux_lifnr like lfa1-lifnr.
    SELECT-OPTIONS s_lifnr for w_aux_lifnr
    DEFAULT 00000001000 .
    selection-screen: end of block b1.
    ======================== Event Blocks =============================
    at selection-screen.
    start-of-selection.
      perform get_data using it_data.
    end-of-selection.
      perform build_alv using it_data t_heading.
    ======================== Subroutines ==============================
    *&      Form  get_data
          Gets the information to be shown in the report.
    form get_data using t_data type tp_tbl_data.
    SELECT e~ebeln
    *e~matnr
    *e~meins
    l~lifnr
    INTO CORRESPONDING FIELDS OF TABLE t_data
    FROM ekko as e
    inner join lfa1 as l on elifnr = llifnr
    WHERE e~ebeln in s_ebeln
    AND l~lifnr in s_lifnr
    endform.                    " get_data
    *&      Form  build_alv
          Builds and display the ALV Grid.
    form build_alv using t_data type tp_tbl_data
                         t_heading  type slis_t_listheader.
    ALV required data objects.
    data: w_title   type lvc_title,
          w_repid   type syrepid,
          w_comm    type slis_formname,
          w_status  type slis_formname,
          x_layout  type slis_layout_alv,
          t_event    type slis_t_event,
          t_fieldcat type slis_t_fieldcat_alv,
          t_sort     type slis_t_sortinfo_alv.
    refresh t_fieldcat.
    refresh t_event.
    refresh t_sort.
    clear x_layout.
    clear w_title.
    Field Catalog
      perform set_fieldcat2 using:
    1 'CHK1' 'XFELD' space space space 'Select' 'Select this row' 'Sel'
    'Select this row' space space space 'X' 'X' space t_fieldcat,
    2 'EBELN' 'EBELN' 'EKKO' space space  space  space  space  space space
    space space space space space t_fieldcat ,
    3 'MATNR' 'MATNR' 'EKKO' space space  space  space  space  space space
    space space space space space t_fieldcat ,
    4 'MEINS' 'MEINS' 'EKKO' space space  space  space  space  space space
    space space space space space t_fieldcat ,
    5 'LIFNR' 'LIFNR' 'LFA1' space space  space  space  space  space space
    space space space space space t_fieldcat .
    Layout
    x_layout-zebra = 'X'.
    Top of page heading
      perform set_top_page_heading using t_heading t_event.
    Events
      perform set_events using t_event.
    GUI Status
      w_status = ''.
      w_repid = sy-repid.
    Title
    w_title = <<If you want to set a title for
                the ALV, please, uncomment and edit this line>>.
    User commands
      w_comm   = 'USER_COMMAND'.
    Order
    Example
    PERFORM set_order USING '<field>' 'IT_DATA' 'X' space space t_sort.
    Displays the ALV grid
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program       = w_repid
          it_fieldcat              = t_fieldcat
          is_layout                = x_layout
          it_sort                  = t_sort
          i_callback_pf_status_set = w_status
          i_callback_user_command  = w_comm
          i_save                   = 'X'
          it_events                = t_event
          i_grid_title             = w_title
        tables
          t_outtab                 = t_data
        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.                    " build_alv.
    *&      Form  set_top_page_heading
          Creates the report headings.
    form set_top_page_heading using t_heading type slis_t_listheader
                                    t_events  type slis_t_event.
    data: x_heading type slis_listheader,
          x_event   type line of slis_t_event.
    Report title
      clear t_heading[].
      clear x_heading.
      x_heading-typ = 'H'.
      x_heading-info = ''(001).
      append x_heading to t_heading.
    Program name
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Program: '.
      x_heading-info = sy-repid.
      append x_heading to t_heading.
    User who is running the report
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'User: '.
      x_heading-info = sy-uname.
      append x_heading to t_heading.
    Date of execution
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Date: '.
      write sy-datum to x_heading-info.
      append x_heading to t_heading.
    Time of execution
      clear x_heading.
      x_heading-typ = 'S'.
      x_heading-key = 'Time: '.
      write sy-uzeit to x_heading-info.
      append x_heading to t_heading.
    Top of page event
      x_event-name = slis_ev_top_of_page.
      x_event-form = 'TOP_OF_PAGE'.
      append x_event to t_events.
    endform.
    *&      Form  set_events
          Sets the events for ALV.
          The TOP_OF_PAGE event is alredy being registered in
          the set_top_page_heading subroutine.
    form set_events using t_events type slis_t_event.
    data: x_event   type line of slis_t_event.
    Example
    clear x_event.
    x_event-name = .
    x_event-form = .
    append x_event to t_event.
    endform.
    *&      Form  set_order
          Adds an entry to the order table.
    FORM set_order USING p_fieldname p_tabname p_up p_down p_subtot
                         t_sort TYPE slis_t_sortinfo_alv.
      DATA: x_sort TYPE slis_sortinfo_alv.
      CLEAR x_sort.
      x_sort-fieldname = p_fieldname.
      x_sort-tabname   = p_tabname.
      x_sort-up = p_up.
      x_sort-down = p_down.
      x_sort-subtot = p_subtot.
      APPEND x_sort TO t_sort.
    ENDFORM.                    "set_order
    *&      Form  set_fieldcat2
          Adds an entry to the field catalog.
       p_colpos: Column position.
       p_fieldname: Field of internal table which is being described by
    *            this record of the field catalog.
       p_ref_fieldname: (Optional) Table field / data element which
    *                describes the properties of the field.
    *                If this field is not given, it is copied from
    *                the fieldname.
       p_ref_tabname: (Optional) Table which holds the field referenced
    *              by <<p_ref_fieldname>>.
                      If this is not given, the parameter
                      <<p_ref_fieldname>> references a data element.
       p_outputlen: (Optional) Column width.
       p_noout: (Optional) If set to 'X', states that the field is not
    *           showed initially. If so, the field has to be
                included in the report at runtime using the display
                options.
       p_seltext_m: (Optional) Medium label to be used as column header.
       p_seltext_l: (Optional) Long label to be used as column header.
       p_seltext_s: (Optional) Small label to be used as column header.
       p_reptext_ddic: (Optional) Extra small (heading) label to be
    *                used as column header.
       p_ddictxt: (Optional) Set to 'L', 'M', 'S' or 'R' to select
                  whether to use SELTEXT_L, SELTEXT_M, SELTEXT_S,
                  or REPTEXT_DDIC as text for column header.
       p_hotspot: (Optional) If set to 'X', this field will be used
    *             as a hotspot area for cursor, alolowing the user
    *          to click on the field.
       p_showasicon: (Optional) If set to 'X', this field will be shown
                     as an icon and the contents of the field will set
    *             which icon to show.
       p_checkbox: (Optional) If set to 'X', this field will be shown
                   as a checkbox.
       p_edit: (Optional) If set to 'X', this field will be editable.
       p_dosum: (Optional) If set to 'X', this field will be summed
                (aggregation function) according to the grouping set
                by the order functions.
       t_fieldcat: Table which contains the whole fieldcat.
    FORM set_fieldcat2 USING
          p_colpos p_fieldname p_ref_fieldname p_ref_tabname
          p_outputlen p_noout
          p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
          p_hotspot p_showasicon p_checkbox p_edit
          p_dosum
          t_fieldcat TYPE slis_t_fieldcat_alv.
      DATA: wa_fieldcat TYPE slis_fieldcat_alv.
      CLEAR wa_fieldcat.
    General settings
      wa_fieldcat-fieldname = p_fieldname.
      wa_fieldcat-col_pos = p_colpos.
      wa_fieldcat-no_out = p_noout.
      wa_fieldcat-hotspot = p_hotspot.
      wa_fieldcat-checkbox = p_checkbox.
      wa_fieldcat-icon = p_showasicon.
      wa_fieldcat-do_sum = p_dosum.
    Set reference fieldname, tablenam and rollname.
    If p_ref_tabname is not given, the ref_fieldname given
       is a data element.
    If p_ref_tabname is given, the ref_fieldname given is a
       field of a table.
    In case ref_fieldname is not given,
       it is copied from the fieldname.
      IF p_ref_tabname IS INITIAL.
        wa_fieldcat-rollname =   p_ref_fieldname.
      ELSE.
        wa_fieldcat-ref_tabname = p_ref_tabname.
        IF p_ref_fieldname EQ space.
          wa_fieldcat-ref_fieldname =   wa_fieldcat-fieldname.
        ELSE.
          wa_fieldcat-ref_fieldname =   p_ref_fieldname.
        ENDIF.
      ENDIF.
    Set output length.
      IF NOT p_outputlen IS INITIAL.
        wa_fieldcat-outputlen = p_outputlen.
      ENDIF.
    Set text headers.
      IF NOT p_seltext_m IS INITIAL.
        wa_fieldcat-seltext_m = p_seltext_m.
      ENDIF.
      IF NOT p_seltext_l IS INITIAL.
        wa_fieldcat-seltext_l = p_seltext_l.
      ENDIF.
      IF NOT p_seltext_s IS INITIAL.
        wa_fieldcat-seltext_s = p_seltext_s.
      ENDIF.
      IF NOT p_reptext_ddic IS INITIAL.
        wa_fieldcat-reptext_ddic = p_reptext_ddic.
      ENDIF.
      IF NOT p_ddictxt IS INITIAL.
        wa_fieldcat-ddictxt = p_ddictxt.
      ENDIF.
    Set as editable or not.
      IF NOT p_edit IS INITIAL.
        wa_fieldcat-input     = 'X'.
        wa_fieldcat-edit     = 'X'.
      ENDIF.
      APPEND wa_fieldcat TO t_fieldcat.
    ENDFORM.                   "set_fieldcat2
    ======================== Subroutines called by ALV ================
    *&      Form  top_of_page
          Called on top_of_page ALV event.
          Prints the heading.
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
        i_logo             = <<If you want to set a logo, please,
                             uncomment and edit this line>>
          it_list_commentary = t_heading.
    endform.                    " alv_top_of_page
    *&      Form  user_command
          Called on user_command ALV event.
          Executes custom commands.
    form user_command using r_ucomm     like sy-ucomm
                            rs_selfield type slis_selfield.
    Example Code
    Executes a command considering the sy-ucomm.
    CASE r_ucomm.
       WHEN '&IC1'.
         Set your "double click action" response here.
         Example code: Create and display a status message.
         DATA: w_msg TYPE string,
               w_row(4) TYPE n.
         w_row = rs_selfield-tabindex.
         CONCATENATE 'You have clicked row' w_row
                     'field' rs_selfield-fieldname
                     'with value' rs_selfield-value
                     INTO w_msg SEPARATED BY space.
         MESSAGE w_msg TYPE 'S'.
    ENDCASE.
    End of example code.
    endform.                    "user_command
    Reward Points if useful.
    Regards,
    Manoj Kumar

  • How to keep hotspot on particular field in alv interactive report

    hi all,
    i have a small requirement.i developed one interactive alv.in vasic alv wheni click on sales order number it shows secondary alv.but here i would like to keep hotspot symbol so user can understand that he has to click on this sales order number only.
    any body can send me the sam ecode please.
    thanks,
    maheedhar.t

    hi...
    here is an ALV report i did with hot spot!!
    (only a part of my entire report)
    tables: marc.
    types : begin of DISP,
            SLNO TYPE I,
            werks type MARC-WERKS,
            matnr type MARA-MATNR,
            maktx type MAKT-MAKTx,
            mtart type MARA-MTART,
            volum type MARA-VOLUM,
            ntgew type MARA-NTGEW,
            ersda type MARA-ERSDA,
            laeda type MARA-LAEDA,
            end of DISP.
    data : it_disp type table of disp,
           wa_disp type disp.
    Data: it_fcat type slis_t_fieldcat_alv,
          wa_fcat type slis_fieldcat_alv.
    parameters : p_werks type marc-werks.
    IF p_werks IS INITIAL.
    MESSAGE I000(Z_errors).
    ELSE.
    select MARC~WERKS
           MARA~MATNR
           MAKT~MAKTX
           MARA~MTART
           MARA~VOLUM
           MARA~NTGEW
           MARA~ERSDA
           MARA~LAEDA
    from
    MARC inner join MARA
    on marcmatnr = maramatnr
    inner join makt
    on marcmatnr = maktmatnr
    into corresponding fields of table IT_DISP
    where marc~werks = p_werks and spras = 'EN'.
    IF SY-SUBRC = 0.
    PERFORM display.
    ELSE.
    MESSAGE I001(Z_errors).
    ENDIF.
    ENDIF.
    form display.
    LOOP AT IT_DISP INTO WA_DISP.
    MOVE SY-TABIX TO WA_DISP-SLNO.
    MODIFY IT_DISP FROM WA_DISP TRANSPORTING SLNO.
    ENDLOOP.
    wa_fcat-col_pos = 1.
    wa_fcat-fieldname = 'SLNO'.
    WA_fcat-SELTEXT_L = 'SLNO'.
    wa_fcat-tabname = 'IT_DISP'.
    wa_fcat-ref_fieldname ='SLNO'.
    *wa_fcat-ref_tabname = ''.
    <b>wa_fcat-hotspot = 'X'.</b>
    append wa_fcat to it_fcat.
    clear wa_fcat.
    the line in bold is wat which wil enable hpt spot for ur ALV display!
    try out.
    reward if my ans is useful.

  • Hotspot click for only some rows in ALV grid for a particular column ?

    Hi there,
            In ALV grid, we can make Hotspot enable for all rows in a specified column
    by specifying in the fieldcatalog with Hotspot attribute set as true.
    But I want to enable Hotspot only for certain rows in the particular column. I tried with MC_STYLE4_LINK , but I didnt got the required result.
    So , how could I achieve that in ALV grid.
    Points would be rewarded for helpful answers.
    Regards,
    Anil .

    Hi,
    You can do it for a column. Please refer to the code snippet below,
      DATA : it_fcat TYPE lvc_t_fcat,
             wa_fcat LIKE LINE OF it_fcat.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
       EXPORTING
      I_BUFFER_ACTIVE              =
         i_structure_name             = 'SMMW_ALERTS_ICON_S'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_BYPASSING_BUFFER           =
      I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = it_fcat
       EXCEPTIONS
         inconsistent_interface       = 1
         program_error                = 2
         OTHERS                       = 3
    LOOP AT it_fcat INTO wa_fcat.
      IF wa_fcat-fieldname = 'STATUS'.
        wa_fcat-hotspot = 'X'.
        MODIFY it_fcat FROM wa_fcat.
        CLEAR wa_fcat.
      ENDIF.
    ENDLOOP.
    CALL METHOD l_obj_alv_grid->set_table_for_first_display
          EXPORTING
        i_structure_name              = 'SMMW_ALERTS_ICON_S'
       CHANGING
            it_outtab                     = lt_alerts_st
            it_fieldcatalog               = it_fcat.
    In the above replace the structure 'SMMW_ALERTS_ICON_S' with your structure and column 'STATUS' with your desired column.
    Hope this helps,
    Regards,
    Vinodh

  • How can I use hotspot click in an ALV grid?

    Hello,
    I have a table that is displayed in an ALV grid and I would like to have one of the columns as clickable icons.
    For example:
    Print  |  Doc. Type | Name
    (icon) |   .docx      | first
    (icon) |   .pdf         | second ... and so on.
    I would like to click in the icon (Print column) and execute an action, but no matter what I do I can't set the action.
    I know that is not just setting "fieldcatalog-hotspot='X'", but I don't know how to use a hotspot handler.
    Here's some of the code I have:
    TYPES: BEGIN OF ty_docs,
                        print LIKE ICON-ID,
                        doc_type LIKE table_doc-TYPE,
                        name LIKE table_doc-NAME,
                 END OF ty_docs.
    DATA:  oref_dock TYPE REF TO cl_gui_docking_container,
                oref_alv TYPE REF TO cl_gui_alv_grid,
                i_fieldcat TYPE lvc_t_fcat,
                aux_fieldcat TYPE lvc_s_fcat,
                aux_lay TYPE lvc_s_layo,
                i_exclude TYPE TABLE OF syucomm,
                i_docs TYPE ty_docs,
                t_docs LIKE TABLE OF i_docs.
    AT SELECTION-SCREEN OUTPUT.
       APPEND 'ONLI' TO i_exclude.
       APPEND 'SJOB' TO i_exclude.
       APPEND 'PRIN' TO i_exclude.
       CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
         EXPORTING
           p_status = sy-pfkey
           p_program = sy-repid
         TABLES
           p_exclude = i_exclude.
    AT SELECTION-SCREEN.
       CHECK sy-ucomm = space.
         SELECT
               icon~ID AS print
               doc~TYPE AS doc_type
               doc~NAME as name
                 INTO CORRESPONDING FIELDS OF TABLE t_docs
                 FROM table_doc AS doc
                      INNER JOIN ICON AS icon    
                        ON icon~NAME EQ 'ICON_PRINT'
                 GROUP BY icon~ID doc~TYPE doc~NAME.
       IF sy-subrc = 0.
         IF oref_dock IS NOT BOUND.
           CREATE OBJECT oref_dock
              EXPORTING
                repid = sy-repid
                dynnr = sy-dynnr
                side = cl_gui_docking_container=>dock_at_bottom
                ratio = 90
             EXCEPTIONS
               OTHERS = 1.
         ENDIF.
         IF oref_alv IS NOT BOUND.
           CHECK oref_dock IS BOUND.
           CREATE OBJECT oref_alv
             EXPORTING
               i_parent = oref_dock
             EXCEPTIONS
               OTHERS = 1.
           CHECK oref_alv IS BOUND.
           aux_fieldcat-fieldname = 'PRINT'.
           aux_fieldcat-coltext = 'Print'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-print'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-just = 'C'.
           aux_fieldcat-hotspot = 'X'.
           aux_fieldcat-outputlen = 10.
           aux_fieldcat-col_pos = 0.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_fieldcat-fieldname = 'TYPE'.
           aux_fieldcat-coltext = 'Doc. Type'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-doc_type'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-outputlen = 15.
           aux_fieldcat-col_pos = 1.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_fieldcat-fieldname = 'NAME'.
           aux_fieldcat-coltext = 'Name'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-name'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-outputlen = 12.
           aux_fieldcat-col_pos = 2.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_lay-grid_title = 'Docs'.
           aux_lay-edit = ''.
           CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
             EXPORTING
              i_structure_name = 'ty_docs'
              i_internal_tabname = 't_docs'
            CHANGING
              ct_fieldcat = i_fieldcat
           EXCEPTIONS
             OTHERS = 3.
           CALL METHOD oref_alv->set_table_for_first_display
             EXPORTING
               i_structure_name = 'ty_docs'
               is_layout = aux_lay
             CHANGING
               it_fieldcatalog = i_fieldcat
               it_outtab = t_docs
             EXCEPTIONS
               OTHERS = 1.
         ELSE.
           CALL METHOD oref_alv->refresh_table_display
             EXCEPTIONS
               OTHERS = 1.
         ENDIF.
      ENDIF.
    Thank you so much in advance!

    Hi,
    After creating grid set the even handler for hot spot.
    SET HANDLER lcl_event_receiver=>handle_hotspot_click FOR alv_grid.
    Try this code:
    TABLES: mara,t001l.
    DATA: BEGIN OF i_alv OCCURS 0,
           matnr TYPE mara-matnr,
           mtart TYPE mara-mtart,
           matkl TYPE mara-matkl,
           groes TYPE mara-groes,
           maktx TYPE makt-maktx,
           END OF i_alv.
    DATA: wa_alv  LIKE LINE OF i_alv.
    DATA: alv_container  TYPE REF TO cl_gui_docking_container.
    DATA: alv_grid       TYPE REF TO cl_gui_alv_grid.
    DATA: layout    TYPE lvc_s_layo.
    DATA: fieldcat  TYPE lvc_t_fcat.
    DATA: gt_t001l TYPE STANDARD TABLE OF t001l.
    CLASS lcl_event_receiver DEFINITION.
       PUBLIC SECTION.
    *-->Method for User command
         CLASS-METHODS :
         handle_hotspot_click FOR EVENT hotspot_click    OF
                                               cl_gui_alv_grid
                                     IMPORTING E_ROW_ID e_column_id.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    CLASS  lcl_event_receiver IMPLEMENTATION.
       METHOD handle_hotspot_click.
         READ TABLE i_alv INTO wa_alv
          INDEX e_row_id-index
           TRANSPORTING matnr.
         SET PARAMETER ID 'MAT' FIELD wa_alv-matnr.
         CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
       ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    PARAMETERS: p_check TYPE matnr.
    INITIALIZATION.
    PERFORM get_data.
    AT SELECTION-SCREEN OUTPUT.
    *  START-OF-SELECTION.
       DATA: variant TYPE  disvariant.
       DATA: repid TYPE sy-repid.
       repid = sy-repid.
       variant-report = sy-repid.
       variant-username = sy-uname.
       layout-zebra = 'X'.
       layout-edit_mode = 'X'.
       CHECK alv_container IS INITIAL.
       CREATE OBJECT alv_container
                   EXPORTING repid     = repid
                             dynnr     = sy-dynnr
                             side      = alv_container->dock_at_right
                             extension = 350.
       CREATE OBJECT alv_grid
              EXPORTING
                    i_parent          =  alv_container.
    * Set event handler
       SET HANDLER lcl_event_receiver=>handle_hotspot_click FOR alv_grid.
    *  ALV Specific. Data selection.
    *  Populate Field Catalog
       PERFORM get_fieldcatalog.
       CALL METHOD alv_grid->set_table_for_first_display
         EXPORTING
           is_layout        = layout
           is_variant       = variant
           i_save           = 'U'
           i_structure_name = 'I_ALV'
         CHANGING
           it_outtab        = i_alv[]
           it_fieldcatalog  = fieldcat[].
    START-OF-SELECTION.
    * FORM GET_DATA
    FORM get_data.
       SELECT * INTO CORRESPONDING FIELDS OF TABLE i_alv
             FROM mara
               INNER JOIN makt
                 ON mara~matnr = makt~matnr
                        UP TO 100 ROWS
                    WHERE makt~spras = sy-langu.
       SORT i_alv ASCENDING BY matnr.
    ENDFORM.                    "get_data
    *      Form  Get_Fieldcatalog - Set Up Columns/Headers
    FORM get_fieldcatalog.
       DATA: ls_fcat TYPE lvc_s_fcat.
       REFRESH: fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Number'.
       ls_fcat-fieldname  = 'MATNR'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '18'.
       ls_fcat-fix_column = 'X'.
       ls_fcat-key        = 'X'.
       ls_fcat-hotspot    = 'X'.
       ls_fcat-col_pos    = '1'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Type'.
       ls_fcat-fieldname  = 'MTART'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '10'.
       ls_fcat-fix_column = 'X'.
       ls_fcat-key        = 'X'.
       ls_fcat-col_pos    = '2'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Group'.
       ls_fcat-fieldname  = 'MATKL'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '12'.
       ls_fcat-col_pos    = '3'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Size'.
       ls_fcat-fieldname  = 'GROES'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '30'.
       ls_fcat-col_pos    = '4'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Description'.
       ls_fcat-fieldname  = 'MAKTX'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '40'.
       ls_fcat-col_pos    = '5'.
       APPEND ls_fcat TO fieldcat.
    ENDFORM.                    "get_fieldcatalog
    Hope this solves your problem....

Maybe you are looking for