Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALV report

Hi.....

I have a requirement ...

where i need to generate an ALV report and upon the selection of the particular PO or Material number or vendor number I need to go for the particular transaction of the number in display mode.

and I wanna know how this can be done in an ALV report.

I know that it has to be done by using events.

If anyone have code for this please send me at

vamshi.sreerangam@gmail.com

or send me the hint where to write the code in the report

Tags:
Former Member
Former Member replied

Hi,

Check this sample report..By double clicking on the report will take you to the ME23N transaction for that Po..

TYPE-POOLS: slis.

DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: BEGIN OF wa_ekko,
ebeln like ekko-ebeln,
ekorg like ekko-ekorg,
ekgrp like ekko-ekgrp,
END OF wa_ekko.

DATA: v_repid TYPE syrepid.
v_repid = sy-repid.

DATA it_ekko LIKE STANDARD TABLE OF wa_ekko WITH HEADER LINE.

SELECT * UP TO 100 ROWS
FROM ekko
INTO CORRESPONDING FIELDS OF TABLE it_ekko.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
     EXPORTING
          i_program_name     = v_repid
          i_internal_tabname = 'WA_EKKO'
          i_inclname         = v_repid
     CHANGING
          ct_fieldcat        = gt_fieldcat.


* have hotspot for a PO.
DATA: s_fieldcat LIKE LINE OF gt_fieldcat.
s_fieldcat-hotspot = 'X'.

MODIFY gt_fieldcat FROM s_fieldcat TRANSPORTING hotspot
       WHERE fieldname = 'EBELN'.

* Pass the program.
v_repid = sy-repid.


CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
     EXPORTING
          i_callback_program      = v_repid
          it_fieldcat             = gt_fieldcat
          i_callback_user_command = 'USER_COMMAND'
     TABLES
          t_outtab                = it_ekko.


*---------------------------------------------------------------------*
*       FORM display_detail                                           *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  UCOMM                                                         *
*  -->  SELFIELD                                                      *
*---------------------------------------------------------------------*
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.

  IF ucomm = '&IC1' AND selfield-fieldname = 'EBELN'.

    READ TABLE it_ekko INDEX selfield-tabindex.

    IF sy-subrc = 0.
      SET PARAMETER ID 'BES' FIELD it_ekko-ebeln.
      CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
    ENDIF.

  ENDIF.

ENDFORM.

Thanks

Naren

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question