TWO Alv Grid in single output

HI All,
Is it possible to add twl grids in single page output?
Regards,
Krishna.

Hi,
i thing it can't. Anyway i am sending model alv grid report.
REPORT CODING
REPORT YMS_EXDET MESSAGE-ID E4 NO STANDARD PAGE HEADING LINE-SIZE 350.
*REPORT  ZMM_EXIN_DOC_ALV_HEADER .
TABLES : J_1IEXCHDR,      " header table
         J_1IEXCDTL,      " item table
         J_1IPART1,       " Excise part I detials
         J_1IPART2,       " Excise Part II details
         LFA1,            " vendor master table
         J_1IMOVEND,      " vendor excise details table
         MSEG,            " Document Segment: Material
         MKPF,            " Header: Material Document
         DD07T,           " domain text table
         T001W.           " Plant and Branch Details
DATA : BEGIN OF IT_CHDR OCCURS 100,
       SERIALNO   LIKE J_1IPART1-SERIALNO,
       DOCNO      LIKE J_1IEXCHDR-DOCNO,
       DOCYR      LIKE J_1IEXCHDR-DOCYR,
       EXNUM      LIKE J_1IEXCHDR-EXNUM,
       EXDAT      LIKE J_1IEXCHDR-EXDAT,
       WERKS      LIKE J_1IEXCHDR-WERKS,
       EXBED      LIKE J_1IEXCHDR-EXBED,
       EXCCD      LIKE J_1IEXCHDR-EXCCD,
       ECS        LIKE J_1IEXCHDR-ECS,
       STATUS LIKE J_1IEXCHDR-STATUS, "CHALLAN STATUS
       END OF IT_CHDR.
DATA : BEGIN OF IT_CDTL OCCURS 100,
       SERIALNO LIKE J_1IPART1-SERIALNO,
       DOCYR  LIKE J_1IEXCDTL-DOCYR,
       DOCNO  LIKE J_1IEXCDTL-DOCNO,
       EXNUM  LIKE J_1IEXCDTL-EXNUM,
       EXDAT  LIKE J_1IEXCDTL-EXDAT,
       LIFNR  LIKE J_1IEXCDTL-LIFNR,
       MATNR  LIKE J_1IEXCDTL-MATNR,
       MAKTX  LIKE J_1IEXCDTL-MAKTX,
       CHAPID LIKE J_1IEXCDTL-CHAPID,
       EXBAS  LIKE J_1IEXCDTL-EXBAS,
       EXBED  LIKE J_1IEXCDTL-EXBED,
       ECS    LIKE J_1IEXCDTL-ECS,
       MENGE  LIKE J_1IEXCDTL-MENGE,
       MEINS  LIKE J_1IEXCDTL-MEINS,
       RDOC2  LIKE J_1IEXCDTL-RDOC2,
       EXGRP  LIKE J_1IEXCDTL-EXGRP,
       RDOC1  LIKE J_1IEXCDTL-RDOC1,
       STATUS LIKE J_1IEXCDTL-STATUS, "CHALLAN STATUS
       END OF IT_CDTL.
DATA TEXT(10).
DATA : BEGIN OF IT_OUT OCCURS 0,
       SERIALNO LIKE J_1IPART1-SERIALNO,
       TEXT1    LIKE TEXT,
       EXNUM    LIKE J_1IEXCDTL-EXNUM,
       EXDAT    LIKE J_1IEXCDTL-EXDAT,
       NAME     LIKE LFA1-NAME1,
       DDTEXT   LIKE DD07T-DDTEXT,
       EXCCD    LIKE J_1IEXCHDR-EXCCD,
       BUDAT    LIKE MKPF-BUDAT,
       EXBAS    LIKE IT_CDTL-EXBAS,
       EXBED    LIKE IT_CDTL-EXBED,
       ECS      LIKE IT_CDTL-ECS,
       MATNR    LIKE IT_CDTL-MATNR,
       MAKTX    LIKE IT_CDTL-MAKTX,
       CHAPID   LIKE IT_CDTL-CHAPID,
       MENGE    LIKE IT_CDTL-MENGE,
       MEINS    LIKE IT_CDTL-MEINS,
       DEL_IND(1),
       END OF IT_OUT.
DATA IT_PART2 LIKE J_1IPART1 OCCURS 0 WITH HEADER LINE.
DATA S_NO(4) .
DATA DB_CNT LIKE SY-TABIX.
DATA EBELN_T LIKE MSEG-EBELN .
TYPE-POOLS : SLIS.
DATA : AFIELD TYPE SLIS_FIELDCAT_ALV.
DATA : LIST_HEADER   TYPE SLIS_T_LISTHEADER,
       FIELDCAT      TYPE SLIS_T_FIELDCAT_ALV,
       LS_FTCAT      TYPE LVC_S_FCAT,
       SORTCAT       TYPE SLIS_T_SORTINFO_ALV,
       SORTCAT_LN    LIKE LINE OF SORTCAT,
       G_REPID LIKE SY-REPID,
       G_BACK_GROUND(70),  "like bapibds01-objkey,
       GS_VARIANT LIKE DISVARIANT,
       G_SAVE ,
       GT_EVENTS TYPE SLIS_T_EVENT,
       ALV_EVENT TYPE SLIS_ALV_EVENT,
       EVENTCAT             TYPE SLIS_T_EVENT,
       EVENTCAT_LN          LIKE LINE OF EVENTCAT,
       LAYOUT_IN            TYPE SLIS_LAYOUT_ALV,
       LAYOUT_IN1           TYPE SLIS_LAYOUT_ALV.
CONSTANTS : GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE
'TOP_OF_PAGE',
            GC_FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE
'USER_COMMAND',
            GC_FORMNAME_BEFORE_OUTPUT TYPE SLIS_FORMNAME VALUE
'BEFORE_OUTPUT'.
  ALV_EVENT TYPE SLIS_ALV_EVENT,
DATA EX_NO LIKE IT_CHDR-EXNUM VALUE 0.
DATA REGTYP_1 LIKE J_1IPART1-REGTYP.
SELECTION-SCREEN BEGIN OF BLOCK B WITH FRAME.
PARAMETERS  WERKS TYPE J_1IEXCHDR-WERKS.
SELECT-OPTIONS : BUDAT FOR J_1IEXCHDR-EXDAT.
PARAMETERS : R1 RADIOBUTTON GROUP GRP DEFAULT 'X',
             R2 RADIOBUTTON GROUP GRP.
SELECTION-SCREEN END OF BLOCK B.
INITIALIZATION.
  G_REPID = SY-REPID.
  G_SAVE = 'A'.
PERFORM BUILD_EVENT USING GT_EVENTS[].
  PERFORM ALV_EVENT_INIT.
AT SELECTION-SCREEN.
  REFRESH LIST_HEADER.
  PERFORM TOP_OF_PAGE_LIST_HEADER USING LIST_HEADER.
START-OF-SELECTION.
PERFORM ALV_EVENT_INIT.
  G_REPID = SY-REPID.
  G_BACK_GROUND = ' ' .
  IF R1 = 'X'.
    CLEAR R2. CLEAR : REGTYP_1.
    REGTYP_1 = 'A'.
     set titlebar 'BALAJI' with DB_CNT.
  ELSEIF R2 = 'X'.
    CLEAR R1.CLEAR : REGTYP_1.
    REGTYP_1 = 'C'.
     set titlebar 'BALAJI1' with DB_CNT.
  ENDIF.
SELECT * FROM J_1IPART1
                  INTO CORRESPONDING FIELDS OF TABLE IT_PART2
                  WHERE REGTYP = REGTYP_1 AND
                        TRNTYP = 'GRPO'.
                        AND BUDAT IN BUDAT.
                          DOCYR = IT_CDTL-DOCYR AND
                          DOCNO = IT_CDTL-DOCNO.
LOOP AT IT_PART2.
   SELECT SINGLE * FROM J_1IEXCHDR
             INTO CORRESPONDING FIELDS OF IT_CHDR
                     WHERE  TRNTYP = 'GRPO' AND
                      STATUS NE ' ' AND
                     STATUS EQ ' ' AND
                     DOCYR = IT_PART2-DOCYR AND
                     DOCNO = IT_PART2-DOCNO AND
                     WERKS = WERKS AND
                     EXDAT IN BUDAT.
                   ORDER BY EXDAT.
   IF SY-SUBRC = 0.
     APPEND IT_CHDR.
   ELSE.
     CONTINUE.
   ENDIF.
IF SY-SUBRC <> 0.
   MESSAGE E084.
ENDIF.
ENDLOOP.
*******************SPD****************
SELECT * INTO CORRESPONDING FIELDS OF IT_CDTL FROM J_1IEXCDTL WHERE
                               TRNTYP = 'GRPO' AND WERKS = WERKS AND
                                EXDAT IN BUDAT AND STATUS NE 'B'.
SELECT SINGLE * FROM J_1IPART1 WHERE DOCNO = IT_CDTL-DOCNO AND
                                     DOCYR = IT_CDTL-DOCYR AND
                                     REGTYP = REGTYP_1.
IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM J_1IPART2 WHERE DOCNO = IT_CDTL-DOCNO AND
                                         DOCYR = IT_CDTL-DOCYR.
  IF SY-SUBRC NE 0.
    IT_CDTL-SERIALNO = J_1IPART1-SERIALNO.
    APPEND IT_CDTL.
  ENDIF.
