Write to Excel Sheets dynamically -URGENT

how to write to the excel sheets dynamically after the query excuetion.I am using MA access DB....

Please do not cross-post!

Similar Messages

  • Help needed to write in excel sheet

    Hi,
    I currently need to read a table and write it in a file.
    iam able to do it by using UTL package.The utl file also writes in xls format.but if a record has two column.
    both the columns are written in a single column in excel
    sheet.Kindly suggest me how to solve this problem
    Thanks in advance.

    1. spool a file with 'csv' extension using Sql*Plus.
    2. Use a delimiter for columns.
    For example,
    select '"'||column1||'","'||column2||'"'
    from mytable

  • How to add number to excel sheet work book cell?

    I am trying to create an excel sheet dynamically. I am able to create and populate the data as well.
    But in one of the cell I have to add 1.0 value. Since I have added this as a new Label(...), after opening the excel sheet I can see an icon in the cell with message as "Number in this cell is formed as a text".
    SO I have changed Label to Number while adding to cell.
    I am using the format as "#.#". Othen than 1.0 everything I can see in the cell as x.y format. Like 1.2, 5.7 etc...
    But for 1.0 I can see as "1." only.
    Is there any way to write 1.0 to cell as a number.
    I am using jxl.jar for excel.

    I have jxl supported api.
    It supports formating the numbers.
    It has NumberFormat class to support formating.
    NumberFormat format = new Numberformat("#.#");
    WritableCellFormat cellFormat = new WritableCellFormat(format);
    excelSheet.addCell(new Number(1, 0, 1.0, cellFormat);
    Api for Number : Number(int column, int row, double value, Cellformat ft);
    If I add other than 1.0, data is displayed properly in the sheet.
    1.2, 4.5, 3.567 --> 3.6 etc...

  • Naming of Excel sheets or tab in SSRS

    I am making a report in SSRS that will be exported to Excel. It displays data from all departments in organization. 
    The first sheet of the report will have a static name for e.g. "Master Report" and it will display data of all departments in single sheet.
    Other sheets will have dynamic name depending on department and will display data of that particular department.
    So it will become something like as shown in picture below.
    I have already made the Master Report and now I want to display those individual department reports but problem is how do I name those sheets? Both these reports will use different data set. If I set the **InitialPageName** property of report to "Master
    Report" then it sets this name for all sheets. If I use an expression for e.g. **=First(Fields!Dept_Title.Value, "ALL_DEPARTMENTS")** then it picks up first department name and then use it for all sheets because as I told above, there are two
    different data sets.  
    Using subreport is of no help either because it doesn't show subreports InitialPageName as Excel sheet name and always uses Main reports name.
    How to solve this issue?

    How did you implement the individual department reports?  Do they all have the same layout?  If yes then you can just group the tablix on the Department label field and use that field in the expression for InitialPageName.
    Have a read through following article, it's using that technique: Naming Excel Sheets Dynamically
    [SSRS]
    For a more complicated layout you could nest a subreport inside the tablix.  But complicated
    layouts usually don't export well to Excel (I mean in a practical way for further analysis by using Excel) so be careful with that...
    SQL Server MVP, MCITP/MCTS SQL Server 2008
    Check out my articles at BI: Beer Intelligence

  • To Mak the headings Bold in Excel sheet.

    Hi All,
         I am sending a mail to SAP inbox with an excel Sheet as an attachment.
         I am creating the Excel sheet Dynamically from the internal table,
         Now the Problem is the Headings i am putting in each colum are mixed with the data of the colums,
         So I have to make the headings<b> BOLD</b> or atleast I have to Differentiate them with the rest of the Data,
         Please Help me out in this,
    Thanx,   Girish.

    Hi Girish,
                 Check out the example.gs_font is marked in bold
    Code Part B.1 Data declarations
    REPORT zole_tutor_example_ms_word .
    *--Include for OLE-enabling definitions
    INCLUDE ole2incl .
    *--Global variables
    *--Variables to hold OLE object and entity handles
    DATA gs_word TYPE ole2_object . "OLE object handle
    DATA gs_documents TYPE ole2_object . "Documents
    DATA gs_actdoc TYPE ole2_object . "Active document
    DATA gs_application TYPE ole2_object . "Application
    DATA gs_options TYPE ole2_object . "Application options
    DATA gs_actwin TYPE ole2_object . "Active window
    DATA gs_actpan TYPE ole2_object . "Active pane
    DATA gs_view TYPE ole2_object . "View
    DATA gs_selection TYPE ole2_object . "Selection
    <b>DATA gs_font TYPE ole2_object . "Font</b>
    DATA gs_parformat TYPE ole2_object . "Paragraph format
    DATA gs_tables TYPE ole2_object . "Tables
    DATA gs_range TYPE ole2_object . "Range handle for various ranges
    DATA gs_table TYPE ole2_object . "One table
    DATA gs_table_border TYPE ole2_object . "Table border
    DATA gs_cell TYPE ole2_object . "One cell of a table
    DATA gs_paragraph TYPE ole2_object . "Paragraph
    DATA gv_pos(5) TYPE n . "Position information for table
    Step 2   Creating the OLE object and get main entities to handle variables.
    START-OF-SELECTION .
    *--Creating OLE object handle variable
    CREATE OBJECT gs_word 'WORD.APPLICATION' .
    IF sy-subrc NE 0 .
    MESSAGE s000(su) WITH 'Error while creating OLE object!'.
    LEAVE PROGRAM .
    ENDIF .
    *--Setting object's visibility property
    SET PROPERTY OF gs_word 'Visible' = '1' .
    *--Opening a new document
    GET PROPERTY OF gs_word 'Documents' = gs_documents .
    CALL METHOD OF gs_documents 'Add' .
    *--Getting active document handle
    GET PROPERTY OF gs_word 'ActiveDocument' = gs_actdoc .
    *--Getting applications handle
    GET PROPERTY OF gs_actdoc 'Application' = gs_application .
    Code Part B.2 Creating the OLE object
    Step 3   Setting the measurement unit to ‘CM.’
    Code Part B.3 Setting measurement unit
    *--Setting the measurement unit
    GET PROPERTY OF gs_application 'Options' = gs_options .
    SET PROPERTY OF gs_options 'MeasurementUnit' = '1' . "CM
    Step 4   Some header text.
    Code Part B.4 Setting header content
    *--Getting handle for the selection which is here the character at the
    *--cursor position
    GET PROPERTY OF gs_application 'Selection' = gs_selection .
    GET PROPERTY OF gs_selection 'Font' = gs_font .
    GET PROPERTY OF gs_selection 'ParagraphFormat' = gs_parformat .
    *--Setting font attributes
    SET PROPERTY OF gs_font 'Name' = 'Arial' .
    SET PROPERTY OF gs_font 'Size' = '10' .
    SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
    SET PROPERTY OF gs_font 'Italic' = '1' . "Italic
    SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
    *--Setting paragraph format attribute
    SET PROPERTY OF gs_parformat 'Alignment' = '2' . "Right-justified
    CALL METHOD OF gs_selection 'TypeText'
    EXPORTING
    #1 = 'This is an OLE example!'.
    *--Setting the view to the main document again
    SET PROPERTY OF gs_view 'SeekView' = '0' . "Main document view
    Step 5   Writing the title.
    Code Part B.5 Writing the title
    *--Reseting font attributes for the title
    SET PROPERTY OF gs_font 'Name' = 'Times New Roman' .
    SET PROPERTY OF gs_font 'Size' = '16' .
    SET PROPERTY OF gs_font 'Bold' = '1' . "Bold
    SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
    SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
    *--Setting paragraph format attribute
    SET PROPERTY OF gs_parformat 'Alignment' = '1' . "Centered
    CALL METHOD OF gs_selection 'TypeText'
    EXPORTING
    #1 = text-000.
    *--Advancing cursor to the new line
    CALL METHOD OF gs_selection 'TypeParagraph' .
    Step 6   Writing some text.
    Code Part B.6 Writing some text
    *--Reseting font attributes for ordinary text
    SET PROPERTY OF gs_font 'Name' = 'Times New Roman' .
    SET PROPERTY OF gs_font 'Size' = '12' .
    SET PROPERTY OF gs_font 'Bold' = '0' . "Not bold
    SET PROPERTY OF gs_font 'Italic' = '0' . "Not Italic
    SET PROPERTY OF gs_font 'Underline' = '0' . "Not underlined
    Please reward if useful.

  • Urgent: Sending an Email with Excel sheet attachment

    Hi All,
    I am preparing a report and has to send mail with excel sheet attachement. In report i am getting everything fine. But in the mail i am not getting the data, data is passing to the FM succesfully. But in the mail, excel is not having full data.
    the below mentioned is my code.
    i_texts-line = c_stern.
      i_texts-line+254(1) = c_newline.
      APPEND i_texts.
      LOOP AT i_texc.
        i_att_line-line = i_texc.
        APPEND i_att_line.
      ENDLOOP.
      DATA: wa_doc_chng LIKE sodocchgi1.
      DATA: w_tab_lines LIKE sy-tabix.
      STATICS: c_body_start TYPE i VALUE '1'.
      CONSTANTS: lc_filename(10) TYPE c VALUE 'Attachment',
                 lc_atthead(30)  TYPE c VALUE 'Manually released invoices'.
      DATA: i_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA: w_doc_name(30) TYPE c.
      DATA: l_text1(15),
            l_text2(12),
            l_text3(15),
            l_text4(15),
            l_text5(14),
            l_text6(17),
            l_text7(10),
            l_text8(20),
            l_text9(19),
            l_text10(19),
            l_text11(19),
            l_text12(16),
            l_text13(20),
            l_text14(19),
            l_text15(19),
            l_text16(30).
      DATA: DATE(10),
            DT(2),
            MON(3),
            YR(4),
            lc_final(50).
      CLEAR: i_texts, i_reci,i_att_line.                "i_bname,
      REFRESH: i_texts, i_reci,i_att_line.              "i_bname,
      WRITE sy-datum TO w_datex.
      WRITE sy-uzeit TO w_timex.
      l_text1 = text-003.
      l_text2 = text-004.
      l_text3 = text-005.
      l_text4 = text-006.
      l_text5 = text-007.
      l_text6 = text-008.
      l_text7 = text-009.
      l_text8 = text-010.
      l_text9 = text-011.
      l_text10 = text-012.
      l_text11 = text-013.
      l_text12 = text-014.
      l_text13 = text-015.
      l_text14 = text-016.
      l_text15 = text-017.
      l_text16 = text-026.
      CONCATENATE
      l_text1
      l_text2
      l_text3
      l_text4
      l_text5
      l_text6
      l_text7
      l_text8
      l_text9
      l_text10
      l_text11
      l_text12
      l_text13
      l_text14
      l_text15
      l_text16
      INTO i_texts SEPARATED BY
      c_horz_tab.
      i_texts-line+254(1) = c_newline.
      APPEND i_texts.
      CLEAR  i_texts.
      LOOP AT i_texc.
        i_att_line-line = i_texc.
        APPEND i_att_line.
      ENDLOOP.
      LOOP AT so_rec.
        i_reci-receiver = so_rec-low.
        i_reci-express = 'X'.
        i_reci-rec_type = 'U'.
        APPEND i_reci.
      ENDLOOP.
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      READ TABLE i_texts INDEX w_tab_lines.
      wa_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( i_texts ).
      wa_obj_name   = 'ZFI_XX_REL_BLOCKED_INVOICE_01'.
      DT  = SY-DATUM+6(2).
      MON = SY-DATUM+4(2).
      YR  = SY-DATUM+0(4).
      CONCATENATE DT MON YR INTO DATE SEPARATED BY '-'.
      CONCATENATE lc_atthead date into lc_final separated by ' '.
      MOVE lc_final
                   TO wa_obj_descr .
      wa_doc_chng-obj_name  = wa_obj_name.
      wa_doc_chng-obj_descr = wa_obj_descr.
      CLEAR i_objpack-transf_bin.
      i_objpack-head_start = 1.
      i_objpack-head_num = 0.
      i_objpack-body_start = 0.
      i_objpack-body_num = w_tab_lines.
      i_objpack-doc_type = 'RAW'.
      APPEND i_objpack.
      APPEND LINES OF i_att_line TO i_texts.
      LOOP AT i_arseg INTO wa_arseg.
        i_xmplt_d-belnr = wa_arseg-belnr.
        i_xmplt_d-budat = wa_arseg-budat.
        i_xmplt_d-bukrs = wa_arseg-bukrs.
        i_xmplt_d-lifnr = wa_arseg-lifnr.
        i_xmplt_d-name1_lifnr = wa_arseg-name1_lifnr.
        i_xmplt_d-wrbtr = wa_arseg-wrbtr.
        i_xmplt_d-waers = wa_arseg-waers.
        i_xmplt_d-ebeln = wa_arseg-ebeln.
        i_xmplt_d-ebelp =  wa_arseg-ebelp.
        i_xmplt_d-reason = wa_arseg-reason.
        i_xmplt_d-dmeng = wa_arseg-dmeng.
        i_xmplt_d-dwert = wa_arseg-dwert.
        i_xmplt_d-bname = wa_arseg-bname.
        i_xmplt_d-name_text = wa_arseg-name_text.
        i_xmplt_d-udate = wa_arseg-udate.
        i_xmplt_d-comment =  wa_arseg-comment.
        APPEND i_xmplt_d.
      ENDLOOP.
      LOOP AT i_xmplt_d.
        CONCATENATE i_xmplt_d-belnr
                    i_xmplt_d-budat
                    i_xmplt_d-bukrs
                    i_xmplt_d-lifnr
                    i_xmplt_d-name1_lifnr
                    i_xmplt_d-wrbtr
                    i_xmplt_d-waers
                    i_xmplt_d-ebeln
                    i_xmplt_d-ebelp
                    i_xmplt_d-reason
                    i_xmplt_d-dmeng
                    i_xmplt_d-dwert
                    i_xmplt_d-bname
                    i_xmplt_d-name_text
                    i_xmplt_d-udate
                    i_xmplt_d-comment
                    INTO i_texts SEPARATED
                    BY c_horz_tab.
        i_texts-line+254(1) = c_newline.
        APPEND i_texts.
        CLEAR i_texts.
      ENDLOOP.
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      READ TABLE i_texts INDEX w_tab_lines.
      wa_doc_chng-doc_size = ( w_tab_lines - 1 ) * 255 + STRLEN( i_texts ).
      DESCRIBE TABLE i_texts LINES w_tab_lines.
      i_objpack-transf_bin = ' '.
      i_objpack-head_start = 0.
      i_objpack-head_num = 0.
      i_objpack-body_start = 1.
      i_objpack-body_num = w_tab_lines.
      i_objpack-doc_type = 'XLS'.
      i_objpack-obj_name = 'Attachment'.
    i_objpack-obj_descr = w_doc_name.
      i_objpack-obj_descr = lc_filename.
      i_objpack-doc_size = w_tab_lines * 255.
      APPEND i_objpack.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
        TABLES
          packing_list               = i_objpack
          contents_txt               = i_texts
          receivers                  = i_reci
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc = 0.
        COMMIT WORK.
      ELSE.
        WRITE: / 'Error in send E-Mail' .
      ENDIF.
    please revert me asap. It is very urgent to me. thanks in advance.
    Bye

    hI
    Have you build your Excel Data table to get attachement in Mail? If no then please find the Eg. code for your reference to send Excel attachment..
    * End of Selection Event : Displaying the selected data                *
    END-OF-SELECTION.
        PERFORM EMAIL_EXCEL_ATTACHMENT.
    ******///form
    FORM EMAIL_EXCEL_ATTACHMENT .
    * Populate table with detaisl to be entered into .xls file
      PERFORM BUILD_XLS_DATA_TABLE.
    * Populate message body text
      PERFORM POPULATE_EMAIL_MESSAGE_BODY.
    * Send file by email as .xls speadsheet
      PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
                                   TABLES IT_MESSAGE
                                          IT_ATTACH
                                    USING S_EMAIL
                                          TEXT-042
                                          C_XLS
                                          'filename'
                                 CHANGING GD_ERROR
                                          GD_RECIEVER.
    *   Instructs mail send program for SAPCONNECT to send email(rsconn01)
      PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
    ENDFORM.                    " EMAIL_EXCEL_ATTACHMENT
    ********///form BUILD_XLS_DATA_TABLE
    FORM BUILD_XLS_DATA_TABLE .
      DATA :    LV_NETWR(20)     TYPE C,
                LV_BOL_DATE(20)  TYPE C,
                LV_KAWRT(20)     TYPE C,
                LV_FKDAT(20)     TYPE C,
                LV_WAERK(20)     TYPE C,
                LV_KURRF(20)     TYPE C,
                LV_SHIPDATE(20)  TYPE C,
                LV_DEPTDATE(20)  TYPE C.
      CONSTANTS:
          CON_TAB  TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
          CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.  "#EC *
      DATA STR TYPE STRING.
    **********/ this parameter concatenate to get headers
      CONCATENATE STR
      'SLNO'
      'OWNER'
      'SERIAL NO'
      'FROM'
      'DESTINATION'
      'INVOICE VALUE'
      'DESCRIPTION'
      'CUSTOMER NAME'
      'BL NUMBER'
      'BL DATE'
      'VESSEL NAME/AIRLINE DETAILS'
      'MODE OF TRANSIT'
      'SHIPPING MARKS'
      'DUTY SUM INSURED'
      'FLAG'
      'OPEN COVERNO'
      'INVOICE DATE'
      'INVOICE NO'
      'LC WORDING'
      'QUANTITY'
      'PACKAGING DETAILS'
      'BASIS OF VALUATION'
      'EXCLUDE WAR SRCC'
      'CURRENCY'
      'EXCHANGE RATE'
      'ADDRESS'
      'VESSEL BUILT YEAR'
      'VESSEL FLAG'
      'VOYAGE NO'
      'SHIPMENT DATE'
      'DEPARTURE DATE'
      'SURVEYOR COUNTRY'
      'SURVEYOR CITY'
      'SURVEYOR AGENT'
      'SURVEYOR ADDRESS'
      'EXPORT CONSIGNMENT'
      'CONTAINER DETAILS'
      CL_ABAP_CHAR_UTILITIES=>CR_LF INTO STR SEPARATED BY CON_TAB.
      LOOP AT IT_FINAL.
    *******/ this is to pass body / row data
        WRITE : IT_FINAL-NETWR    TO LV_NETWR,              "#EC UOM_IN_MES
                IT_FINAL-BOL_DATE TO LV_BOL_DATE,
                IT_FINAL-KAWRT    TO LV_KAWRT,              "#EC UOM_IN_MES
                IT_FINAL-FKDAT    TO LV_FKDAT,
                IT_FINAL-WAERK    TO LV_WAERK,
                IT_FINAL-KURRF    TO LV_KURRF,
                IT_FINAL-SHIPDATE TO LV_SHIPDATE,
                IT_FINAL-DEPTDATE TO LV_DEPTDATE.
        CONCATENATE
               STR
               IT_FINAL-SLNO
               IT_FINAL-OWNER
               IT_FINAL-SRNO
               IT_FINAL-PORT_LOAD
               IT_FINAL-PORT_DSCHR
               LV_NETWR
               IT_FINAL-DESCRIP
               IT_FINAL-CUSTNAME
               IT_FINAL-BOL_NUM
               LV_BOL_DATE
               IT_FINAL-VESSELNAME
               IT_FINAL-SHP_TYPE
               IT_FINAL-SHP_MARK
               LV_KAWRT
               IT_FINAL-FLAG
               IT_FINAL-OPEN_CONO
               LV_FKDAT
               IT_FINAL-VBELN
               IT_FINAL-LC_WORD
               IT_FINAL-QUANT
               IT_FINAL-PACKDETL
               IT_FINAL-INCO1
               IT_FINAL-EXCWSR
               LV_WAERK
               LV_KURRF
               IT_FINAL-ADDPAY
               IT_FINAL-VESSBYR
               IT_FINAL-VESSFLG
               IT_FINAL-VOY_FLY_NO
               LV_SHIPDATE
               LV_DEPTDATE
               IT_FINAL-SURCOUNT
               IT_FINAL-INCO2
               IT_FINAL-EXPORT_CON
               IT_FINAL-SURAGT
               IT_FINAL-SURADD
               IT_FINAL-CONTRNO
       CL_ABAP_CHAR_UTILITIES=>CR_LF INTO STR SEPARATED BY CON_TAB.
      ENDLOOP.
      CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
        EXPORTING
          TEXT      = STR
        TABLES
          FTEXT_TAB = IT_ATTACH.
    ENDFORM.                    " BUILD_XLS_DATA_TABLE
    ******// form POPULATE_EMAIL_MESSAGE_BODY
    FORM POPULATE_EMAIL_MESSAGE_BODY .
      REFRESH IT_MESSAGE.
      IT_MESSAGE = TEXT-043.  " Please find attached Insurance Certificate details
      APPEND IT_MESSAGE.
    ENDFORM.                    " POPULATE_EMAIL_MESSAGE_BODY
    *******'/ form SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
    *       text
    *      -->PIT_MESSAGE           text
    *      -->PIT_ATTACH            text
    *      -->P_EMAIL               text
    *      -->P_MTITLE              text
    *      -->P_FORMAT              text
    *      -->P_FILENAME            text
    *      -->P_ATTDESCRIPTION      text
    *      -->P_SENDER_ADDRESS      text
    *      -->P_SENDER_ADDRES_TYPE  text
    *      -->P_ERROR               text
    *      -->P_RECIEVER            text
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES PIT_MESSAGE
                                              PIT_ATTACH
                                        USING P_EMAIL
                                              P_MTITLE
                                              P_FORMAT
                                              P_FILENAME
                                              P_ATTDESCRIPTION
                                              P_SENDER_ADDRESS
                                              P_SENDER_ADDRES_TYPE
                                     CHANGING P_ERROR
                                              P_RECIEVER.       "#EC *
      DATA: LD_ERROR    TYPE SY-SUBRC,                          "#EC *
    *        LD_RECIEVER TYPE SY-SUBRC,
            LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
    *        LD_EMAIL LIKE  SOMLRECI1-RECEIVER,
            LD_FORMAT TYPE  SO_OBJ_TP ,
            LD_ATTDESCRIPTION TYPE  SO_OBJ_NAM ,
            LD_ATTFILENAME TYPE  SO_OBJ_DES ,
            LD_SENDER_ADDRESS LIKE  SOEXTRECI1-RECEIVER,
            LD_SENDER_ADDRESS_TYPE LIKE  SOEXTRECI1-ADR_TYP,
            LD_RECEIVER LIKE  SY-SUBRC.                         "#EC *
    *  ld_email   = p_email.
      LD_MTITLE = P_MTITLE.
      LD_FORMAT              = P_FORMAT.
      LD_ATTDESCRIPTION      = P_ATTDESCRIPTION.
      LD_ATTFILENAME         = P_FILENAME.
      LD_SENDER_ADDRESS      = P_SENDER_ADDRESS.
      LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
    * Fill the document data.
      W_DOC_DATA-DOC_SIZE = 1.
    * Populate the subject/generic message attributes
      W_DOC_DATA-OBJ_LANGU = SY-LANGU.
      W_DOC_DATA-OBJ_NAME  = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
      W_DOC_DATA-SENSITIVTY = 'F'.
    * Fill the document data and get size of attachment
      CLEAR W_DOC_DATA.
      DESCRIBE TABLE IT_ATTACH LINES W_CNT.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
         W_CNT * 255 + STRLEN( IT_ATTACH ).
      W_DOC_DATA-OBJ_LANGU  = SY-LANGU.
      W_DOC_DATA-OBJ_NAME   = 'SAPRPT'.
      W_DOC_DATA-OBJ_DESCR  = LD_MTITLE.
      W_DOC_DATA-SENSITIVTY = 'F'.
      CLEAR T_ATTACHMENT.
      REFRESH T_ATTACHMENT.
      T_ATTACHMENT[] = PIT_ATTACH[].
    * Describe the body of the message
      CLEAR T_PACKING_LIST.
      REFRESH T_PACKING_LIST.
      T_PACKING_LIST-TRANSF_BIN = SPACE.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM = 0.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE = 'raw'.
      APPEND T_PACKING_LIST.
    * Create attachment notification
      T_PACKING_LIST-TRANSF_BIN = 'X'.
      T_PACKING_LIST-HEAD_START = 1.
      T_PACKING_LIST-HEAD_NUM   = 1.
      T_PACKING_LIST-BODY_START = 1.
      DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
      T_PACKING_LIST-DOC_TYPE   =  LD_FORMAT.
      T_PACKING_LIST-OBJ_DESCR  =  LD_ATTDESCRIPTION.
      T_PACKING_LIST-OBJ_NAME   =  LD_ATTFILENAME.
      T_PACKING_LIST-DOC_SIZE   =  T_PACKING_LIST-BODY_NUM * 255.
      APPEND T_PACKING_LIST.
    * Add the recipients email address
      CLEAR T_RECEIVERS.
      REFRESH T_RECEIVERS.
      LOOP AT S_EMAIL.
        T_RECEIVERS-RECEIVER = S_EMAIL-LOW.
        T_RECEIVERS-REC_TYPE = 'U'.
        T_RECEIVERS-COM_TYPE = 'INT'.
        T_RECEIVERS-NOTIF_DEL = 'X'.
        T_RECEIVERS-NOTIF_NDEL = 'X'.
        APPEND T_RECEIVERS.
      ENDLOOP.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA              = W_DOC_DATA
          PUT_IN_OUTBOX              = 'X'
          SENDER_ADDRESS             = LD_SENDER_ADDRESS
          SENDER_ADDRESS_TYPE        = LD_SENDER_ADDRESS_TYPE
          COMMIT_WORK                = 'X'
        IMPORTING
          SENT_TO_ALL                = W_SENT_ALL
        TABLES
          PACKING_LIST               = T_PACKING_LIST
          CONTENTS_BIN               = T_ATTACHMENT
          CONTENTS_TXT               = IT_MESSAGE
          RECEIVERS                  = T_RECEIVERS
        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.
    * Populate zerror return code
      LD_ERROR = SY-SUBRC.
    * Populate zreceiver return code
      LOOP AT T_RECEIVERS.
        LD_RECEIVER = T_RECEIVERS-RETRN_CODE.
      ENDLOOP.
    ENDFORM.                    " SEND_FILE_AS_EMAIL_ATTACHMENT
    *******/form
    *&      Form  INITIATE_MAIL_EXECUTE_PROGRAM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM INITIATE_MAIL_EXECUTE_PROGRAM .
      WAIT UP TO 2 SECONDS.
      SUBMIT RSCONN01 WITH MODE = 'INT'
                    WITH OUTPUT = 'X'
                    AND RETURN.
    ENDFORM.                    " INITIATE_MAIL_EXECUTE_PROGRAM
    *********end of code to trigger mail in excel format....
    If any other help please let me know......
    I am sure this example code will help you to resolve your problem...
    please analyse above code for your requirement...
    In my scenario the message you said is not displaying.....
    Reward Points

  • Read and write excel sheet data from uploded file in sharepoint site programmatically 2013

    hi team,
    I am working on sharepoint 2013.I want to read and write data in excel sheet (micrsoft excel) from stored file in shrepoint docoumnt library .please suggest me
    vijay

    Hi
    Vijay,
    check those links
    http://www.sharepointwithattitude.com/archives/61
    https://social.technet.microsoft.com/Forums/en-US/e760051b-a92f-473c-9ec9-0f0c36c99e40/read-and-write-excel-sheet-data-from-uploded-file-in-sharepoint-site-programmatically-2013?forum=sharepointdevelopment
    Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation. Please remember to mark the reply as answer if it helps.

  • In excel sheet tab name is not coming-urgent

    hi all,
    one small rewquirement. if u run this test program it opens a excel sheet which contains signle tab. here tab name is not coming. i dont no hot to display tabname here.anybody can  make the changes and send me the code.
    i am sending my code below.
    thanks,
    maheedhar.t
    REPORT  ytestvij MESSAGE-ID zv.
    TABLES sscrfields.
    TYPE-POOLS: icon.
    TYPES : BEGIN OF zfnames_ds,
            reptext TYPE reptext,
            END OF zfnames_ds.
    TYPE-POOLS ole2 .
    DATA: wa_fntxt TYPE smp_dyntxt.
    DATA : wa_t75_booking TYPE zvt75_booking_h,
            t_t75_booking TYPE STANDARD TABLE OF zvt75_booking_h.
    DATA : wa_fields TYPE dfies,
            t_fields TYPE STANDARD TABLE OF dfies.
    DATA : wa_fnames TYPE zfnames_ds,
            t_fnames TYPE STANDARD TABLE OF zfnames_ds.
    handles for OLE objects
    DATA: h_excel TYPE ole2_object,        " Excel object
          h_mapl TYPE ole2_object,         " list of workbooks
          h_map TYPE ole2_object,          " workbook
          h_zl TYPE ole2_object,           " cell
          h_f TYPE ole2_object.            " font
    DATA  h TYPE i.
    DATA : lin TYPE i.
    data: excel       type ole2_object,
          application type ole2_object,
          books       type ole2_object,
          book        type ole2_object,
          sheet       type ole2_object,
          cell        type ole2_object,
          column      type ole2_object.
    PARAMETERS : p_input TYPE localfile.
    Add button to application toolbar
    SELECTION-SCREEN FUNCTION KEY 1.  "Will have a function code of 'FC01'
    INITIALIZATION.
    Add displayed text string to buttons
      wa_fntxt-icon_id = icon_xls.
      wa_fntxt-icon_text = 'Input File template'.
      wa_fntxt-quickinfo = 'T75 Header Data'.
      sscrfields-functxt_01 = wa_fntxt.
    AT SELECTION-SCREEN.
      IF sscrfields-ucomm = 'FC01'.
    do nothing
        PERFORM open_excel.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_input.
      PERFORM get_filename USING p_input.
    START-OF-SELECTION.
    *set pf-status 'ONE'.
    END-OF-SELECTION.
      WRITE : lin.
    *&      Form  GET_FILENAME
          text
    -->  p1        text
    <--  p2        text
    FORM get_filename USING p_file TYPE rlgrap-filename . "localfile.
      DATA : w_rc TYPE i.
      DATA : wa_file_table TYPE file_table ,
              t_file_table TYPE STANDARD TABLE OF file_table.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
       EXPORTING
         WINDOW_TITLE            =
         DEFAULT_EXTENSION       =
         DEFAULT_FILENAME        =
         FILE_FILTER             =
         INITIAL_DIRECTORY       =
         MULTISELECTION          =
        CHANGING
          file_table              = t_file_table[]
          rc                      = w_rc
         USER_ACTION             =
        EXCEPTIONS
          file_open_dialog_failed = 1
          cntl_error              = 2
          error_no_gui            = 3
          OTHERS                  = 4
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      LOOP AT t_file_table INTO wa_file_table.
        p_file = wa_file_table-filename.
      ENDLOOP.
    ENDFORM.                    " GET_FILENAME
    *&      Form  open_excel
          text
    -->  p1        text
    <--  p2        text
    FORM open_excel.
    SELECT * FROM ZVT75_BOOKING_H
              INTO TABLE t_t75_booking
              UP TO 10 ROWS.
    start Excel
      CREATE OBJECT h_excel 'EXCEL.APPLICATION'.
      PERFORM err_hdl.
      SET PROPERTY OF h_excel  'Visible' = 1.
      PERFORM err_hdl.
    get list of workbooks, initially empty
      CALL METHOD OF h_excel 'Workbooks' = h_mapl.
      PERFORM err_hdl.
    add a new workbook
      CALL METHOD OF h_mapl 'Add' = h_map.
      PERFORM err_hdl.
    output column headings to active Excel sheet
      PERFORM fill_cell USING 1 1 1 'Financial year'.
      PERFORM fill_cell USING 1 2 1 'Financial quarter'.
      PERFORM fill_cell USING 1 3 1 'Customer number'.
      PERFORM fill_cell USING 1 4 1 'Booking Year'.
      PERFORM fill_cell USING 1 5 1 'Financial quarter'.
      PERFORM fill_cell USING 1 6 1 'Contract type'.
      PERFORM fill_cell USING 1 7 1 'Sub Contract type'.
      PERFORM fill_cell USING 1 8 1 'Customer purchase order number'.
      PERFORM fill_cell USING 1 9 1 'Booking Amount'.
      PERFORM fill_cell USING 1 10 1 'Currency Key'.
    LOOP AT t_t75_booking into wa_t75_booking.
    copy items to active EXCEL sheet
       H = SY-TABIX + 1.
       PERFORM FILL_CELL USING H 1 0 wa_t75_booking-BOOKYEAR.
       PERFORM FILL_CELL USING H 2 0 wa_t75_booking-BOOKQTR.
       PERFORM FILL_CELL USING H 3 0 wa_t75_booking-.
       PERFORM FILL_CELL USING H 4 0 wa_t75_booking-BOOKYEAR.
       PERFORM FILL_CELL USING H 5 0 wa_t75_booking-BOOKQTR.
    ENDLOOP.
    disconnect from Excel
      FREE OBJECT h_excel.
      PERFORM err_hdl.
    ENDFORM.                    " open_excel
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM err_hdl.
    data test type sy-subrc.
    test = sy-subrc.
      IF test <> 0.
         Message e000(ZV) with 'Error in OLE-Automation:'.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM fill_cell USING i j bold val.
      CALL METHOD OF h_excel 'Cells' = h_zl EXPORTING #1 = i #2 = j.
      set property of sheet 'Name'  = 'T75'.
      PERFORM err_hdl.
      SET PROPERTY OF h_zl 'Value' = val .
      PERFORM err_hdl.
      GET PROPERTY OF h_zl 'Font' = h_f.
      PERFORM err_hdl.
      SET PROPERTY OF h_f 'Bold' = bold .
      PERFORM err_hdl.
    ENDFORM.

    Hi,
    Look at the below thread, i posted complete code in this one, just copy that Program and past in your SAP and run the Program, it will create 3 sheets with the names also, then look at the Sheet name in the code, you will understand where to add the code
    Re: format an excel
    Regards
    Sudheer

  • HOW CAN I GET THE TIME IN EXCEL SHEET USING WRITE TO MEASUREMENT INSTRUCTION

    HI, I am using GET TIME IN SECONDS ,and after that i placed SECONDS TO DATE /TIME instruction ,and i had taken a write to measurement file instruction
    to get the time in excel sheet. Now i am not able to connect write to measurement source to seconds to date and time output . Is there any solution.
    I am attaching my VI file also.
    Attachments:
    TEST.vi ‏43 KB

    Hi
    Im using Labview 8.2. Currently it just shows the data without the time. Im not sure what to do. It works perfectly though. I just want the time to appear on my notepad along with my data
    holla
    Attachments:
    Testing1.txt ‏1 KB
    Untitled 231_LV80.vi ‏23 KB

  • How to import a dynamic excel sheet to a dynamic database table.

    I am not a developer, but am looking at what is possible in SQL server as I am planning an implementation strategy.
    My requirement is as follows:
    I receive an excel sheet and I do not know what are the columns or the number of columns in the sheet.
    I need to load this sheet data into a dynamic table in SQL server - named based on input excel sheet. The column names should get created from the header row. This should be achieved just by providing excel sheet name & location.
    Thanks

    Hi,
    Try with below links :
    http://micktechblog.blogspot.in/2011/06/ssis-excel-import-with-unknown-number.html
    http://munishbansal.wordpress.com/2009/06/09/dynamic-columns-mapping-%E2%80%93-script-component-as-destination-ssis/
    sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **.

  • How to write to a password protected excel sheet using ActiveX?

    Hi all,
    I would like to write to a protected Excel sheet. I protect the sheet just in case the data is not wrongly programmatically saved to other cells. These cells contained formulas.
    Please help.
    Thanks,
    keng

    Hi Randy,
    Thank you for looking into my problem.
    I have looked into the Workbook.open property node. There is "password" on the property node. Please see attached diagrams.
    Is is the right way to do it?
    Please advise further.
    For your information, the Excel workbook and sheet 1 are password protected.
    Thanks,
    keng
    Attachments:
    Password_Excel.jpg ‏37 KB
    Password_Sheet.jpg ‏23 KB

  • Write data in Excel Sheet

    I want to write data from oracle table to Excel sheet in formated way like bold or merge the cell in case of same value.
    Edited by: shiv kumar on Jul 27, 2010 10:18 AM

    Read Suns JDBC Tutorial, then if there is already an Excel spreadsheet set up to use as an ODBC datasource use JDBC and the JDBC/ODBC bridge. If there is not an already setup ODBC Datasource then Google POI HSSF and/or JExcel to do the Excel part.

  • Write data of a table to an excel sheet

    Hi
    How i can write data of a table to an excel sheet?
    regard
    deemy

    Search this forum for 1.2 Jiga-examples...

  • How to export a dynamically generated datatable into excel sheet 2013?

    I have one data table and in that data table i am fetching data from sharepoint 2013 lists.
    When I export that data table into excel sheet, what ever data is static will be shown but the data which I fetch from lists are not coming.
    How should I get that data in my excel sheet from that data table?
    This is the code for Export to Excel:
    public void ExportToExcel(DataTable dt)
    if (dt.Rows.Count > 0)
    string filename = "WebTrafficReport.xls";
    System.IO.StringWriter tw = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
    DataGrid dgGrid = new DataGrid();
    dgGrid.DataSource = dt;
    dgGrid.DataBind();
    //Get the HTML for the control.
    dgGrid.RenderControl(hw);
    //Write the HTML back to the browser.
    //Response.ContentType = application/vnd.ms-excel;
    Response.ContentType = "application/vnd.ms-excel";
    Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
    this.EnableViewState = false;
    Response.Write(tw.ToString());
    Response.End();
    Thanks in Advance.

    ublic void ExportToExcel(DataTable dt)
    if (dt.Rows.Count > 0)
    string filename = "WebTrafficReport.xls";
    System.IO.StringWriter tw = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
    DataGrid dgGrid = new DataGrid();
    dgGrid.DataSource = dt;
    dgGrid.DataBind();
    //Get the HTML for the control.
    dgGrid.RenderControl(hw);
    //Write the HTML back to the browser.
    //Response.ContentType = application/vnd.ms-excel;
    Response.ContentType = "application/vnd.ms-excel";
    Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
    this.EnableViewState = false;
    HttpContext.Current.Response.Write(sw.ToString());
                        HttpContext.Current.Response.Flush();
                        HttpContext.Current.Response.End();
    }}try this should help

  • Read data from database  write it in excel sheet throw java

    hi
    i wanna to read database table & write it contain in excel sheet how i will do this connectivity between jdbc & excelDB how i will do this
    tell me
    sandeep patil
    [email protected]

    Read Suns JDBC Tutorial, then if there is already an Excel spreadsheet set up to use as an ODBC datasource use JDBC and the JDBC/ODBC bridge. If there is not an already setup ODBC Datasource then Google POI HSSF and/or JExcel to do the Excel part.

Maybe you are looking for

  • Custom Scheduler Error  and guidance required

    Hello Experts, I am creating a custom scheduler on OIM 11g R1, while running the importmetadata.bat am getting the following error: FYI: OIM on win 32 platform: While running script first am getting the your environment has been set then the followin

  • Data purge utility in OIM 9.1.0.2

    Hi All, Anybody aware of any data purge procedures/steps/utility in OIM. I have studied that following tables are used for audit purpose. Following table holds of user profile snapshot (whenever user data get changed). Reference document is http://do

  • How to compare dates in Crystal Reports 2008

    Hello, I cannot figure out how to compare the dates in the Crystal reports. I need all dates that are in the future to be displayed with the green font. So in the formula for the font for this texbox I've tried to use different formulas like: If Date

  • How to read multiple files at multiple locations using properties file

    hi all , in my code i take configuration input from a properties file ,it was really easy but what if there are multiple files ? how can i take configuration input (file path etc) from properties file in that case ? any suggestion ?

  • Edited pdf file upload from iPad

    Is there any way other than sending an E-mail (which does not always work, depending on the receiving server) to upload an edited pdf document on the iPad to cloud storage (e.g., the Acrobat.com site)?