Need help on ALV report

hi,
i am new to ALV programming,i awant to generate the report with three teable mseg,mkpf,mard.
i need selection screen also.
in the selection screen following is the field names.
Matdoc number-mseg-mblnr
mat number - mseg-matnr
plant - mseg-werks
sloc mseg-lgort
movtype- mseg-bwart.
batch number- mseg-charg.
ordernumber -mseg-aufnr.
costcenter- mseg-kostl.
reservation number- mseg-rsnum.
storage bin - mard-lgpbe.
i want to fetch the data from three tables
mseg,mard,mkpf.
after featch report should disply in alv grid following items.
Matdoc number-mseg-mblnr
mat number - mseg-matnr
plant - mseg-werks
sloc mseg-lgort
movtype- mseg-bwart.
batch number- mseg-charg.
ordernumber -mseg-aufnr.
costcenter- mseg-kostl.
reservation number- mseg-rsnum.
storage bin - mard-lgpbe.
posting date - mkpf-budat.
if any body have the code kindly send it as early as posible.
Thanks,
Rammohan.

here is a sample program i think almost containing the same tables and fields
*& Report  ZSD_R_ENHANCEMENT2                                           *
*& REPORT PROGRAMMING FOR THE FURTHER ENHANCEMENT OF THE PRE-GENERATED
*& MB51. REQUIREMENT IS TO ADD FIVE MORE FIELDS.
*& OLD MATERIAL ON THE TOP LEFT CORNER OF THE HEADER AND
*& Batch number the right of material document.
*& Serial number if found should be placed to the right of the batch number.
*& Handling unit/ storage unit to the right of serial number.
*& Transaction description at the last of the report.
REPORT  ZSD_R_ENHANCEMENT2 MESSAGE-ID ZB6T2                      .
*& STRUCTURE CREATION FOR INTERNAL TABLES                              *
*STRUCUTRE CREATION FOR HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
TYPES: BEGIN OF TY_MKPF_MSEG,
       MBLNR TYPE MBLNR,   " NUMBER OF MATERIAL DOC
       MJAHR TYPE MJAHR,   " MATERIAL DOCUMENT YEAR
       VGART TYPE VGART,   " TRANSACTION EVENT TYPE
       BLART TYPE BLART,   " DOCUMENT TYPE
       BUDAT TYPE BUDAT,   " POSTING DATE INT THE DOC
       USNAM TYPE USNAM,   " USERNAME
       XBLNR TYPE XBLNR1,  " REFERENCE DOCUMENT NUMBER
       MATNR TYPE MATNR,   " MATERIAL NUMBER
       WERKS TYPE WERKS_D, " PLANT
       LGORT TYPE LGORT_D, " STORAGE LOCATION
       CHARG TYPE CHARG_D, " BATCH NUM
       LIFNR TYPE ELIFN,   " ACC OF VENDOR
       KUNNR TYPE EKUNN,   " CUSTOMER NUM
       SOBKZ TYPE SOBKZ,   " SPECIAL STOKING
       BWART TYPE BWART,   " MOVEMENT TYPE
       ZEILE TYPE MBLPO,   " ITEM IN MATERIAL DOCUMENT
       ERFMG TYPE ERFMG,   " QUANTITY IN UNIT OF ENTERY
       ERFME TYPE ERFME,   " UNIT OF ENTRY
       END OF TY_MKPF_MSEG,
*STRUCTURE FOR MATERIAL MASTER DATA
       BEGIN OF TY_MARA,
       MATNR TYPE MATNR,   " MATERIAL TYPE
       BISMT TYPE BISMT,   " OLD MATERIAL NUMBER
       END OF TY_MARA,
*STRUCTURE DECLARATION FOR MATERIAL DESCRIPTION
       BEGIN OF TY_MAKT,
       MATNR TYPE MATNR,   " MATERIAL NUM
       SPRAS TYPE SPRAS,    " LANGUAGE KEY
       MAKTX TYPE MAKTX,   " MATERIAL DESC
       END OF TY_MAKT,
*STRUCTURE DECLARATION FOR MOVEMENT TYPE TEXT
       BEGIN OF TY_T156T,
       BWART TYPE BWART,   " MOVEMENT TYPE
       BTEXT TYPE BTEXT,   " MOVEMENT TYPE TEXT
       SPRAS TYPE SPRAS,   " LANGUAGE KEY
       END OF TY_T156T,
*STRUCTURE CREATION FOR DOCUMENT HEADER FOR SERIALNUMBERS FOR GOOD MOVEMENTS
       BEGIN OF TY_SER03,
       MBLNR TYPE MBLNR,   " NUMBER OF MATERIAL DOC
       MJAHR TYPE MJAHR,   " MATERIAL DOCU YEAR
       ZEILE TYPE MBLPO,   " OUTPUT IN MATERIAL DOC
       OBKNR TYPE OBJKNR,  " OBJECT LIST NUMBER
       END OF TY_SER03,
*STRUCUTRE DECLARATION FOR PLANTS MAINTANENCE OBKECT LIST
       BEGIN OF TY_OBJK,
       OBKNR TYPE OBJKNR,  " OBJECT LIST NUMBER
       OBZAE TYPE OBJZA,   " OBLECT LIST COUNTERS
       SERNR TYPE GERNR,   " SERIAL NUMBER
       END OF TY_OBJK,
*STRUCUTRE DECLARATION FOR PLANTS/BRANCHES
       BEGIN OF TY_T001W,
       WERKS TYPE WERKS_D, " PLANT
       NAME1 TYPE NAME1,   " NAME
       END OF TY_T001W,
*STRUCUTRE DECLARATION FOR OUTPUT TABLE
      BEGIN OF TY_OUTPUT,
       MATNR TYPE MATNR,   " MATERIAL NUMBER
       BISMT TYPE BISMT,   " OLD MATERIAL NUMBER
       MAKTX TYPE MAKTX,   " MATERIAL DESC
       WERKS TYPE WERKS_D, " PLANT
       NAME1 TYPE NAME1,   " NAME
       LGORT TYPE LGORT_D, " Storage Location
       BWART TYPE BWART,   " Movement Type
       MBLNR TYPE MBLNR,   " NUMBER OF MATERIAL DOC
       CHARG TYPE CHARG_D, " BATCH NUM
       SERNR TYPE GERNR,   " SERIAL NUMBER
       ZEILE TYPE MBLPO,   " OUTPUT IN MATERIAL DOC
       BUDAT TYPE BUDAT,   " POSTING DOCU DATE
       ERFMG TYPE ERFMG,   " QUANTITY IN UNIT OF ENTRY
       ERFME TYPE ERFME,   " UNINT OF ENTRY
       BTEXT TYPE BTEXT,   " MOVEMENT TYPE TEXT
       MJAHR TYPE MJAHR,   " MATEREIAL DOC YEAR
       VGART TYPE VGART,   " TRANSACTION EVENT TYPE
       BLART TYPE BLART,   " DOCUMENT TYPE
       USNAM TYPE USNAM,   " USERNAME
       XBLNR TYPE XBLNR1,  " REFERENCE DOCUMENT NUM
       SOBKZ TYPE SOBKZ,   " SPECIAL STOCKING
       LIFNR TYPE ELIFN,   " ACC OF VENDOR
       KUNNR TYPE EKUNN,   " CUSTOMER
       OBKNR TYPE OBJKNR,  " OBJECT LIST NUMBER
       END OF TY_OUTPUT.
*&INTERNAL TABLE DECLARATION FOR STRUCUTRES                            *
INTERNAL TABLE DECLARATION FOR HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
DATA : T_MKPF_MSEG TYPE STANDARD TABLE OF TY_MKPF_MSEG INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR MATERIAL MASTER DAT
       T_MARA TYPE STANDARD TABLE OF TY_MARA INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR MATERIAL TYPE DESC
       T_MAKT TYPE STANDARD TABLE OF TY_MAKT INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR MOVEMENT TYPE TEXT
       T_T156T TYPE STANDARD TABLE OF TY_T156T INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR Document Header for Serial Numbers for Goods Movements
       T_SER03 TYPE STANDARD TABLE OF TY_SER03 INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR Plant Maintenance Object List
       T_OBJK TYPE STANDARD TABLE OF TY_OBJK INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR Plants/Branches
       T_T001W TYPE STANDARD TABLE OF TY_T001W INITIAL SIZE 0,
*INTERNAL TABLE DECLARATION FOR OUTPUT
       T_OUTPUT TYPE STANDARD TABLE OF TY_OUTPUT INITIAL SIZE 0,
*&WORK AREA DECLARATIONS FOR INTERNAL TABLES                           *
*WORK AREA DECLARATION HEADER MATERIAL DOCMENT AND DOCUMENT SEGEMNT MATERIAL
       W_MKPF_MSEG TYPE TY_MKPF_MSEG,
*WORK AREA DECLARATION MATERIAL MASTER DATA
       W_MARA TYPE TY_MARA,
*WORK AREA DECLARATION MATERIAL TYPE DESC
       W_MAKT TYPE TY_MAKT,
*WORK AREA DECLARATION MOVEMENT TYPE TEXT\
       W_T156T TYPE TY_T156T,
*WORK AREA DECLARATION Document Header for Serial Numbers for Goods Movements
       W_SER03 TYPE TY_SER03,
*WORK AREA DECLARATION PLANT MAINTENANCE OBJECT LIST
       W_OBJK TYPE TY_OBJK,
*WORK AREA DECLARATION PLANTS AND BRANCHES
       W_T001W TYPE TY_T001W,
*WORK AREA DECLARATION FOR OUTPUT TABLE.
      W_OUTPUT TYPE TY_OUTPUT,
*& GLOBAL VARIABLE DECLARATIONS                                        *
       G_MATNR TYPE MSEG-MATNR,
       G_WERKS TYPE MSEG-WERKS,
       G_LGORT TYPE MSEG-LGORT,
       G_CHARG TYPE MSEG-CHARG,
       G_LIFNR TYPE MSEG-LIFNR,
       G_KUNNR TYPE MSEG-KUNNR,
       G_BWART TYPE MSEG-BWART,
       G_SOBKZ TYPE MSEG-SOBKZ,
       G_BUDAT TYPE MKPF-BUDAT,
       G_USNAM TYPE MKPF-USNAM,
       G_VGART TYPE MKPF-VGART,
       G_XBLNR TYPE MKPF-XBLNR.