ENDIF.
ENDSELECT.
***************SPD********************
SELECT BDOCNO BDOCYR BEXNUM BEXDAT BWERKS BEXBED B~EXCCD
       B~ECS
       B~STATUS
       A~SERIALNO
       FROM J_1IPART1 AS A INNER JOIN J_1IEXCHDR AS B
       ON ADOCYR = BDOCYR AND ADOCNO = BDOCNO INTO CORRESPONDING
       FIELDS OF TABLE IT_CHDR WHERE B~TRNTYP = 'GRPO' AND
       BWERKS = WERKS AND BEXDAT IN BUDAT AND
       B~STATUS = ' ' AND
       B~STATUS = 'C' AND
       A~REGTYP = REGTYP_1.
SORT IT_PART2 BY SERIALNO.
LOOP AT IT_CHDR.
   SELECT * FROM J_1IEXCDTL
             INTO CORRESPONDING FIELDS OF IT_CDTL
            FOR ALL ENTRIES IN IT_CHDR
                    WHERE
                     TRNTYP = 'GRPO' AND
                      STATUS EQ ' ' AND
                      STATUS EQ 'C' AND
                     STATUS NE 'P' AND
                     DOCNO  = IT_CHDR-DOCNO AND
                     DOCYR  = IT_CHDR-DOCYR AND
                     EXNUM  = IT_CHDR-EXNUM AND
                     EXDAT  = IT_CHDR-EXDAT AND
                     WERKS  = IT_CHDR-WERKS.
     IF SY-SUBRC = 0.
       APPEND IT_CDTL.
       CLEAR  IT_CDTL.
     ELSE.
       CONTINUE.
     ENDIF.
   ENDSELECT.
MODIFY IT_CDTL INDEX SY-TABIX.
CLEAR IT_CDTL.
ENDLOOP.
*****spd change**********
*LOOP AT IT_CDTL.
*SELECT SINGLE * FROM J_1IPART2 WHERE DOCNO = IT_CDTL-DOCNO AND
                                    DOCYR = IT_CDTL-DOCYR.
*IF SY-SUBRC = 0.
DELETE IT_CDTL INDEX SY-TABIX.
*ENDIF.
*ENDLOOP.
**SELECT
*******spd ****************
SORT IT_CDTL BY  EXNUM EXDAT.
DELETE ADJACENT DUPLICATES FROM IT_CDTL COMPARING MATNR EXNUM EXDAT.
  LOOP AT IT_CDTL.
    CLEAR TEXT.
    DB_CNT = DB_CNT + 1.
    READ TABLE IT_CHDR WITH KEY EXNUM = IT_CDTL-EXNUM DOCNO =
IT_CDTL-DOCNO.
   READ TABLE IT_PART2 WITH KEY DOCNO = IT_CDTL-DOCNO .
   IT_OUT-SERIALNO = IT_PART2-SERIALNO.
    SELECT SINGLE NAME1 FROM LFA1
                    INTO IT_OUT-NAME
                    WHERE LIFNR = IT_CDTL-LIFNR.
    SELECT SINGLE * FROM LFA1
                      WHERE LIFNR = IT_CDTL-LIFNR.
    IF LFA1-LAND1 EQ 'IN'.
      TEXT = 'INVOICE'.
      IT_OUT-TEXT1 = TEXT.
    ELSE.
      TEXT = 'BOE'.
      IT_OUT-TEXT1 = TEXT.
    ENDIF.
    SELECT SINGLE * FROM J_1IMOVEND
                    WHERE LIFNR = IT_CDTL-LIFNR.
    SELECT SINGLE * FROM DD07T
                   INTO IT_OUT-DDTEXT
                    WHERE DOMNAME = 'J_1IVTYP' AND
                          DDLANGUAGE = 'EN' AND
                          DOMVALUE_L = J_1IMOVEND-J_1IVTYP.
  IF DD07T-DDTEXT = 'First Stage Dealer of indigenous excisable goods'
OR
    DD07T-DDTEXT = 'Second Stage Dealer of indigenous excisablegoods'.
      DD07T-DDTEXT = 'Dealer'.
    ENDIF.
    IT_OUT-DDTEXT = DD07T-DDTEXT.
   ELSEIF DD07T-DDTEXT = 'Second Stage Dealer of indigenous excisable
*goods'.
      DD07T-DDTEXT =
    CLEAR EBELN_T.
    SELECT SINGLE LFBNR FROM MSEG
                        INTO EBELN_T
                        WHERE MBLNR = IT_CDTL-RDOC2 .
    SELECT SINGLE * FROM MSEG
                      WHERE BWART EQ '106' AND
                            LFBNR = EBELN_T ."and
                           ebeln = ebeln_t.
    IF SY-SUBRC = 0.
      IT_OUT-DEL_IND = 'X'.
    ELSE.
      IT_OUT-DEL_IND = ' '.
    ENDIF.
    SELECT SINGLE BUDAT FROM MKPF
                      INTO IT_OUT-BUDAT
                      WHERE MBLNR = EBELN_T  ."MSEG-LFBNR.
    IT_OUT-EXNUM = IT_CDTL-EXNUM.
    IT_OUT-EXDAT = IT_CDTL-EXDAT.
    IT_OUT-EXCCD = IT_CHDR-EXCCD.
   IT_OUT-SERIALNO = IT_CHDR-SERIALNO.
    IT_OUT-SERIALNO = IT_CDTL-SERIALNO.
    IT_OUT-EXBAS = IT_CDTL-EXBAS.
    IT_OUT-EXBED = IT_CDTL-EXBED.
    IT_OUT-ECS   = IT_CDTL-ECS.
    IT_OUT-MATNR = IT_CDTL-MATNR.
    IT_OUT-MAKTX = IT_CDTL-MAKTX.
    IT_OUT-CHAPID = IT_CDTL-CHAPID.
    IT_OUT-MENGE = IT_CDTL-MENGE.
    IT_OUT-MEINS = IT_CDTL-MEINS.
    APPEND IT_OUT.
   EX_NO = IT_CDTL-EXNUM.
  ENDLOOP.
Title Portion
  IF REGTYP_1 = 'A'.
    SET TITLEBAR 'BALAJI' WITH DB_CNT.
  ELSEIF REGTYP_1 = 'C'.
    SET TITLEBAR 'BALAJI1' WITH DB_CNT.
  ENDIF.
  AFIELD-COL_POS = 1.
  AFIELD-FIELDNAME = 'SERIALNO'.
  AFIELD-SELTEXT_L = 'SERIAL NO.'.
  AFIELD-JUST = 'L'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 2.
  AFIELD-FIELDNAME = 'TEXT1'.
  AFIELD-SELTEXT_L = 'TYPE OF DOC'.
  AFIELD-JUST = 'L'.
  AFIELD-DECIMALS_OUT = '0'.
  AFIELD-NO_ZERO = 'X'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 3.
  AFIELD-FIELDNAME = 'EXNUM'.
  AFIELD-SELTEXT_L = 'DOC.NO'.
  AFIELD-JUST = 'L'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 4.
  AFIELD-FIELDNAME = 'EXDAT'.
  AFIELD-SELTEXT_L = 'DOC.DATE'.
  AFIELD-JUST = 'C'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 5.
  AFIELD-FIELDNAME = 'NAME'.
  AFIELD-SELTEXT_L = 'NAME OF THE SUPPLIER'.
  AFIELD-NO_ZERO = 'X'.
  AFIELD-JUST = 'L'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 6.
  AFIELD-FIELDNAME = 'DDTEXT'.
  AFIELD-SELTEXT_L = 'TYPE-OF-SUPPLIER'.
  AFIELD-JUST = 'L'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 7.
  AFIELD-FIELDNAME = 'EXCCD'.
  AFIELD-SELTEXT_L = 'ECC OF THE SUPPLIER'.
  AFIELD-NO_ZERO = 'X'.
  AFIELD-JUST = 'L'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 8.
  AFIELD-FIELDNAME = 'BUDAT'.
  AFIELD-SELTEXT_L = 'INPUT RECV DATE'.
  AFIELD-JUST = 'C'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 9.
  AFIELD-FIELDNAME = 'EXBAS'.
  AFIELD-SELTEXT_L = 'ASSESSABLE-VALUE'.
  AFIELD-DO_SUM             = 'X'.
  AFIELD-JUST = 'R'.
  AFIELD-DECIMALS_OUT = '2'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 10.
  AFIELD-FIELDNAME = 'EXBED'.
  AFIELD-SELTEXT_L = 'DET OF CREDIT TAKEN CENVAT'.
  AFIELD-JUST = 'R'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 11.
  AFIELD-FIELDNAME = 'ECS'.
  AFIELD-SELTEXT_L = 'DET OF CREDIT TAKEN E-CESS'.
  AFIELD-JUST = 'R'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 12.
  AFIELD-FIELDNAME = 'MATNR'.
  AFIELD-SELTEXT_L = 'MATERIAL-CODE'.
  AFIELD-JUST = 'L'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 13.
  AFIELD-FIELDNAME = 'MAKTX'.
  AFIELD-SELTEXT_L = 'DESCRIPTION'.
  AFIELD-JUST = 'L'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 14.
  AFIELD-FIELDNAME = 'CHAPID'.
  AFIELD-SELTEXT_L = 'TARIFF-ID'.
  AFIELD-JUST = 'L'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 15.
  AFIELD-FIELDNAME = 'MENGE'.
  AFIELD-SELTEXT_L = 'QUANTITY'.
  AFIELD-JUST = 'R'.
  AFIELD-DO_SUM             = ' '.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 16.
  AFIELD-FIELDNAME = 'MEINS'.
  AFIELD-SELTEXT_L = 'UOM'.
  AFIELD-JUST = 'C'.
  APPEND AFIELD TO FIELDCAT.
  AFIELD-COL_POS = 17.
  AFIELD-FIELDNAME = 'DEL_IND'.
  AFIELD-SELTEXT_L = 'Deleted'.
  AFIELD-JUST = 'C'.
  APPEND AFIELD TO FIELDCAT.
