Spot instead comma in Excel from SAP

Hi all.
I get a Excel file from SAP. One of the fields is material, with format XXXXX.X in SAP, but in Excel it is shown with format XXXXX,X I need in Excel the material is shown with a spot, like SAP. What can I do?
The code is:
CREATE OBJECT Excel  'EXCEL.APLICATION'.
CALL METHOD OF Excel 'WORKBOOKS' = books.
CALL METHOD OF books 'ADD' = book.
LOOP AT tab.
PERFORM rellenar_celdas USING x1 tab-gltri.
PERFORM rellenar_celdas USING x2 tab-matnr.
ENDLOOP.
SET PROPERTY OF Excel 'VISIBLE' = 1.
FORM rellenar_celdas USING i j val.
CALL METHOD OF Excel 'CELLS' = cell
EXPORTING
#1 = i
#2 = j
SET PROPERTY OF cell 'VALUE' = val.
ENFORM.
Thanks a lot.
Marta.

I did like this
FORM CREATE_GRID USING
       X1 TYPE I Y1 TYPE I
       X2 TYPE I Y2 TYPE I
       NAME.
*Workbooks.workSheets(1).columns(GS_CELLS).
*Worksheets("Sheet1").Cells(5, 3).Font.Size = 14
   CALL METHOD OF GS_EXCEL 'Cells' = GS_CELL1
   EXPORTING #1 = X1 #2 = Y1.
   CALL METHOD OF GS_EXCEL 'Cells' = GS_CELL2
   EXPORTING #1 = X2 #2 = Y2.
   CALL METHOD OF GS_EXCEL 'Range' = GS_CELLS
   EXPORTING #1 = GS_CELL1 #2 = GS_CELL2.
   CALL METHOD OF GS_CELLS 'Select' .
   CALL METHOD OF GS_CELLS 'Merge' .
   CALL METHOD OF GS_CELLS 'BorderAround'
   EXPORTING #1 = 1 #2 = 2.
   SET PROPERTY OF GS_CELLS 'NumberFormat' = '#,##0.00' .
   SET PROPERTY OF GS_CELLS 'RowHeight' = 13.
   SET PROPERTY OF GS_CELLS 'Value' = NAME.
   SET PROPERTY OF GS_CELLS 'VerticalAlignment' = 2.
*  SET PROPERTY OF gs_cells 'HorizontalAlignment' = -4108.
   SET PROPERTY OF GS_CELLS 'WrapText' =  1.
   GET PROPERTY OF GS_CELLS 'Font' = GS_FONT.
   SET PROPERTY OF GS_FONT 'Size' = 8.
ENDFORM.