*& SELECTION SCREEN EVENT                                              *
*SELECT OPTIONS EVENTS FOR ITEM DETAILS
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS: S_MATNR FOR G_MATNR,
                S_WERKS FOR G_WERKS,
                S_LGORT FOR G_LGORT,
                S_CHARG FOR G_CHARG,
                S_LIFNR FOR G_LIFNR,
                S_KUNNR FOR G_KUNNR,
                S_BWART FOR G_BWART,
                S_SOBKZ FOR G_SOBKZ.
SELECTION-SCREEN END OF BLOCK B1.
*SELECT OPTIONS EVENTS FOR HEADER DETAILS
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
SELECT-OPTIONS: S_BUDAT FOR G_BUDAT,
                S_USNAM FOR G_USNAM,
                S_VGART FOR G_VGART,
                S_XBLNR FOR G_XBLNR.
SELECTION-SCREEN END OF BLOCK B2.
*&INITIALIZATION EVENTS                                                *
INITIALIZATION.
  CLEAR: W_MKPF_MSEG,
         W_MARA,
         W_MAKT,
         W_T156T,
         W_SER03,
         W_OBJK,
         W_T001W,
         W_OUTPUT.
  REFRESH: T_MKPF_MSEG,
           T_MARA,
           T_MAKT,
           T_T156T,
           T_SER03,
           T_OBJK,
           T_T001W,
           T_OUTPUT.
*&  At Selection screen Event
AT SELECTION-SCREEN.
  PERFORM SUB_VALID_MATNR.
  PERFORM SUB_VALID_WERKS.
  PERFORM SUB_VALID_LGORT.
  PERFORM SUB_VALID_CHARG.
  PERFORM SUB_VALID_LIFNR.
  PERFORM SUB_VALID_KUNNR.
  PERFORM SUB_VALID_BWART.
  PERFORM SUB_VALID_SOBKZ.
  PERFORM SUB_VALID_BUDAT.
  PERFORM SUB_VALID_USNAM.
  PERFORM SUB_VALID_VGART.
  PERFORM SUB_VALID_XBLNR.
*&  Start of selection event.
START-OF-SELECTION.
  PERFORM SUB_GET_MKPF_MSEG.
  PERFORM SUB_GET_MARA.
  PERFORM SUB_GET_MAKT.
  PERFORM SUB_GET_T156T.
  PERFORM SUB_GET_SER03.
  PERFORM SUB_GET_T001W.
  PERFORM SUB_BSLIST_DISP.
*&      Form  SUB_VALID_MATNR
*VALIDATION FOR MATERIAL NUM
FORM SUB_VALID_MATNR .
  DATA : L_MATNR TYPE MATNR.
  SELECT SINGLE MATNR
         FROM MARA
         INTO L_MATNR
         WHERE MATNR IN S_MATNR.
  IF SY-SUBRC <> 0.
   MESSAGE E001.
  ENDIF.
ENDFORM.                    " SUB_VALID_MATNR
*&      Form  SUB_VALID_WERKS
      text
FORM SUB_VALID_WERKS .
  DATA L_WERKS TYPE WERKS_D.
  SELECT SINGLE WERKS
         FROM T001W
         INTO L_WERKS
         WHERE WERKS IN S_WERKS.
  IF SY-SUBRC <> 0.
    MESSAGE E002.
  ENDIF.
ENDFORM.                    " SUB_VALID_WERKS
*&      Form  SUB_VALID_LGORT
      text
FORM SUB_VALID_LGORT .
  DATA L_LGORT TYPE LGORT_D.
  SELECT SINGLE LGORT
         FROM T001L
         INTO L_LGORT
         WHERE LGORT IN S_LGORT.
  IF SY-SUBRC <> 0.
   MESSAGE E003.
  ENDIF.
ENDFORM.                    " SUB_VALID_LGORT
*&      Form  SUB_VALID_CHARG
      text
FORM SUB_VALID_CHARG .
  DATA L_CHARG TYPE CHARG_D.
  SELECT SINGLE CHARG
         FROM MCHA
         INTO L_CHARG
         WHERE CHARG IN S_CHARG.
  IF SY-SUBRC <> 0.
   MESSAGE E004.
  ENDIF.
ENDFORM.                    " SUB_VALID_CHARG
*&      Form  SUB_VALID_LIFNR
      text
FORM SUB_VALID_LIFNR .
  DATA L_LIFNR TYPE LIFNR.
  SELECT SINGLE LIFNR
         FROM LFA1
         INTO L_LIFNR
         WHERE LIFNR IN S_LIFNR.
  IF SY-SUBRC <> 0.
   MESSAGE E005.
  ENDIF.
ENDFORM.                    " SUB_VALID_LIFNR
*&      Form  SUB_VALID_KUNNR
      text
FORM SUB_VALID_KUNNR .
  DATA L_KUNNR TYPE KUNNR.
  SELECT SINGLE KUNNR
         FROM KNA1
         INTO L_KUNNR
         WHERE KUNNR IN S_KUNNR.
  IF SY-SUBRC <> 0.
   MESSAGE E006.
  ENDIF.
ENDFORM.                    " SUB_VALID_KUNNR
*&      Form  SUB_VALID_BWART
      text
FORM SUB_VALID_BWART .
  DATA L_BWART TYPE BWART.
  SELECT SINGLE BWART
         FROM T156
         INTO L_BWART
         WHERE BWART IN S_BWART.
  IF SY-SUBRC <> 0.
   MESSAGE E007.
  ENDIF.
ENDFORM.                    " SUB_VALID_BWART
*&      Form  SUB_VALID_SOBKZ
      text
FORM SUB_VALID_SOBKZ .
DATA L_SOBKZ TYPE SOBKZ.
SELECT SINGLE SOBKZ
       FROM T148
       INTO L_SOBKZ
       WHERE SOBKZ IN S_SOBKZ.
IF SY-SUBRC <> 0.
MESSAGE E008.
ENDIF.
ENDFORM.                    " SUB_VALID_SOBKZ
*&      Form  SUB_VALID_BUDAT
      text
FORM SUB_VALID_BUDAT .
  DATA L_BUDAT TYPE BUDAT.
  SELECT SINGLE BUDAT
         FROM MKPF
         INTO L_BUDAT
         WHERE BUDAT IN S_BUDAT.
  IF SY-SUBRC <> 0.
   MESSAGE E009.
  ENDIF.
ENDFORM.                    " SUB_VALID_BUDAT
*&      Form  SUB_VALID_USNAM
      text
FORM SUB_VALID_USNAM .
  DATA L_USNAM TYPE USNAM.
  SELECT SINGLE USNAM
         FROM MKPF
         INTO L_USNAM
         WHERE USNAM IN S_USNAM.
  IF SY-SUBRC <> 0.
   MESSAGE E010.
  ENDIF.
ENDFORM.                    " SUB_VALID_USNAM
*&      Form  SUB_VALID_VGART
      text
FORM SUB_VALID_VGART .
  DATA L_VGART TYPE VGART.
  SELECT SINGLE VGART
         FROM MKPF
         INTO L_VGART
         WHERE VGART IN S_VGART.
  IF SY-SUBRC <> 0.
   MESSAGE E011.
  ENDIF.
ENDFORM.                    " SUB_VALID_VGART
*&      Form  SUB_VALID_XBLNR
      text
FORM SUB_VALID_XBLNR .
  DATA L_XBLNR TYPE XBLNR.
  SELECT SINGLE XBLNR
         FROM MKPF
         INTO L_XBLNR
         WHERE XBLNR IN S_XBLNR.
  IF SY-SUBRC <> 0.
    MESSAGE E012.
  ENDIF.
ENDFORM.                    " SUB_VALID_XBLNR
*&      Form  SUB_GET_MKPF_MSEG
      text
FORM SUB_GET_MKPF_MSEG .
  REFRESH T_MKPF_MSEG.
  SELECT KMBLNR KMJAHR K~VGART
         KBLART KBUDAT K~USNAM
         K~XBLNR
         SMATNR SWERKS S~LGORT
         SCHARG SLIFNR S~KUNNR
         SSOBKZ SBWART S~ZEILE
         SERFMG SERFME
     INTO TABLE T_MKPF_MSEG
     FROM MKPF AS K INNER JOIN MSEG AS S
       ON KMBLNR = SMBLNR AND KMJAHR = SMJAHR
    WHERE    K~VGART IN S_VGART
         AND K~BUDAT IN S_BUDAT
         AND K~USNAM IN S_USNAM
         AND K~XBLNR IN S_XBLNR
         AND S~MATNR IN S_MATNR
         AND S~WERKS IN S_WERKS
         AND S~LGORT IN S_LGORT
         AND S~CHARG IN S_CHARG
         AND S~SOBKZ IN S_SOBKZ
         AND S~LIFNR IN S_LIFNR
         AND S~KUNNR IN S_KUNNR.
ENDFORM.                    " SUB_GET_MKPF_MSEG
*&      Form  SUB_GET_MARA
      text
FORM SUB_GET_MARA .
  IF T_MKPF_MSEG IS NOT INITIAL.
    SORT T_MKPF_MSEG BY MATNR.
    REFRESH T_MARA.
  SELECT MATNR
         BISMT
         FROM MARA
         INTO TABLE T_MARA
         FOR ALL ENTRIES IN T_MKPF_MSEG
         WHERE MATNR = T_MKPF_MSEG-MATNR.
ENDIF.
ENDFORM.                    " SUB_GET_MARA
*&      Form  SUB_GET_MAKT
      text
FORM SUB_GET_MAKT .
REFRESH T_MAKT.
  SELECT MATNR
         SPRAS
         MAKTX
         FROM MAKT
         INTO TABLE T_MAKT
         FOR ALL ENTRIES IN T_MKPF_MSEG
         WHERE SPRAS = SY-LANGU AND  MATNR = T_MKPF_MSEG-MATNR.