AFIELD-COL_POS = 18.
AFIELD-FIELDNAME = 'PO NO'.
AFIELD-SELTEXT_L = 'PURDOCNO'.
AFIELD-JUST = 'C'.
APPEND AFIELD TO FIELDCAT.
* LAYOUT FOR ZEBRA CATLOG
  LAYOUT_IN-COLWIDTH_OPTIMIZE = 'X'.
  LAYOUT_IN-ZEBRA             = 'X'.
  LAYOUT_IN-GET_SELINFOS      = 'X'.
  LAYOUT_IN-CONFIRMATION_PROMPT = 'X'.
  LAYOUT_IN-DETAIL_POPUP = 'X' .
SORTCAT-decimals     = '0'.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM      = G_REPID
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
      I_SAVE                  = G_SAVE
      IS_VARIANT              = GS_VARIANT
      IT_FIELDCAT             = FIELDCAT
      IT_SORT                 = SORTCAT
      IS_LAYOUT               = LAYOUT_IN
      IT_EVENTS               = EVENTCAT
     I_BACKGROUND_ID         = g_back_ground
    TABLES
      T_OUTTAB                = IT_OUT.
*&      Form  TOP_OF_PAGE_LIST_HEADER
      text
     -->LIST_HEADERtext
FORM TOP_OF_PAGE_LIST_HEADER USING LIST_HEADER TYPE SLIS_T_LISTHEADER.
  DATA : HLINE TYPE SLIS_LISTHEADER,
         TEXT(60) TYPE C.
  CLEAR : HLINE,TEXT.
  HLINE-TYP = 'H'.
  HLINE-INFO = TEXT.
  APPEND HLINE TO LIST_HEADER.
  SELECT SINGLE * FROM T001W WHERE WERKS = WERKS.
  CLEAR : HLINE,TEXT.
  HLINE-TYP = 'H'.
  WRITE 'PLANT :' TO TEXT.
  WRITE WERKS TO TEXT+8.
  HLINE-INFO = TEXT.
  APPEND HLINE TO LIST_HEADER.
  CLEAR : HLINE,TEXT.
  HLINE-TYP = 'H'.
  WRITE T001W-NAME1 TO TEXT.
  HLINE-INFO = TEXT.
  APPEND HLINE TO LIST_HEADER.
  CLEAR : HLINE,TEXT.
  HLINE-TYP = 'H'.
  WRITE T001W-STRAS TO TEXT.
  HLINE-INFO = TEXT.
  APPEND HLINE TO LIST_HEADER.
  CLEAR : HLINE,TEXT.
  HLINE-TYP = 'H'.
  WRITE T001W-ORT01 TO TEXT.
  HLINE-INFO = TEXT.
  APPEND HLINE TO LIST_HEADER.
  CLEAR : HLINE,TEXT.
  HLINE-TYP = 'H'.
  WRITE 'DATE :' TO TEXT.
  WRITE BUDAT-LOW TO TEXT+7.
  IF BUDAT-HIGH NE ''.
    WRITE 'TO' TO TEXT+18.
    WRITE BUDAT-HIGH TO TEXT+22.
  ENDIF.
  HLINE-INFO = TEXT.
  APPEND HLINE TO LIST_HEADER.
ENDFORM.                    "TOP_OF_PAGE_LIST_HEADER
*&      Form  ALV_EVENT_INIT
      text
FORM ALV_EVENT_INIT .
  CLEAR ALV_EVENT.
  ALV_EVENT-NAME = SLIS_EV_TOP_OF_PAGE.
  ALV_EVENT-FORM = 'ALV_TOP_OF_PAGE'.
  APPEND ALV_EVENT TO EVENTCAT.
  CLEAR ALV_EVENT.
  ALV_EVENT-NAME = SLIS_EV_TOP_OF_LIST.
  ALV_EVENT-FORM = 'ALV_TOP_OF_LIST'.
  APPEND ALV_EVENT TO EVENTCAT.
   CLEAR ALV_EVENT.
   ALV_EVENT-NAME = SLIS_EV_END_OF_LIST.
   ALV_EVENT-FORM = 'ALV_END_OF_LIST'.
   APPEND ALV_EVENT TO GT_EVENTS.
   CLEAR ALV_EVENT.
   ALV_EVENT-NAME = SLIS_EV_END_OF_PAGE.
   ALV_EVENT-FORM = 'ALV_END_OF_PAGE'.
   APPEND ALV_EVENT TO GT_EVENTS.
ENDFORM.                    "ALV_EVENT_INIT
*&      Form  ALV_TOP_OF_PAGE
      text
FORM ALV_TOP_OF_PAGE.
  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      IT_LIST_COMMENTARY = LIST_HEADER
      I_LOGO             = 'ENJOYSAP_LOGO'.
ENDFORM.                    "ALV_TOP_OF_PAGE
*&      Form  BUILD_EVENT
      text
     -->P_GT_EVENTS[]  text
FORM BUILD_EVENT USING P_EVENTS TYPE SLIS_T_EVENT.
  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      I_LIST_TYPE     = 0
    IMPORTING
      ET_EVENTS       = P_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG = 1
      OTHERS          = 2.
  READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND INTO
ALV_EVENT.
  IF SY-SUBRC = 0.
    MOVE GC_FORMNAME_USER_COMMAND TO ALV_EVENT-FORM.
    APPEND ALV_EVENT TO P_EVENTS.
  ENDIF.
  READ TABLE P_EVENTS WITH KEY NAME = SLIS_EV_BEFORE_LINE_OUTPUT INTO
ALV_EVENT.
  IF SY-SUBRC = 0.
    MOVE GC_FORMNAME_BEFORE_OUTPUT TO ALV_EVENT-FORM.
    APPEND ALV_EVENT TO P_EVENTS.
  ENDIF.
ENDFORM.                    " BUILD_EVENT
Thanks,
Shankar

