Download data into excel with boxes

Hi Folks,
           In my goods receipt report output, there is a footer with boxes for signature purpose.
           This output should be able to download in Excel format.
           Is it possible to show the boxes in excel file while downloading the output?
           If so, please suggest me how to do so..
          Thanks in advance,
          Shyam.

Hi ermac,
              Is there any simple process other than OLE application, as it is a simple report.
                   Thanks,
                   Shyam.

Similar Messages

  • How to download data into excel by displaying field names in top 2 rows

    Hi experts,
             i am trying to download an internal table data into excel(open office) by reserving top 2 rows. In 1st row i want to display tech.name where as in 2nd row i want to display discription of tech name of the fields. Well, i tried with FM gui_upload and used fieldnames  parameter and even its working too but i'm unable to work with 2nd col.
    Please help me out....
    with regards.
    Praveen.

    Try this code:
    If IT_FINAL is the internal table containing the data that you want to download :
    IF IT_FINAL[] IS INITIAL.
        WRITE : 'No Data Fetched'.
      ELSE.
      Build header table Field catelague
        PERFORM UR_FIELDCAT_BUILD USING G_F_REPNM
                                        'IT_FINAL'
                                 CHANGING IT_FCAT_001.
        DATA: L_F_LINES TYPE I,
              L_F_FROM TYPE I,
              L_F_TO TYPE I,
              L_F_DIFF TYPE I,
              L_TEMP_FINAL LIKE TABLE OF IT_FINAL.
        DESCRIBE TABLE IT_FINAL LINES L_F_LINES.
        IF L_F_LINES > 16000.
          L_F_FROM = 1.
          L_F_TO = 16000.
          DO.
            APPEND LINES OF IT_FINAL FROM L_F_FROM
                                              TO L_F_TO TO L_TEMP_FINAL.
            PERFORM DOWNLOAD_DATA_HEADER TABLES L_TEMP_FINAL
                                                   IT_FCAT_001
                                             USING GF_FILE1.
            IF L_F_TO >= L_F_LINES.
              EXIT.
            ENDIF.
            L_F_FROM = L_F_TO + 1.
            L_F_DIFF = L_F_LINES - L_F_TO.
            IF L_F_DIFF >= 16000.
              L_F_TO = L_F_TO + 16001.
            ELSE.
              L_F_TO = L_F_LINES.
            ENDIF.
            REFRESH: L_TEMP_FINAL.
         ENDDO.
       ELSE.
         PERFORM DOWNLOAD_DATA_HEADER TABLES IT_FINAL
                                         IT_FCAT_001
                                  USING GF_FILE1.
       ENDIF.
    ENDIF.
    FORM UR_FIELDCAT_BUILD
                 USING P_REPID
                       P_TABNAM
    CHANGING C_T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
       REFRESH C_T_FIELDCAT.
       CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
            EXPORTING
                 I_PROGRAM_NAME         = P_REPID
                 I_INTERNAL_TABNAME     = P_TABNAM
               I_STRUCTURE_NAME       = 'TY_FLODAT'
                 I_INCLNAME             = P_REPID
                 I_BYPASSING_BUFFER     = 'X'
            CHANGING
                 CT_FIELDCAT            = C_T_FIELDCAT
            EXCEPTIONS
                 INCONSISTENT_INTERFACE = 1
                 PROGRAM_ERROR          = 2
                 OTHERS                 = 3.
    ENDFORM.
    FORM DOWNLOAD_DATA_HEADER
                  TABLES T_OUTTAB
                  T_FIELDCAT
                  USING P_FILENAM.
       TYPE-POOLS: SLIS.
       REPLACE 'YYYYMMDD' WITH SY-DATUM INTO P_FILENAM.
       DATA: T_GXXLT_O    TYPE TABLE OF GXXLT_O WITH HEADER LINE,
             T_GXXLT_H    TYPE TABLE OF GXXLT_H WITH HEADER LINE,
             T_GXXLT_H_TEMP TYPE TABLE OF GXXLT_H WITH HEADER LINE,
             T_GXXLT_P    TYPE TABLE OF GXXLT_P WITH HEADER LINE,
             T_GXXLT_S    TYPE TABLE OF GXXLT_S WITH HEADER LINE,
             T_GXXLT_V    TYPE TABLE OF GXXLT_V WITH HEADER LINE,
             L_S_FIELDCAT TYPE SLIS_FIELDCAT_ALV..
       DATA: F_FILE       TYPE GXXLT_F-FILE,
             F_ATT_COLS   TYPE I,
             F_HRZ_KEYS   TYPE I,
             F_VRT_KEYS   TYPE I.
    TYPES: BEGIN OF TY_FLDNM,
               FIELDNAME(30) TYPE C,
            END   OF TY_FLDNM.
    DATA : L_T_FLDNAME TYPE TABLE OF TY_FLDNM,
            L_R_FLDNAME TYPE TY_FLDNM.
    REFRESH:  L_T_FLDNAME.
    LOOP AT T_FIELDCAT INTO L_S_FIELDCAT .
       CLEAR L_R_FLDNAME.
       CONCATENATE  L_S_FIELDCAT-SELTEXT_S  '_'
                    L_S_FIELDCAT-FIELDNAME
        INTO L_R_FLDNAME-FIELDNAME.
       APPEND L_R_FLDNAME TO L_T_FLDNAME.
    ENDLOOP.
    IF T_OUTTAB[] IS INITIAL.
       WRITE : /'No data Fetch !'.
    ELSE.
       DESCRIBE TABLE T_FIELDCAT LINES F_ATT_COLS.
       LOOP AT T_FIELDCAT INTO L_S_FIELDCAT.
         T_GXXLT_H-COL_NO        = L_S_FIELDCAT-COL_POS.
         T_GXXLT_H-ROW_NO        = 1.
         T_GXXLT_H-COL_NAME      = L_S_FIELDCAT-FIELDNAME.
         APPEND T_GXXLT_H.
         CLEAR T_GXXLT_S.
         T_GXXLT_S-COL_NO        = L_S_FIELDCAT-COL_POS.
         T_GXXLT_S-COL_OPS       = 'NOP'.
         T_GXXLT_S-COL_SRC       = L_S_FIELDCAT-COL_POS.
         CASE L_S_FIELDCAT-INTTYPE.
           WHEN 'Z' OR 'P' OR 'I' OR 'F'.
             T_GXXLT_S-COL_TYP   = 'NUM'.
           WHEN 'C' OR 'X' OR 'T' OR 'N'.
             T_GXXLT_S-COL_TYP   = 'STR'.
           WHEN 'D'.
             T_GXXLT_S-COL_TYP   = 'DAT'.
          WHEN OTHERS.
            T_GXXLT_S-COL_TYP   = 'STR'.
        ENDCASE.
        APPEND T_GXXLT_S.
        IF L_S_FIELDCAT-KEY EQ 'X'.
          CLEAR T_GXXLT_H.
          T_GXXLT_H-COL_NO     = L_S_FIELDCAT-COL_POS.
          T_GXXLT_H-ROW_NO     = 1.
          T_GXXLT_H-COL_NAME   = L_S_FIELDCAT-FIELDNAME.
          APPEND T_GXXLT_H.
        ENDIF.
      ENDLOOP.
      MOVE P_FILENAM TO F_FILE.
      LOOP AT T_FIELDCAT INTO L_S_FIELDCAT.
        READ TABLE T_GXXLT_H WITH KEY COL_NAME = L_S_FIELDCAT-FIELDNAME.
        IF SY-SUBRC EQ 0.
          T_GXXLT_H_TEMP-COL_NO = T_GXXLT_H-COL_NO.
          T_GXXLT_H_TEMP-ROW_NO = 2.
          T_GXXLT_H_TEMP-COL_NAME =  L_S_FIELDCAT-SELTEXT_S.
          APPEND T_GXXLT_H_TEMP TO T_GXXLT_H.
          CLEAR T_GXXLT_H.
          ENDIF.
        ENDLOOP.
        CALL FUNCTION 'XXL_FULL_API'
             EXPORTING
                  FILENAME          = F_FILE
                  NO_START          = ''
                  N_ATT_COLS        = F_ATT_COLS
                  N_HRZ_KEYS        = F_HRZ_KEYS
                  N_VRT_KEYS        = F_VRT_KEYS
                  SEMA_TYPE         = ''
                  SO_TITLE          = ''
             TABLES
                  DATA              = T_OUTTAB
                  HKEY              = T_GXXLT_H
                  ONLINE_TEXT       = T_GXXLT_O
                  PRINT_TEXT        = T_GXXLT_P
                  SEMA              = T_GXXLT_S
                  VKEY              = T_GXXLT_V
             EXCEPTIONS
                  CANCELLED_BY_USER = 1
                  DATA_TOO_BIG      = 2
                  DIM_MISMATCH_DATA = 3
                  DIM_MISMATCH_SEMA = 4
                  DIM_MISMATCH_VKEY = 5
                ERROR_IN_HKEY     = 6
                ERROR_IN_SEMA     = 7
                FILE_OPEN_ERROR   = 8
                FILE_WRITE_ERROR  = 9
                INV_DATA_RANGE    = 10
                INV_WINSYS        = 11
                INV_XXL           = 12
                OTHERS            = 13.
      ENDIF.
    ENDFORM.

  • Back ground job to download data into excel in the given path on sel-screen

    Hi Friends,
      I have 2 radion buttons on the selection screen 1. Online 2. Back ground.
    If i select the back ground radion button all program should run in back ground only, and finally the data should be downloaded to excel file on the given path in selection screen.
    Does any one have code for this.
    Thanks in advance
    Ajay
    Edited by: Ajay kumar on Aug 30, 2010 11:03 AM

    Hi Ajay,
    try this way..
    If sy-batch = 'X' . "background Job
    *   Submit report in background and creating spool
      SUBMIT (w_rname) USING SELECTION-SET p_var
          TO SAP-SPOOL WITHOUT SPOOL DYNPRO
          SPOOL PARAMETERS wa_pri_params AND RETURN.
      COMMIT WORK AND WAIT.
    *   To fetch the spool number from TSP01 table
      IF sy-subrc EQ 0.
        SELECT rqident
               FROM tsp01
               INTO p_spool
    *             UP TO 1 ROWS
               WHERE rq2name = wa_pri_params-plist.
        ENDSELECT.
      ENDIF.
    ENDIF.
    * Fetching Spool data into internal table
      CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
        EXPORTING
          rqident              = p_spool
        TABLES
          buffer               = t_Excel_data.
    "Now format the Data into excel format or Comma seperated format and download to Appl server.
    Prabhudas

  • Download date into excel sheet without changing the properties of column

    Hi All,
    I am trying to download a date field from SAP to Excel sheet. But the date is getting downloaded successfully, but the format of the column is getting changed to DATE. Is there any way to restrict it?
    I am using GUI_DOWNLOAD for downloading the data.
    I have declared the date field as CHAR10  Eg (09/13/2011) and moving the data into excel.
    Result i need : data should be downlaoded as 09/13/2011 but format of the cell should not be changed.
    Regards
    Eswar.

    Hi Eswar,
    Change the date format type dats instead of char format or any standards like erdat from vbak.Then you can in proper format.
    Regards,
    Madhu.

  • How to download output data into Excel with all Column Headings

    Hi Experts,
    Please tell me How to download output data of ALV Grid into Excel file with all Column Headings and I want to do this using coding,
    please send me if any solution is available.
    Thanks & Regards,
    Yogesh

    VERSION CONTROL (Most recent on top):                                *
      DATE(mm.dd.yyyy)    AUTHOR                                         *
      06.25.2007         Pattan Naveen                                   *
    Hi yogesh,,
    Go through this in this u find ur solution.
    report ZTEst_programe no standard page heading
                               line-size 100
                               line-count 50(5)
                               message-id zz.
    *--alv type declaration
    type-pools: slis.
    *--Tables:
    tables: anla,
            anlz,
            anlh,
            anlb,
            anlc.
    data: v_pos type i.
    data: v_ndjar type i.
    data: v_ndper type i,
          v_ndperndabp type i,
          v_ndjarndabp1 type i,
          v_ndjarndabp type i,
          value type i,
    date(10) type c value '2006.12.04'.
    data: c_0000(4) type c value '0000'.
    data: begin of it_final occurs 0,
             anlkl(8),
             bukrs(4),
             anln1 like anla-anln1,
             anln2 like anla-anln2,
             txt50 like anla-txt50,
             txa50 like anla-txa50,
             anlhtxt like anlh-anlhtxt,
             sernr like anla-sernr,
             invnr like anla-invnr,
             menge like anla-menge,
             meins like anla-meins,
             inken like anla-inken,
               ivdat like anla-ivdat,
             aktiv like anla-aktiv,
             gsber like anlz-gsber,
             kostl like anlz-kostl,
             kostlv like anlz-kostlv,
             werks like anlz-werks,
             stort like anlz-stort,
              raumn like anlz-raumn,
              txjcd like anlz-txjcd,
             ord41 like anla-ord41,
             ord44 like anla-ord44,
             gdlgrp like anla-gdlgrp,
             anlue like anla-anlue,
             lifnr like anla-lifnr,
             typbz like anla-typbz,
             aibn1 like anla-aibn1,
          aibn2 like anla-aibn2,
            aibdt like anla-aibdt,
             posnr like anla-posnr,
            vmgli like anla-vmgli,
            invzu like anla-invzu,
            ernam like anla-ernam,
            erdat like anla-erdat,
             afabe like anlb-afabe,
            afasl like anlb-afasl,
             ndjar like anlb-ndjar,
             ndper like anlb-ndper,
            afabg like anlb-afabg,
            ndabj like anlc-ndabj,
            ndabp like anlc-ndabp,
            andsj like anlc-andsj,
             andsp like anlc-andsp,
            safbg like anlb-safbg,
             umjar like anlb-umjar,
           inbda like anlb-inbda,
           kansw like anlc-kansw,
           knafa like anlc-knafa,
            kaafa like anlc-kaafa,
                     deakt like anla-deakt,
    kanza like anlc-kanza,
    kaufw like anlc-kaufw,
    kinvz like anlc-kinvz,
    ksafa like anlc-ksafa,
    kmafa like anlc-kmafa,
      end of it_final.
    data: begin of it_final_as91 occurs 0,
             anlkl(8),
             bukrs(4),
             anln1 like anla-anln1,
             anln2 like anla-anln2,
             txt50 like anla-txt50,
             txa50 like anla-txa50,
             anlhtxt like anlh-anlhtxt,
             sernr like anla-sernr,
             invnr like anla-invnr,
             menge like anla-menge,
             meins like anla-meins,
             inken like anla-inken,
             ivdat like anla-ivdat,
             aktiv like anla-aktiv,
             gsber like anlz-gsber,
             kostl like anlz-kostl,
             kostlv like anlz-kostlv,
             werks like anlz-werks,
             stort like anlz-stort,
             raumn like anlz-raumn,
             txjcd like anlz-txjcd,
             ord41 like anla-ord41,
             ord44 like anla-ord44,
             gdlgrp like anla-gdlgrp,
             anlue like anla-anlue,
             lifnr(10),
             typbz(15),
             aibn1 like anla-aibn1,
             aibn2 like anla-aibn2,
            aibdt like anla-aibdt,
             posnr like anla-posnr,
            vmgli like anla-vmgli,
            invzu like anla-invzu,
            ernam like anla-ernam,
            erdat like anla-erdat,
    end of it_final_as91.
    data: it_download_as91 like it_final_as91 occurs 0
                                              with header line."#EC NEEDED
    data: begin of it_final_as92 occurs 0,
             anlkl(8),
             bukrs(4),
             anln1 like anla-anln1,
             anln2 like anla-anln2,
             deakt like anla-deakt,
             ernam like anla-ernam,
             erdat like anla-erdat,
             afabe like anlb-afabe,
             afasl like anlb-afasl,
             ndjar like anlb-ndjar,
             ndper like anlb-ndper,
              afabg like date,
             ndabj(3) type c,
             ndabp(3) type c,
            kansw like anlc-kansw,
           knafa like anlc-knafa,
            kaafa like anlc-kaafa,
    kanza like anlc-kanza,
    kaufw like anlc-kaufw,
    kinvz like anlc-kinvz,
    ksafa like anlc-ksafa,
    kmafa like anlc-kmafa,
      end of it_final_as92.
    data: it_download_as92 like it_final_as92 occurs 0
                                              with header line."#EC NEEDED
    data: begin of it_values occurs 0,
             anlkl(8),
             bukrs(4),
             anln1 like anla-anln1,
             anln2 like anla-anln2,
             deakt like anla-deakt,
             afabe like anlb-afabe,
            afasl like anlb-afasl,
             ndjar like anlb-ndjar,
             ndper like anlb-ndper,
             afabg like date,
             ndabj(3) type c,
             ndabp(3) type c,
             afabe_02 like anlb-afabe,
             afasl_02 like anlb-afasl,
             ndjar_02 like anlb-ndjar,
             ndper_02 like anlb-ndper,
              afabg_02 like date,
             ndabj_02 like anlc-ndabj,
             ndabp_02 like anlc-ndabp,
            kansw01 like anlc-kansw,
           knafa01 like anlc-knafa,
            kaafa01 like anlc-kaafa,
              kansw02 like anlc-kansw,
           knafa02 like anlc-knafa,
            kaafa02 like anlc-kaafa,
              kansw03 like anlc-kansw,
           knafa03 like anlc-knafa,
            kaafa03 like anlc-kaafa,
              kansw04 like anlc-kansw,
           knafa04 like anlc-knafa,
            kaafa04 like anlc-kaafa,
              kansw05 like anlc-kansw,
           knafa05 like anlc-knafa,
            kaafa05 like anlc-kaafa,
           kansw06 like anlc-kansw,
           knafa06 like anlc-knafa,
           kaafa06 like anlc-kaafa,
           kansw07 like anlc-kansw,
           knafa07 like anlc-knafa,
           kaafa07 like anlc-kaafa,
           kansw08 like anlc-kansw,
           knafa08 like anlc-knafa,
           kaafa08 like anlc-kaafa,
           kansw09 like anlc-kansw,
           knafa09 like anlc-knafa,
           kaafa09 like anlc-kaafa,
    kanza01 like anlc-kanza,
    kaufw01 like anlc-kaufw,
    kinvz01 like anlc-kinvz,
    ksafa01 like anlc-ksafa,
    kmafa01 like anlc-kmafa,
      end of it_values.
    data: it_values_xls like it_values occurs 0
                                       with header line."#EC NEEDED
    data: begin of it_itab1 occurs 0,
           bukrs like anla-bukrs,
           anlkl like anla-anlkl,
           anln1 like anla-anln1,
             anln2 like anla-anln2,
           txt50 like anla-txt50,
           txa50 like anla-txa50,
           invnr like anla-invnr,
           ktogr like anla-ktogr,
           sernr like anla-sernr,
           menge like anla-menge,
           meins like anla-meins,
           ivdat like anla-ivdat,
           inken like anla-inken,
           aktiv like anla-aktiv,
           deakt like anla-deakt,
           zugdt like anla-zugdt,
           zujhr like anla-zujhr,
           zuper like anla-zuper,
           gdlgrp like anla-gdlgrp,
           anlue like anla-anlue,
           xafabch like anla-xafabch,
           aibn1 like anla-aibn1,
           aibn2 like anla-aibn2,
           aibdt like anla-aibdt,
           posnr like anla-posnr,
           ord41 like anla-ord41,
            ord44 like anla-ord44,
            vmgli like anla-vmgli,
             invzu like anla-invzu,
             typbz like anla-typbz,
             lifnr like anla-lifnr,
             ernam like anla-ernam,
             erdat like anla-erdat,
          end of it_itab1.
    data: begin of it_itab2 occurs 0,
            bukrs like anlz-bukrs,
            anln1 like anlz-anln1,
             anln2 like anla-anln2,
            bdatu like anlz-bdatu,
            werks like anlz-werks,
            gsber like anlz-gsber,
            kostl like anlz-kostl,
            kostlv like anlz-kostlv,
            stort like anlz-stort,
            raumn like anlz-raumn,
            txjcd like anlz-txjcd,
            ipsnr like anlz-ipsnr,
          end of it_itab2.
    data: begin of it_itab3 occurs 0,
            bukrs like anlh-bukrs,
            anln1 like anlh-anln1,
            anlhtxt like anlh-anlhtxt,
           end of it_itab3.
    data: begin of it_itab4 occurs 0,
            bukrs like anlb-bukrs,
            anln1 like anlb-anln1,
             anln2 like anla-anln2,
            afabe like anlb-afabe,
            bdatu like anlb-bdatu,
            afasl like anlb-afasl,
            ndjar like anlb-ndjar,
            ndper like anlb-ndper,
            afabg like anlb-afabg,
            ndurj like anlb-ndurj,
            ndurp like anlb-ndurp,
            umjar like anlb-umjar,
            safbg like anlb-safbg,
            zinbg like anlb-zinbg,
            inbda like anlb-inbda,
            end of it_itab4.
    data: begin of it_itab5 occurs 0,
           bukrs like anlc-bukrs,
           anln1 like anlc-anln1,
             anln2 like anla-anln2,
           gjahr like anlc-gjahr,
           afabe like anlc-afabe,
           zujhr like anlc-zujhr,
           zucod like anlc-zucod,
           ndabj like anlc-ndabj,
           ndabp like anlc-ndabp,
           kansw like anlc-kansw,
           knafa like anlc-knafa,
           kaafa like anlc-kaafa,
           ksafa like anlc-ksafa,
           andsj like anlc-andsj,
           andsp like anlc-andsp,
    kanza like anlc-kanza,
    kaufw like anlc-kaufw,
    kinvz like anlc-kinvz,
    kmafa like anlc-kmafa,
          end of it_itab5.
    ALV DECLARATIONS
    *--declarations for Xls sheet header field names
    data: begin of it_head occurs 0,
    column(70).
    data: end of it_head.
    data: begin of it_head1 occurs 0,
    column(70).
    data: end of it_head1.
    *--type declarations for field catalog for basic report
    data: it_fldcat_head  type slis_t_fieldcat_alv,
          wa_fldcat_head type slis_fieldcat_alv."#EC NEEDED
    data : w_field type slis_fieldcat_alv."#EC NEEDED
    data: it_fldcat_head1  type slis_t_fieldcat_alv,
          wa_fldcat_head1 type slis_fieldcat_alv."#EC NEEDED
    *--type declarations for layout design
    data: wa_layout type slis_layout_alv.
    *--type declarations for list header on grid
    *data: top_of_page type slis_t_listheader.
    *--declaration of variables
    data : w_repid like sy-repid.
    **selection-screen
    select-options: s_bukrs for anla-bukrs,
                    s_anln1 for anla-anln1.
    select-options: s_deakt for anla-deakt,
                    s_gjahr for anlc-gjahr obligatory,
                    s_anlkl for anla-anlkl,
                    s_date for anla-aktiv.
    *selection-screen
    selection-screen begin of block blk1 with frame title  text-022.
    selection-screen begin of line.
    parameters : r1 radiobutton group g1 default 'X'.
    selection-screen comment 20(50) text-020.
    selection-screen end of line.
    selection-screen begin of line.
    parameters : r2 radiobutton group g1.
    selection-screen comment 20(50) text-021.
    selection-screen end of line.
    selection-screen end of block blk1.
    selection-screen begin of block blk2 with frame title  text-023.
    select-options: s_ernam for anla-ernam,
                       s_erdat for anla-erdat .
    selection-screen end of block blk2.
    *--INITIALIZATION
    initialization.
      w_repid = sy-repid.
    at selection-screen.
      if r1 = 'X'.
        perform selection_screen_validation.
      endif.
      if r2 = 'X'.
        perform selection_screen_validation.
      endif.
    *--START-OF-SELCTION
    start-of-selection.
      if r1 = 'X'.
        perform populate-data.
        perform fill_finaldata.
       perform comment_build using top_of_page.
        perform xls_output.
        perform download.
      endif.
      if r2 = 'X'.
        perform populate-data.
        perform fill_finaldata.
        perform fill_as92data.
        perform putdata_horizontal.
        perform xls_output_as92.
        perform download_as92.
      endif.
    *--END-OF-SELCTION
    end-of-selection.
      if r1 = 'X'.
        perform build_layout.
        perform build_fieldcatalog.
       perform top_of_page.
        perform list-display.
      endif.
      if r2 = 'X'.
        perform build_layout.
        perform build_fieldcatalog1.
        perform list-display1.
      endif.
    *&      Form  SELECTION_SCREEN_VALIDATION
          text
    -->  p1        text
    <--  p2        text
    form selection_screen_validation.
    *--validating originating company code
      data: l_bukrs like anla-bukrs."#EC NEEDED
      if not s_bukrs[] is initial.
        select single bukrs from anla
               into l_bukrs
               where bukrs in s_bukrs.
        if sy-subrc <> 0.
          message e000 with text-001 .
        endif.
      endif.
    *--validating originating main asset no.
      data: l_anln1 like anla-anln1."#EC NEEDED
      if not s_anln1[] is initial.
        select single anln1 from anla
               into l_anln1
               where anln1 in s_anln1.
        if sy-subrc <> 0.
          message e000 with text-002 .
        endif.
      endif.
    *--validating originating Deactivation date
      data: l_deakt like anla-deakt."#EC NEEDED
      if not s_deakt[] is initial.
        select single deakt from anla
               into l_deakt
               where deakt in s_deakt.
        if sy-subrc <> 0.
          message e000 with text-004 .
        endif.
      endif.
    *--validating originating asset class.
      data: l_anlkl like anla-anlkl."#EC NEEDED
      if not s_anlkl[] is initial.
        select single anlkl from anla
               into l_anlkl
               where anlkl in s_anlkl.
        if sy-subrc <> 0.
          message e000 with text-006 .
        endif.
      endif.
    *--validating originating Date
      data: l_date like anla-aktiv."#EC NEEDED
      if not s_date[] is initial.
        select single aktiv from anla
               into l_date
               where aktiv in s_date.
        if sy-subrc <> 0.
          message e000 with text-007 .
        endif.
      endif.
    *--validating originating Fiscal year which first acquisition was posted
      data: l_gjahr like anlc-gjahr."#EC NEEDED
      if not s_gjahr[] is initial.
        select single gjahr from anlc
               into l_gjahr
               where gjahr in s_gjahr.
        if sy-subrc <> 0.
          message e000 with text-008.
        endif.
      endif.
      data: l_ernam like anla-ernam."#EC NEEDED
      if not s_ernam[] is initial.
        select single ernam from anla
               into l_ernam
               where ernam in s_ernam.
        if sy-subrc <> 0.
          message e000 with text-009.
        endif.
      endif.
      data: l_erdat like anla-erdat."#EC NEEDED
      if not s_erdat[] is initial.
        select single erdat from anla
               into l_erdat
               where erdat in s_erdat.
        if sy-subrc <> 0.
          message e000 with text-010.
        endif.
      endif.
    endform.                    " SELECTION_SCREEN_VALIDATION
    *&      Form  POPULATE-DATA
          text
    -->  p1        text
    <--  p2        text
    form populate-data.
      select bukrs
             anlkl
             anln1
             anln2
             txt50
             txa50
             invnr
             ktogr
             sernr
             menge
             meins
             ivdat
             inken
             aktiv
             deakt
             zugdt
             zujhr
             zuper
             gdlgrp
             anlue
             xafabch
             aibn1
             aibn2
             aibdt
             posnr
             ord41
             ord44
             vmgli
             invzu
             typbz
             lifnr
             ernam
             erdat
            from anla
                into table it_itab1
                where anlkl in s_anlkl and
                      anln1 in s_anln1 and
                      deakt in s_deakt and
                      bukrs in s_bukrs and
                      aktiv in s_date.
      if sy-subrc ne 0.
        message e000 with 'Data does not exist'(094).
      endif.
      if not it_itab1[] is initial.
        select bukrs
               anln1
               anln2
               bdatu
               werks
               gsber
               kostl
               kostlv
               stort
               raumn
               txjcd
               ipsnr
               from anlz
               into table it_itab2
               for all entries in it_itab1
               where bukrs = it_itab1-bukrs and
                     anln1 = it_itab1-anln1 and
                    anln2 = it_itab1-anln2.
                      anln2 = '0000'.
        if sy-subrc ne 0.
          message e000 with 'Data does not exist'(094).
        endif.
      endif.
      if not it_itab2[] is initial.
        select bukrs
               anln1
               anlhtxt
               from anlh
               into table it_itab3
        for all entries in it_itab2
        where bukrs = it_itab2-bukrs and
              anln1 = it_itab2-anln1.
        if sy-subrc ne 0.
          message e000 with 'Data does not exist'(094).
        endif.
      endif.
      if not it_itab1[] is initial.
        select bukrs
        anln1
        anln2
        afabe
        bdatu
        afasl
        ndjar
        ndper
        afabg
        ndurj
        ndurp
        umjar
        safbg
        zinbg
        inbda
        from anlb
        into table it_itab4
        for all entries in it_itab1
        where bukrs = it_itab1-bukrs and
              anln1 = it_itab1-anln1 and
             anln2 = it_itab1-anln2.
               anln2 = '0000'.
        if sy-subrc ne 0.
          message e000 with 'Data does not exist'(094).
        endif.
      endif.
      sort it_itab4  by bukrs anln1 anln2 afabe.
      if not it_itab4[] is initial.
        select bukrs
              anln1
              anln2
             gjahr
            afabe
            zujhr
            zucod
             ndabj
             ndabp
             kansw
             knafa
             kaafa
             ksafa
             andsj
             andsp
             kanza
    kaufw
    kinvz
    kmafa
             from anlc
             into table it_itab5
             for all entries in it_itab4
             where bukrs = it_itab4-bukrs and
                anln1 = it_itab4-anln1 and
               anln2 = it_itab4-anln2 and
                anln2 = '0000' and
                gjahr in s_gjahr.
        if sy-subrc ne 0.
          message e000 with 'Data does not exist'(094).
        endif.
      endif.
      sort it_itab5 by bukrs anln1 anln2 ndabj ndabp.
    endform.                    " POPULATE-DATA
    *&      Form  FILL_FINALDATA
          text
    -->  p1        text
    <--  p2        text
    form fill_finaldata.
      loop at it_itab5.
        loop at it_itab4 where bukrs = it_itab5-bukrs and
                            anln1 = it_itab5-anln1 and
                            anln2 = it_itab5-anln2 and
                            afabe = it_itab5-afabe.
          it_final-afabe = it_itab4-afabe.
          it_final-afasl = it_itab4-afasl.
          it_final-ndjar = it_itab4-ndjar.
          it_final-ndper = it_itab4-ndper.
          it_final-afabg = it_itab4-afabg.
          it_final-umjar = it_itab4-umjar.
          it_final-safbg = it_itab4-safbg.
          it_final-inbda = it_itab4-inbda.
          it_final-ndabj = it_itab5-ndabj.
          it_final-ndabp = it_itab5-ndabp.
          it_final-kansw = it_itab5-kansw.
          it_final-knafa = it_itab5-knafa.
          it_final-kaafa = it_itab5-kaafa.
          it_final-andsj = it_itab5-andsj.
          it_final-andsp = it_itab5-andsp.
          it_final-kanza = it_itab5-kanza.
          it_final-kaufw = it_itab5-kaufw.
          it_final-kinvz = it_itab5-kinvz.
          it_final-ksafa = it_itab5-ksafa.
          it_final-kmafa = it_itab5-kmafa.
          read table it_itab1 with key   bukrs = it_itab5-bukrs
                                      anln1 = it_itab5-anln1
                                      anln2 = it_itab5-anln2.
          if sy-subrc = 0.
            it_final-anlkl = it_itab1-anlkl.
            it_final-anln1 = it_itab1-anln1.
            it_final-anln2 = it_itab1-anln2.
            it_final-bukrs = it_itab1-bukrs.
            it_final-txt50 = it_itab1-txt50.
            it_final-txa50 = it_itab1-txa50.
            it_final-invnr = it_itab1-invnr.
            it_final-sernr = it_itab1-sernr.
            it_final-menge = it_itab1-menge.
            it_final-meins = it_itab1-meins.
            it_final-ivdat = it_itab1-ivdat.
            it_final-inken = it_itab1-inken.
            it_final-aktiv = it_itab1-aktiv.
            it_final-deakt = it_itab1-deakt.
            it_final-gdlgrp = it_itab1-gdlgrp.
            it_final-anlue = it_itab1-anlue.
            it_final-aibn1 = it_itab1-aibn1.
            it_final-aibn2 = it_itab1-aibn2.
            it_final-aibdt = it_itab1-aibdt.
            it_final-ord41 = it_itab1-ord41.
            it_final-ord44 = it_itab1-ord44.
            it_final-vmgli = it_itab1-vmgli.
            it_final-typbz = it_itab1-typbz.
            it_final-lifnr = it_itab1-lifnr.
            it_final-posnr = it_itab1-posnr.
            it_final-invzu = it_itab1-invzu.
          endif.
          read table it_itab2 with key   bukrs = it_itab5-bukrs
                                    anln1 = it_itab5-anln1
                                    anln2 = it_itab5-anln2.
          if sy-subrc = 0.
            it_final-werks = it_itab2-werks.
            it_final-gsber = it_itab2-gsber.
            it_final-kostl = it_itab2-kostl.
            it_final-kostlv = it_itab2-kostlv.
            it_final-stort = it_itab2-stort.
            it_final-raumn = it_itab2-raumn.
            it_final-txjcd = it_itab2-txjcd.
          endif.
          read table it_itab3 with key  bukrs = it_itab5-bukrs
                                     anln1 = it_itab5-anln1.
          if sy-subrc = 0.
            it_final-anlhtxt = it_itab3-anlhtxt.
          endif.
          append it_final.
          clear it_final.
        endloop.
      endloop.
      loop at it_final.
        move-corresponding it_final to it_final_as91.
        append it_final_as91.
        clear it_final_as91.
      endloop.
      delete adjacent duplicates from it_final_as91 comparing anlkl bukrs
      anln1 anln2.
      it_download_as91[] = it_final_as91[].
    endform.                    " FILL_FINALDATA
    *&      Form  BUILD_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    form build_layout.
      wa_layout-zebra = 'X'.
    endform.                    " BUILD_LAYOUT
    *&      Form  BUILD_FIELDCATALOG
          text
    -->  p1        text
    <--  p2        text
    form build_fieldcatalog.
      if it_fldcat_head is initial.
        v_pos = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'ANLKL'.
        wa_fldcat_head-seltext_l = 'Asset Class'(093).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'BUKRS'.
        wa_fldcat_head-seltext_l = 'Company'(092).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'ANLN1'.
        wa_fldcat_head-seltext_l = 'Asset No'(091).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'ANLN2'.
        wa_fldcat_head-seltext_l = 'Asset Sub No'(090).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'TXT50'.
        wa_fldcat_head-seltext_l = 'Asset Des.'(089).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'TXA50'.
        wa_fldcat_head-seltext_l = 'Asset Des.'(088).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'ANLHTXT'.
        wa_fldcat_head-seltext_l = 'Asset main no txt'(087).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'SERNR'.
        wa_fldcat_head-seltext_l = 's.no/Expl no.'(086).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'INVNR'.
        wa_fldcat_head-seltext_l = 'Inv No'(085).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'MENGE'.
        wa_fldcat_head-seltext_l = 'Qtty'(084).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'MEINS'.
        wa_fldcat_head-seltext_l = 'Units'(083).
        append wa_fldcat_head to it_fldcat_head.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'INKEN'.
        wa_fldcat_head-seltext_l = 'Inv indi.'(082).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'IVDAT'.
        wa_fldcat_head-seltext_l = 'Last inv date'(081).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'AKTIV'.
        wa_fldcat_head-seltext_l = 'Asset Capital date'(080).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'GSBER'.
        wa_fldcat_head-seltext_l = 'Busin. Area'(079).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'KOSTL'.
        wa_fldcat_head-seltext_l = 'cost centre'(078).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'KOSTLV'.
        wa_fldcat_head-seltext_l = 'CC respon.for asset'(077).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'WERKS'.
        wa_fldcat_head-seltext_l = 'Plant'(076).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'STORT'.
        wa_fldcat_head-seltext_l = 'Asset location'(075).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'RAUMN'.
        wa_fldcat_head-seltext_l = 'Room'(074).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'TXJCD'.
        wa_fldcat_head-seltext_l = 'Tax. Jur.'(073).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'ORD41'.
        wa_fldcat_head-seltext_l = 'Evaluation Grp 1'(072).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'ORD44'.
        wa_fldcat_head-seltext_l = 'Evaluation Grp 4'(071).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'GDLGRP'.
        wa_fldcat_head-seltext_l = 'Evalu. group 5'(070).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'ANLUE'.
        wa_fldcat_head-seltext_l = 'Asset Super No'(069).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'LIFNR'.
        wa_fldcat_head-seltext_l = 'Vendor Acct. No.'(068).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'TYPBZ'.
        wa_fldcat_head-seltext_l = 'Reference no'(067).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'AIBN1'.
        wa_fldcat_head-seltext_l = 'Original Asset Trans.'(066).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'AIBN2'.
        wa_fldcat_head-seltext_l = 'Original Asset Trans.'(065).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'AIBDT'.
        wa_fldcat_head-seltext_l = 'Trans. Asset'(064).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'POSNR'.
        wa_fldcat_head-seltext_l = 'WBS Elt. Invt. Proj.'(063).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'VMGLI'.
        wa_fldcat_head-seltext_l = 'Property clas.key'(062).
        append wa_fldcat_head to it_fldcat_head.
       V_POS = 0.
        v_pos = v_pos + 1.
        w_field-col_pos = v_pos.
        wa_fldcat_head-tabname = 'it_FINAL_AS91'.
        wa_fldcat_head-fieldname = 'INVZU'.
        wa_fldcat_head-seltext_l = 'suppl.inv spec.'(061).
        append wa_fldcat_head to it_fldcat_head.
      endif.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  COMMENT_BUILD
          text
         -->P_TOP_OF_PAGE  text
    *form comment_build using top_of_page type slis_t_listheader.
    data: ls_line type slis_listheader.
    ****Header
    clear : ls_line.
    ls_line-typ = 'H'.
    LS_LINE-KEY: not used for this type
    ls_line-info = 'ASSET MASTER DATA LIST'.
    append ls_line to top_of_page.
    ****Selection
    clear ls_line.
    ls_line-typ = 'S'.
    ls_line-key = 'Key 1'.
    ls_line-info = 'Asset Records'.
    append ls_line to top_of_page.
    ****Action
    clear ls_line.
    ls_line-typ = 'A'.
    LS_LINE-KEY: not used for this type
    ls_line-info = 'for AS91'.
    append ls_line to top_of_page.
    *endform. "comment_build
          FORM top_of_page                                              *
    *form top_of_page.
    call function 'REUSE_ALV_COMMENTARY_WRITE'
          exporting
               i_logo             = 'ENJOYSAP_LOGO'
               it_list_commentary = top_of_page.
    *endform. "top_of_page
    *&      Form  LIST-DISPLAY
          text
    -->  p1        text
    <--  p2        text
    form list-display.
    wa_layout-colwidth_optimize = 'X'.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program     = w_repid
               i_callback_top_of_page = 'TOP_OF_PAGE'
                is_layout              = wa_layout
                it_fieldcat            = it_fldcat_head
               i_background_id        = 'ALV_BACKGROUND'
           tables
                t_outtab               = it_final_as91
           exceptions
                program_error          = 1
                others                 = 2.
      if sy-subrc <> 0.
    write:/'No Top of Page'(098).
      endif.
    endform.                    " LIST-DISPLAY
    *&      Form  DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    form download.
      perform setup_header.
      call function 'DOWNLOAD'
           exporting
                filetype                = 'DAT'
           tables
                data_tab                = it_download_as91
                fieldnames              = it_head
           exceptions
                invalid_filesize        = 1
                invalid_table_width     = 2
                invalid_type            = 3
                no_batch                = 4
                unknown_error           = 5
                gui_refuse_filetransfer = 6
                customer_error          = 7
                others                  = 8.
      if sy-subrc <> 0.
    write:/'Error in file Type'(097).
      endif.
    endform.                    " DOWNLOAD
    *&      Form  setup_header
          text

  • How to download output into Excel with Header?

    Dear Friends,
        I want to download a my list output into excel format with <b>Column heading</b>. How will I do this?
        Another question is i want name of database table in Which SAP stores <b>DDIC object name and its property</b>, so that i can write Select * from ' ' where .... For example i have table ZABC with three fields so i need In which table it stores ZABC as table and a table in which it stores Its field name.

    Hi,
    Look at the sample code for Download into Excel.
    data: begin of excel_sum_it occurs 0,
          bukrs(80),
          belnr(80),
          gjahr(80),
          blart(80),
          budat like bkpf-budat,
          monat(80),
          cpudt like bkpf-cpudt,
          cputm like bkpf-cputm,
          usnam(80),
          tcode(80),
          xblnr(80),
          waers(80),
          dwrbtr(25),
          cwrbtr(25),
          end of excel_sum_it.
    data: begin of titles_it occurs 10,
          title(80),
    end of titles_it.
    at user-command.
      case sy-ucomm.
        when 'SUMMARY'.
          perform summary_download.
        when 'DETAIL'.
          perform detail_download.
        when others.
      endcase.
    ******Create one PF-STATUS for one push button for download.
    Before this FM you need to move your date to Execl_sum_it Internal table.
    For example here I used this table for down load.
    *&      Form  summary_download
          text
    -->  p1        text
    <--  p2        text
    form summary_download.
      data: fname like rlgrap-filename value 'Summary_Details.xls'.
      perform fill_titles.
      check not excel_sum_it[] is initial.
      call function 'DOWNLOAD'
           exporting
                filename                = fname
                filetype                = 'DAT'
           tables
                data_tab                = excel_sum_it
                fieldnames              = titles_it
           exceptions
                invalid_filesize        = 1
                invalid_table_width     = 2
                invalid_type            = 3
                no_batch                = 4
                unknown_error           = 5
                gui_refuse_filetransfer = 6
                customer_error          = 7
                others                  = 8.
      if sy-subrc ne 0.
        message e000 with text-e07.
      endif.
    endform.                    " summary_download
    *&      Form  fill_titles
          text
    -->  p1        text
    <--  p2        text
    form fill_titles.
      refresh titles_it.
      concatenate text-h06 text-h16 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h07 text-h17 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h08 text-h18 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h07 text-h19 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h09 text-h20 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h08 text-h21 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h11 text-h22 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h11 text-h23 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h12 text-h24  into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h13 text-h25 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h07 text-h26 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h13 text-h28  into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h14 text-h27 into titles_it-title
                                          separated by space.
      append titles_it.
      concatenate text-h15 text-h27 into titles_it-title
                                          separated by space.
      append titles_it.
    endform.                    " fill_titles
    ***Here in the FILL_TITLES you give you own HEADER .
    Thanks.
    If this helps you reward with points.

  • Problem in Download data into Excel File

    Hi Friends,
    I have one doubt on WDJ.
             I have got the data from the Back and display the data into Table UI Element. Depending upon po_status equals to OA Pending that time conf_Ship_date Column is Empty. That time we can Select All Checkbox Click on Download Button Excel file is not download. Why it not download? Conf_Ship_date Column is Empty. Conf_Ship_date Column is data available that time data download into Excel File.
    My Req: if Conf_Ship_date Column is empty that time click on Download that data will download in to Excel. In Excel Conf_Ship_date Column will display in NULL or 00.00.0000 Like this also.
    Code:ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date()); 
    This means I am getting date from PoDetails_OutTab(StockEle)this node and add this date to PoDetails_ExcelData(ExcelEle) this node.Finally the date will available in PoDetails_ExcelData this node. By Using this node I will download data.
    How to do this work?
    Regards
    Vijay

    Hi Arun,
    For Example in Table 4 rows and 14 columns data is available. Select all check boxes click on download button total 4 rows and 14 columns data is downloaded.
    Table 4 rows and 14 columns data is available. But in some cells data not available in that time I m getting null values from ECC System. That time I am not able to download.
    In Particularly this problem I am getting only date colums.
    So now I have develop this code
    public void onActiondownloadToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActiondownloadToExcel(ServerEvent)
         IPrivatePO_Details_ResultView.IPoDetails_ExcelDataNode ExcelNode = wdContext.nodePoDetails_ExcelData();
         IPrivatePO_Details_ResultView.IPoDetails_ExcelDataElement ExcelEle; 
         IPrivatePO_Details_ResultView.IPoDetails_OutTabNode StockNode = wdContext.nodePoDetails_OutTab();
         IPrivatePO_Details_ResultView.IPoDetails_OutTabElement StockEle ;
         for(int i = 0 ;i<StockNode.size();i++)
         StockEle = StockNode.getPoDetails_OutTabElementAt(i);
         if(StockEle.getCheckBox()== true)
         ExcelEle = ExcelNode.createPoDetails_ExcelDataElement();// Create Element
         if(StockEle.getConf_Shp_Date()==null)
         java.sql.Date deliverydate1=new java.sql.Date(0,0,0);
         ExcelEle.setConf_Shp_Date(deliverydate1);
         else
         ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date()); 
    By using this code i have to download total Records but in this Conf_Shp_Date colums i am getting 31-12.1899 this output in Excel. But i need in Excel to print Null or 00.00.0000 like
         ExcelEle.setQuantity(StockEle.getQuantity());
         ExcelEle.setDeliv_Date(StockEle.getDeliv_Date());
         if(StockEle.getExpt_Shp_Date()==null)
         java.sql.Date deliverydate2=new java.sql.Date(0,0,0);
         ExcelEle.setExpt_Shp_Date(deliverydate2);
         else
         ExcelEle.setExpt_Shp_Date(StockEle.getExpt_Shp_Date());
         ExcelEle.setVendor_Material(StockEle.getVendor_Material());
         ExcelNode.addElement(ExcelEle);
         if(ExcelNode.size()>0)
         wdThis.wdGetCO_POPendingController().downloadData(wdContext.nodePoDetails_ExcelData());// This is for Downalod data Method
         wdThis.wdGetCO_POPendingController().DownLoadToExcel();// This is for Open Popup Window
         wdContext.nodePoDetails_ExcelData().invalidate();
         else
         wdComponentAPI.getMessageManager().reportException("Please select any one po item from the table",true);
        //@@end
    Regards
    Vijay
    Edited by: KalluriVijay on May 18, 2010 10:05 AM

  • Regarding downloading data into excel from internal table

    hi all ,
    i'm using the function module  SAP_CONVERT_TO_XLS_FORMAT to download data of internal table into excel . now i need to know . when user presses the button for downlading it should download after downloading if he again tries to download it in the same  should not allow him to download or  it should refresh the excel of the speecific path and then it should downlaod . please let me know how  make it.

    Hi,
    Use below FM
    call function 'MS_EXCEL_OLE_STANDARD_DAT'
    exporting
    file_name = p_file " path offile where u need to download
    CREATE_PIVOT = 0
    DATA_SHEET_NAME = ' '
    PIVOT_SHEET_NAME = ' '
    PASSWORD = ' '
    PASSWORD_OPTION = 0
    tables
    PIVOT_FIELD_TAB =
    data_tab = <dyn_table>  "internal table with data
    *fieldnames = int_head "internal table with header
    exceptions
    file_not_exist = 1
    filename_expected = 2
    communication_error = 3
    ole_object_method_error = 4
    ole_object_property_error = 5
    invalid_filename = 6
    invalid_pivot_fields = 7
    download_problem = 8
    others = 9
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Regards,
    Prashant

  • Error while downloading data into excel file.

    Hi,
        I have a requirement to download data available in xstring to excel file.
    I have a RFC which has export parameter 'file_data' of type xstring. When i call RFC
    from web dynpro abap application it gives data out pout in xstring format.
    I am opening excel file using that xstring data as below
    cl_wd_runtime_services=>attach_file_to_response(
    i_filename = 'file.xls'
    i_content = ls_data_source-data_source   ***[xstring data from RFC]
    i_mime_type = 'x-excel/application'
    i_in_new_window = abap_true ).
    But excel file not coming in correct format. its  giving an error while download
    excel file
    Error is
          " the file you are trying to open , 'file[1].xls', is in a different format than
    specified by the file extension. Verify that the file is not corrupted and is from
    a trusted source before opening the file. Do you want to open the file now? "
    If i click on 'YES' button file opening but not in proper excel format. Data is coming
    in tab delimiter format in excel file.
    Please suggest any solution for this problem.
    Thanks,
    Venkat.

    Hi Thomas,
    Following is the logic implemented in RFC which is giving XSTRING as export parameter
    STEP1      create a dynamic internal table
               Create field catalog for the table   using LVC_FIELDCATALOG_MERGE
                   CALL METHOD cl_alv_table_create=>create_dynamic_table
                        EXPORTING
                           it_fieldcatalog = it_fieldcat
                         IMPORTING
                           ep_table        = dyn_table.
                  CREATE  EXCEL SHEET BY SENDING FIELD CATALOG AND DATA TAB
    STEP2 # Convert text table to xstring.
            CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
              IMPORTING
                buffer   = l_content
              TABLES
                text_tab = lt_data_tab
              EXCEPTIONS
                failed   = 1
                OTHERS   = 2.
    STEP3  *# Psss Data to Netweaver
              PERFORM pass_data_to_nw USING is_import
                                      CHANGING es_attachment_metadata.

  • Download Table Data into Excel with Less Size

    Hi All,
    In OBIEE 11.1.1.5, following are my finding of the File Sizes using Various Export Options.
    I have used Default SampleAppLite RPD and Webcat , Order Details Report
    No.of Records : 2000
    Export Excel 2003+ (mht) : 3,812 KB
    Export Power Point 2003+ : 8,901 KB
    Export Power Point 2007 : 478 KB
    Export Data CSV : 205 KB
    Export Data Tab Delimited : 409 KB
    When the viewscontrolmessages.xml is modified to from "Format=mht" to "Format=excel" for the Download to Excel option,
    the filw size was reduced to
    Export Excel (xls) : 2,748 KB
    By observing the drastic reduction of file size in the Export to Power Point options between Version 2003 and 2007.
    we are expecting that a Version Change in Excel might also reduce the Download Size to around 700 KB
    But somehow we are not able to achieve this.
    So please Suggest
    Note: CSV is not an Option, as we loose all Formatting like Grand and Sub Totals and other data level formatting.

    Hi All,
    In OBIEE 11.1.1.5, following are my finding of the File Sizes using Various Export Options.
    I have used Default SampleAppLite RPD and Webcat , Order Details Report
    No.of Records : 2000
    Export Excel 2003+ (mht) : 3,812 KB
    Export Power Point 2003+ : 8,901 KB
    Export Power Point 2007 : 478 KB
    Export Data CSV : 205 KB
    Export Data Tab Delimited : 409 KB
    When the viewscontrolmessages.xml is modified to from "Format=mht" to "Format=excel" for the Download to Excel option,
    the filw size was reduced to
    Export Excel (xls) : 2,748 KB
    By observing the drastic reduction of file size in the Export to Power Point options between Version 2003 and 2007.
    we are expecting that a Version Change in Excel might also reduce the Download Size to around 700 KB
    But somehow we are not able to achieve this.
    So please Suggest
    Note: CSV is not an Option, as we loose all Formatting like Grand and Sub Totals and other data level formatting.

  • Entering Data into Excel with Applescript

    I am looking to populate various worksheets in a single Excel file (Workbook?) with data that I enter via a dialog box in an Applescript. I'm a newbie and can't quite figure out the Applescript syntax of how to actually get data to be entered into an Excel cell.
    dan

    I only have 2004 to test on at the moment, and I can't see your whole worksheet, but:
    I made a file Workbook1.xls on my desktop and made the second worksheet name "Room 218".
    Entering "H,218" works OK with this script, so I suspect there's something odd about the two extra "activates" that you have in your code, unless it is to do with 2008.
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;">
    set a to text returned of (display dialog "Please enter the slot (A-H) and the room #, separating them with a comma:" default answer "")
    set astid to AppleScript's text item delimiters
    set AppleScript's text item delimiters to ","
    set AppleScript's text item delimiters to astid
    set {chosenslot, chosenroom} to {(a's text item 1), (a's text item 2)}
    tell application "Microsoft Excel"
    activate
    open workbook workbook file name ((path to desktop as text) & "Workbook1.xls")
    set worksheetname to "Room " & chosenroom
    activate object worksheet worksheetname
    set formula of range "J3" of worksheet worksheetname to chosenslot
    end tell </pre>
    Incidentally, all those commas in the formatted script threw me, and it happened to me as well.
    Insert this line at the top of the forum formatting script to be safe:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;">
    set AppleScript's text item delimiters to " "
    </pre>

  • Regarding downloading data into excel from alv output

    hi experts,
    i have developed a customized report(ALV) in which the employee number and all details are coming but when i press
    download to excel button and get downloaded it to the excel sheet the employee number is only not coming but all details are coming in the excel sheet.please help me to short out this problem.
    Also what i found that when i press print preview button then employee number here is also not coming but rest
      of the details are coming.

    Hi Ravi,
               For downloading the data from ALV to Excel use the following FM's
    SAP_CONVERT_TO_XLS_FORMAT
    GUI_DOWNLOAD.
    In the function GUI_DOWNLOAD use the filetype as "DBF" due to which all the data gets downloaded perfectly.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = fname
          FILETYPE                        = 'DBF'
        APPEND                          = ' '
        WRITE_FIELD_SEPARATOR           = ' '
        HEADER                          = '00'
        TRUNC_TRAILING_BLANKS           = ' '
        WRITE_LF                        = 'X'
        COL_SELECT                      = ' '
        COL_SELECT_MASK                 = ' '
        DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = ' '
        NO_AUTH_CHECK                   = ' '
        CODEPAGE                        = ' '
        IGNORE_CERR                     = ABAP_TRUE
        REPLACEMENT                     = '#'
        WRITE_BOM                       = ' '
        TRUNC_TRAILING_BLANKS_EOL       = 'X'
        WK1_N_FORMAT                    = ' '
        WK1_N_SIZE                      = ' '
        WK1_T_FORMAT                    = ' '
        WK1_T_SIZE                      = ' '
        WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      IMPORTING
        FILELENGTH                      =
        tables
          data_tab                        =  itab
        FIELDNAMES                      =
      EXCEPTIONS
        FILE_WRITE_ERROR                = 1
        NO_BATCH                        = 2
        GUI_REFUSE_FILETRANSFER         = 3
        INVALID_TYPE                    = 4
        NO_AUTHORITY                    = 5
        UNKNOWN_ERROR                   = 6
        HEADER_NOT_ALLOWED              = 7
        SEPARATOR_NOT_ALLOWED           = 8
        FILESIZE_NOT_ALLOWED            = 9
        HEADER_TOO_LONG                 = 10
        DP_ERROR_CREATE                 = 11
        DP_ERROR_SEND                   = 12
        DP_ERROR_WRITE                  = 13
        UNKNOWN_DP_ERROR                = 14
        ACCESS_DENIED                   = 15
        DP_OUT_OF_MEMORY                = 16
        DISK_FULL                       = 17
        DP_TIMEOUT                      = 18
        FILE_NOT_FOUND                  = 19
        DATAPROVIDER_EXCEPTION          = 20
        CONTROL_FLUSH_ERROR             = 21
        OTHERS                          = 22
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Pls reward if useful.
    Thanks,
    Sirisha.

  • Function module to download data into excel file

    Hi Friends,
    Please tell me the function module name which popsup a popup box to specify a filename and the location and when clicking on the OK button, the file should be downloaded to the specified location.
    I need it ASAP.
    Thanks,
    Jaffer Ali.S

    Hi Shamshudeen,
    You have to use two funtion modules to acheive this.
    1. To get the file path from user.
    2. To download the excel sheet in prescribed path.
    For 1 use following code
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath .
        CALL FUNCTION 'F4_FILENAME'
         EXPORTING
           program_name        = syst-cprog
           dynpro_number       = syst-dynnr
      FIELD_NAME          = ' '
         IMPORTING
           file_name           = p_fpath  .
    The file path will be stored in p_fpath.
    Now use GUI_DOWNLOAD function module and pass the file name p_fpath to it along with filetype as .xls
    Hope this helps you.
    Thanks,
    Arun

  • How to download data into  two different columns 2003 excel format in ole

    Hi ALL
    when we download data into excel using ole with delimiter it works fine in 2007 but when we check this with 2003 format
    both fields come in only one column .Can any one suggest  
      CONCATENATE WA_ALL-PERNR LV_ICNUM INTO WA_PERNR SEPARATED BY W_DELI   IN CHARACTER MODE.

    If you're already using OLE, you can fill in value for each cell separately instead of using a delimiter. Something like this fragment:
    FORM fill_cell USING p_row p_col p_value.
      CALL METHOD OF obj_excel 'CELLS' = obj_cell
        EXPORTING
        #1 = p_row
        #2 = p_col.
      SET PROPERTY OF obj_cell 'VALUE' = p_value.
    ENDFORM.                    "fill_cell

  • Download BSP data into Excel

    Hello all,
    I want create a BSP page, with 2 radio buttons,
    If 1st selected I want read 2 tables and display data other BSP page.
    If 2nd one selected I want download 2 tables data into excel file.
    Any one can help how to download data into excel file and display data into other bsp page.
    Thanks,
    Regards,
    Venkat

    For downloading to a spread sheet:
    Convert your fetched data to a string and convert to XSTRING format and finally download to a spread sheet.
    Sample: I selected data from vbak say vbeln and kunnr in an internal table.
    data : v_string type string, v_xstring type xstring.
    <header portion - to have the heading in the spread sheet>
    concatenate 'Order Number' 'Customer'
       cl_abap_char_utilities=>cr_lf into v_string
       separated by cl_abap_char_utilities=>horizontal_tab.
    <Line item entries from my internal table say i_vbak>
    loop at i_vbak into wa_vbak.
      concatenate v_string wa_vbak-vbeln wa_vbak-kunnr
       cl_abap_char_utilities=>cr_lf into v_string
       separated by cl_abap_char_utilities=>horizontal_tab.
    endloop.
    All the data is now in string format. Calling the FM to convert to XSTRING
      call function 'SCMS_STRING_TO_XSTRING'
        exporting
          text     = v_string
          mimetype = 'APPLICATION/MSEXCEL; charset=utf-16le' (probably create this in a variable and call here)
        importing
          buffer   = v_xstring.
    concatenate cl_abap_char_utilities=>byte_order_mark_little v_xstring into v_xstring in byte mode.
    Now we have it in XSTRING format - this can be downloaded to a spread sheet.
    v_appl = 'APPLICATION/MSEXCEL; charset=utf-16le'.
    runtime->server->response->set_header_field( name = 'content-type' value = v_appl ).
    Eliminating the cache problems when loading Excel Format
    runtime->server->response->delete_header_field( name = if_http_header_fields=>cache_control ).
    runtime->server->response->delete_header_field( name = if_http_header_fields=>expires ).
    runtime->server->response->delete_header_field( name = if_http_header_fields=>pragma ).
    Start excel in a separate window
    runtime->server->response->set_header_field( name = 'content-disposition' value = 'attachment; filename=Order_list.xls' ).
    Displaying the data in excel.
    v_len = xstrlen( v_xstring ).
    runtime->server->response->set_data( data = v_xstring length = v_len ).
    navigation->response_complete( ).
    All the above code can be written in onInputprocessing event (probably your loop/selection can be in a method of your appl class).
    I believe you are triggering the event based on a click (say radio button or a button after selecting the radiobutton).
    In the other screen you can use tableview to display your data - probably two sub screens(page fragment) to display each table.
    Regds,
    Krish

Maybe you are looking for

  • No menu option for Review Acrobat 9

    I haev Acrobat Pro 9 on a windows XP machine.  I had previously created PDF from MS Word documents and sent them for shared review with no problem. Today, I do not have the option int he file menu to initiate this process anymore. Does anyone know wh

  • How can I monitor selects on a table?

    I have just been asked to develop a trigger to count all selects on a table, but I don't see how triggers could be activated by a select statement. Is there another way to do this? Thanks very much, Craig Addleman Jr. DBA

  • Why can't I subcribe to integrated messaging on my droid turbo?

    I have tried all day to subscribe to this program, but I continue to receive a message about a code. I no longer can receive text messages and this is becoming frustrating.

  • Handling Units Print Program

    Hi, I have handling units defined in VL01N to do the packing of the materials. Now it is necessary to print a label with the info of each HU. What is the stadard SAP Program to print these HU based forms?

  • Remember site under linux

    In which file camera access settings for site are saved under linux? Have suspect that smth wrong with them, because for both http://mailvu.com/testCamera/TestYourWebCam.html http://www.testwebcam.com/ i've got error while trying to remeber my allow