ENDFORM.                    " SUB_GET_MAKT
*&      Form  SUB_GET_T156T
      text
FORM SUB_GET_T156T .
  SELECT BWART
         BTEXT
         SPRAS
         FROM T156T
         INTO TABLE T_T156T
         FOR ALL ENTRIES IN T_MKPF_MSEG
         WHERE SPRAS = SY-LANGU AND BWART = T_MKPF_MSEG-BWART.
ENDFORM.                    " SUB_GET_T156T
*&      Form  SUB_GET_SER03
      text
FORM SUB_GET_SER03 .
  SELECT MBLNR
         MJAHR
         ZEILE
         OBKNR
         FROM SER03
         INTO TABLE T_SER03
         FOR ALL ENTRIES IN T_MKPF_MSEG
         WHERE MBLNR = T_MKPF_MSEG-MBLNR
         AND MJAHR = T_MKPF_MSEG-MJAHR
         AND ZEILE = T_MKPF_MSEG-ZEILE.
IF T_SER03 IS NOT INITIAL.
  SELECT OBKNR
         OBZAE
         SERNR
         FROM OBJK
         INTO CORRESPONDING FIELDS OF TABLE T_OBJK
         FOR ALL ENTRIES IN T_SER03
         WHERE OBKNR = T_SER03-OBKNR.
ENDIF.
ENDFORM.                    " SUB_GET_SER03
*&      Form  SUB_GET_T001W
      text
FORM SUB_GET_T001W .
  SELECT WERKS
         NAME1
         FROM T001W
         INTO TABLE T_T001W
         FOR ALL ENTRIES IN T_MKPF_MSEG
         WHERE WERKS = T_MKPF_MSEG-WERKS.
ENDFORM.                    " SUB_GET_T001W
*&      Form  SUB_BSLIST_DISP
FOR DISPLAY OUT
FORM SUB_BSLIST_DISP .
REFRESH T_OUTPUT.
  CLEAR W_MKPF_MSEG.
  SORT T_MKPF_MSEG BY MBLNR MJAHR ZEILE MATNR.
  LOOP AT T_MKPF_MSEG INTO W_MKPF_MSEG.
    W_OUTPUT-MBLNR = W_MKPF_MSEG-MBLNR .
    W_OUTPUT-MJAHR = W_MKPF_MSEG-MJAHR.
    W_OUTPUT-VGART = W_MKPF_MSEG-VGART.
    W_OUTPUT-BLART = W_MKPF_MSEG-BLART.
    W_OUTPUT-BUDAT = W_MKPF_MSEG-BUDAT.
    W_OUTPUT-USNAM = W_MKPF_MSEG-USNAM.
    W_OUTPUT-XBLNR = W_MKPF_MSEG-XBLNR.
    W_OUTPUT-ZEILE = W_MKPF_MSEG-ZEILE.
    W_OUTPUT-BWART = W_MKPF_MSEG-BWART.
    W_OUTPUT-MATNR = W_MKPF_MSEG-MATNR.
    W_OUTPUT-WERKS = W_MKPF_MSEG-WERKS.
    W_OUTPUT-LGORT = W_MKPF_MSEG-LGORT.
    W_OUTPUT-CHARG = W_MKPF_MSEG-CHARG.
    W_OUTPUT-SOBKZ = W_MKPF_MSEG-SOBKZ.
    W_OUTPUT-LIFNR = W_MKPF_MSEG-LIFNR.
    W_OUTPUT-KUNNR = W_MKPF_MSEG-KUNNR.
    W_OUTPUT-ERFMG = W_MKPF_MSEG-ERFMG.
    W_OUTPUT-ERFME = W_MKPF_MSEG-ERFME.
    CLEAR W_MARA.
    READ TABLE T_MARA INTO W_MARA WITH KEY MATNR = W_OUTPUT-MATNR.
    IF SY-SUBRC = 0.
      W_OUTPUT-BISMT = W_MARA-BISMT.
    ENDIF.
    CLEAR W_MAKT.
    READ TABLE T_MAKT INTO W_MAKT WITH KEY MATNR = W_OUTPUT-MATNR .
    IF SY-SUBRC = 0.
      W_OUTPUT-MAKTX = W_MAKT-MAKTX.
    ENDIF.
    CLEAR W_T156T.
    READ TABLE T_T156T INTO W_T156T WITH KEY  BWART = W_OUTPUT-BWART  .
    IF SY-SUBRC = 0.
      W_OUTPUT-BTEXT = W_T156T-BTEXT.
    ENDIF.
    CLEAR W_T001W.
    READ TABLE T_T001W INTO W_T001W WITH KEY WERKS = W_MKPF_MSEG-WERKS.
    IF SY-SUBRC = 0.
      W_OUTPUT-NAME1 = W_T001W-NAME1.
    ENDIF.
    CLEAR W_SER03.
    READ TABLE T_SER03 INTO W_SER03 WITH KEY MBLNR = W_OUTPUT-MBLNR
                                              MJAHR = W_OUTPUT-MJAHR
                                              ZEILE = W_OUTPUT-ZEILE.
    IF SY-SUBRC = 0.
      W_OUTPUT-OBKNR = W_SER03-OBKNR.
    ENDIF.
    CLEAR W_OBJK.
    READ TABLE T_OBJK INTO W_OBJK WITH KEY OBKNR = W_OUTPUT-OBKNR.
    IF SY-SUBRC = 0.
    W_OUTPUT-SERNR = W_OBJK-SERNR .
    ENDIF.
    APPEND W_OUTPUT TO T_OUTPUT.
    CLEAR W_OUTPUT.
    ENDLOOP.
    PERFORM SUB_DISPLAY.
ENDFORM.
*&      Form  SUB_DISPLAY
HIERARICAL DISPLAY
FORM SUB_DISPLAY .
SORT T_OUTPUT BY MATNR BISMT MAKTX WERKS NAME1 LGORT BWART MBLNR CHARG SERNR ZEILE BUDAT ERFMG ERFME BTEXT.
CLEAR W_OUTPUT.
LOOP AT T_OUTPUT INTO W_OUTPUT.
AT NEW NAME1.
WRITE:/ W_OUTPUT-MATNR,
        W_OUTPUT-BISMT,
        W_OUTPUT-MAKTX,
        W_OUTPUT-WERKS,
        W_OUTPUT-NAME1.
ENDAT.
AT NEW BTEXT.
WRITE:/ W_OUTPUT-LGORT,
        W_OUTPUT-BWART,
        W_OUTPUT-MBLNR,
        W_OUTPUT-CHARG,
        W_OUTPUT-SERNR,
        W_OUTPUT-ZEILE,
        W_OUTPUT-BUDAT,
        W_OUTPUT-ERFMG,
        W_OUTPUT-ERFME,
        W_OUTPUT-BTEXT.
ENDAT.
CLEAR W_OUTPUT.
ENDLOOP.
REFRESH T_OUTPUT.
ENDFORM.                    " SUB_DISPLAY