Similar Messages

  • Read Excel from sap server HDD

    I want to read xls from path wich I see by FM RZL_READ_DIR_LOCAL (server space) and how to read xls format to itab from this path?
    ALSM_EXCEL_TO_INTERNAL_TABLE work only on local HDD (not server space)

    Hi,
    You need to use the OPEN DATASET and READ DATASET statements.
    Here is a sample, This program will upload a comma delimited file from app server, and break it up into specific fields of an ITAB.
    report ztest_0001
    no standard page heading.
    parameters: d1 type localfile default '/usr/sap/TST/SYS/Data1.csv'.
    data: begin of itab occurs 0,
    fld1(20) type c,
    fld2(20) type c,
    fld3(20) type c,
    end of itab.
    data: wa(2000) type c.
    start-of-selection.
    open dataset d1 for input in text mode.
    if sy-subrc = 0.
    do.
    read dataset d1 into wa.
    if sy-subrc 0.
    exit.
    endif.
    split wa at ',' into itab-fld1 itab-fld2 itab-fld3.
    append itab.
    enddo.
    endif.
    close dataset d1.
    Regards,
    Satish

  • How to display image in Excel from SAP

    I have to download the image from SAP to Excel with data. Is there any way to do it.
    Thanks
    Vivek

    thanks for replies,
    i checked that one also but didn't get the solution i tried it shows like http://apex.oracle.com/pls/apex/f?p=52985:2:107570357797788:::::
    and my log in credentials are
    Workspace name: ajit_personal
    user name: ajit
    Pass word: ajit
    please check once where i am going wrong,
    thanks in advance,
    Regards,
    ajit

  • PDF creator display bold output instead of defined mix from SAP Script

    Dear all,
    we've a little trouble with the pdf converter in SAP 4.6C.
    In the systeme there is a custom based soft font implemented (RSTXPDF2). The Forms work with SAPScript and use the global imported soft font , the direct printed output and local created pdf are fine.
    But when i try to use the archive for this documents the output use the right font, some characters are different so that i can see that the creator use the font.
    But the created and stored document in the archiv display all character in bold version, so that this isn't like the original.
    I try to use the testreport RSTXPDFT4 from sap to create a pdf download from spool, which was created witht the printer that create the paper output as well.
    The created pdf has the same problems, so that all is printed in a bold version of the style.
    The form has a headline in bold and after this there are some normal characters parts  and two parts with bold words.
    It's seems that the data in the output send all, but the converter can't interpret the bold end information as in the paper output.
    The target solution is to archive the pdf, but when the short spool isn't fine so i think that the archive printer isn't the problem. The printer was copied from the default, because the archivlink type can't use global softfonts.
    The fonts are activated in the se73 for the archive printer type and e. g. sapwin.
    Hint when i use the archive default which can't use softfonts the courier was used and the different areas will be display in bold and normal as defined.
    Every hint is welcome to find out why the convertor makes all in bold.
    Best regards
    Thorsten Stracke

    Dear all,
    we've a little trouble with the pdf converter in SAP 4.6C.
    In the systeme there is a custom based soft font implemented (RSTXPDF2). The Forms work with SAPScript and use the global imported soft font , the direct printed output and local created pdf are fine.
    But when i try to use the archive for this documents the output use the right font, some characters are different so that i can see that the creator use the font.
    But the created and stored document in the archiv display all character in bold version, so that this isn't like the original.
    I try to use the testreport RSTXPDFT4 from sap to create a pdf download from spool, which was created witht the printer that create the paper output as well.
    The created pdf has the same problems, so that all is printed in a bold version of the style.
    The form has a headline in bold and after this there are some normal characters parts  and two parts with bold words.
    It's seems that the data in the output send all, but the converter can't interpret the bold end information as in the paper output.
    The target solution is to archive the pdf, but when the short spool isn't fine so i think that the archive printer isn't the problem. The printer was copied from the default, because the archivlink type can't use global softfonts.
    The fonts are activated in the se73 for the archive printer type and e. g. sapwin.
    Hint when i use the archive default which can't use softfonts the courier was used and the different areas will be display in bold and normal as defined.
    Every hint is welcome to find out why the convertor makes all in bold.
    Best regards
    Thorsten Stracke

  • Open Excel from SAP

    Hi,<br>
    got a problem. I click the Excel button after I did a query, but nothing happend. I mean the system ask me to save it as txt file, but then Excel dosn't start... More... if Im in one remote session I got this error on my status bar:<br><br>
    <i>Error -216 [86.29]</i><br><br>
    Hope somebody can help<br>
    Thx,Roberto

    Coming back to my problem I made some test...<br>
    Consider first my "architecture":<br><br>
    I got some client that works as client pc and some other that works thru Remote Desktop.<br><br>
    I thought that address the Excel path like
    ServerName\Program Files\Microsof Office\bla bla could be a common path to everybody, but I discovered that seems SAP dosnt like so much it, it like more C:\Program Files\Microsoft Office\bla bla<br>
    Setting the path in  this way works for them that are working with Remote Desktop, but dosn't work for the other clients, coz they maybe got installed Office in another folder or another disk..<br>
    Why should I do? Create a standard configuration for all the client so they got installed Microsoft Office in the same folder...??? Let say I got 200 client...I don't want neither to take in consideration...<br><br>
    Why if Microsoft let you select the path where you like more to install office, SAP impose to get just one folder, that should be the same for everybody? Did they assume that everybody install office in the same folder, did they?? In this case.. sorry guys but things are different..<br><br>
    Why you SAP guys don't consider in the next release, the let the user installation, set the path he likes more fore Word Excel or whatever else? Could be appriciate... as well as a tools for copy one configuration for every clients, instead of going client to client to setup everything....but this is another chapter ...that upset me..<br><br>
    Cheers<br>
    Roberto

  • Can't export to Excel from SAP after upgrade

    Hi there,
    We couldn't export to Excel after upgrading SAP from 2007B PL15 to 8.81 Pl07.
    We tried all workstations as well as server itself and encountered below error upon exporting to Excel.
    "AutoOpen.xls cannot be accessed. The file may be corrupted, loated on a server that is not responding, or read only."
    Microsoft Excel Folder under "General Settings >> Path tab" has been defined.
    If you have a solution or workaround for the above error, kindly share with me.
    Thank you.
    Regards,
    Yadana

    Dear Yadana,
    Check this forum
    Re: Export to excel doesn't work anymore
    Regards
    Mangesh Pagdhare.

  • Downloaded data in Excel from SAP table data to have the macro and control?

    We know that in SE16 screen to display SAP table data, there is a menu item or button to download the table data to excel sheet, but in the excel sheet, the data is for display only and some calculation functions (e.g. sum) are not be able to be downloaded to the excel sheet as macro.
    Our customers would like us to see if there is a way that in the excel sheet with the download SAP table data, only some certain rows/columns of data are allowed to be changed by customers or in other words, other areas in the excel sheet should be frozen and users can not even insert a column and do the copy/paste rows/columns.  And also the original calculated column in SAP table (e.g., sum) would be in the corresponding column in the excel sheet, but with macro to do the same function (e.g., sum).  After the customers perform some changes in some allowed certain rows/columns in the excel file, then the changed data can be uploaded back to SAP.
    Wonder if there are such ABAP program to fullfill the above task to download SAP table data to an excel file and to make the downloaded data in the excel with only some certain row/columns to be changeable and all other areas frozen?
    Thanks and we will give you reward points for valuable answers!

    Hi,
    This scenario can be met with the FM : RH_START_EXCEL_WITH_DATA
    This is available in Older versions. Starts Excel with a macro.
    I have never tried using this FM.
    However, I came across : http://www.jt77.com/development1/programming-23850.html
    Showing the use of it.
    To get useful hints, also refer :
    1) Transaction : DWDM
    2) MS EXCEL as OLE Client : 
    http://help.sap.com/saphelp_nw04/helpdata/en/40/b297f3c32711d194ac00a0c94260a5/frameset.htm
    3) Read the content at any table + Defined Macros used to call Function Modules
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c043d836-166c-2910-b99e-ae3633dec547
    Once you get a solution, would appreciate a mail to me @ <REMOVED BY MODERATOR>
    Cheers,
    Remi
    Edited by: Alvaro Tejada Galindo on Feb 29, 2008 5:41 PM

  • Sending email from SAP

    Hi,
    I have a requirement where i need to add heading and fields names in the excel download. The first record should start from line 10....can anybody tel me which  FM will allow to  download to excel from SAP with above req.
    Any pointers in this wil be helpfull.
    regards,
    sandhya.

    Hi,
    See the following Program in this also i am download the file to Excel sheet.
    Report ZCL_TALLY.
    DATA:
    BEGIN OF fs_table,
    line(256) TYPE c,
    END OF fs_table.
    DATA:
    t_table LIKE STANDARD TABLE OF fs_table.
    DATA:
    fs_temp LIKE fs_table,
    fs_whole LIKE fs_table.
    DATA:
    t_temp_table LIKE STANDARD TABLE OF fs_whole.
    DATA:
    BEGIN OF fs_tally_table,
    field1 TYPE c length 10,
    field2 TYPE c LENGTH 30,
    field3 TYPE c LENGTH 30,
    amt1 TYPE c LENGTH 17,
    amt2 TYPE c LENGTH 17,
    field4 TYPE c LENGTH 50,
    END OF fs_tally_table.
    DATA:
    t_tally_table LIKE STANDARD TABLE OF fs_tally_table.
    DATA:
    w_index TYPE i,
    w_temp TYPE i,
    w_date(8) TYPE c.
    DATA:
    w_temp1(17) TYPE c,
    w_temp2(17) TYPE c.
    CONSTANTS:
    c_char VALUE '"'.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = 'd:\tally_temp.txt'
    FILETYPE = 'ASC'
    HAS_FIELD_SEPARATOR = ' '
    HEADER_LENGTH = 0
    READ_BY_LINE = 'X'
    DAT_MODE = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    CHECK_BOM = ' '
    VIRUS_SCAN_PROFILE =
    NO_AUTH_CHECK = ' '
    IMPORTING
    FILELENGTH =
    HEADER =
    TABLES
    data_tab = t_table
    EXCEPTIONS
    FILE_OPEN_ERROR = 1
    FILE_READ_ERROR = 2
    NO_BATCH = 3
    GUI_REFUSE_FILETRANSFER = 4
    INVALID_TYPE = 5
    NO_AUTHORITY = 6
    UNKNOWN_ERROR = 7
    BAD_DATA_FORMAT = 8
    HEADER_NOT_ALLOWED = 9
    SEPARATOR_NOT_ALLOWED = 10
    HEADER_TOO_LONG = 11
    UNKNOWN_DP_ERROR = 12
    ACCESS_DENIED = 13
    DP_OUT_OF_MEMORY = 14
    DISK_FULL = 15
    DP_TIMEOUT = 16
    OTHERS = 17
    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_table INTO fs_table.
    w_index = w_index + 1.
    IF fs_table-line(1) CO '0123456789'.
    IF sy-subrc EQ 0.
    w_temp = w_index + 1.
    READ TABLE t_table INDEX w_temp INTO fs_temp.
    IF sy-subrc EQ 0.
    CONCATENATE fs_table-line fs_temp-line INTO fs_whole-line.
    APPEND fs_whole TO t_temp_table.
    ENDIF.
    ENDIF.
    ENDIF.
    ENDLOOP.
    LOOP AT t_temp_table INTO fs_whole.
    DO.
    REPLACE '"' WITH space INTO fs_whole-line.
    IF sy-subrc NE 0.
    EXIT.
    ENDIF.
    ENDDO.
    CONDENSE fs_whole-line NO-GAPS.
    MODIFY t_temp_table FROM fs_whole-line INDEX sy-tabix.
    SEARCH fs_whole-line FOR ','.
    IF sy-fdpos EQ 9.
    CONCATENATE '0' fs_whole-line INTO fs_whole-line.
    ENDIF.
    CONCATENATE fs_whole-line+6(4)
    fs_whole-line+3(2)
    fs_whole-line(2)
    INTO w_date.
    fs_whole-line(10) = w_date.
    SPLIT fs_whole-line AT ','
    INTO fs_tally_table-field1
    fs_tally_table-field2
    fs_tally_table-field3
    fs_tally_table-amt1
    fs_tally_table-amt2
    fs_tally_table-field4.
    APPEND fs_tally_table TO t_tally_table.
    ENDLOOP.
    LOOP AT t_tally_table INTO fs_tally_table.
    WRITE: / fs_tally_table-field1,
    fs_tally_table-field2,
    fs_tally_table-field3,
    fs_tally_table-amt1,
    fs_tally_table-amt2,
    fs_tally_table-field4.
    ENDLOOP.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename = 'D:\TALLY_tab1.xls'
    WRITE_FIELD_SEPARATOR = 'X'
    tables
    data_tab = t_tally_table
    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.
    Use FM GUI_DOWNLOAD to download the data to excel sheet
    <REMOVED BY MODERATOR>
    Regards,
    Chandru
    Edited by: Alvaro Tejada Galindo on Feb 19, 2008 6:05 PM

  • How to send ALV Report in excel format from SAP

    Hi Gurus,
    We are using SAP 4.7 and using different SAP reports.Now I want to send SAP ALV report in excel format directly from SAP in background.Now we send these reports in background weekly by using autimetic scheduling but this is PDF format.Now I want to change this pdf format to excel format.In SCOT T.Code I am able to find any excel format.Please help me out.
    I am waiting for your reply.
    Advance Thanks
    Nirmal

    Hi Nirmal,
    I have done the same in my previous organisation.For this particular solution you need to ask your basis guys to upgrade the support package so that BCS classes could be available in the system.
    API interafces five some problem with attachemnts and SAP has recommended to use BCS classes.
    Currently BCS classes won't be availbale in 4.7.
    Once the BCS classes are available
    use below code
       CONSTANTS:
        lc_tab          TYPE c VALUE cl_bcs_convert=>gc_tab,
        lc_crlf         TYPE c VALUE cl_bcs_convert=>gc_crlf,
       lc_codepage     TYPE abap_encod VALUE '4103',
    data :
       lv_string      TYPE string,
       binary_content TYPE solix_tab,
       size           TYPE so_obj_len,
       *" Set Heading of Excel File
      CONCATENATE 'Employee DATA'
                   lc_crlf lc_crlf
                   INTO lv_string.
       *" Set Header for Excel Fields
      CONCATENATE lv_string
                  lc_header1 lc_tab
                  lc_header2 lc_tab
                  lc_header3 lc_tab
                  lc_header4 lc_tab
                  lc_header5 lc_tab
                  lc_header6 lc_tab
                  lc_header7 lc_tab
                  lc_header8 lc_tab
                  lc_header9 lc_tab
                  lc_header10 lc_crlf
                  INTO lv_string.
    "lc_header1 to 10 could be your field headers
       "Move Internal table data
      LOOP AT gt_final1 INTO gwa_final1.
        CONCATENATE lv_string
                    gwa_final1-field1     lc_tab
                    gwa_final1-field2      lc_tab
                    gwa_final1-field3    lc_crlf
                    INTO lv_string.
      ENDLOOP.
       *" convert the text string into UTF-16LE binary data including
    *" byte-order-mark. Mircosoft Excel prefers these settings
    *" all this is done by new class cl_bcs_convert (see note 1151257)
      TRY.
          cl_bcs_convert=>string_to_solix(
            EXPORTING
              iv_string   = lv_string
              iv_codepage = lc_codepage  "suitable for MS Excel, leave empty
              iv_add_bom  = abap_true     "for other doc types
            IMPORTING
              et_solix  = binary_content
              ev_size   = size ).
        CATCH cx_bcs.
          MESSAGE e445(so).
      ENDTRY.
      TRY.
    *" create persistent send request
          send_request = cl_bcs=>create_persistent( ).
          document = cl_document_bcs=>create_document(
            i_type    = lc_doc
            i_text    = main_text
            i_subject = lc_sub  ).     
          document->add_attachment(
            i_attachment_type    = lc_attach                    "#EC NOTEXT
            i_attachment_subject = lc_sub                       "#EC NOTEXT
            i_attachment_size    = size
            i_att_content_hex    = binary_content ).
       send_request->set_document( document ).
       recipient = cl_cam_address_bcs=>create_internet_address( email ).
       CALL METHOD send_request->add_recipient
              EXPORTING
                i_recipient = recipient.
       IF recipient IS NOT INITIAL.
            sent_to_all = send_request->send( i_with_error_screen = abap_true ).
            COMMIT WORK.
    *        MESSAGE text-014 TYPE gc_succ  .
          ENDIF.
        CATCH cx_bcs INTO bcs_exception.
          MESSAGE i865(so) WITH bcs_exception->error_type.
      ENDTRY.
    For BCS decalartion u can go to se 38 and see program BCS_EXAMPLE_1 to BCS_EXAMPLE_7.
    Rewrads if helpful.
    Cheers
    Ramesh Bhatt

  • Problem in Excel after extracting data from SAP Report

    Hello,
    I have a problem with Excel file after extracting it from one of the SAP report.
    When my client extracted data from SAP in to excel he is coming across minus symbol on both sides of the number.
    for ex:        -447492177-
    When i extracted same SAP report in to excel i didnt face any such problem.
    Please share your inputs on what could be the problem.

    1. Make sure your client and you are using the same version of Microsoft Excel
    2. Let your client try to OPEN the exported xls file from a existed workbook instead of double-clicking the file directly.
    Atom

  • Aattach an existing Excel file to an email from SAP system.

    Hi,
    How can I attach an existing Excel file from SAP system (Example in 'DIR_TEMP' folder) & send a mail. Guess this requires a class with a method which picks up the file using the file path. Does CL_DOCUMENT_BCS provides this???? boz CL_DOCUMENT_BCS->ADD_DOCUMENT_AS_ATTACHMENT is for Add Existing Document as an Attachment,if so please let me know how with few lines of code??
    Thankx in advance.

    *  Local Data declarations
      DATA: ls_rec          TYPE somlreci1.
      DATA: lp_send_request    TYPE REF TO cl_bcs,
            lp_document        TYPE REF TO cl_document_bcs,
            lp_sender          TYPE REF TO if_sender_bcs,
            lp_recipient       TYPE REF TO if_recipient_bcs,
            lp_bcs_exception   TYPE REF TO cx_bcs.
      DATA: lt_text TYPE soli_tab,
            ls_text LIKE LINE OF lt_text,
            lv_flag.
      DATA: lt_tline TYPE TABLE OF tline.
      DATA lv_receiver TYPE ad_smtpadr.
    *  DATA lt_attach  TYPE soli_tab.
      DATA ls_tline TYPE tline.
      TRY.
    *   create persistent send request
          lp_send_request = cl_bcs=>create_persistent( ).
    * Get the text
          IF iv_stxt IS NOT INITIAL.
            CALL METHOD zfi_flexgl_common=>read_text
              EXPORTING
                iv_stxt   = iv_stxt
              IMPORTING
                et_tline  = lt_tline
                ev_failed = ev_failed.
            LOOP AT lt_tline INTO ls_tline.
              APPEND ls_tline-tdline TO lt_text.
            ENDLOOP.
          ENDIF.
    *  create and set document
    *     create document from internal table with text
          lp_document = cl_document_bcs=>create_document(
                          i_type    = iv_format_type   "'XLS' "HTM'
                          i_text    = lt_text
                          i_subject = iv_msg_subj ).
          IF it_attach IS NOT INITIAL.
    * Add attachment
    *        DATA:      l_size      TYPE sood-objlen,              " Size of Attachment
    *                   l_lines     TYPE i.                        " Lines count
    *        l_lines = LINES( it_attach ).
    *        l_size = l_lines * 255.
            CALL METHOD lp_document->add_attachment
              EXPORTING
                i_attachment_type    = 'RAW'
                i_attachment_subject = 'My attachment'
    *            i_attachment_size    = l_size
                i_att_content_text   = it_attach.
          ENDIF.
    *     add document to send request
          CALL METHOD lp_send_request->set_document( lp_document ).
    * Sender addess
    *l_sender = cl_sapuser_bcs=>create( sy-uname ).
    *call method l_send_request->set_sender
    *  exporting
    *    i_sender = l_sender.
    *      LOOP AT it_rec INTO ls_rec.
          lv_receiver = iv_rec.
          TRY.
              CALL METHOD cl_cam_address_bcs=>create_internet_address
                EXPORTING
                  i_address_string = lv_receiver
                RECEIVING
                  result           = lp_recipient.
            CATCH cx_address_bcs .
          ENDTRY.
          CALL METHOD lp_send_request->add_recipient
            EXPORTING
              i_recipient  = lp_recipient
              i_blind_copy = abap_true
              i_express    = abap_true.
    *      ENDLOOP.
          IF sy-subrc <> 0.
            ev_failed = abap_true.
            EXIT.
          ENDIF.
    *     ---------- send document ---------------------------------------
          CALL METHOD lp_send_request->send(
            RECEIVING
              result              = lv_flag ).
        CATCH cx_send_req_bcs.
          ev_failed = abap_true.
        CATCH cx_document_bcs.
          ev_failed = abap_true.
      ENDTRY.
      IF iv_commit = abap_true.
        COMMIT WORK.
      ENDIF.

  • Sending external mail with excel attachment from SAP

    Hi All,
    I am trying to send a external mail from SAP. Mail is getting posted correctly with attachment having type excel. If attach file has more than 1 records then in mail it is coming in a single lines. it is not getting wrap.
    e.g. my attach internal table has records like LINE1
                                                                      LINE2
                                                                      LINE3
    output in attach excel file is : LINE1         LINE2          LINE3
    in attach file it should come line by line.
    source code of my function module is as follows :
    FUNCTION ZXI_SEND_MAIL_WITH_ATTACHMENT.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(SUBJECT) TYPE  SO_OBJ_DES OPTIONAL
    *"     REFERENCE(ATTACH_NAME1) TYPE  SOOD-OBJDES
    *"     REFERENCE(EXT1) TYPE  SOODK-OBJTP
    *"     REFERENCE(MAIL_ID) TYPE  ADR6-SMTP_ADDR
    *"  TABLES
    *"      IT_CONTENT TYPE  SOLI_TAB OPTIONAL
    *"      IT_ATTACH TYPE  SOLI_TAB OPTIONAL
      DATA: send_request       TYPE REF TO cl_bcs.
      DATA: document           TYPE REF TO cl_document_bcs.
      DATA: sender             TYPE REF TO cl_sapuser_bcs.
      DATA: recipient          TYPE REF TO if_recipient_bcs.
      DATA: exception_info     TYPE REF TO if_os_exception_info,
      bcs_exception      TYPE REF TO cx_document_bcs.
      DATA i_attachment_size TYPE sood-objlen.
    Creates persistent send request
      send_request = cl_bcs=>create_persistent( ).
      TRY.
    *****Create txt mail document**************************
          document = cl_document_bcs=>create_document(
                                        i_type    = 'RAW'
                                        i_text = it_content[]
                                        i_subject = subject ).
    **************Creates Attachment 1***********************
          CALL METHOD document->add_attachment
            EXPORTING
              i_attachment_type    = ext1
              i_attachment_subject = attach_name1
              i_att_content_text   = it_attach[].
    Add document to send request
          CALL METHOD send_request->set_document( document ).
    Get sender object
          sender = cl_sapuser_bcs=>create( sy-uname ).
    Add sender
          CALL METHOD send_request->set_sender
            EXPORTING
              i_sender = sender.
          recipient = cl_cam_address_bcs=>create_internet_address(
                               i_address_string = mail_id ).
          CALL METHOD send_request->add_recipient
            EXPORTING
              i_recipient  = recipient
              i_express    = 'U'
              i_copy       = ' '
              i_blind_copy = ' '
              i_no_forward = ' '.
    **********Trigger e-mails immediately****************************
          send_request->set_send_immediately( 'X' ).
          CALL METHOD send_request->send( ).
          COMMIT WORK.
        CATCH cx_document_bcs INTO bcs_exception.
      ENDTRY.
    ENDFUNCTION.
    please suggest me a solution and thanks in advance.
    Thanks&Regards,
    Sachin

    See the sample code  for sending attachment as Mail
    Mailing with Attachment by ABAP Coding  
    Refer this link:
    Mail with attachment.
    FORM send_list_to_basis .
      DATA: w_path      LIKE rlgrap OCCURS 0 WITH HEADER LINE,
            lt_index    TYPE sy-tabix,
            doc_type(3) TYPE c,
            descr       LIKE it_objpack_basis-obj_descr,
            temp_data   LIKE w_path,
            temp1       TYPE string,
            tab_lines   TYPE i,
            langu(15)   TYPE c,
            expirydate  TYPE so_obj_edt,
            L_FILE1(100).
      CONCATENATE 'C:\' sy-repid '_' sy-datum '.XLS' INTO L_FILE1.
      W_PATH-FILENAME = L_FILE1.
      APPEND w_path.
      CLEAR w_path.
      wa_doc_chng-obj_descr  = 'User List not logged on for 180 days'.
      wa_doc_chng-obj_langu  = 'E'.
      wa_doc_chng-obj_expdat = sy-datum.
      CLEAR w_subject.
      CONCATENATE 'Please find attached document with list of users'
                  'not logged on for 180 days for client' sy-mandt
                  INTO w_subject SEPARATED BY space.
      it_objtxt_basis-line = w_subject.
      APPEND it_objtxt_basis.
      CLEAR it_objtxt_basis.
      it_objtxt_basis-line = text-004.
      APPEND it_objtxt_basis.
      CLEAR it_objtxt_basis.
      CLEAR w_tab_line.
      DESCRIBE TABLE it_objtxt_basis LINES w_tab_line.
      READ TABLE it_objtxt_basis INDEX w_tab_line  INTO l_cline.
      wa_doc_chng-doc_size =
       ( w_tab_line - 1 ) * 255 + STRLEN( l_cline ).
      CLEAR it_objpack_basis-transf_bin.
      it_objpack_basis-head_start = 1.
      it_objpack_basis-head_num   = 0.
      it_objpack_basis-body_start = 1.
      it_objpack_basis-body_num   = w_tab_line.
      it_objpack_basis-doc_type   = 'RAW'.
      APPEND it_objpack_basis.
      CLEAR it_objpack_basis.
      LOOP AT w_path.
        temp1 = w_path.
        descr = w_path.
        CALL FUNCTION 'STRING_REVERSE'
          EXPORTING
            string  = descr
            lang    = 'E'
          IMPORTING
            rstring = descr.
        CALL FUNCTION 'STRING_SPLIT'
          EXPORTING
            delimiter = '\'
            string    = descr
          IMPORTING
            head      = descr
            tail      = temp_data.
        CALL FUNCTION 'STRING_REVERSE'
          EXPORTING
            string  = descr
            lang    = 'E'
          IMPORTING
            rstring = descr.
        CALL FUNCTION 'STRING_SPLIT'
          EXPORTING
            delimiter = '.'
            string    = descr
          IMPORTING
            head      = temp_data
            tail      = doc_type.
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename      = temp1
            filetype      = 'BIN'
            header_length = 0
            read_by_line  = 'X'
            replacement   = '#'
          TABLES
            data_tab      = it_upload.
        DESCRIBE TABLE it_upload LINES tab_lines.
        DESCRIBE TABLE it_objbin_basis LINES lt_index.
        lt_index = lt_index + 1.
        LOOP AT it_upload.
          wa_objbin_basis-line = it_upload-line.
          APPEND wa_objbin_basis TO it_objbin_basis.
          CLEAR wa_objbin_basis.
        ENDLOOP.
        it_objpack_basis-transf_bin = 'X'.
        it_objpack_basis-head_start = 0.
        it_objpack_basis-head_num   = 0.
        it_objpack_basis-body_start = lt_index.
        it_objpack_basis-body_num   = tab_lines.
        it_objpack_basis-doc_type   = doc_type.
        it_objpack_basis-obj_descr  = descr.
        it_objpack_basis-doc_size   = tab_lines * 255.
        APPEND it_objpack_basis.
        CLEAR it_objpack_basis.
      ENDLOOP.
      it_reclist_basis-receiver = '[email protected]'.
      it_reclist_basis-rec_type = 'U'.
      APPEND it_reclist_basis.
      CLEAR it_reclist_basis.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_doc_chng
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          packing_list               = it_objpack_basis
          contents_txt               = it_objtxt_basis
          contents_bin               = it_objbin_basis
          receivers                  = it_reclist_basis
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      IF sy-subrc EQ 0.
        SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
      ENDIF.
    ENDFORM.                    " send_list_to_basis
    Reward points if useful
    Regards
    Anji

  • Upload data from Excel to Sap-Crm

    Hi All,
    I need to upload data from EXCEL to SAP-CRM system.The problem is in crm there is no ALSM_EXCEL_INTO_INTERNAL_TABLE or corresponding function modules exist.Using GUI_UPLOAD I can upload data from excel to CRM but the main problem with this is it supports only 255 chars for entire line, in my excel file it contains more than 255 chars.Please help me out.

    Try the following :
    Class: CL_GUI_FRONTEND_SERVICES
    Method: GUI_UPLOAD
    Thanks
    <b>Allot points if this helps!</b>

  • Upload data from Excel into SAP CRM using webservices

    Hi,
               I want to upload the data from EXCEL into SAP CRM using a web  service, can anyone say me the process and also how to map the excel and the source code structures.
    Thanks,
    Sanju.

    Try the following :
    Class: CL_GUI_FRONTEND_SERVICES
    Method: GUI_UPLOAD
    Thanks
    <b>Allot points if this helps!</b>

  • How to upload data from excel to SAP using VB script or Macros

    Hi Guys,
    I want to make a macro enabled Excel sheet which  i can use to upload huge data on SAP . I read some discussion but didnt get anything. Please help me with a step by step document.

    Hi,
    Please refer below link.
    Need help from Excel and SAP expert! [SOLVED]
    http://visualbasic.ittoolbox.com/groups/technical-functional/vb-vba-l/call-transaction-in-sap-from-excel-vba-macro-and-download-alv-list-object-results-to-spreadsheet-3335996
    Regards,
    Rafi

Maybe you are looking for

  • Read data in real time and save as an excel file

    Hi, I want to write a LabVIEW progarmme which able to read data in real time and save it as an excel file from Varian Vacuum muli-gauge. It is using RS232 port. Can anyone give me some examples or point me in the right direction? I am a beginner of L

  • Where is Solaris 10 Companion Disk?

    Hi all! When I have just finished setting up Solaris 10 on my PC (x86 - Intel), I realized that the X-Windows is not a part within CDs. Anh I do not how to download them, exactly, I do not know about their address in Sun website. Would you like to gu

  • Load xml to system form

    I've created some buttons on the Item Master Data user defined fields form (-150). I am having troubles saving and then loading these buttons as xml. Can anyone help me?

  • Sync issues w/ music and video

    I'm a proud new owner of a 16GB iPod Touch and absolutely love it. However I have been running into some issues when transferring files from iTunes to the Touch. Transferring Videos or music from iTunes to the ipod appears to work. It shows that they

  • Exception ussing location.href

    Hi, from a JSP page I pass a form to a Servlet where I access to a MySql DataBase. If happend some thing, I show an alert javacript and I want to redirect again to the JSP page. But I obtain an error. Inthe Servlet I use: protected void doPost(HttpSe