Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Hi

 I developed a ALV Interactive report as below, is there any other method of developing the same report....

*&---------------------------------------------------------------------*
*& Report  ZALV_WITH_INTERACTIVE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZALV_WITH_INTERACTIVE.

TYPE-POOLS SLIS .

TYPES : BEGIN OF TY_MARA,
        MATNR TYPE MARA-MATNR,
        MTART TYPE MARA-MTART,
        MBRSH TYPE MARA-MBRSH,
        MEINS TYPE MARA-MEINS,
      END OF TY_MARA.

DATA : I_MARA TYPE TABLE OF TY_MARA .
DATA : WA_MARA TYPE TY_MARA .
DATA : I_MAKT TYPE TABLE OF MAKT .

DATA : I_FCAT TYPE SLIS_T_FIELDCAT_ALV .
DATA : WA_FCAT LIKE LINE OF I_FCAT .
DATA : I_EVENTS TYPE SLIS_T_EVENT .
DATA : WA_EVENTS LIKE LINE OF I_EVENTS .
DATA : V_MATNR TYPE MARA-MATNR .

START-OF-SELECTION .
  PERFORM GET_DATA .
  PERFORM CREATE_FCAT.
  PERFORM GET_EVENTS .

END-OF-SELECTION .
  PERFORM DISP_ALV .

*&---------------------------------------------------------------------*
*&      Form  GET_DATA
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM GET_DATA .
  SELECT * FROM MARA
      INTO CORRESPONDING FIELDS OF TABLE I_MARA
       .
ENDFORM.                    " GET_DATA
*&---------------------------------------------------------------------*
*&      Form  DISP_ALV
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM DISP_ALV .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = SY-REPID
      IT_FIELDCAT        = I_FCAT
      IT_EVENTS          = I_EVENTS
    TABLES
      T_OUTTAB           = I_MARA.

ENDFORM.                    " DISP_ALV
*&---------------------------------------------------------------------*
*&      Form  CREATE_FCAT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM CREATE_FCAT .

  WA_FCAT-COL_POS = '1' .
  WA_FCAT-FIELDNAME = 'MATNR' .
  WA_FCAT-TABNAME = 'I_MARA' .
  WA_FCAT-SELTEXT_M = 'MATERIALNO' .
  WA_FCAT-KEY = 'X' .
  APPEND WA_FCAT TO I_FCAT .
  CLEAR WA_FCAT .

  WA_FCAT-COL_POS = '2' .
  WA_FCAT-FIELDNAME = 'MTART' .
  WA_FCAT-TABNAME = 'I_MARA' .
  WA_FCAT-SELTEXT_M = 'MATERIALTYPE' .
*  WA_FCAT-NO_OUT = 'X' .
  WA_FCAT-HOTSPOT = 'X' .
  APPEND WA_FCAT TO I_FCAT .
  CLEAR WA_FCAT .

  WA_FCAT-COL_POS = '3' .
  WA_FCAT-FIELDNAME = 'MBRSH' .
  WA_FCAT-REF_FIELDNAME = 'MBRSH' .
  WA_FCAT-REF_TABNAME = 'MARA' .
*  WA_FCAT-TABNAME = 'I_MARA' .
*  WA_FCAT-SELTEXT_M = 'INDSECTOR' .
*  WA_FCAT-EDIT = 'X' .
  APPEND WA_FCAT TO I_FCAT .
  CLEAR WA_FCAT .

  WA_FCAT-COL_POS = '4' .
  WA_FCAT-FIELDNAME = 'MEINS' .
  WA_FCAT-TABNAME = 'I_MARA' .
  WA_FCAT-SELTEXT_M = 'MAT.UNITS' .
  WA_FCAT-EMPHASIZE = 'C610'.
  APPEND WA_FCAT TO I_FCAT .
  CLEAR WA_FCAT .

ENDFORM.                    " CREATE_FCAT
*&---------------------------------------------------------------------*
*&      Form  GET_EVENTS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM GET_EVENTS .
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    IMPORTING
      ET_EVENTS = I_EVENTS.

  READ TABLE I_EVENTS INTO WA_EVENTS WITH KEY NAME = 'USER_COMMAND'.
  WA_EVENTS-FORM = 'FORM_UC' .
  MODIFY I_EVENTS FROM WA_EVENTS INDEX SY-TABIX .

ENDFORM.                    " GET_EVENTS

*&---------------------------------------------------------------------*
*&      Form  FORM_UC
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->UCOMM      text
*      -->SELFIELD   text
*----------------------------------------------------------------------*
FORM FORM_UC USING UCOMM TYPE SY-UCOMM
                   SELFIELD TYPE SLIS_SELFIELD .
  V_MATNR = SELFIELD-VALUE .
  CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
    EXPORTING
      INPUT  = V_MATNR
    IMPORTING
      OUTPUT = V_MATNR.

  SELECT * FROM MAKT
     INTO TABLE I_MAKT
      WHERE MATNR = V_MATNR .

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM = SY-REPID
      I_STRUCTURE_NAME   = 'MAKT'
    TABLES
      T_OUTTAB           = I_MAKT.

ENDFORM .                    "FORM_UC

  • No labels

2 Comments

  1. Former Member

    Please post this as a question in SCN.

  2. post this as a  question in scn? wiki scn is not a forum.delete this post.factory method is there.