Interactive

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

*&---------------------------------------------------------------------*

*& Report  ZMR_OOALV_CUSTOMCONT
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZMR_OOALV_INTERACTIVE.
types : begin of ty_ekko,
         ebeln type ebeln,
         bukrs type bukrs,
         aedat type aedat,
        end of ty_ekko.
data : lt_ekko type STANDARD TABLE OF ty_ekko. "ekko.
data : wa_ekko type ty_ekko.
DATA : LR_CUST TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
       LR_ALV TYPE REF TO CL_GUI_ALV_GRID.
data : lt_fldcat type lvc_t_fcat,
       wa_fldcat type lvc_s_fcat.
PARAMETERS : p_lifnr type lifnr.

* Local class for implementing HOTSPOT_CLICK event
class lc_events DEFINITION.
  PUBLIC SECTION.
  methods : handle_hotspot for EVENT HOTSPOT_CLICK of CL_GUI_ALV_GRID
                        IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO.
ENDCLASS.

class lc_events IMPLEMENTATION.
  method handle_hotspot.
    BREAK-POINT.
    read table lt_ekko into wa_ekko index ES_ROW_NO-ROW_ID.
    if sy-subrc = 0.
      set PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
      call TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
      endif.
    ENDMETHOD.
ENDCLASS.
data : lr_events type ref to lc_events.
START-OF-SELECTION.
select ebeln bukrs aedat from ekko into TABLE lt_ekko where lifnr = p_lifnr.
  if sy-subrc = 0.
     call screen 9000.
    else.

      endif.
*&---------------------------------------------------------------------*
*&      Module  STATUS_9000  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_9000 OUTPUT.
*  SET PF-STATUS 'xxxxxxxx'.
*  SET TITLEBAR 'xxx'.
* CREATE OBJECT FOR CUSTOM CONTINER
 CREATE OBJECT LR_CUST
   EXPORTING
     CONTAINER_NAME              = 'CONT'
   EXCEPTIONS
     CNTL_ERROR                  = 1
     CNTL_SYSTEM_ERROR           = 2
     CREATE_ERROR                = 3
     LIFETIME_ERROR              = 4
     LIFETIME_DYNPRO_DYNPRO_LINK = 5
     others                      = 6.
IF LR_CUST IS NOT INITIAL.
* CREATE OBJECT FOR ALV GRID.
CREATE OBJECT LR_ALV
  EXPORTING
   I_PARENT          = LR_CUST  "CONTAINER OBJECT
  EXCEPTIONS
    ERROR_CNTL_CREATE = 1
    ERROR_CNTL_INIT   = 2
    ERROR_CNTL_LINK   = 3
    ERROR_DP_CREATE   = 4
    others            = 5.
IF LR_ALV IS NOT INITIAL. "IS BOUND
* Prepare field catalog.
  wa_fldcat-COL_POS = 1.
  wa_fldcat-FIELDNAME = 'EBELN'.
  wa_fldcat-TABNAME = 'LT_EKKO'.
  wa_fldcat-SCRTEXT_S = 'Pur Ord'.
  wa_fldcat-SCRTEXT_m = 'Purchase Ord'.
  wa_fldcat-SCRTEXT_l = 'Purchase Order'.
  wa_fldcat-HOTSPOT = abap_true. "X
  append wa_fldcat to lt_fldcat.
  clear wa_fldcat.

  wa_fldcat-COL_POS = 2.
  wa_fldcat-FIELDNAME = 'AEDAT'.
  wa_fldcat-TABNAME = 'LT_EKKO'.
  wa_fldcat-REF_FIELD = 'AEDAT'.
  WA_FLDCAT-REF_TABLE = 'EKKO'.
  append wa_fldcat to lt_fldcat.
  clear wa_fldcat.

    wa_fldcat-COL_POS = 3.
  wa_fldcat-FIELDNAME = 'BUKRS'.
  wa_fldcat-TABNAME = 'LT_EKKO'.
  wa_fldcat-REF_FIELD = 'BUKRS'.
  WA_FLDCAT-REF_TABLE = 'T001'.
  append wa_fldcat to lt_fldcat.
  clear wa_fldcat.

*  CALL METHOD SET TABLE FOR FIRST DISPLAY
CALL METHOD LR_ALV->SET_TABLE_FOR_FIRST_DISPLAY
  CHANGING
    IT_OUTTAB                     = LT_EKKO
    IT_FIELDCATALOG               = LT_FLDCAT
  EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR                 = 2
    TOO_MANY_LINES                = 3
    others                        = 4
        .
  create object lr_events.
  set HANDLER lr_events->handle_hotspot for lr_alv.
  ENDIF.
  ENDIF.

ENDMODULE.                 " STATUS_9000  OUTPUT

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy