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

Interactive Alv Events

This report displays purchase order (PO) header data in an interactive ALV grid and allows drilling down to PO item details. It selects header data for a given vendor, builds the field catalog, and displays the grid. Double clicking a PO number retrieves the item data for that PO from a second table, rebuilds the field catalog for items, and displays those details in another grid.

Uploaded by

sksk1911
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)
73 views4 pages

Interactive Alv Events

This report displays purchase order (PO) header data in an interactive ALV grid and allows drilling down to PO item details. It selects header data for a given vendor, builds the field catalog, and displays the grid. Double clicking a PO number retrieves the item data for that PO from a second table, rebuilds the field catalog for items, and displays those details in another grid.

Uploaded by

sksk1911
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

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

*& Report  ZMR_ALV_MANUAL
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZMR_ALV_INTERACTIVE.

types : begin of ty_ekpo,
         ebeln type ebeln,
         ebelp type ebelp,
         matnr type matnr,
         menge type bstmg,
         netwr type BWERT,
        end of ty_ekpo,
        begin of ty_ekko,
          ebeln type ebeln,
          bukrs type bukrs,
          lifnr type lifnr,
        end of ty_ekko.
data : lt_ekpo type standard table of TY_ekpo.
data : lt_ekko type standard table of ty_ekko.

data : lt_fldcat type slis_t_fieldcat_alv,
       wa_fldcat type slis_fieldcat_alv.

parameters p_lifnr type lifnr.

start-of-selection.

select ebeln bukrs lifnr from ekko into table lt_ekko where lifnr = p_lifnr.
  if sy-subrc = 0.
        wa_fldcat-fieldname = 'EBELN'.
   WA_FLDCAT-tabname = 'LT_EKKO'.
   WA_FLDCAT-SELTEXT_L = 'PO Number'.
   WA_FLDCAT-SELTEXT_m = 'PO Number'.
   WA_FLDCAT-SELTEXT_s = 'PO NO'.
   WA_FLDCAT-HOTSPOT = 'X'.
   append wa_fldcat to lt_fldcat.
   clear wa_fldcat.

   wa_fldcat-fieldname = 'BUKRS'.
   WA_FLDCAT-tabname = 'LT_EKKO'.
   WA_FLDCAT-SELTEXT_L = 'Company Code'.
   WA_FLDCAT-SELTEXT_m = 'Company Code'.
   WA_FLDCAT-SELTEXT_s = 'Company Code'.
   append wa_fldcat to lt_fldcat.
   clear wa_fldcat.

   wa_fldcat-fieldname = 'LIFNR'.
   WA_FLDCAT-tabname = 'LT_EKKO'.
   WA_FLDCAT-SELTEXT_L = 'Vendor'.
   WA_FLDCAT-SELTEXT_m = 'Vendor'.
   WA_FLDCAT-SELTEXT_s = 'Vendor'.
   append wa_fldcat to lt_fldcat.
   clear wa_fldcat.
data : lt_events type slis_t_event,
       wa_events type slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
 IMPORTING
   ET_EVENTS             = lt_events
 EXCEPTIONS
   LIST_TYPE_WRONG       = 1
   OTHERS                = 2.
*
wa_events-form = 'DOUBLE_CLICK'.
MODIFY LT_EVENTS FROM WA_EVENTS TRANSPORTING FORM WHERE NAME = 'USER_COMMAND'.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM                = sy-repid
*      I_CALLBACK_USER_COMMAND           = 'DOUBLE_CLICK'
      IT_FIELDCAT                       = LT_FLDCAT
      IT_EVENTS                         = LT_EVENTS
     TABLES
       t_outtab                         = LT_EKKO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2.
    endif.

form double_click  USING R_UCOMM  LIKE SY-UCOMM
                         RS_SELFIELD TYPE SLIS_SELFIELD.

  break-point.
  IF R_UCOMM = '&IC1'.
     select ebeln
       ebelp
       matnr
       menge
       netwr from ekpo into table lt_ekpo where ebeln = RS_SELFIELD-VALUE.
  if sy-subrc = 0.
*  Manual field cat.
   REFRESH LT_FLDCAT.
   wa_fldcat-fieldname = 'EBELN'.
   WA_FLDCAT-tabname = 'LT_EKPO'.
   WA_FLDCAT-SELTEXT_L = 'PO Number'.
   WA_FLDCAT-SELTEXT_m = 'PO Number'.
   WA_FLDCAT-SELTEXT_s = 'PO NO'.
   append wa_fldcat to lt_fldcat.
   clear wa_fldcat.

   wa_fldcat-fieldname = 'EBELP'.
   WA_FLDCAT-tabname = 'LT_EKPO'.
   WA_FLDCAT-SELTEXT_L = 'PO Item Number'.
   WA_FLDCAT-SELTEXT_m = 'PO Item No'.
   WA_FLDCAT-SELTEXT_s = 'PO Item'.
   append wa_fldcat to lt_fldcat.
   clear wa_fldcat.

   wa_fldcat-fieldname = 'MATNR'.
   WA_FLDCAT-tabname = 'LT_EKPO'.
   WA_FLDCAT-ref_fieldname = 'MATNR'.
   WA_FLDCAT-ref_tabname  = 'MARA'.
   wa_fldcat-edit = 'X'.
   append wa_fldcat to lt_fldcat.
   clear wa_fldcat.

      wa_fldcat-fieldname = 'MENGE'.
   WA_FLDCAT-tabname = 'LT_EKPO'.
   WA_FLDCAT-ref_fieldname = 'MENGE'.
   WA_FLDCAT-ref_tabname  = 'EKPO'.
   WA_FLDCAT-DO_SUM = 'X'.
   append wa_fldcat to lt_fldcat.
   clear wa_fldcat.

   wa_fldcat-fieldname = 'NETWR'.
   WA_FLDCAT-tabname = 'LT_EKPO'.
   WA_FLDCAT-ref_fieldname = 'NETWR'.
   WA_FLDCAT-ref_tabname  = 'EKPO'.
   WA_FLDCAT-DO_SUM = 'X'.
   append wa_fldcat to lt_fldcat.
   clear wa_fldcat.
   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM                = sy-repid
      IT_FIELDCAT                       = LT_FLDCAT
     TABLES
       t_outtab                         = LT_EKPO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2.
endif.
    ENDIF.
  endform.

output: give input 1000

output for purchase header: and by click on po number u vl get item details.

out put for Item details:

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