Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

how to call a Ztransaction in alv using hotspot

dhinesh_thirugnanam
Active Participant
0 Kudos

Hi,

I want to call a ztransaction( eg.zva23) in alv using hotspot. How do i do it.Kindly let me know the procedure.

Moderator message : Not enough re-search before posting, discussion locked.

Message was edited by: Vinod Kumar

7 REPLIES 7

gouravkumar64
Active Contributor
0 Kudos

Hi,

3 steps u have to do

1)Activate hotspot in alv ,

2)Activate user command in ALV,

3)Create a subroutine for that,

Hope this thread will give u the answer

http://scn.sap.com/thread/1598737

Regards

Gourav.

reachdebopriya
Active Participant
0 Kudos

Hi Dinesh,

Try this code.... It is an example. Do according to the below code. It will work.

In ALV OOPs...

*----------------------------------------------------------------------*

*       CLASS respond_events DEFINITION

*----------------------------------------------------------------------*

*

*----------------------------------------------------------------------*

CLASS respond_events DEFINITION FINAL .

  PUBLIC SECTION .

    METHODS : respond_hotspot_click FOR EVENT hotspot_click

              OF cl_gui_alv_grid

                IMPORTING e_row_id.

ENDCLASS .                    "respond_events definition

*----------------------------------------------------------------------*

*       CLASS respond_events IMPLEMENTATION

*----------------------------------------------------------------------*

* Implementation of the custom class for hotspot

*----------------------------------------------------------------------*

CLASS respond_events IMPLEMENTATION .

  METHOD respond_hotspot_click  .
    CLEAR gs_final.
    READ TABLE gt_final INTO gs_final INDEX e_row_id .
    IF sy-subrc EQ 0 .
      SET PARAMETER ID 'TNR' FIELD gs_final-tknum.
      CALL TRANSACTION 'VT03N' AND SKIP FIRST SCREEN .
    ENDIF .
  ENDMETHOD .            "respond_hotspot_click

ENDCLASS .               "respond_events implementation

DATA: glr_respond_events TYPE REF TO respond_events  .

In PBO

*-- Create grid with defaule container type object

    CREATE OBJECT gr_grid

      EXPORTING

        i_parent = cl_gui_container=>default_screen.

    CREATE OBJECT glr_respond_events.

    CALL METHOD gr_grid->set_table_for_first_display

      EXPORTING

        is_variant           = gs_variant

        i_save               = lc_a

        is_layout            = gs_layout

        it_toolbar_excluding = gt_exclude

      CHANGING

        it_outtab            = gt_final[]

        it_fieldcatalog      = gt_fieldcat[].

    SET HANDLER glr_respond_events->respond_hotspot_click FOR gr_grid.

Regards,

Debopriya Ghosh

vinoth_aruldass
Contributor
0 Kudos

hi,

write your code in your AT USER COMMAND event .

in your field catalog specify hotspot = 'X'.

in your at user command .

ex

call transaction 'Transaction' skip first screen.

hope it helps,

Vinoth

Former Member
0 Kudos

Hi , I had done the as below for alv using hotspot in my training object.

1. Put hotspot for a required field as below for field catalog.

  ST_FIELDCAT1-FIELDNAME = 'EBELN'.

  ST_FIELDCAT1-SELTEXT_L = 'Purchasing Document Number'.

  ST_FIELDCAT1-HOTSPOT = 'X'.

append st_fieldcat to it_fieldcat.

2. Call the alv as below and give the subroutine name at usercommand option as below.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

   I_CALLBACK_PROGRAM                = SY-REPID

   I_CALLBACK_PF_STATUS_SET          = 'PF01'

   I_CALLBACK_USER_COMMAND           = 'SECONDPAGE'

   I_CALLBACK_TOP_OF_PAGE            = 'SUB1_TOPOFPAGE'

   IS_LAYOUT                         = ST_LAYOUT1

  IT_FIELDCAT                       = T_FIELDCAT1

   TABLES

     T_OUTTAB                          = IT_FINAL1.

3. Write the subroutine to execute upon clicking the hotspot. Alv will redirect to the subroutine if any body clicked on hotspot. Below is the code and procedures for that.

**************************************************************************************************************************************************

*

*                    SUBROUTINE FOR HANDLING THE USER CLICK EVENT IN THE BASIC LIST OUTPUT

*       The interface parameters passing to this subroutine are of types (sy-ucomm) and (slis-selfield).

* And we can identify the selected fieldname and value of that field by validating slis-selfied's Fieldname & Value of that field.

***************************************************************************************************************************************************

FORM SECONDPAGE USING L_UCOM TYPE SY-UCOMM

                       L_FIELDTABLE TYPE SLIS_SELFIELD.

** Check condition on user selection,

** If user clicked on ebeln field

  IF L_FIELDTABLE-FIELDNAME = 'EBELN'.

Write your logic here some thing like call transaction or anything you want to execute it.

** End of conditin check for User-command. **

ENDFORM.                    "SECONDPAGE

And for more info or help go to ALV function module and go to documentation where you can find syntax and info for all the above.

Regards,
Praveen Chitturi.

0 Kudos

Hope it helped you.

If you got it you may close the discussion by makr as answer option.

dhinesh_thirugnanam
Active Participant
0 Kudos

Hi,

But my requirement is to how to call a ztcode(type module pool) with paramaters.....

0 Kudos

any tcode you can call using at user command event .

You debug your at user command event and get the logic.

call transaction ' Ztrans' .

will call your transcation.

hope it helps,

Vinoth