0% found this document useful (0 votes)
68 views4 pages

Interaction Report Using SALV With The Help of Hotspot Method and On

The document describes a class called HEADER that interacts with SALV (Screen Painter ALV) to display sales order data. The class contains methods to retrieve sales order header and item data from tables EKKO and EKPO, generate an ALV display of the header data, and set hotspots on the order number field to display related item data when clicked. The on_linkclick method handles clicks on the order number field to retrieve and display the corresponding item data.

Uploaded by

nikhil potta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views4 pages

Interaction Report Using SALV With The Help of Hotspot Method and On

The document describes a class called HEADER that interacts with SALV (Screen Painter ALV) to display sales order data. The class contains methods to retrieve sales order header and item data from tables EKKO and EKPO, generate an ALV display of the header data, and set hotspots on the order number field to display related item data when clicked. The on_linkclick method handles clicks on the order number field to retrieve and display the corresponding item data.

Uploaded by

nikhil potta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Interaction report using SALV with the help of Hotspot method and

on_linkclick-events.

*&---------------------------------------------------------------------*
*& Report  ZATLINESEL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZATLINESEL.

Include ztopp.

INCLUDE zmid.

INITIALIZATION.

create OBJECT o_obj.

at SELECTION-SCREEN.
START-OF-SELECTION.
o_obj->getdata( ).
o_obj->generate_DATA( ).

*&---------------------------------------------------------------------*
*&  Include           ZTOPP
*&---------------------------------------------------------------------*
  PARAMETERS : PDN type ekko-ebeln.
CLASS HEADER DEFINITION.

PUBLIC SECTION.

TYPES: BEGIN OF TY_EKKO,
        EBELN TYPE EKKO-EBELN,
        BUKRS TYPE EKKO-BUKRS,
        BSART TYPE EKKO-BSART,
        LOEKZ TYPE EKKO-LOEKZ,
        STATU TYPE EKKO-STATU,
        LIFNR TYPE EKKO-LIFNR,
        EKORG TYPE EKKO-EKORG,
        EKGRP TYPE EKKO-EKGRP,
        FRGGR TYPE EKKO-FRGGR,
        frgsx TYPE ekko-frgsx,
        frgke TYPE ekko-frgke,
        frgzu TYPE ekko-frgzu,
        frgrl TYPE ekko-frgrl,
      END OF TY_EKKO.

TYPES: BEGIN OF TY_EKPO,
        EBELN TYPE EKPO-EBELN,
        EBELP TYPE EKPO-EBELP,
        LOEKZ TYPE EKPO-LOEKZ,
        STATU TYPE EKPO-STATU,
        MATNR TYPE EKPO-MATNR,
        BUKRS TYPE EKPO-BUKRS,
        WERKS TYPE EKPO-WERKS,
        LGORT TYPE EKPO-LGORT,
        MATKL TYPE EKPO-MATKL,
        MENGE TYPE EKPO-MENGE,
        MEINS TYPE EKPO-MEINS,
        NETPR TYPE EKPO-NETPR,
        NETWR TYPE EKPO-NETWR,
        NTGEW TYPE EKPO-NTGEW,
        GEWEI TYPE EKPO-GEWEI,
      END OF TY_EKPO.

data : lt_ekko type table of ty_ekko,
        Lt_TEMP type table of ty_ekko,
       ls_ekko type ty_ekko,
       lt_ekpo type table of ty_ekpo,
       ls_ekpo type ty_ekpo.

METHODS:
getdata,
generate_Data,
set_hotspot
Changing
  co_alv type REF TO cl_salv_table
  co_out TYPE REF TO HEADER,

on_linkclick

for event link_click of cl_salv_events_table
importing
  row
  column.

ENDCLASS.

data : o_obj TYPE REF TO header,
       o_alv TYPE REF TO cl_salv_table.

*&---------------------------------------------------------------------*
*&  Include           ZMID
*&---------------------------------------------------------------------*

CLASS HEADER IMPLEMENTATION.
  METHOD getdata.
    select  EBELN
        BUKRS
        BSART
        LOEKZ
        STATU
        LIFNR
        EKORG
        EKGRP
        FRGGR
        FRGSX
        FRGKE
        FRGZU
        FRGRL from ekko into table lt_ekko where Ebeln = PDN.

ENDMETHOD.

METHOD GENERATE_DATA.

   data: lxmsg TYPE REF TO cx_salv_msg.

   try.
     cl_salv_table=>factory(
     IMPORTING
       r_salv_table = O_ALV
       CHANGING
         t_table = lT_ekko ).
  CATCH CX_SALV_MSG into LXMSG.
       endtry.

       O_OBJ->SET_HOTSPOT(
       CHANGING
         CO_ALV = O_ALV
         CO_OUT = O_OBJ
         ).

       o_alv->display( ).
ENDMETHOD.

METHOD SET_HOTSPOT.
  data: lo_cols_tab TYPE REF TO cl_salv_columns_table,
        lo_col_tab type REF TO cl_salv_column_table.

  LO_COLS_TAB = co_alv->get_columns( ).
  TRY.
    lo_col_tab ?= lo_cols_tab->get_column('EBELN').
    endtry.
    lo_cols_tab = co_alv->get_columns( ).
    try.
      call METHOD lo_col_tab->set_cell_type
      EXPORTING
        value = if_salv_c_cell_type=>hotspot.
      CATCH CX_SALV_DATA_ERROR.
        ENDTRY.
        DATA: LO_EVENTS TYPE REF TO CL_SALV_EVENTs_TABLE.
        LO_EVENTS = O_ALV->GET_EVENT( ).
        SET HANDLER CO_OUT->ON_LINKCLICK FOR LO_EVENTS.
endmethod.

    METHOD on_linkclick.
      case column.
        when 'EBELN'.
          READ TABLE LT_EKKO INTO LS_EKKO INDEX ROW.
          IF SY-SUBRC = 0 AND ls_ekko-EBELN IS NOT INITIAL.

    SELECT ebeln
ebelp
loekz
statu
matnr
bukrs
werks
lgort
matkl
menge
meins
netpr
netwr
ntgew
gewei FROM EKPO INTO TABLE LT_EKPO WHERE EBELN = LS_ekko-EBELN.

ENDIF.
TRY.
  CALL METHOD CL_SALV_TABLE=>FACTORY
  IMPORTING
    R_SALV_TABLE = O_ALV
    CHANGING
      T_TABLE = LT_EKPO.
  ENDTRY.

  o_alv->display( ).
  ENDCASE.
 endmethod.

ENDCLASS.

You might also like