Skip to Content
author's profile photo
Former Member

about ALV how to change fieldcatlog(OO)

Hi all,

I have a problem about ALV(OO). First I

*create fieldcatlog

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'

EXPORTING

i_structure_name = 'ZBC_TEAM_MEMBERS'

i_bypassing_buffer = 'X'

CHANGING

ct_fieldcat = it_my_grid_fieldcat[].

  • add hotspot

LOOP AT it_my_grid_fieldcat INTO wa_fieldcatalog.

CASE wa_fieldcatalog-fieldname.

WHEN 'EMAIL'.

wa_fieldcatalog-hotspot = 'X'.

ENDCASE.

MODIFY it_my_grid_fieldcat FROM wa_fieldcatalog.

ENDLOOP.

  • display ALV

CALL METHOD my_grid->set_table_for_first_display

EXPORTING

i_bypassing_buffer = 'X'

is_variant = gs_my_grid_variant

i_save = gs_my_grid_save

i_default = 'X'

is_layout = it_my_grid_layout

is_print = it_my_grid_print

CHANGING

it_outtab = it_my_grid_outtab[]

it_fieldcatalog = it_my_grid_fieldcat[]

it_sort = it_my_grid_sort[].

And now I want that if I click the hotspot it will call transaction 'XXX', how can I do that ?

Thanks in advace.

Best Regard.

Nick

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

5 Answers

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 09:53 AM

    Hi,

    do like this.

    FIELD-SYMBOLS: <lfs_fieldcat> TYPE lvc_s_fcat.

    LOOP AT fcat ASSIGNING <lfs_fieldcat>.

    <lfs_fieldcat>-hotspot = 'X'.

    ENDLOOP.

    here u don't need to write any appen or modify.

    rgds,

    bharat.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 09:57 AM

    Hi nick,

    U have to trigger a event that i.e hotspot_click., ie u have to set a handler for this and after setting the handler u can call the transaction 'XXX' when clicked.

    regards,

    Santosh Thorat

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 27, 2007 at 10:05 AM

    You need to handle event

    HANDLE_DOUBLE_CLICK

    for the class

    CL_GUI_ALV_GRID

    See example program BCALV_GRID_02 for code

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Sep 27, 2007 at 10:08 AM

    Hi

    Please find the following demo pgm for hotspot event using ALV(OO)

    CLASS lcl_event_receiver DEFINITION.

    PUBLIC SECTION.

    METHODS:

    handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid

    IMPORTING e_row_id e_column_id es_row_no.

    ENDCLASS.

    CLASS lcl_event_receiver IMPLEMENTATION.

    • Handle hotspot clicks in the ALV grid

    METHOD handle_hotspot_click.

    PERFORM process_hotspot

    USING e_row_id e_column_id.

    • Note:

    • e_row_id e_column_id & es_row_no values come from event handler parms

    • " handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid

    • IMPORTING e_row_id e_column_id es_row_no. "

    ENDMETHOD.

    ENDCLASS.

      • Register events on the backend:

    • Set event handlers for ALV grid control

    • SET HANDLER o_event_receiver->handle_hotspot_click FOR go_grid.

      &----


      *& Form Process_HOTSPOT -alv event-

      &----


      • -->P_E_ROW_ID Row parm of event hotspot_click

      • -->P_E_COLUMN_ID Column parm of event hotspot_click

      ----


      ----


      FORM process_hotspot USING p_e_row_id

      p_e_column_id.

      CLEAR: g_wa_tsinfo, g_wa_tsinfo2.

      • Note:

      • e_row & e_column values used come from the event handler parms

      • " handle_dbl_click FOR EVENT double_click OF cl_gui_alv_grid

      • IMPORTING e_row e_column es_row_no, "

      • Beware of dbl clicks on index row = 0 that is the Column headings row

      IF p_e_row_id = 0.

      CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'

      EXPORTING

      textline1 = 'You must choose a cell'.

      EXIT.

      ENDIF.

      • Get values of dbl clicked row & load work area for CADO call

      IF NOT r_detail IS INITIAL.

      READ TABLE i_tsinfo

      INDEX p_e_row_id

      INTO g_wa_tsinfo.

      • Hold values for transaction call

      MOVE g_wa_tsinfo-pernr TO parm_pernr.

      MOVE g_wa_tsinfo-iedd TO parm_iedd.

      ELSE.

      READ TABLE i_tsinfo_2

      INDEX p_e_row_id

      INTO g_wa_tsinfo2.

      • Hold values for transaction call

      MOVE g_wa_tsinfo2-pernr TO parm_pernr.

      MOVE g_wa_tsinfo2-iedd TO parm_iedd.

      ENDIF.

        • For this program;

        • A hotspot click on person #, Setup or Direct Labor calls ZPP007.

        • A hotspot click on indirect Labor calls CADO.

        • You can ID the column using the e_column_id parm.

        CASE p_e_column_id.

        • Hotspot click on person # calls CADO.

        WHEN 'PERNR'.

        PERFORM direct_labor_rqs.

        WHEN 'ACT_SETUP'.

        PERFORM direct_labor_rqs.

        WHEN 'ACT_LABOR'.

        PERFORM direct_labor_rqs.

        ENDCASE.

        CLEAR: g_wa_tsinfo, g_wa_tsinfo2.

        CLEAR: parm_pernr, parm_iedd.

        ENDFORM. " Process_HOTSPOT

        FORM direct_labor_rqs.

        • When there are no user row selections,

        • and if date range entries were not made in this pgm's select screen

        • Do a direct call to the ZPP007 transaction AND exit the form.

        IF parm_pernr IS INITIAL

        AND slt_highdate IS INITIAL.

        • Call transaction CADO displaying it's selection screen

        CALL TRANSACTION 'ZPP007'.

        • modes: 'A' Dsp screens, 'E' Dsp if error, 'N' No dsplay

        • default = 'A'

        EXIT.

        ENDIF.

        • Use module to set BDC for call to transaction ZPP007

        • Note: the EXIT in the IF block just prior to this code

        PERFORM bdc_zpp007_data

        USING parm_pernr parm_iedd.

        • Call transaction CADO using selected row values in the BDC

        • and avoiding it's selection screen.

        CALL TRANSACTION 'ZPP007'

        USING i_bdcdata

        MODE 'E'

        MESSAGES INTO messtab.

        • AND SKIP FIRST SCREEN

        • modes: 'A' Dsp screens, 'E' Dsp if error, 'N' No dsplay

        ENDFORM. " Direct_Labor_Rqs

        Regards

        Varalakshmi.K

      Add comment
      10|10000 characters needed characters exceeded

    • author's profile photo
      Former Member
      Posted on Sep 27, 2007 at 10:16 AM

      Hello Nick

      Have a look at my sample report <b>ZUS_SDN_ALVGRID_EVENTS_HOTSPOT</b> in thread

      Event handling in alv oops With buttons

      Regards

      Uwe

      Add comment
      10|10000 characters needed characters exceeded