Similar Messages

  • Need help In ALV report

    Hi All,
    I am working on ALV report.I need one logic.
    When Ever I executed report, The output should looks 'Selected Total data' like Yellow color. How can i do that.
    The report out should show sthe ' All the data is selected'. Just like Ctrl+A.
    regards,
    Ajay

    Hi
    if you wants to see the totals in separate color , you develop the I_SORT table with the respective fields and pass to the fun module
    then that total field will be always displayed with yelloe color
    or
    See this sample code to color the ALV fields
    and accordingly assign the color for your field
    REPORT zsharad_test1.
    TABLES: ekko.
    TYPE-POOLS: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    line_color(4) TYPE c, "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
    I.e. Field type may be required in-order for
    the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-datatype = 'CURR'.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    APPEND fieldcatalog TO fieldcatalog.
    CLEAR fieldcatalog.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
    gd_layout-info_fieldname = 'LINE_COLOR'.
    gd_layout-totals_only = 'X'.
    gd_layout-f2code = 'DISP'. "Sets fcode for when double
    "click(press f2)
    gd_layout-zebra = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text = 'helllllo'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    i_callback_user_command = 'USER_COMMAND'
    i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    it_special_groups = gd_tabgroup
    IT_EVENTS = GT_XEVENTS
    i_save = 'X'
    is_variant = z_template
    TABLES
    t_outtab = it_ekko
    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. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    DATA: ld_color(1) TYPE c.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    UP TO 10 ROWS
    FROM ekpo
    INTO TABLE it_ekko.
    *Populate field with color attributes
    LOOP AT it_ekko INTO wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
    i.e. wa_ekko-line_color = 'C410'
    ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
    IF ld_color = 8.
    ld_color = 1.
    ENDIF.
    CONCATENATE 'C' ld_color '10' INTO wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
    MODIFY it_ekko FROM wa_ekko.
    ENDLOOP.
    ENDFORM. " DATA_RETRIEVAL
    Regards
    Anji

  • Help regarding alv report

    i need to develop alv report which displays po and corresponding invoice receipt information.
    what all  fields can i include in invoice receipt information.please help on this.thanks in advance.credit will be given.

    Hi,
    Check the following link:
    http://www.sapbrain.com/TUTORIALS/TECHNICAL/ALV_tutorial.html
    http://www.sapbrain.com/ARTICLES/TECHNICAL/ABAP/company%20logo%20in%20the%20top%20of%20alv%20report.html
    Regards,
    Bhaskar

  • Need help on classical report

    hi friends i need help on classical reports,
    sold-party,
    material
    sales and distrubitutation channel ,division,
    incoming orders,order number,invoice ,credit,
    i need sub totals and final total of invoice and each customer should display in new page .

    Hi
    Use the Tables KNA1,VBAk,VBAP,VBRK and VBRP and design the report
    see the sample report using KNA1,VBAK and VBAP.
    REPORT ZTEJ_INTAB1 LINE-SIZE 103 LINE-COUNT 35(5) NO STANDARD PAGE
    HEADING.
    *TABLES DECLARATION
    TABLES : KNA1, VBAK, VBAP.
    *SELECT OPTIONS
    SELECT-OPTIONS: CUST_NO FOR KNA1-KUNNR.
    *INITIALIZATION
    INITIALIZATION.
    CUST_NO-LOW = '01'.
    CUST_NO-HIGH = '5000'.
    CUST_NO-SIGN = 'I'.
    CUST_NO-OPTION = 'BT'.
    APPEND CUST_NO.
    *SELECTION SCREEN VALIDATION
    AT SELECTION-SCREEN ON CUST_NO.
    LOOP AT SCREEN.
    IF CUST_NO-LOW < 1 OR CUST_NO-HIGH > 5000.
    MESSAGE E001(ZTJ1).
    ENDIF.
    ENDLOOP.
    *BASIC LIST SELECTION
    START-OF-SELECTION.
    SELECT KUNNR NAME1 ORT01 LAND1 INTO
    (KNA1-KUNNR, KNA1-NAME1,KNA1-ORT01,KNA1-LAND1)
    FROM KNA1
    WHERE KUNNR IN CUST_NO.
    WRITE:/1 SY-VLINE,
    KNA1-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
    16 SY-VLINE,
    KNA1-NAME1 UNDER 'NAME',
    61 SY-VLINE,
    KNA1-ORT01 UNDER 'CITY',
    86 SY-VLINE,
    KNA1-LAND1 UNDER 'COUNTRY',
    103 SY-VLINE.
    HIDE: KNA1-KUNNR.
    ENDSELECT.
    ULINE.
    *SECONDARY LIST ACCESS
    AT user-command.
    IF SY-UCOMM = 'IONE'.
    PERFORM SALES_ORD.
    ENDIF.
    IF SY-UCOMM = 'ITWO'.
    PERFORM ITEM_DET.
    ENDIF.
    *TOP OF PAGE
    TOP-OF-PAGE.
    FORMAT COLOR 1.
    WRITE : 'CUSTOMER DETAILS'.
    FORMAT COLOR 1 OFF.
    ULINE.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'CUSTOMER NO.',
    16 SY-VLINE,
    18 'NAME',
    61 SY-VLINE,
    63 'CITY',
    86 SY-VLINE,
    88 'COUNTRY',
    103 SY-VLINE.
    ULINE.
    FORMAT COLOR 3 OFF.
    *TOP OF PAGE FOR SECONDARY LISTS
    TOP-OF-PAGE DURING LINE-SELECTION.
    *TOP OF PAGE FOR 1ST SECONDARY LIST
    IF SY-UCOMM = 'IONE'.
    ULINE.
    FORMAT COLOR 1.
    WRITE : 'SALES ORDER DETAILS'.
    ULINE.
    FORMAT COLOR 1 OFF.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'CUSTOMER NO.',
    16 SY-VLINE,
    18 'SALES ORDER NO.',
    40 SY-VLINE,
    42 'DATE',
    60 SY-VLINE,
    62 'CREATOR',
    85 SY-VLINE,
    87 'DOC DATE',
    103 SY-VLINE.
    ULINE.
    ENDIF.
    FORMAT COLOR 3 OFF.
    *TOP OF PAGE FOR 2ND SECONDARY LIST
    IF SY-UCOMM = 'ITWO'.
    ULINE.
    FORMAT COLOR 1.
    WRITE : 'ITEM DETAILS'.
    ULINE.
    FORMAT COLOR 1 OFF.
    FORMAT COLOR 3.
    WRITE : 1 SY-VLINE,
    3 'SALES ORDER NO.',
    40 SY-VLINE,
    42 'SALES ITEM NO.',
    60 SY-VLINE,
    62 'ORDER QUANTITY',
    103 SY-VLINE.
    ULINE.
    ENDIF.
    FORMAT COLOR 3 OFF.
    *END OF PAGE
    END-OF-PAGE.
    ULINE.
    WRITE :'USER :',SY-UNAME,/,'DATE :', SY-DATUM, 85 'END OF PAGE:',
    SY-PAGNO.
    SKIP.
    *& Form SALES_ORD
    *& FIRST SECONDARY LIST FORM
    FORM SALES_ORD .
    SELECT KUNNR VBELN ERDAT ERNAM AUDAT INTO
    (VBAK-KUNNR, VBAK-VBELN, VBAK-ERDAT, VBAK-ERNAM, VBAK-AUDAT)
    FROM VBAK
    WHERE KUNNR = KNA1-KUNNR.
    WRITE:/1 SY-VLINE,
    VBAK-KUNNR UNDER 'CUSTOMER NO.' HOTSPOT ON,
    16 SY-VLINE,
    VBAK-VBELN UNDER 'SALES ORDER NO.' HOTSPOT ON,
    40 SY-VLINE,
    VBAK-ERDAT UNDER 'DATE',
    60 SY-VLINE,
    VBAK-ERNAM UNDER 'CREATOR',
    85 SY-VLINE,
    VBAK-AUDAT UNDER 'DOC DATE',
    103 SY-VLINE.
    HIDE : VBAK-VBELN.
    ENDSELECT.
    ULINE.
    ENDFORM. " SALES_ORD
    *& Form ITEM_DET
    *& SECOND SECONDARY LIST FORM
    FORM ITEM_DET .
    SELECT VBELN POSNR KWMENG INTO
    (VBAP-VBELN, VBAP-POSNR, VBAP-KWMENG)
    FROM VBAP
    WHERE VBELN = VBAK-VBELN.
    WRITE : /1 SY-VLINE,
    VBAP-VBELN UNDER 'SALES ORDER NO.',
    40 SY-VLINE,
    VBAP-POSNR UNDER 'SALES ITEM NO.',
    60 SY-VLINE,
    VBAP-KWMENG UNDER 'ORDER QUANTITY',
    103 SY-VLINE.
    ENDSELECT.
    ULINE.
    ENDFORM. " ITEM_DET
    REPORT demo_list_at_pf.
    START-OF-SELECTION.
    WRITE 'Basic List, Press PF5, PF6, PF7, or PF8'.
    AT pf5.
    PERFORM out.
    AT pf6.
    PERFORM out.
    AT pf7.
    PERFORM out.
    AT pf8.
    PERFORM out.
    FORM out.
    WRITE: 'Secondary List by PF-Key Selection',
    / 'SY-LSIND =', sy-lsind,
    / 'SY-UCOMM =', sy-ucomm.
    ENDFORM.
    After executing the program, the system displays the basic list. The user can press the function keys F5 , F6 , F7 , and F8 to create secondary lists. If, for example, the 14th key the user presses is F6 , the output on the displayed secondary list looks as follows:
    Secondary List by PF-Key Selection
    SY-LSIND = 14
    SY-UCOMM = PF06
    Example for AT USER-COMMAND.
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
    WRITE: 'Basic List',
    / 'SY-LSIND:', sy-lsind.
    TOP-OF-PAGE.
    WRITE 'Top-of-Page'.
    ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
    CASE sy-pfkey.
    WHEN 'TEST'.
    WRITE 'Self-defined GUI for Function Codes'.
    ULINE.
    ENDCASE.
    AT LINE-SELECTION.
    SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
    PERFORM out.
    sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
    CASE sy-ucomm.
    WHEN 'FC1'.
    PERFORM out.
    WRITE / 'Button FUN 1 was pressed'.
    WHEN 'FC2'.
    PERFORM out.
    WRITE / 'Button FUN 2 was pressed'.
    WHEN 'FC3'.
    PERFORM out.
    WRITE / 'Button FUN 3 was pressed'.
    WHEN 'FC4'.
    PERFORM out.
    WRITE / 'Button FUN 4 was pressed'.
    WHEN 'FC5'.
    PERFORM out.
    WRITE / 'Button FUN 5 was pressed'.
    ENDCASE.
    sy-lsind = sy-lsind - 1.
    FORM out.
    WRITE: 'Secondary List',
    / 'SY-LSIND:', sy-lsind,
    / 'SY-PFKEY:', sy-pfkey.
    ENDFORM.
    When you run the program, the system displays the following basic list with a the page header defined in the program:
    You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
    Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
    For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
    Reward points for useful Answers
    Regards
    Anji

  • Need help on Oracle Report format

    Hi,
    I need help on Oracle Reports. I am generating a report in excel sheet. I have a column which is 13 digit number (In database it is CHAR datatype). In excel sheet it showing some thing like 9.78381E+12. I want to show complete number like 9783805591331.
    Also sometimes leading zero's are not showing when my column values is something like 0098794859583. I need to show the leading zero's as well in excel without losing them.
    Below are the parameters i am using for the report
    DESFORMAT=SPREADSHEET AND DESTYPE=FILE
    My Oracle 9i developer version.
    Any help on this would be much appreciated.
    Thanks
    Kishore

    An additional quote string ' character with the number field will solve this problem but if u want to display this field in report then it will look ugly
    '''||yourfield from table; check ur regional settings also
    plz mark it helpful correct if it is

  • Need to create alv report to show pan card number.

    Hi,
    I need to create alv report to show employee and vendor  name , number ,  Pan card number .This is for hr module.
    could any one tell me table and fields for this and how I can relate them with foriegn and primary key.
    Regards,
    Moderator Message: Do your own work
    Edited by: kishan P on Oct 5, 2010 10:38 AM

    Yes, but it only has one generic Date column, no start date and end date. I can't use that twice in the prompt. Although I can specify it to be 'between', but I'm not sure I can pass values to both variables like that.
    Currently I have used Campaign Start Date and Campaign End Date to enter values in calender format to the variables.

  • Need help Connecting Crystal Reports 8.5 with GBS Agency Expert 6.7.6c

    Need help Connecting Crystal Reports 8.5 with GBS Agency Expert 6.7.6c.  I need assistance on connecting these together so I can run a report.  I am not an IT person so if someone could dumb it down it would be great.
    Thanks,
    NBGHealth

    Hello,
    I assume GBS Agency Expert 6.7.6c is some sort of database or data source? If you have an ODBC driver then create or use a System DSN to the database. Then you can create a report using that DSN.
    Otherwise I suggest you contact the makers of GBS Agency Expert 6.7.6c and ask them how to connect to the database.
    Let them know CR is ANSII 92 ODBC 3 compliant.
    Thank you
    Don

  • I m in urgent need of sme alv reports in sd module so plz hlp me out.

    i m in urgent need of sme alv reports in sd module so plz hlp me out.
    if possible plz provide explanation so tht i can understand it fast and well.

    check with below standard reports :
    Sales summary - VC/2
    Display Customer Hierarchy - VDH2
    Display Condition record report - V/I6
    Pricing Report - V/LD
    Create Net Price List - V_NL
    List customer material info - VD59
    List of sales order - VA05
    List of Billing documents - VF05
    Inquiries list - VA15
    Quotation List - VA25
    Incomplete Sales orders - V.02
    Backorders - V.15
    <b>Outbound Delivery Monitor - VL06o
    Incomplete delivery - V_UC</b>Customer
    Returns-Analysis - MC+A
    Customer Analysis- Sales - MC+E
    Customer Analysis- Cr. Memo - MC+I
    Deliveries-Due list - VL04
    Billing due list - VF04
    Incomplete Billing documents - MCV9
    Customer Analysis-Basic List - MCTA
    Material Analysis(SIS) - MCTC
    Sales org analysis - MCTE
    Sales org analysis-Invoiced sales - MC+2
    Material Analysis-Incoming orders - MC(E
    General- List of Outbound deliveries - VL06f
    Material Returns-Analysis - MC+M
    Material Analysis- Invoiced Sales - MC+Q
    Variant configuration Analysis - MC(B
    Sales org analysis-Incoming orders - MC(I
    Sales org analysis-Returns - MC+Y
    Sales office Analysis- Invoiced Sales - MC-E
    Sales office Analysis- Returns - MC-A
    Shipping point Analysis - MC(U
    Shipping point Analysis-Returns - MC-O
    <b>Blocked orders - V.14</b>
    Order Within time period - SD01
    Duplicate Sales orders in period - SDD1
    Display Delivery Changes - VL22
    Simple example what  i did - Monthly Sales Report
    TYPE-POOLS
    type-pools : slis.
    Tables
    tables : VBAK,
             VBAP.
    Internal table for VBAK Table
    data : begin of i_vbak occurs 0,
           vbeln like vbak-vbeln,
           bstnk like vbak-bstnk,
           vdatu like vbak-vdatu,
           end of i_vbak.
    Internal table for VBAP and MATNR
    data : begin of i_vbap occurs 0,
           vbeln like vbap-vbeln,
           matnr like vbap-matnr,
           kdmat like vbap-kdmat,
           kwmeng like vbap-kwmeng,
           netpr like vbap-netpr,
           maktx like makt-maktx,
           end of i_vbap.
    Internal tables
    data : begin of i_sales occurs 0,
           vdatu like vbak-vdatu,
           bstnk like vbak-bstnk,
           matnr like vbap-matnr,
           maktx like makt-maktx,
           kdmat like vbap-kdmat,
           kwmeng like vbap-kwmeng,
           netpr  like vbap-netpr,
           end of i_sales.
    Variable for ALV
    data : v_repid like sy-repid,
           gt_fieldcat    type slis_t_fieldcat_alv.
    Selection-screen
    selection-screen : begin of block blk with frame title text-001.
    select-options : s_vbeln for vbak-vbeln,
                     s_erdat for vbak-erdat,
                     s_ernam for vbak-ernam,
                     s_vdatu for vbak-vdatu obligatory,
                     s_BSTNK for vbak-BSTNK,
                     s_KUNNR for vbak-kunnr,
                     s_matnr for vbap-matnr,
                     s_KDMAT for vbap-KDMAT.
    selection-screen : end of block blk.
    Initilization
    initialization.
      v_repid = sy-repid.
    S T A R T  -  O F  -  S E L E C T I O N ****************
    start-of-selection.
    Get the data from VBAK and VBAP Tables
      perform get_vbak_vbap.
    E N D  -  O F  -  S E L E C T I O N *****************
    end-of-selection.
    Display the data
      perform dispolay_data.
    *&      Form  get_vbak_vbap
          Get the data from VBAK and VBAP Table
    FORM get_vbak_vbap.
    Get the data from VBAK Table
      select vbeln bstnk vdatu from vbak into table i_vbak
                         where vbeln in s_vbeln
                         and   bstnk in s_bstnk
                         and   vdatu in s_vdatu
                         and   kunnr in s_kunnr
                         and   erdat in s_erdat
                         and   ernam in s_ernam.
      if sy-subrc ne 0.
        message e000(zwave) with 'No data found for given selection'.
      endif.
    Get the data from VBAP Table
      select avbeln amatnr akdmat akwmeng a~netpr
             b~maktx into table i_vbap
             from vbap as a inner join makt as b on bmatnr = amatnr
             for all entries in i_vbak
             where a~vbeln in s_vbeln
             and   a~kdmat in s_kdmat
             and   a~abgru = space
             and   a~matnr in s_matnr
             and   a~matnr ne '000000000000009999'
             and   a~matnr ne '000000000000004444'
             and   a~matnr ne '000000000000008888'
             and   a~matnr ne '000000000000001111'
             and   a~werks = '1000'
             and   b~spras = 'E'
             and   a~vbeln = i_vbak-vbeln.
      if sy-subrc ne 0.
        message e000(zwave) with 'No data found for given selection'.
      endif.
      sort i_vbak by vbeln.
      sort i_vbap by vbeln matnr.
      loop at i_vbap.
        read table i_vbak with key vbeln = i_vbap-vbeln
                                binary search.
        if sy-subrc eq 0.
          i_sales-bstnk = i_vbak-bstnk.
          i_sales-vdatu = i_vbak-vdatu.
          i_sales-matnr = i_vbap-matnr.
          i_sales-kdmat = i_vbap-kdmat.
          i_sales-maktx = i_vbap-maktx.
          i_sales-netpr = i_vbap-netpr.
          i_sales-kwmeng = i_vbap-kwmeng.
          append i_sales.
        else.
          continue.
        endif.
        clear : i_sales,
                i_vbap,
                i_vbak.
      endloop.
      sort i_sales by vdatu bstnk matnr.
      refresh : i_vbap,
                i_vbak.
    ENDFORM.                    " get_vbak_vbap
    *&      Form  dispolay_data
          Display the data
    FORM dispolay_data.
    Fill the Fiedlcat
      PERFORM fieldcat_init  using gt_fieldcat[].
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                =
      I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
          IT_FIELDCAT                       = gt_fieldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_ADD_FIELDCAT                   =
      IT_HYPERLINK                      =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
      IT_EXCEPT_QINFO                   =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = i_sales
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    ENDFORM.                    " dispolay_data
    *&      Form  fieldcat_init
          text
         -->P_GT_FIELDCAT[]  text
    FORM fieldcat_init USING  e01_lt_fieldcat type slis_t_fieldcat_alv.
      DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    Delivery Date
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'VDATU'.
      LS_FIELDCAT-OUTPUTLEN    = 12.
      LS_FIELDCAT-TABNAME    = 'I_SALES'.
      ls_fieldcat-seltext_L = 'Delivery Date'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Purchase Order #Material Description
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'BSTNK'.
      LS_FIELDCAT-OUTPUTLEN    = 25.
      LS_FIELDCAT-TABNAME    = 'I_SALES'.
      ls_fieldcat-seltext_L = 'Purchase Order #'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Material
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-REF_FIELDNAME    = 'MATNR'.
      LS_FIELDCAT-REF_TABNAME    = 'MARA'.
      LS_FIELDCAT-FIELDNAME    = 'MATNR'.
      LS_FIELDCAT-TABNAME    = 'I_SALES'.
      ls_fieldcat-seltext_L = 'Material #'.
      ls_fieldcat-seltext_M = 'Material #'.
      ls_fieldcat-seltext_S = 'Material #'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Material Description
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'MAKTX'.
      LS_FIELDCAT-OUTPUTLEN    = 40.
      LS_FIELDCAT-TABNAME    = 'I_SALES'.
      ls_fieldcat-seltext_L = 'Material Description'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Customer Material #
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'KDMAT'.
      LS_FIELDCAT-OUTPUTLEN    = 35.
      LS_FIELDCAT-TABNAME    = 'I_SALES'.
      ls_fieldcat-seltext_L = 'Customer material no.'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Quantity
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'KWMENG'.
      LS_FIELDCAT-OUTPUTLEN    = 15.
      LS_FIELDCAT-TABNAME    = 'I_SALES'.
      ls_fieldcat-seltext_L = 'Quantity'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    Net Price
      CLEAR LS_FIELDCAT.
      LS_FIELDCAT-FIELDNAME    = 'NETPR'.
      LS_FIELDCAT-OUTPUTLEN    = 15.
      LS_FIELDCAT-TABNAME    = 'I_SALES'.
      ls_fieldcat-seltext_L = 'Net Price'.
      APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.
    ENDFORM.                    " fieldcat_init
    Thanks
    Seshu

  • Nee help on ALV report for Total of BSEG-BUZEI & F1 document in FB03

    Hi friends,
    I need to diplay line items total & when double clicked on BELNR field it should open the F1 document in FB03.
    Could anyone plz guide me on this.
    Waiting for response.
    below is my code,
    Kindly needed help.
    REPORT  YALV_1.
    TABLES : BKPF,BSEG.
    Data for ALV display
    TYPE-POOLS: SLIS.
    data : int_fcat type SLIS_T_FIELDCAT_ALV,
           fieldcatalog type slis_t_fieldcat_alv with header line.
    DATA:  wa_sortinfo TYPE slis_sortinfo_alv,
           i_sortcat TYPE slis_t_sortinfo_alv.
    TYPES  : BEGIN OF T_BKPF,
            BUKRS TYPE BKPF-BUKRS,
            BELNR TYPE BKPF-BELNR,
            GJAHR TYPE BKPF-GJAHR,
            BLART TYPE BKPF-BLART,
            BLDAT TYPE BKPF-BLDAT,
            BUDAT TYPE BKPF-BUDAT,
            END OF T_BKPF.
    types: begin of t_bseg,
           BUZEI TYPE BSEG-BUZEI,
           end of t_bseg.
    DATA : it_bkpf TYPE STANDARD TABLE OF t_bkpf with header line,
          wa_bkpf TYPE t_bkpf,
           it_bseg type standard table of t_bseg.
          wa_bseg type t_bseg.
    field to store report name
    DATA :  i_repid like sy-repid.
    select bukrs belnr gjahr blart bldat budat from bkpf into table
    it_bkpf where blart = 'AA'.
    field to check table length
    *data i_lines like sy-tabix.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    PERFORM sortcat_init CHANGING i_sortcat.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but
    *can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such
    *as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'BUKRS'.
      fieldcatalog-seltext_m   = 'Company Code'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 4.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BELNR'.
      fieldcatalog-seltext_m   = 'Doc No'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'GJAHR'.
      fieldcatalog-seltext_m   = 'Fiscal Year'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BLART'.
      fieldcatalog-seltext_m   = 'DOC Type'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BLDAT'.
      fieldcatalog-seltext_m   = 'Doc Date'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BUDAT'.
      fieldcatalog-seltext_m   = 'Popsting Date'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BUZEI'.
      fieldcatalog-seltext_m   = 'Line Items'.
      fieldcatalog-col_pos     = 6.
      fieldcatalog-do_sum      = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    FORM sortcat_init CHANGING i_sortcat TYPE slis_t_sortinfo_alv.
      CLEAR wa_sortinfo.
      wa_sortinfo-fieldname = 'BUKRS'.
      wa_sortinfo-tabname = 'T_BKPF'.
      wa_sortinfo-spos = 1.            " First sort by this field.
      wa_sortinfo-up = 'X'.            "   Ascending
      wa_sortinfo-subtot = 'X'.        " Subtotal at Name1
      APPEND wa_sortinfo TO i_sortcat.
      CLEAR wa_sortinfo.
      wa_sortinfo-fieldname = 'BELNR'.
      wa_sortinfo-tabname = 'T_BKPF'.
      wa_sortinfo-spos = 2.            " Sec sort by this field.
      wa_sortinfo-up = 'X'.            "   Ascending
      wa_sortinfo-subtot = 'X'.        " Subtotal at Name1
      APPEND wa_sortinfo TO i_sortcat.
    ENDFORM.                    " sortcat_init
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      i_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = i_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
               is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_sort                = i_sortcat
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = IT_BKPF
           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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    form data_retrieval.
    IF it_bkpf[] IS NOT INITIAL.
       select buzei from bseg into
         table it_bseg for all entries in it_bkpf
         where bukrs = it_bkpf-bukrs
         and belnr = it_bkpf-belnr
         and gjahr = it_bkpf-gjahr.
         endif.
    endform.                    " DATA_RETRIEVAL.

    Hello
    1.
    form display_alv_report.
    i_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_callback_program = i_repid
    i_callback_user_command = 'USER_COMMAND'
    it_fieldcat = fieldcatalog[]
    i_save = 'X'
    tables
    t_outtab = IT_BKPF
    exceptions
    program_error = 1
    others = 2.
    2.
    * FORM USER_COMMAND
    FORM user_command USING u_com LIKE sy-ucomm sel_lin TYPE slis_selfield.
    CASE u_com.
      WHEN '&IC1'. 
        CASE sel_lin.
          WHEN 'BELNR'.
          read TABLE IT_BKPF INDEX sel_lin-tabindex.
          SET PARAMETER ID 'BLN' FIELD IT_BKPF-BELNR.
          SET PARAMETER ID 'BUK' FIELD IT_BKPF-BUKRS.
          SET PARAMETER ID 'GJR' FIELD IT_BKPF-GJAHR.
          CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN. 
        ENDCASE.
    CLEAR u_com.
    ENDCASE.
    ENDFORM. "USER_COMMAND

  • Need help in Interactive Report

    hi,
    i am using a ALV report now i want to make it interactive. as i click on the current page i need to go MIR4 transaction. how can i do it?
    please please help on this issue.

    to make an alv interactive  i did the following steps
    try it by yourself then only u can learn dont copy and paste the code
    step1: declare an iternal table and work area of the type
    data: it_events type standard table of slis_t_alv_events,
            wa_events like line of it_data.
    step2: use the function module
                  reuse_alv_get_events
    and pass the internal table to the fm so that u will get all the events in an internal table . This internal table will have 2 fields like name and form. In the name field u will have all the names of events like
    top_of_page,end_of_page,user_command etc
    so what ever event u want to use modify the internal table according it.For example if u want to use user_command.
    read the internal table it_events into wa_events with key name eq 'USER_COMMAND'.
    after reading the internal table
    move 'f_user_command' to wa_events-form.
    then modify the internal table according to it
    modify it_events from wa_events transporting form.
    after this the internal table will have name = USER_COMMAND and
    form = 'f_user_command'.
    call this form anywhere in the program
    form f_user_command using r_ucomm like sy-ucomm
                                      rs_selfield like slis_selfield.
    case r_ucomm.
    write u r code as appropiate
    WHEN '&IC1'.
    SET parameter ID 'AUN' FIELD rs_selfield-value.( aun is the parameter id for the field for which u r clicking depending on that select the parameter id)
    CALL TRANSACTION 'VA02' AND SKIP FIRST SCREEN.
    ENDIF.

  • Need help in dynamic report for a range of year and period

    Dear all,
    I need help in creating an ALV report with dynamic columns based on the Year and period entered on the selection screen. for example if in the year we enter 2002 and period range from 10 to 12 then we should get the 3 columns display for cost(example) for period 10/2002, 11/2002 and 12/2002.
    Can anyone help me in achieving this dynamically since the user can enter the year also in intervals along with the period and data also needs to be populated in the corresponding columns.
    An example code would be of great help.
    Thanks,
    Amit

    Hi,
    Use field symbols as follows.
    TYPE-POOLS : SLIS.
    TABLES : MARC,T001W.
    DATA : BEGIN OF ITAB OCCURS 0,
           MATNR LIKE MARC-MATNR,
           END OF ITAB.
    DATA : FIELDSTAB TYPE LVC_T_FCAT,
           STAB      TYPE LVC_S_FCAT,
           T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
           S_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
           NEW_LINE TYPE REF TO DATA,
           NEW_TABLE TYPE REF TO DATA,
           INDEX(3) TYPE C,
           STR(70),
           TEXT(6),
           CNT(1),
           TEXT1(16),
           REPID LIKE SY-REPID.
    FIELD-SYMBOLS : <FS> TYPE STANDARD TABLE,
                    <WA> TYPE ANY.
    SELECT-OPTIONS : S_WERKS FOR MARC-WERKS NO INTERVALS,
                     S_MATNR FOR MARC-MATNR NO INTERVALS.
    INITIALIZATION.
      REPID = SY-REPID.
    START-OF-SELECTION.
      SELECT * FROM MARC
               INTO CORRESPONDING FIELDS OF TABLE ITAB
               WHERE MATNR IN S_MATNR
               AND   WERKS IN S_WERKS.
      SORT ITAB BY MATNR.
      DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MATNR.
      STAB-FIELDNAME = 'MATNR'.
      STAB-DATATYPE  = 'CHAR'.
      STAB-INTLEN    = '18'.
      APPEND STAB TO FIELDSTAB.
      CLEAR CNT.
      LOOP AT S_WERKS.
        CLEAR TEXT.
        CNT = CNT + 1.
        CONCATENATE  'EISLO' CNT INTO TEXT.
        STAB-FIELDNAME = TEXT.
        STAB-DATATYPE  = 'CHAR'.
        STAB-INTLEN    = '16'.
        APPEND STAB TO FIELDSTAB.
        CLEAR S_WERKS.
      ENDLOOP.
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = FIELDSTAB
        IMPORTING
          EP_TABLE        = NEW_TABLE.
      ASSIGN NEW_TABLE->* TO <FS>.
      CREATE DATA NEW_LINE LIKE LINE OF <FS>.
      ASSIGN NEW_LINE->* TO <WA>.
      PERFORM MOVE_DATA.
      CLEAR S_FIELDCAT.
      S_FIELDCAT-FIELDNAME = 'MATNR'.
      S_FIELDCAT-TABNAME = ITAB.
      S_FIELDCAT-SELTEXT_M = 'Part Number'.
      S_FIELDCAT-NO_ZERO = 'X'.
      S_FIELDCAT-DDICTXT   = 'M'.
      APPEND S_FIELDCAT TO T_FIELDCAT.
      CLEAR CNT.
      LOOP AT S_WERKS.
        CLEAR T001W.
        CNT = CNT + 1.
        SELECT SINGLE * FROM T001W WHERE WERKS = S_WERKS-LOW AND SPRAS = SY-LANGU.
        CLEAR TEXT.
        CONCATENATE 'EISLO' CNT INTO TEXT.
        S_FIELDCAT-FIELDNAME = TEXT.
        S_FIELDCAT-SELTEXT_M = T001W-NAME2.
    S_FIELDCAT-NO_ZERO = 'X'.
        S_FIELDCAT-DDICTXT   = 'M'.
        APPEND S_FIELDCAT TO T_FIELDCAT.
        CLEAR S_WERKS.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          IT_FIELDCAT = T_FIELDCAT[]
        TABLES
          T_OUTTAB    = <FS>.
    *&      Form  MOVE_DATA
          text
    FORM MOVE_DATA.
      LOOP AT ITAB.
        CLEAR STR.
        CONCATENATE ITAB-MATNR ' ' INTO STR SEPARATED BY SPACE.
        LOOP AT S_WERKS.
          CLEAR MARC.
          SELECT SINGLE * FROM MARC WHERE MATNR = ITAB-MATNR AND WERKS = S_WERKS-LOW.
          IF SY-SUBRC EQ 0.
            CLEAR TEXT1.
            TEXT1 = MARC-EISLO.
            CONCATENATE STR TEXT1 INTO STR SEPARATED BY SPACE.
          ELSE.
            CONCATENATE STR '0' INTO STR SEPARATED BY SPACE.
          ENDIF.
        ENDLOOP.
        <WA> = STR.
        APPEND <WA> TO <FS>.
        CLEAR ITAB.
      ENDLOOP.
    ENDFORM.                    "MOVE_DATA
    Reward points if helpful.
    Regards,
    Sankar..

  • Need to send ALV Report as an Excel sheet via Email

    Well , I need to Email an ALV Report as an Excel Sheet using my program. What do I need to do and how?
    Answers will be rewarded with points.
    Thanks

    Hi Manu,
    You can copy and paste the following codes and try to execute..
    Hope this will help you..
    note: dont forget to change 'SAPUSER' to your SAP user id.
    REPORT  yhn_test8                               .
    TYPE-POOLS: slis, slist, truxs.
    DATA t5         LIKE t005t OCCURS 0 WITH HEADER LINE.
    DATA fcat       TYPE slis_t_fieldcat_alv.
    DATA listobject LIKE abaplist OCCURS 0 WITH HEADER LINE.
    DATA stack      TYPE slist_listlevel_stack WITH HEADER LINE.
    DATA ttxt       LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    PARAMETER p_alv   RADIOBUTTON GROUP a.
    PARAMETER p_excel RADIOBUTTON GROUP a.
    START-OF-SELECTION.
      SELECT * INTO TABLE t5
               FROM t005t
              WHERE spras = sy-langu.
      CLEAR : fcat, fcat[].
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'T005T'
        CHANGING
          ct_fieldcat            = fcat
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF p_alv = 'X'.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            it_fieldcat   = fcat
          TABLES
            t_outtab      = t5
          EXCEPTIONS
            program_error = 1
            OTHERS        = 2.
        IF sy-subrc <> 0.
        ENDIF.
      ELSEIF p_excel = 'X'.
        CALL FUNCTION 'LIST_FREE_MEMORY'.
        SUBMIT yhn_test8 EXPORTING LIST TO MEMORY AND RETURN.
        CALL FUNCTION 'LIST_FROM_MEMORY'
          TABLES
            listobject = listobject
          EXCEPTIONS
            not_found  = 1
            OTHERS     = 2.
        IF sy-subrc = 0.
        Generate LIST for excel file
          CALL FUNCTION 'LIST_TO_TXT'
            TABLES
              listtxt            = ttxt
              listobject         = listobject
            EXCEPTIONS
              empty_list         = 1
              list_index_invalid = 2
              OTHERS             = 3.
          IF sy-subrc = 0.
            LOOP AT ttxt.
              REPLACE ALL OCCURRENCES OF '|' IN ttxt-line
                      WITH cl_abap_char_utilities=>horizontal_tab.
              MODIFY ttxt.
            ENDLOOP.
            PERFORM send_email.
          ENDIF.
        ENDIF.
      ENDIF.
    *&      Form  send_email
    FORM send_email .
      DATA docs LIKE docs OCCURS 0 WITH HEADER LINE.
      DATA excelsize TYPE i.
      DATA excel LIKE solisti1   OCCURS 0 WITH HEADER LINE.
      DATA doc LIKE sodocchgi1.
      DATA excelln TYPE i.
      DATA int_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA int_objhead LIKE solisti1   OCCURS 2 WITH HEADER LINE.
      DATA int_objtext LIKE solisti1   OCCURS 0 WITH HEADER LINE.
      DATA int_reclist LIKE somlreci1  OCCURS 1 WITH HEADER LINE.
      DATA bodyln LIKE sy-tabix.
      DATA output_data TYPE ssfcrescl.
      excel[] = ttxt[].
    excel table sizes
      DESCRIBE TABLE excel LINES excelln.
    Body Email
      int_objtext-line = 'Test Body'.
      APPEND int_objtext.
      DESCRIBE TABLE int_objtext LINES bodyln.
      READ     TABLE int_objtext INDEX bodyln.
      CLEAR doc.
      doc-doc_size   = ( bodyln - 1 ) * 255 + STRLEN( int_objtext ).
      doc-obj_name   = ' '.
      doc-sensitivty = 'P'.
      doc-proc_syst  = sy-sysid.
      doc-proc_clint = sy-mandt.
      CLEAR: int_objpack, int_objpack[].
      int_objpack-transf_bin = ' '.
      int_objpack-head_start = 1.
      int_objpack-head_num   = 0.
      int_objpack-body_start = 1.
      int_objpack-body_num   = bodyln.
      int_objpack-doc_type   = 'RAW'.
      int_objpack-obj_descr  = 'Test'.
      APPEND int_objpack.
      CLEAR: int_objhead, int_objhead[].
      int_objhead            = 'Attachment'.
      APPEND int_objhead.
      int_objpack-transf_bin = 'X'.
      int_objpack-head_start = 1.
      int_objpack-head_num   = 0.
      int_objpack-body_start = 1.
      int_objpack-body_num   = excelln.
      int_objpack-doc_size   = excelsize.
      int_objpack-doc_type   = 'XLS'.
      int_objpack-obj_name   = 'excel'.
      int_objpack-obj_descr  = 'test.xls'. "File name
      APPEND int_objpack.
      Set Receiver
      int_reclist-receiver   = 'SAPUSER'.
      int_reclist-rec_type   = 'B'.
      int_reclist-notif_del  = 'X'.
      int_reclist-notif_read = 'X'.
      int_reclist-notif_ndel = 'X'.
      int_reclist-express    = 'X'.
      APPEND int_reclist.
      doc-obj_descr = 'Report in Excel'.
      Sending Email
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = doc
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = int_objpack
          object_header              = int_objhead
          contents_bin               = excel
          contents_txt               = int_objtext   "Body
          receivers                  = int_reclist
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          document_type_not_exist    = 3
          operation_no_authorization = 4
          parameter_error            = 5
          x_error                    = 6
          enqueue_error              = 7
          OTHERS                     = 8.
    ENDFORM.                    " send_email

  • Help,Webdynpro ALV report

    Hello,
    My Webdynpro ALV report display SFLIGHT all fields .
    But I want to show only five fields,
    how code?
    CODE::
    data:node_flights type ref to if_wd_context_node,
           it_flights type sflight_tab1,
           is_flights type sflight,
           it_final type IF_MAIN=>elements_flights,
           is_final type IF_MAIN=>element_flights.
      select * from sflight into table it_flights up to 10 rows.
      node_flights = wd_context->get_child_node( 'FLIGHTS' ).
      data:l_ref_cmp_usage type ref to if_wd_component_usage.
      l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
      if l_ref_cmp_usage->has_active_component( ) is initial.
        l_ref_cmp_usage->create_component( ).
      endif.
      data:l_ref_interfacecontroller type ref to iwci_salv_wd_table.
      l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
    navigate from <CONTEXT> to <NODE_FLIGHT> via lead selection
      node_flights = wd_context->get_child_node( name = `NODE_FLIGHT` ).
    fill context node
      node_flights ->bind_table( it_flight ).
    endmethod.
    thanks

    HI,
    There is no need to change your code.
    Do one thing.
    Create a node SFLIGHT and do not add dictionary structure SFLIGHT.
    Then create what are the required five attributes under it.
    Make sure all these five refer to the dictionary data elements.
    example: If you want carrid declare dectionary structure S_CARR_ID.
    Like wise.
    Now finally goto component usage->ALV->INTERFACECONTROLLER in the
    left side tree of web dynpro component.
    Then create component usage and drag SFLIGHT node to DATA of the context.
    It is one of the way.
    Second way is.
    Create SFLIGHT node and mention SFLIGHT as stricture and select five required attributes that you need.
    Now after creation of SFLIGHT NODE just delete the structure name present in the PROPERTIES of
    SFLIGHT NODE.
    Now finally goto component usage->ALV->INTERFACECONTROLLER in the
    left side tree of web dynpro component.
    Then create component usage and drag SFLIGHT node to DATA of the context.
    I hope it helped you.
    Regards and Best wishes.

  • Needed help on this report

    When BELNR field is double clicked it is not going to F1 document in FB03
    Could anybody help on this , plz help
    Here is the code,
    *& Report  YALV_1
    REPORT  YALV_1.
    TABLES : BKPF,BSEG.
    Data for ALV display
    TYPE-POOLS: SLIS.
    data : int_fcat type SLIS_T_FIELDCAT_ALV,
           fieldcatalog type slis_t_fieldcat_alv with header line.
    DATA:  wa_sortinfo TYPE slis_sortinfo_alv,
           i_sortcat TYPE slis_t_sortinfo_alv.
    TYPES  : BEGIN OF T_BKPF,
            BUKRS TYPE BKPF-BUKRS,
            BELNR TYPE BKPF-BELNR,
            GJAHR TYPE BKPF-GJAHR,
            BLART TYPE BKPF-BLART,
            BLDAT TYPE BKPF-BLDAT,
            BUDAT TYPE BKPF-BUDAT,
           BUZEI TYPE BSEG-BUZEI,
            END OF T_BKPF.
    types: begin of t_bseg,
           BUZEI TYPE BSEG-BUZEI,
           end of t_bseg.
    DATA : it_bkpf TYPE STANDARD TABLE OF t_bkpf with header line,
          wa_bkpf TYPE t_bkpf,
           it_bseg type standard table of t_bseg.
          wa_bseg type t_bseg.
    field to store report name
    DATA :  i_repid like sy-repid.
    select bukrs belnr gjahr blart bldat budat from bkpf into table
    it_bkpf where blart = 'AA'.
    field to check table length
    *data i_lines like sy-tabix.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    PERFORM sortcat_init CHANGING i_sortcat.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but
    *can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such
    *as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'BUKRS'.
      fieldcatalog-seltext_m   = 'Company Code'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 4.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BELNR'.
      fieldcatalog-seltext_m   = 'Doc No'.
      fieldcatalog-hotspot = 'X'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'GJAHR'.
      fieldcatalog-seltext_m   = 'Fiscal Year'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BLART'.
      fieldcatalog-seltext_m   = 'DOC Type'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BLDAT'.
      fieldcatalog-seltext_m   = 'Doc Date'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BUDAT'.
      fieldcatalog-seltext_m   = 'Popsting Date'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'BUZEI'.
      fieldcatalog-seltext_m   = 'Line Items'.
      fieldcatalog-col_pos     = 6.
      fieldcatalog-do_sum      = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    FORM sortcat_init CHANGING i_sortcat TYPE slis_t_sortinfo_alv.
      CLEAR wa_sortinfo.
      wa_sortinfo-fieldname = 'BUKRS'.
      wa_sortinfo-tabname = 'T_BKPF'.
      wa_sortinfo-spos = 1.            " First sort by this field.
      wa_sortinfo-up = 'X'.            "   Ascending
      wa_sortinfo-subtot = 'X'.        " Subtotal at Name1
      APPEND wa_sortinfo TO i_sortcat.
      CLEAR wa_sortinfo.
      wa_sortinfo-fieldname = 'BELNR'.
      wa_sortinfo-tabname = 'T_BKPF'.
      wa_sortinfo-spos = 2.            " Sec sort by this field.
      wa_sortinfo-up = 'X'.            "   Ascending
      wa_sortinfo-subtot = 'X'.        " Subtotal at Name1
      APPEND wa_sortinfo TO i_sortcat.
    ENDFORM.                    " sortcat_init
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      i_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = i_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
               is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_sort                = i_sortcat
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = IT_bkpf
           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.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    form data_retrieval.
    IF it_bkpf[] IS NOT INITIAL.
       select buzei from bseg into
         table it_bseg for all entries in it_bkpf
         where bukrs = it_bkpf-bukrs
         and belnr = it_bkpf-belnr
         and gjahr = it_bkpf-gjahr.
         endif.
    endform.                    " DATA_RETRIEVAL.
    FORM USER_COMMAND
    FORM user_command USING u_com LIKE sy-ucomm sel_lin TYPE slis_selfield.
    CASE u_com.
      WHEN '&IC1'.
        CASE sel_lin.
          WHEN 'BELNR'.
          read TABLE IT_BKPF INDEX sel_lin-tabindex.
          SET PARAMETER ID 'BLN' FIELD IT_BKPF-BELNR.
          SET PARAMETER ID 'BUK' FIELD IT_BKPF-BUKRS.
          SET PARAMETER ID 'GJR' FIELD IT_BKPF-GJAHR.
          CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
        ENDCASE.
    CLEAR u_com.
    ENDCASE.
    ENDFORM. "USER_COMMAND

    Pl. do this change in ur code...
    FORM user_command USING u_com LIKE sy-ucomm sel_lin TYPE slis_selfield.
    CASE u_com.
    WHEN '&IC1'.
    CASE sel_lin-FIELDNAME.
    WHEN 'BELNR'.
    read TABLE IT_BKPF INDEX sel_lin-tabindex.
    SET PARAMETER ID 'BLN' FIELD IT_BKPF-BELNR.
    SET PARAMETER ID 'BUK' FIELD IT_BKPF-BUKRS.
    SET PARAMETER ID 'GJR' FIELD IT_BKPF-GJAHR.
    CALL TRANSACTION 'FB03' AND SKIP FIRST SCREEN.
    ENDCASE.
    CLEAR u_com.
    ENDCASE.
    ENDFORM. "USER_COMMAND
    Regards,
    Joy.

  • Need Help XML Publisher Report

    Hi Friends
    I need to generate a report in xml publisher responsibility .
    I have create and designed the RTF file using word , And i have genetared an XML file(template )
    I have some doubt please clarify by doubts
    In RTF template i have some 4columns
    For EXample i Give some column name
    Invoice Number , Invoice Line Number ,Tax Type ,Tax Code Name etc....
    In my RTF I have done like this
    I have created two 2 row and 4column
    In the 1st row i have all the 4 column heading
    In the 2nd row i have done like this
    Developer tab> Design mode > In the legacy tool i have selected text Form field
    Once i double click the text form field in the default text i have Given C1 Then in the Add help text button i have given <?C_INVOICE_NUMBER?> like this i have done for alls the columns
    My RTF design is completed
    Now i need load the XML is it?
    In the XMl data query i have placed my sql statement
    Here my doubt starts
    wether all the column in the RTF should be in the XML sql statement ha?
    2)In the top of my RTF i need to add date and page No how to add that ?
    Thanks In advance
    AT

    Hi Friend
    Iam saying this is my XML file
    <LIST_G_TAX_NAME>
    <G_TAX_NAME>
    <C_SORT_TAX_NAME>USE TAX</C_SORT_TAX_NAME>
    <C_TAX_NAME>Use Tax</C_TAX_NAME>
    <C_TAX_RATE>8.25</C_TAX_RATE>
    <C_TAX_TYPE>USE</C_TAX_TYPE>
    <C_PERIOD_NAME>OCT-11</C_PERIOD_NAME>
    <LIST_G_VENDOR>
    <G_VENDOR>
    <C_SORT_VENDOR_NAME/>
    <C_SORT_SITE_CODE/>
    <C_VENDOR_ID>851</C_VENDOR_ID>
    <C_VENDOR_NAME>ORACLE CORPORATION</C_VENDOR_NAME>
    <C_SITE_CODE>CHICAGO</C_SITE_CODE>
    <LIST_G_INVOICE>
    <G_INVOICE>
    <C_INVOICE_DATE>17-OCT-11</C_INVOICE_DATE>
    <C_SORT_INVOICE_NUMBER>1308</C_SORT_INVOICE_NUMBER>
    <C_INVOICE_ID>350889</C_INVOICE_ID>
    <C_INVOICE_NUMBER>1308</C_INVOICE_NUMBER>
    <C_INVOICE_LINE_NUMBER>1</C_INVOICE_LINE_NUMBER>
    <C_PO_NUMBER>256388</C_PO_NUMBER>
    <C_DESCRIPTION>TEST</C_DESCRIPTION>
    <C_GL_DATE>17-OCT-11</C_GL_DATE>
    <C_INVOICE_LINE_AMOUNT>15</C_INVOICE_LINE_AMOUNT>
    <C_CHARGE_ACCOUNT>412.00.6410.7831.1076.1001.00.000.0000</C_CHARGE_ACCOUNT>
    <C_LIABILITY_ACCOUNT>412.00.0000.2152.1208.1001.00.000.0000</C_LIABILITY_ACCOUNT>
    <C_BATCH_NAME>101711</C_BATCH_NAME>
    <C_SITE_CODE2>CHICAGO</C_SITE_CODE2>
    <C_INVOICE_AMOUNT>15</C_INVOICE_AMOUNT>
    <LIST_G_DIST>
    <G_DIST>
    <C_INVOICE_TAX_ID>10061</C_INVOICE_TAX_ID>
    <C_LINE_TYPE>ITEM</C_LINE_TYPE>
    </G_DIST>
    </LIST_G_DIST>
    <C_TAXABLE_AMOUNT>15</C_TAXABLE_AMOUNT>
    <C_TAX_AMOUNT>1.24</C_TAX_AMOUNT>
    <C_INVOICE_AMOUNT_DISP> 15.00 </C_INVOICE_AMOUNT_DISP>
    <C_TAXABLE_AMOUNT_DISP> 15.00 </C_TAXABLE_AMOUNT_DISP>
    <C_TAX_AMOUNT_DISP> 1.24 </C_TAX_AMOUNT_DISP>
    </G_INVOICE>
    </LIST_G_INVOICE>
    <C_INVOICE_SITE_SUM>124.9</C_INVOICE_SITE_SUM>
    <C_INVOICE_SITE_SUM_DISP> 124.90 </C_INVOICE_SITE_SUM_DISP>
    <C_TAX_SITE_SUM>5.4</C_TAX_SITE_SUM>
    <C_TAX_SITE_SUM_DISP> 5.40 </C_TAX_SITE_SUM_DISP>
    <C_TAXABLE_SITE_SUM>65.66</C_TAXABLE_SITE_SUM>
    <C_TAXABLE_SITE_SUM_DISP> 65.66 </C_TAXABLE_SITE_SUM_DISP>
    </G_VENDOR>
    </LIST_G_VENDOR>
    <C_OLD_VENDOR_ID>0</C_OLD_VENDOR_ID>
    <C_INVOICE_SUM>124.9</C_INVOICE_SUM>
    <C_INVOICE_SUM_DISP> 124.90 </C_INVOICE_SUM_DISP>
    <C_TAX_SUM>5.4</C_TAX_SUM>
    <C_TAX_SUM_DISP> 5.40 </C_TAX_SUM_DISP>
    <C_TAXABLE_SUM>65.66</C_TAXABLE_SUM>
    <C_TAXABLE_SUM_DISP> 65.66 </C_TAXABLE_SUM_DISP>
    </G_TAX_NAME>
    </LIST_G_TAX_NAME>
    And if i need all the column to be displayed in my report
    1)Invoice Number
    2)Invoice Line Number
    3)Tax Type
    4)Tax Code Name
    5)Tax Rate Percent
    6)Supplier Name
    7)Description
    8)Gl Date
    9)Invoive Line Amount
    10)Taxable Line Amount
    11)Tax Liability
    12)Po Number
    13)Charge Account
    14)Liability Account
    Which tag do i need to use fro grouping
    For ex
    Instead of this <?for-each:G_TAX_NAME?> <?end for-each?>
    which one i need to use
    Please help
    Thanks
    AT

Maybe you are looking for

  • I bought a magazine template from Pages Toolbox and it's only showing 2 pages out of 10 why?

    This morning I bought a template from the Pages Toolbox Kit. It's a new magazine template and when I viewed it before I bought it there were 10 pages. I procedded to buy it. When I opened it to work on it it is only showing the cover and the first pa

  • Batch determination reg.

    Hi dudes, 1.if we want batch determination for components for prod/process order, whether we need inventory management settings for batch determination or for production/process order. 2. if we maintain settings for production/process order, then we

  • Choping up a string in powershell

    I have a variable called $office $Office = (get-aduser -Identity $Name -Properties * |select physicalDeliveryOfficeName).physicalDeliveryOfficeName It produces results like this 01A;514;295;632;428;485;442;277;800;175 Of course it could be shorter or

  • Permitted Payee

    Hi I want to create a vendor master with permitted payee..I am tring to find the field in Idoc for permitted payee but there is no field for permitted payee.I dont think we can do using an Idoc extension in this case.Is there any BAPI to create a ven

  • Unicode support in j2me urgent

    does kvm supports unicode? how can we display arabic characters by using j2me? thanks iffat,beenish