Similar Messages

  • Can we have two alv grid in the output

    Hi
    Can we have two alv grid in the output?. If yes how can we do that using oops alv. I think first need to create the container on that two subscreen. is this correct? Thanks.
    Regards
    Raj

    >
    Rajitha1234 wrote:
    > Hi
    >
    >  Can we have two alv grid in the output?. If yes how can we do that using oops alv. I think first need to create the container on that two subscreen. is this correct? Thanks.
    >
    > Regards
    > Raj
    Hi Rajitha,
    You can have as many as ALV output in the screen By using OOPS.
    By using Container you can pass ALV output.
    see the sample Program SALV_TEST_TABLE.
    Regards,
    Prabhudas

  • Two AlV Grids in a single screen

    I want to bring two ALV GRIDS in a single report output screen.How can i achieve this through Classical coding( not OBJECT ORIENTED ). If possible please provide with codes.
    thanks,
    Venkat

    Hello Venkat
    I agree that using fm's this is an almost impossible task whereas using OO-based ALV lists it is just a piece of cake.
    For a sample have a look at report ZUS_SDN_TWO_ALV_GRIDS in thread alv
    or report ZUS_SDN_THREE_ALV_GRIDS in thread Alv
    Regards
      Uwe

  • Two ALV Grids in a single screen are overlapping eachother

    Hi,
    I have created two ALV grids in a single screen. I have used seperate containers for them.
    But on executing them , both the ALV grids are overlapping eachother.
    Please give me a solution.

    Hi,
      IF w_custom_container IS INITIAL.
    Creating Object for the Custom Container.
        CREATE OBJECT w_custom_container
          EXPORTING
            container_name              = w_container
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e054.  "CNTL ERROR
          WHEN 2.
            MESSAGE e055.  "CNTL SYSTEM ERROR
          WHEN 3.
            MESSAGE e056.  "CREATE ERROR
          WHEN 4.
            MESSAGE e057.  "LIFETIME ERROR
          WHEN 5.
            MESSAGE e058.  "LIFETIME DYNPRO DYNPRO LINK
        ENDCASE.
    Creating object for the Splitter Container.
        CREATE OBJECT w_split_container
          EXPORTING
            parent            = w_custom_container
            orientation       = 0
            sash_position     = 30
            with_border       = 2
          EXCEPTIONS
            cntl_error        = 1
            cntl_system_error = 2
            OTHERS            = 3.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e054. "CNTL_ERROR
          WHEN 2.
            MESSAGE e055. "CNTL_SYSTEM_ERROR
        ENDCASE.
    Creating Grid Control.
        CREATE OBJECT w_grid1
          EXPORTING
            i_parent = w_split_container->top_left_container.
        CREATE OBJECT w_grid2
          EXPORTING
            i_parent = w_split_container->bottom_right_container.
    Building field catalog for ALV.
    Fieldcat for the Detail Record.
        PERFORM build_fieldcat        USING:  c_1 c_code c_output c_check
                                              c_comcode c_olength,
                                              c_2 c_fileno c_output c_check
                                              c_filenum c_olength,
                                              c_3 c_dedcod c_output c_check
                                              c_dedcode c_olength,
                                              c_4 c_dedfac c_output c_check
                                              c_dedf c_olength.
    FieldCatlog for the Error Records.
        PERFORM build_fieldcat_error  USING:  c_1 c_pernr c_error c_check
                                              c_person c_olength,
                                              c_2 c_desc c_error c_check
                                              c_descp c_olength.
    ALV Display.
        CALL METHOD w_grid1->set_table_for_first_display
    EXPORTING
       i_buffer_active               =
       i_bypassing_buffer            =
       i_consistency_check           =
       i_structure_name              =
       is_variant                    =
       i_save                        =
       i_default                     = 'X'
       is_layout                     =
       is_print                      =
       it_special_groups             =
       it_toolbar_excluding          =
       it_hyperlink                  =
       it_alv_graphics               =
       it_except_qinfo               =
       ir_salv_adapter               =
          CHANGING
            it_outtab                     = t_error
            it_fieldcatalog               = t_fieldcat_error
       it_sort                       =
       it_filter                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e076. "invalid parameter combination
          WHEN 2.
            MESSAGE e001. "program error
          WHEN 3.
            MESSAGE e078. "too many lines
        ENDCASE.
        CALL METHOD w_grid2->set_table_for_first_display
    EXPORTING
       i_buffer_active               =
       i_bypassing_buffer            =
       i_consistency_check           =
       i_structure_name              =
       is_variant                    =
       i_save                        =
       i_default                     = 'X'
       is_layout                     =
       is_print                      =
       it_special_groups             =
       it_toolbar_excluding          =
       it_hyperlink                  =
       it_alv_graphics               =
       it_except_qinfo               =
       ir_salv_adapter               =
          CHANGING
            it_outtab                     = t_output
            it_fieldcatalog               = t_fieldcat
       it_sort                       =
       it_filter                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e076. "invalid parameter combination
          WHEN 2.
            MESSAGE e001. "program error
          WHEN 3.
            MESSAGE e078. "too many lines
        ENDCASE.
      ELSE.
        CALL METHOD w_grid1->refresh_table_display
          EXPORTING
            i_soft_refresh = 'X'.
        CALL METHOD w_grid2->refresh_table_display
          EXPORTING
            i_soft_refresh = 'X'.
      ENDIF.
    Hope it Helps,
    Jayant Sahu.

  • How can I get the selected rows from two ALV grids at the same time?

    I have a program that uses two ALV grids in one dialog screen. I'm using the OO ALV model (SALV* classes).
    The user can select any number of rows from each grid. Then, when a toolbar pushbutton is pressed, I'd have to retrieve the selected rows from both grids and start some processing with these rows.
    It is no problem to assign event handlers to both grids, and use the CL_SALV_TABLE->GET_SELECTIONS and CL_SALV_SELECTIONS->GET_SELECTED_ROWS methods to find out which rows were marked by the user. Trouble is, this only works when I raise an event in each grid separately, for instance via an own function that I added to the grid's toolbar. So, I can only see the selected rows of the same grid where such an event was raised.
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.
    As it is right now, I can have an own button in both grid's toolbar, select the rows, click on the extra button in each grid (this will tell me what entries were selected per grid). Then, I'd have to click on a third button (the one in the dialog screen's toolbar), and process the selected rows from both grids.
    How can I select the rows, then click on just one button, and process the marked entries from both grids?
    Is it somehow possible to raise an event belonging to each grid programmatically, so that then the corresponding CL_SALV_SELECTIONS->GET_SELECTED_ROWS will work?
    Thanks.

    Hello Tamas ,
    If I try to do this in the PBO of the dialog screen (that contains the two grids), the result of CL_SALV_SELECTIONS->GET_SELECTED_ROWS will be empty, as the program does not recognize the marked entries in the grids. Also, an event for grid1 does not see the selected rows from grid2 either.--->
    is it possible to  have a check box in each grid  & get the selected lines in PAI of the screen ?
    regards
    prabhu

  • Report with two ALV grids and a header

    Hi experts,
    I have a report with two ALV grids in the same screen, each one in a separated container. The information displays it correctly. The report has been implemented by using OO Programming.
    My real trouble is in the header. It must have a logo, a title with a specific font and other information.
    I'll attach a capture of my need:
    [Report with two ALV grids and a header|http://picasaweb.google.com/lh/photo/AcQD49QPmm-0L_jL2iMedA?feat=directlink]
    Then, I want to set up the header you can see, with logo, a font with specific features. Obviously, the header you see has taken from another report. But is the same idea.
    I've tried with a third container, using the CL_GUI_CONTAINER and CL_GUI_CONTAINER classes, but it doesn't work.
    Any idea? Would welcome any help you can provide.
    Thanks in advance,
    Jorge Rojas

    Hi, Jorge.
    Should the header be a"attached" to any of the ALV? Or it should be carried alone?
    If first applies, you've given the solution yourself: put the info & logo in first ALV's header and invoke it from the proper method.
    You could use CL_GUI_DOCKING_CONTAINER CLASS to divide screen in several containers and then, in the upper one, I would create another one docking container to divide the screen into two: the written info could be performed with an HTML viewer class and the logo with a CL_GUI_PICTURE element.
    Cheers.

  • Create blank screen space between two ALV grids

    I want to create some blank screen space between the two ALV grids I have on the screen.  Can someone tell me how to do this?
    Thanks and best regards,
    Sandy

    You don't have link the two containers.
    I guess you have a grid and tree control that you want to display. So, use a different container for each of these controls, so that they appear differently.
    If you don't want space in between them, you can have one container and split that into and display the tree and grid in each of the split portions.
    The advantage with this will be you can resize the tree/grids using the vertical line that separates them.
    Take a look at WE02 transaction to see what I am trying to explain.
    Regards,
    Ravi

  • Need to display two ALV GRIDs in a single screen

    Hi,
    I have a question, i'm using version 4.6. I want to display 2 ALVs in a single screen or by calling.
    Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2) 
    Step 2 : Display In a single report
    ALV1 report (Editable ,Has to be a GRID)
    ALV2 report (Non Editable, Has to be a GRID)
                             (or)
    Step 1 : The internal table (which holds the data for the ALVs has to be populated before calling ALV1 or ALV2)
    Step 2 :
    ALV1 report (Editable ,Has to be a GRID, with a custom button to call ALV2 hiding the ALV1 ie not visible to user)
    ALV2 report (Non Editable ,Has to be a GRID, with a custom button to call ALV1 hiding the ALV2 ie not visible to user)
    Please help me <b><REMOVED BY MODERATOR></b>
    Message was edited by:
            Alvaro Tejada Galindo

    Hi
    ABAP List Viewer
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    Check the program in the following link:
    http://sap-img.com/abap/display-secondary-list-using-alv-grid.htm
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_basic.htm
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    13. Top-of-page in ALV
    selection-screen and top-of-page in ALV
    14.  ALV Group Heading
    http://www.sap-img.com/fu037.htm
    How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    15. ALV output to PDF conversion
    It has an example code for PDF Conversion.
    http://www.erpgenie.com/abap/code/abap51.htm
    converting the output of alv in pdf
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    The common features of report are column alignment, sorting, filtering, subtotals, totals etc. To implement these, a lot of coding and logic is to be put. To avoid that we can use a concept called ABAP List Viewer (ALV).
    This helps us to implement all the features mentioned very effectively.
    Using ALV, We can have three types of reports:
    1. Simple Report
    2. Block Report
    3. Hierarchical Sequential Report
    There are some function modules which will enable to produce the above reports without much effort.
    All the definitions of internal tables, structures and constants are declared in a type-pool called SLIS.
    1. SIMPLE REPORT.
    The important function modules are
    a. Reuse_alv_list_display
    b. Reuse_alv_fieldcatalog_merge
    c. Reuse_alv_events_get
    d. Reuse_alv_commentary_write
    e. Reuse_alv_grid_display
    A. REUSE_ALV_LIST_DISPLAY : This is the function module which prints the data.
    The important parameters are :
    I. Export :
    i. I_callback_program : report id
    ii. I_callback_pf_status_set : routine where a user can set his own pf status or change the functionality of the existing pf status
    iii. I_callback_user_command : routine where the function codes are handled
    iv. I_structure name : name of the dictionary table
    v. Is_layout : structure to set the layout of the report
    vi. It_fieldcat : internal table with the list of all fields and their attributes which are to be printed (this table can be populated automatically by the function module REUSE_ALV_FIELDCATALOG_MERGE
    vii. It_events : internal table with a list of all possible events of ALV and their corresponding form names.
    II. Tables :
    i. t_outtab : internal table with the data to be output
    B. REUSE_ALV_FIELDCATALOG_MERGE : This function module is used to populate a fieldcatalog which is essential to display the data in ALV. If the output data is from a single dictionary table and all the columns are selected, then we need not exclusively create the field catalog. Its enough to mention the table name as a parameter(I_structure name) in the REUSE_ALV_LIST_DISPLAY. But in other cases we need to create it.
    The Important Parameters are :
    I. Export :
    i. I_program_name : report id
    ii. I_internal_tabname : the internal output table
    iii. I_inclname : include or the report name where all the dynamic forms are handled.
    II Changing
    ct_fieldcat : an internal table with the type SLIS_T_FIELDCAT_ALV which is
    declared in the type pool SLIS.
    C. REUSE_ALV_EVENTS_GET : Returns table of possible events for a list type
    Parameters :
    I. Import :
    Et_Events : The event table is returned with all possible CALLBACK events
    for the specified list type (column 'NAME'). For events to be processed by Callback, their 'FORM' field must be filled. If the field is initialized, the event is ignored. The entry can be read from the event table, the field 'FORM' filled and the entry modified using constants from the type pool SALV.
    II. Export :
    I_List_type :
    0 = simple list REUSE_ALV_LIST_DISPLAY
    1 = hierarchcal-sequential list REUSE_ALV_HIERSEQ_LIST_DISPLAY
    2 = simple block list REUSE_ALV_BLOCK_LIST_APPEND
    3 = hierarchical-sequential block list
    REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_COMMENTARY_WRITE : This is used in the Top-of-page event to print the headings and other comments for the list.
    Parameters :
    I. it_list_commentary : internal table with the headings of the type slis_t_listheader.
    This internal table has three fields :
    Typ : ‘H’ – header, ‘S’ – selection , ‘A’ - action
    Key : only when typ is ‘S’.
    Info : the text to be printed
    E. REUSE_ALV_GRID_DISPLAY : A new function in 4.6 version, to display the results in grid rather than as a preview.
    Parameters : same as reuse_alv_list_display
    This is an example for simple list.
    2. BLOCK REPORT
    This is used to have multiple lists continuously.
    The important functions used in this report are:
    A. REUSE_ALV_BLOCK_LIST_INIT
    B. REUSE_ALV_BLOCK_LIST_APPEND
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    A. REUSE_ALV_BLOCK_LIST_INIT
    Parameters:
    I. I_CALLBACK_PROGRAM
    II. I_CALLBACK_PF_STATUS_SET
    III. I_CALLBACK_USER_COMMAND
    This function module is used to set the default gui status etc.
    B. REUSE_ALV_BLOCK_LIST_APPEND
    Parameters :
    Export :
    I. is_layout : layout settings for block
    II. it_fieldcat : field catalog
    III. i_tabname : internal table name with output data
    IV. it_events : internal table with all possible events
    Tables :
    i. t_outtab : internal table with output data.
    This function module adds the data to the block.
    Repeat this function for all the different blocks to be displayed one after the other.
    C. REUSE_ALV_BLOCK_LIST_HS_APPEND
    This function module is used for hierarchical sequential blocks.
    D. REUSE_ALV_BLOCK_LIST_DISPLAY
    Parameters : All the parameters are optional.
    This function module display the list with data appended by the above function.
    Here the functions REUSE_ALV_FIELDCATALOG_MERGE, REUSE_ALV_EVENTS_GET, REUSE_ALV_COMMENTARY_WRITE can be used.
    3. Hierarchical reports :
    Hierarchical sequential list output.
    The function module is
    A. REUSE_ALV_HIERSEQ_LIST_DISPLAY
    Parameters:
    I. Export:
    i. I_CALLBACK_PROGRAM
    ii. I_CALLBACK_PF_STATUS_SET
    iii. I_CALLBACK_USER_COMMAND
    iv. IS_LAYOUT
    v. IT_FIELDCAT
    vi. IT_EVENTS
    vii. i_tabname_header : Name of the internal table in the program containing the
    output data of the highest hierarchy level.
    viii. i_tabname_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    ix. is_keyinfo : This structure contains the header and item table field
    names which link the two tables (shared key).
    II. Tables
    i. t_outtab_header : Header table with data to be output
    ii. t_outtab_item : Name of the internal table in the program containing the
    output data of the lowest hierarchy level.
    slis_t_fieldcat_alv : This internal table contains the field attributes. This internal table can be populated automatically by using ‘REUSE_ALV_FIELDCATALOG_MERGE’.
    Important Attributes :
    A. col_pos : position of the column
    B. fieldname : internal fieldname
    C. tabname : internal table name
    D. ref_fieldname : fieldname (dictionary)
    E. ref_tabname : table (dictionary)
    F. key(1) : column with key-color
    G. icon(1) : icon
    H. symbol(1) : symbol
    I. checkbox(1) : checkbox
    J. just(1) : (R)ight (L)eft (C)ent.
    K. do_sum(1) : sum up
    L. no_out(1) : (O)blig.(X)no out
    M. outputlen : output length
    N. seltext_l : long key word
    O. seltext_m : middle key word
    P. seltext_s : short key word
    Q. reptext_ddic : heading (ddic)
    R. ddictxt(1) : (S)hort (M)iddle (L)ong
    S. datatype : datatype
    T. hotspot(1) : hotspot
    Regards
    Anji

  • Two  ALV Grid Display  format on the Single page

    Hi guru's
    I have two plant details. I want to be  display these two plant details in the single page with ALV Grid display format.. like
    plant no 1(Details):
    xxxx  xxxx xxxx xxxx with ALV Grid Display format
    plant no 2 (Details):
    xxx  xxxx xxxx xxxx ALV Grid Display format
    Can any body help on the .. if you have sample code pls paste.
    Thanks in Advance
    Surendra

    hi,
    Grid display is not possible but u can display two list on same page by Block ALV....
    TYPE-POOLS : slis.
    TABLES : mara,
             makt.
    SELECT-OPTIONS : mat FOR mara-matnr.
    DATA : BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,
            maktx LIKE makt-maktx,
            matkl LIKE mara-matkl,
            mtart LIKE mara-mtart,
           END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1.
    DATA : BEGIN OF itab1_col OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1_col.
    DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
           t_fcat2 TYPE slis_t_fieldcat_alv,
           wa_fcat TYPE slis_fieldcat_alv,
           t_eve TYPE slis_t_event,
           wa_eve TYPE slis_alv_event,
           t_layout TYPE slis_layout_alv.
    DATA : v_repid LIKE sy-repid,
           t_mat LIKE mara-matnr.
    DEFINE create_fcat.
      clear wa_fcat.
      wa_fcat-fieldname = &1.
      wa_fcat-seltext_l = &2.
      wa_fcat-outputlen = &3.
      append wa_fcat to t_fcat1.
    END-OF-DEFINITION.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM dis_data.
    *&      Form  get_data
          text
    FORM get_data.
      SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara AS a INNER JOIN makt AS b ON
      amatnr = bmatnr
      WHERE a~matnr IN mat.
      LOOP AT itab.
        itab1-mtart = itab-mtart.
        itab1-count = 1.
        APPEND itab1.
      ENDLOOP.
      SORT itab1 BY mtart.
      LOOP AT itab1.
        MOVE-CORRESPONDING itab1 TO itab1_col.
        COLLECT itab1_col.
      ENDLOOP.
    ENDFORM.                    "get_data
    *&      Form  dis_data
          text
    FORM dis_data.
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program      = v_repid.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE1'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MATNR' 'Material' '10',
      'MAKTX' 'Material Description' '40',
      'MTART' 'Type' '10',
      'MATKL' 'Group' '10'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB'
          it_events   = t_eve
        TABLES
          t_outtab    = itab.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE2'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MTART' 'Type' '10',
      'COUNT' 'Total' '5'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB1_COL'
          it_events   = t_eve
        TABLES
          t_outtab    = itab1_col.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    ENDFORM.                    "dis_data
    *&      Form  top_of_page1
          text
    FORM top_of_page1.
      FORMAT COLOR COL_POSITIVE.
      WRITE:/ 'First Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    *&      Form  top_of_page2
          text
    FORM top_of_page2.
      FORMAT COLOR COL_NEGATIVE.
      WRITE /5 'Second Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    reward if usefull....

  • How to use two ALV grids in a single program (pl read below for details)?

    Please read thoroughly::
    I have an ALV report using REUSE_ALV_GRID_DISPLAY.
    On the output of this report, when I click on a "change" button, a couple of columns should be made editable.
    I achieved this by modifying the fieldcatalog and triggering the output with another REUSE_ALV_GRID_DISPLAY.
    When I click on the back button of this second report, it is still taking me to the first one.
    How to over come this?
    Note:
    I used custom containers etc but the default buttons on the container are not controllable. I added custom buttons but could not suppress the default ones. So I did not pursue this much even though this is more comfortable to use.
    I am not able to get into the code in debug to see how the default buttons like COPY, INSERT ROW etc are working.
    Can any body throw some inputs into this?
    Thanks,
    Ven.

    >I achieved this by modifying the fieldcatalog and triggering the >output with another REUSE_ALV_GRID_DISPLAY.
    >When I click on the back button of this second report, it is still >taking me to the first one.
    >How to over come this?
    For this there is a solution
    i am thinking you are using user_command and calling the second time ALV Grid if so check this.
    form user_command using r_ucomm type sy-ucomm selfield type slis_selfield.
    case r_ucomm.
    when 'CHANGE'.
    selfield-exit = 'X'.   "use this , this will solve the problem
    "i hope you are calling the Function here
    endform.

  • Two ALV Grid in the same screeen

    Hi,
      I have created a module pool with a screen.
    In this screen I have defined two customer objects and I dipslay two different ALV grid.
    DATA: grid_1         TYPE REF TO cl_gui_alv_grid,
              grid_2         TYPE REF TO cl_gui_alv_grid.
    When the user puts the values into the field in both lists and pushes "enter", the program gets the input value by method
    "get_selected_rows". It works only for the list where there is the cursor.
    I need to read the value of each list at the same moment.
    Thanks in advance
    Marco

    *& Report  Z7CC_ALV_OOPS_TWO_ALV_SCREENS                               *
    report  z7cc_alv_oops_two_alv_screens           .
    * TEMP DECLARATION TYPE DECLARATIONS
    * Structure for Sales Order
    types: begin of y_vbak      ,
    vbeln type vbeln_va ,
    end of y_vbak        ,
    * Structure for Sales Order Details.
    begin of y_vbap           ,
    vbeln type vbeln_va    ,
    posnr type posnr_va    ,
    matnr type matnr       ,
    charg type charg_d     ,
    arktx type arktx       ,
    end of y_vbap             ,
    *& Structure of line item ----------
    begin of  y_po_item,
    ebeln type ekko-ebeln, " PO NUMBER
    ebelp type ekpo-ebelp,  "LINE ITEM
    matnr like ekpo-matnr,  " Material Number
    netpr like ekpo-netpr,  " Price per unit.
    menge like ekpo-menge,  " Purchase order quantity.
    netwr like ekpo-netwr,  " Net order in Purchase order currency
    meins like ekpo-meins,  " UOM
    end of y_po_item.
    data: t_y_po_item type standard table of y_po_item.
    data:  w_container_1        type ref to cl_gui_container        .
    data: t_vbap      type standard table of y_vbap.
    *--------- END OF TEMP DECLARATION ------------
    data: ok_code like sy-ucomm.
    *-- Global data definitions for ALV
    *--- ALV Grid instance reference
    data gr_alvgrid type ref to cl_gui_alv_grid .
    *--- Name of the custom control added on the screen
    data gc_custom_control_name type scrfname value 'Z7CC_ALV2' .
    *--- Custom container instance reference
    data gr_ccontainer type ref to cl_gui_custom_container .
    *--- Field catalog table
    data gt_fieldcat type lvc_t_fcat .
    data gt_fieldcat_2 type lvc_t_fcat .
    *--- Layout structure
    data gs_layout type lvc_s_layo .
    *&------- DECLARATION FOR THE NEXT SCREEN ------------------
    *--- ALV Grid instance reference
    data gr_alvgrid_2 type ref to cl_gui_alv_grid .
    *--- Name of the custom control added on the screen-----------
    data gc_custom_control_name_2 type scrfname value 'Z7CC_ALV' .
    *--- Custom container instance reference
    data gr_ccontainer_2 type ref to cl_gui_custom_container .
    *Declare your internal table which is supposed to hold the list data.
    *&Let’s name it “gt_list”.
    *Here is an example declaration.
    *--- Internal table holding list data
    data begin of gt_list occurs 0.
    data   matnr like mara-matnr.
    data   maktx like makt-maktx.
    data end of gt_list .
    data: begin of gt_list_2 occurs 0.
    include structure  z7cc_po_header.
    data: linecolor(4) type c, "Color for corresponding line
    end of gt_list_2.
    data: t_gt_list_2   type standard table of z7cc_po_header.
    *----- CLASS DECLARATION ------
    * FIELD-SYMBOLS
    field-symbols <fs_vbap> type y_vbap.
    field-symbols <fs_gt_list_2> type z7cc_po_header.
    class lcl_event_receiver definition deferred.
    data w_event_receiver type ref to lcl_event_receiver.
    * Creating a class definition for handling events on the ALV Grid.
    class lcl_event_receiver definition.
    public section.
    methods: handle_top_of_page for event top_of_page
    of cl_gui_alv_grid
    importing e_dyndoc_id,
    handle_hotspot_click for event hotspot_click
    of cl_gui_alv_grid
    importing e_row_id,
    handle_toolbar_event for event toolbar
    of cl_gui_alv_grid
    importing e_object,
    handle_user_command  for event user_command
    of cl_gui_alv_grid
    importing e_ucomm.
    endclass.                    "lcl_event_receiver  DEFINATION
    * Implementing the Class for handling events on the ALV Grid.
    class lcl_event_receiver implementation.
    method handle_top_of_page.
    perform show_top_of_page using e_dyndoc_id   w_container_1.
    endmethod.                    "handle_top_of_page
    method handle_hotspot_click.
    perform show_hotspot_click_details using e_row_id.
    endmethod.                    "lcl_event_receiver
    method handle_toolbar_event.
    perform create_alv_toolbar using e_object.
    endmethod.                    "handle_toolbar_event
    method handle_user_command.
    perform handle_user_command using e_ucomm.
    endmethod.                    "handle_user_command
    endclass.                    "lcl_event_receiver IMPLEMENTATION
    data:   w_grid               type ref to cl_gui_alv_grid         .
    *-------- END OF CLASS DECLARATION -------------
    start-of-selection.
    perform populate_table.
    call screen 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    module status_0100 output.
    set pf-status 'Z7CC_ALV1'.
    *  SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  DISPLAY_ALV  OUTPUT
    *       text
    module display_alv output.
    perform display_alv.
    endmodule.                 " DISPLAY_ALV  OUTPUT
    *&      Form  POPULATE_TABLE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form populate_table .
    select ebeln ebelp matnr  netpr menge netwr meins into corresponding fields of table t_y_po_item
    from ekpo.
    select ekko~ebeln ekko~bukrs ekko~aedat ekko~ernam
    ekko~lifnr ekko~zterm ekko~angnr  into corresponding fields of
    table t_gt_list_2    from ekko .
    endform.                    " POPULATE_TABLE
    *&      Form  DISPLAY_ALV
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form display_alv .
    if gr_alvgrid is initial .
    perform create_first_obj_container.
    *&----------- ONE MORE CONTROL ON THE SCREEN-------------------
    perform create_second_obj_container.
    " DISPLAY_ALV
    *   Creating ALV Grid instance
    perform create_first_alvgrid.
    perform create_second_alvgrid.
    *  PERFORM FIELD_CATALOG.  " CREATE A FIELD CATALOG.
    perform field_cat changing gt_fieldcat.
    perform field_cat_1 changing gt_fieldcat_2.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
    perform call_mthd_display_both_grid.
    *&---------  create a field catalog.------------
    perform event_handling.
    else.
    *&-----------CALL ALV GRID REFRESH  TABLE DISPLAY
    perform call_mthd_alv_refresh.
    endif.
    endform.                    "DISPLAY_ALV
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    module user_command_0100 input.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  EXIT_PROGRAM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form exit_program .
    leave program.
    endform.                    " EXIT_PROGRAM
    *&      Module  PAI  INPUT
    *       text
    module pai input.
    case ok_code.
    when '&EXT'.
    perform exit_program.
    when others.
    *     do nothing
    endcase.
    clear ok_code.
    endmodule.                 " PAI  INPUT
    *&      Form  CREATE_FIRST_OBJ_CONTAINER
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form create_first_obj_container .
    create object gr_ccontainer
    exporting
    container_name              = gc_custom_control_name
    if sy-subrc <> 0.
    *          MESSAGE ID SY-MSGID TYPE  SY-MSGTY NUMBER SY-MSGNO
    *                     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform.                    " CREATE_FIRST_OBJ_CONTAINER
    *&----------------------------------------

  • Problem with same layout (variant) for two ALV Grid and ALV Tree

    Hello!
    I have two docking containers on the screen. On the left i have cl_gui_alv_tree, on the right cl_salv_table.
    When a user set a default layout for ALV Grid (or ALV Tree), raport starts and sets this layout in both objects (tree and grid).
    How to avoid this?

    Hi,
    Take Two radio buttons.
    First radion button display the two containers in grid format,
    second radio button display the two containers in tree format base on user selection.
    CREATE OBJECT G_DOCING_CONTAINER
        EXPORTING PARENT = G_CUSTOM_CONTAINER."G_CONTAINER.
    DISPLAY THE DATA IN GRID FORMATA
    CREATE OBJECT r_grid
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    DISPLAY THE GRID DATA IN SECOND CONTAINER
    CREATE OBJECT r_grid1
        EXPORTING
          i_parent          = G_DOCING_CONTAINER
    CALL METHOD g_docing_container->set_width
          EXPORTING
            width      = 1300.
    OTHERWISE WE CAN DISPLAY THE TWO CONTAINERS DATA IN A GRID FORMAT
    CREATE OBJECT g_tree
        EXPORTING
          parent                = g_docing_container"g_custom_container
    IF R1 = 'X'.  "FOR GRID DISPLAY
    CALL METHOD r_grid1->set_table_for_first_display
    CALL METHOD r_grid2->set_table_for_first_display
    ELSE.
    ************TREE DISPLAY
    ENDIF.
    regards,
    muralii

  • Two ALV's in single report without Using Containers

    Hi All,
    I have a requirement to show two ALV reports in a single report and the thing is I am not supposed to use Containers(Screen Painter). and OOPS concepts.
    Is there a way we can achieve this?
    Any valuable suggestion is highly appreciated.
    Thanks-

    Hi rahul,
    1. This simple program will give u an idea
    of block alv.
    -> Two or more alvs on same screen, without
       using container or oops.
    2. It will print two alv
    a) itab = table from t001
    b) ptab = table from t000
    3. Just copy paste in new program.
    REPORT zam_temp54 .
    type-pools : slis.
    data : alvfc type slis_t_fieldcat_alv.
    data : alvly type slis_layout_alv.
    data : alvev type slis_t_event .
    DATA : BEGIN OF itab OCCURS 0.
    include structure t001.
    DATA: END OF itab.
    DATA : BEGIN OF ptab OCCURS 0.
    INCLUDE STRUCTURE t000.
    DATA: END OF ptab..
    PARAMETERS : a TYPE c.
    start-of-selection.
    *--------------- SELECT DATA
    SELECT * FROM t001 into table itab.
    select * from t000 into table ptab.
    *--------------- INIT BLOCK ALV
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
    EXPORTING
    i_callback_program = sy-repid.
    *--------------- ADD INTERNAL TABLE ITAB
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'ITAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = ALVFC.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    is_layout = alvly
    it_fieldcat = alvfc
    i_tabname = 'ITAB'
    it_events = alvev
    TABLES
    t_outtab = ITAB
    EXCEPTIONS
    program_error = 1
    maximum_of_appends_reached = 2
    OTHERS = 3.
    *------------------- ADD INTERNAL TABLE PTAB
    REFRESH ALVFC[].
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    I_PROGRAM_NAME = SY-REPID
    I_INTERNAL_TABNAME = 'PTAB'
    I_INCLNAME = SY-REPID
    CHANGING
    CT_FIELDCAT = ALVFC.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
    EXPORTING
    is_layout = alvly
    it_fieldcat = alvfc
    i_tabname = 'PTAB'
    it_events = alvev
    TABLES
    t_outtab = PTAB
    EXCEPTIONS
    program_error = 1
    maximum_of_appends_reached = 2
    OTHERS = 3.
    *--------------- DISPLAY
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    regards,
    amit m.

  • Downloading ALV Grid (using objects) output to Excel

    Hi all,
    I'm using objects for ALV Grid. I have few other fields (few are above and few are below the custom control) on screen other than custom control. I want to download the entire screen to excel (including other fields). But using Export option I'm able to download only ALV Grid. I did tried with Excel in place option which is not pulling data from ALV Grid control.
    Please suggest me the solution.
    Regards
    Jaker.

    hi
    use this code in ALV format
    TABLES USR03.
    DATA: BEGIN OF ISAPDAT OCCURS 0,
              BNAME LIKE USR03-BNAME,
              NAME1 LIKE USR03-NAME1,
              NAME2 LIKE USR03-NAME2,
          END OF ISAPDAT.
    PARAMETERS P_FNAME LIKE RLGRAP-FILENAME
                        DEFAULT 'd:\sapdata.xls' OBLIGATORY.
    SELECT * FROM USR03 INTO CORRESPONDING FIELDS OF TABLE ISAPDAT.
    SORT ISAPDAT.
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
         EXPORTING
              I_FILENAME        = P_FNAME
         TABLES
              I_TAB_SAP_DATA    = ISAPDAT
         EXCEPTIONS
              CONVERSION_FAILED = 1
              OTHERS            = 2.
    IF SY-SUBRC EQ 0.
      WRITE:/ 'Download to Excel complete'.
    ELSE.
      WRITE:/ 'Error with download'.
    ENDIF.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:34 PM

  • How to put up the traffic lights icon in the ALV Grid. OO output

    Hi all,
    I have a requriement that after all the report execution parts are done, i need to display the posted or unposted document using the Traffic light icon in the report output, i am displaying the report in ALV OO form and i already geta  field with a conent X of the document is posted else that field is blank currently.
    Regards

    Sample code here for this.
    *& Report  Z_50657_ALV_EX2                                             *
    *& Program Name: Test Program for ALV                                  *
    *  Developer Name: ADCDEV (Rahul Kavuri )                              *
    *  Description: ALV Report to Display Vendor Details                   *
    *& Date:7th April 2006                                                 *
    REPORT  Z_50657_ALV_EX2
            NO STANDARD PAGE HEADING
            LINE-COUNT 65(3)
            LINE-SIZE 220
            MESSAGE-ID ZZ.
    *                             Type Pools                               *
    TYPE-POOLS: SLIS, ICON.
    *                              Tables                                  *
    TABLES: VBAK. "Sales Document Data
    *                         Internal Tables                              *
    * TABLE TO HOLD DATA OF SALES DOCUMENT
    DATA: BEGIN OF IT_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN, "Sales Document
          VBTYP LIKE VBAK-VBTYP, "SD document category
          AUDAT LIKE VBAK-AUDAT, "Document date (date received/sent)
          AUGRU LIKE VBAK-AUGRU, "Order reason (reason for the business)
          AUART LIKE VBAK-AUART, "Sales Document Type
          NETWR LIKE VBAK-NETWR, "Net Sales Order in Doc. Currency
          WAERK LIKE VBAK-WAERK, "SD document currency
          ICON TYPE ICON-ID,     "traffic lights
          END OF IT_VBAK.
    *                             Work Areas                               *
    *WORK AREAS DEFINED FOR ALV'S
    DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,      "field catalog
          IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,     "field catalog ITAB
          WA_SORT TYPE SLIS_SORTINFO_ALV,           "SORT work area
          IT_SORT TYPE SLIS_T_SORTINFO_ALV,         "SORT ITAB
          LAYOUT TYPE SLIS_LAYOUT_ALV,              "LAYOUT
          WA_FCODE TYPE SLIS_EXTAB,                 "FUN CODE
          I_FCODE_EXTAB TYPE SLIS_T_EXTAB,
          WA_EVENTS TYPE SLIS_ALV_EVENT,
          IT_EVENTS TYPE SLIS_T_EVENT.
    *                       Selection-Screen                               *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
    PARAMETERS: P_VBTYP LIKE VBAK-VBTYP DEFAULT 'C'.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
    PARAMETERS: LIST RADIOBUTTON GROUP G1,
                GRID RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    *                     At  Selection-Screen                             *
    *VALIDATION
    *                       Start of Selection                             *
    START-OF-SELECTION.
    *POPULATION OF DATA INTO INTERNAL TABLE ITAB
      PERFORM GET_DATA.
    *DEFINE USER DEFINED FIELDCATALOG
      PERFORM DEFINE_FIELDCATALOG.
    *SUBTOTALS AND TOTALS DISPLAY USING SORT
      PERFORM SORT_LIST.
    *CHANGE FCODE OF STATUS
      PERFORM CHANGE_FCODE.
    *CHECK RADIOBUTTON OPTION AND ACCORDINGLY FINAL DISPLAY
      PERFORM CHECK_OPTION.
    *&      Form  GET_DATA
    *       text
    FORM GET_DATA.
      SELECT VBELN
             VBTYP
             AUDAT
             AUGRU
             AUART
             NETWR
             WAERK FROM VBAK INTO TABLE IT_VBAK
             WHERE VBELN IN S_VBELN AND VBTYP = P_VBTYP
             AND ERDAT > '01.01.2004' AND NETWR > 0.
      LOOP AT IT_VBAK.
        IF IT_VBAK-NETWR < 10000.
          IT_VBAK-ICON = '@08@'.
        ELSEIF IT_VBAK-NETWR > 100000.
          IT_VBAK-ICON = '@0A@'.
        ELSE.
          IT_VBAK-ICON = '@09@'.
        ENDIF.
        MODIFY IT_VBAK INDEX SY-TABIX.
      ENDLOOP.
    ENDFORM.                    "GET_DATA
    *&      Form  CHECK_OPTION
    *       text
    FORM CHECK_OPTION.
      WA_EVENTS-NAME = 'TOP_OF_PAGE'.
      WA_EVENTS-FORM = 'TOP'.
      APPEND WA_EVENTS TO IT_EVENTS.
      CLEAR WA_EVENTS.
      WA_EVENTS-NAME = 'END_OF_LIST'.
      WA_EVENTS-FORM = 'END_LIST'.
      APPEND WA_EVENTS TO IT_EVENTS.
      CLEAR WA_EVENTS.
      IF LIST = 'X'.
        PERFORM LIST_DISP.
      ENDIF.
      IF GRID = 'X'.
        PERFORM GRID_DISP.
      ENDIF.
    ENDFORM.                    "CHECK_OPTION
    *&      Form  DEFINE_FIELDCATALOG
    *       text
    FORM DEFINE_FIELDCATALOG.
      WA_FIELDCAT-COL_POS = 1.
      WA_FIELDCAT-FIELDNAME = 'ICON'.
      WA_FIELDCAT-SELTEXT_L = 'ICON'.
      WA_FIELDCAT-ICON = 'X'.
      WA_FIELDCAT-OUTPUTLEN = 8.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 2.
      WA_FIELDCAT-FIELDNAME = 'VBELN'.
      WA_FIELDCAT-SELTEXT_L = 'SALES DOC NO.'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 3.
      WA_FIELDCAT-FIELDNAME = 'AUDAT'.
      WA_FIELDCAT-SELTEXT_L = 'CREATED ON'.
      WA_FIELDCAT-OUTPUTLEN = 10.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 4.
      WA_FIELDCAT-FIELDNAME = 'VBTYP'.
      WA_FIELDCAT-SELTEXT_L = 'CATEGORY'.
      WA_FIELDCAT-OUTPUTLEN = 1.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 6.
      WA_FIELDCAT-FIELDNAME = 'AUGRU'.
      WA_FIELDCAT-SELTEXT_L = 'REASON'.
      WA_FIELDCAT-OUTPUTLEN = 3.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 5.
      WA_FIELDCAT-FIELDNAME = 'AUART'.
      WA_FIELDCAT-SELTEXT_L = 'DOC TYPE'.
      WA_FIELDCAT-OUTPUTLEN = 4.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 7.
      WA_FIELDCAT-FIELDNAME = 'NETWR'.
      WA_FIELDCAT-SELTEXT_L = 'NET VALUE'.
      WA_FIELDCAT-OUTPUTLEN = 17.
      WA_FIELDCAT-DECIMALS_OUT = 2.
    *  WA_FIELDCAT-DO_SUM = 'X'.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-COL_POS = 8.
      WA_FIELDCAT-FIELDNAME = 'WAERK'.
      WA_FIELDCAT-SELTEXT_L = 'UNIT'.
      WA_FIELDCAT-OUTPUTLEN = 50.
      WA_FIELDCAT-TABNAME = 'IT_VBAK'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "DEFINE_FIELDCATALOG
    *&      Form  DEFINE_LAYOUT
    *       text
    FORM DEFINE_LAYOUT.
      LAYOUT-ZEBRA = 'X'.
      LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL SUM'.
      LAYOUT-WINDOW_TITLEBAR = 'EXERCISE 2'.
      LAYOUT-TOTALS_TEXT  = 'TOTAL'.
    ENDFORM.                    "DEFINE_LAYOUT
    *&      Form  SORT_LIST
    *       text
    FORM SORT_LIST.
      WA_SORT-FIELDNAME = 'VBELN'.
      WA_SORT-TABNAME = 'IT_VBAK'.
      WA_SORT-SPOS = 1.
      WA_SORT-UP = 'X'.
      WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-FIELDNAME = 'NETWR'.
      WA_SORT-TABNAME = 'IT_VBAK'.
      WA_SORT-UP = 'X'.
      WA_SORT-SPOS = 2.
      WA_SORT-SUBTOT = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    ENDFORM.                    "SORT_LIST
    *&      Form  LIST_DISP
    *       text
    FORM LIST_DISP.
      PERFORM DEFINE_LAYOUT.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM             = SY-REPID
         IT_FIELDCAT                    = IT_FIELDCAT
         IS_LAYOUT                      = LAYOUT
         IT_SORT                        = IT_SORT
         I_CALLBACK_PF_STATUS_SET       = 'STATUS'
         IT_EXCLUDING                   = I_FCODE_EXTAB
         I_CALLBACK_USER_COMMAND        = 'USER_COMMAND'
         IT_EVENTS                      = IT_EVENTS[]
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER        =
    *     ES_EXIT_CAUSED_BY_USER         =
        TABLES
         T_OUTTAB                       = IT_VBAK
    *   EXCEPTIONS
    *     PROGRAM_ERROR                  = 1
    *     OTHERS                         = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "LIST_DISP
    *&      Form  GRID_DISP
    *       text
    FORM GRID_DISP.
      PERFORM DEFINE_LAYOUT.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM       = SY-REPID
          IS_LAYOUT                = LAYOUT
          IT_FIELDCAT              = IT_FIELDCAT
          IT_SORT                  = IT_SORT
          I_CALLBACK_PF_STATUS_SET = 'STATUS'
          IT_EXCLUDING             = I_FCODE_EXTAB
          I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
          IT_EVENTS                = IT_EVENTS[]
        TABLES
          T_OUTTAB                 = IT_VBAK.
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "GRID_DISP
    *&      Form  STATUS
    *       text
    *      -->P_EXTAB    text
    FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
      SET PF-STATUS 'STATUS' EXCLUDING P_EXTAB.
    ENDFORM.                    "STATUS
    *&      Form  USER_COMMAND
    *       text
    *      -->R_UCOMM      text
    *      -->RS_SELFIELD  text
    FORM USER_COMMAND USING R_UCOMM     LIKE SY-UCOMM
                                   RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN 'BACK' OR 'CANC' OR 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN '&IC1'.
          SET PARAMETER ID 'AUN' FIELD RS_SELFIELD-VALUE.
          CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    *&      Form  CHANGE_FCODE
    *       text
    FORM CHANGE_FCODE.
      WA_FCODE = 'PRNT'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&OAD'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&AVE'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&EB9'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&SUM'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&UMC'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&XPA'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
      WA_FCODE = '&OMP'.
      APPEND WA_FCODE TO I_FCODE_EXTAB.
    ENDFORM.                    "CHANGE_FCODE
    *&      Form  TOP
    *       text
    FORM TOP.
      IF LIST = 'X'.
        WRITE:/ SY-ULINE.
        WRITE:/ 'DATE:', SY-DATUM,55 'INTELLIGROUP ASIA PVT LTD'.
        WRITE:/ 'TIME:', SY-UZEIT.
        WRITE:/ 'USER NAME:', SY-UNAME,60 SY-TITLE.
        WRITE:/ 'PAGE', SY-PAGNO.
        WRITE:/ SY-ULINE.
      ENDIF.
      IF GRID = 'X'.
        DATA: LS_LINE TYPE SLIS_LISTHEADER,
              E04_LT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
    *   Listenüberschrift: Typ H
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'H'.
    *   LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = 'Summary'.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
    *   Kopfinfo: Typ S
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'S'.
        LS_LINE-KEY  = 'Intelligroup'.
        LS_LINE-INFO = ''.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
        LS_LINE-KEY  = 'ASIA'.
        LS_LINE-INFO = 'PVT LTD'.
        APPEND LS_LINE TO E04_LT_TOP_OF_PAGE.
    *   Aktionsinfo: Typ A
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'A'.
    *   LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = 'truman'.
        APPEND LS_LINE TO  E04_LT_TOP_OF_PAGE.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY = E04_LT_TOP_OF_PAGE
            I_LOGO             = 'ENJOY_SAP_LOGO'.
      ENDIF.
    ENDFORM.                    "TOP
    *&      Form  END_LIST
    *       text
    FORM END_LIST.
      IF LIST = 'X'.
        SKIP 2.
        WRITE:/60 'END OF PAGE'.
      ENDIF.
      IF GRID = 'X'.
          DATA: LS_LINE TYPE SLIS_LISTHEADER,
              E04_LT_END_OF_LIST TYPE SLIS_T_LISTHEADER.
    *   Listenüberschrift: Typ H
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'H'.
    *   LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = 'Summary'.
        APPEND LS_LINE TO E04_LT_END_OF_LIST.
    *   Kopfinfo: Typ S
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'S'.
        LS_LINE-KEY  = 'Intelligroup'.
        LS_LINE-INFO = ''.
        APPEND LS_LINE TO E04_LT_END_OF_LIST.
        LS_LINE-KEY  = 'ASIA'.
        LS_LINE-INFO = 'PVT LTD'.
        APPEND LS_LINE TO E04_LT_END_OF_LIST.
    *   Aktionsinfo: Typ A
        CLEAR LS_LINE.
        LS_LINE-TYP  = 'A'.
    *   LS_LINE-KEY:  not used for this type
        LS_LINE-INFO = TEXT-105.
        APPEND LS_LINE TO  E04_LT_END_OF_LIST.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            IT_LIST_COMMENTARY = E04_LT_END_OF_LIST.
      ENDIF.
    ENDFORM.                    "END_LIST

Maybe you are looking for

  • Time Machine won't back up to External

    Would appreciate some guidance please. Have been running Time Machine since August ( when bought iMac 21.5 ) without any problem. I installed a 2nd ( portable ) external hard drive that I back up to separately. I'd been under the impression that I ha

  • Crystal Reports on MS Terminal Server printing the size of a postage stamp

    Post Author: phil CA Forum: General When I print off reports from our accounting system to an HP 1022 Printer which is installed on my workstation from a MS Terminal Server it prints the entire document the size of a postage stamp? We are using the C

  • Screen displaying negative image

    My 3 year old was hitting buttons on my laptop, I walked over to remove him and my screen is a complete negative image of what is being displayed. I am sure it was just a combination of buttons hit but I have no idea how to revert it. Anyone??? Anyon

  • Clear me about package concept?

    While executing packages at first time the entire package loaded into memory then 2nd time execution it will executed from local memory. if in case any update happened in any schema object then how the execution happened? its from server or local mem

  • Current Lightroom version 5.6 is crashing constantly. I'm using Windows 8.1 . Wasn't happening before!

    Since I updated to lates LR version it constantly crashes saying the the program found a problem. I'm running  Windows 8.1 OS. Any assistance will be much appreciated! Raul