Problem when converting from spool to XLS file

Hey.
I need to get table data from the spool and send it by mail in an xls file.
so this is what i have done:
I have used the FM 'RSPO_RETURN_ABAP_SPOOLJOB' to get the data table from the spool.
then i am sending the data table in an xls file via the FM 'SO_DOCUMENT_SEND_API1'.
the problem is that the xls file that i am getting through the mail is defected.
All the contents of the spool is located in the first row, first column.
How can i fix it?
Thanks, Barak.

After geting the data in a internal table.from spool......refer this report.....
data: p_email   type somlreci1-receiver
                               value 'MAIL ID'.
data: begin of it001 occurs 0,
      bukrs type t001-bukrs,
      butxt type t001-butxt,
      end of it001.
data:   imessage type standard table of solisti1 with header line,
        iattach type standard table of solisti1 with header line,
        ipacking_list like sopcklsti1 occurs 0 with header line,
        ireceivers like somlreci1 occurs 0 with header line,
        iattachment like solisti1 occurs 0 with header line.
start-of-selection.
  select bukrs butxt into table it001 from t001.
  Populate table with detaisl to be entered into .xls file
  perform build_xls_data .
Populate message body text
  clear imessage.   refresh imessage.
  imessage = 'Please find attached excel file'.
  append imessage.
Send file by email as .xls speadsheet
  perform send_email_with_xls tables imessage
                                      iattach
                                using p_email
                                      'Example Excel Attachment'
                                      'XLS'
                                      'TestFileName'
                                      'CompanyCodes'.
     Form  BUILD_XLS_DATA
form build_xls_data .
constants: con_cret type x value '0D',  "OK for non Unicode
            con_tab type x value '09'.   "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
constants:
    con_tab  type c value cl_abap_char_utilities=>horizontal_tab,
    con_cret type c value cl_abap_char_utilities=>cr_lf.
  concatenate 'BUKRS' 'BUTXT'
         into iattach separated by con_tab.
  concatenate con_cret iattach into iattach.
  append  iattach.
  loop at it001 .
    concatenate it001-bukrs it001-butxt
           into iattach separated by con_tab.
    concatenate con_cret iattach  into iattach.
    append  iattach.
  endloop .
endform.
     Form  SEND_EMAIL_WITH_XLS
form send_email_with_xls tables pit_message
                                          pit_attach
                                    using p_email
                                          p_mtitle
                                          p_format
                                          p_filename
                                          p_attdescription.
  data: xdocdata like sodocchgi1,
        xcnt type i.
Fill the document data.
  xdocdata-doc_size = 1.
Populate the subject/generic message attributes
  xdocdata-obj_langu = sy-langu .
  xdocdata-obj_name  = 'SAPRPT' .
  xdocdata-obj_descr = p_mtitle .
Fill the document data and get size of attachment
  clear xdocdata.
  read table iattach index xcnt.
  xdocdata-doc_size =
     ( xcnt - 1 ) * 255 + strlen( iattach ).
  xdocdata-obj_langu  = sy-langu.
  xdocdata-obj_name   = 'SAPRPT'.
  xdocdata-obj_descr  = p_mtitle.
  clear iattachment.  refresh iattachment.
  iattachment[] = pit_attach[].
Describe the body of the message
  clear ipacking_list.  refresh ipacking_list.
  ipacking_list-transf_bin = space.
  ipacking_list-head_start = 1.
  ipacking_list-head_num = 0.
  ipacking_list-body_start = 1.
  describe table imessage lines ipacking_list-body_num.
  ipacking_list-doc_type = 'RAW'.
  append ipacking_list.
Create attachment notification
  ipacking_list-transf_bin = 'X'.
  ipacking_list-head_start = 1.
  ipacking_list-head_num   = 1.
  ipacking_list-body_start = 1.
  describe table iattachment lines ipacking_list-body_num.
  ipacking_list-doc_type   =  p_format.
  ipacking_list-obj_descr  =  p_attdescription.
  ipacking_list-obj_name   =  p_filename.
  ipacking_list-doc_size   =  ipacking_list-body_num * 255.
  append ipacking_list.
Add the recipients email address
  clear ireceivers.  refresh ireceivers.
  ireceivers-receiver = p_email.
  ireceivers-rec_type = 'U'.
  ireceivers-com_type = 'INT'.
  ireceivers-notif_del = 'X'.
  ireceivers-notif_ndel = 'X'.
  append ireceivers.
  call function 'SO_DOCUMENT_SEND_API1'
       exporting
            document_data              = xdocdata
            put_in_outbox              = 'X'
            commit_work                = 'X'
       tables
            packing_list               = ipacking_list
            contents_bin               = iattachment
            contents_txt               = imessage
            receivers                  = ireceivers
       exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            others                     = 8.
endform.
Reward IF.........
Regards
Anbu

Similar Messages

  • Encountered problem when converting from development to runtime environment

    1. I ran apxdevrm.sql switch my environment to runtime. Although it seemed to finish successfully, this error was in the log and according to registry, my installation was invalidated(still works though).
    drop package wwv_flow_create_flow_api (doesn't seem to exist)
    ERROR at line 1:
    ORA-04043: object WWV_FLOW_CREATE_FLOW_API does not exist
    Entry in dba_registry:
    COMP_NAME--Oracle Application ExpressSTATUS
    STATUS--INVALID
    2. Next, not sure if it had made the switch, I then ran apxdvins,sql to revert back because of problem #1. (later found out that it was still devl environment)
    This time, this message appeared in log...
    FAILED CHECK FOR TRIGGER BIN$UH58A027El3gRAADutXi8w==$0
    (Installation still invalid)
    Any ideas?

    1. Commented "drop package" stmt out on apexdevrm.sql to get rid of non-existent package problem. (probably holdover from v3.0)
    2. purged dba_recyclebin to get rid of problem #2.
    Dba_registry entry still shows as INVALID... Has anyone else encountered these problems when switching from dev to runtime? (or vice-versa)

  • Problems when converting from pdf to word

    I am a translator and I get most of my work in pdf files. So I convert the pdfs into words to be able to change the text and edit. However, when dcuments are converted from pdf to word I have found they become very unstable and difficult to work with to the point I usually end up not using the coverted file. Is there any place I can go for training about what to do with those documents? Can anyone relate to this problem?
    thanks

    Hi patryba,
    You can access ExportPDF here: Adobe Acrobat.com.
    Please let us know how it goes!
    Best,
    Sara

  • Query Problem when converting from access to Mysql

    I am trying to get a small application to work with a mysql
    db. The original
    db is access, for some reason I am getting an error now that
    the db has been
    converted over to mysql. Any gurus out there spot the
    problem. Here is the
    query:
    <cfquery name="getprevmonth"
    username="#request.myDBUserName#"
    password="#request.myDBPassword#"
    datasource="#request.myDSN#">
    SELECT cal_date,(day(cal_date)) AS theprevmonth
    FROM jot_eventcal
    WHERE (cal_date >=
    #CreateDate(Year(prev_date),Month(prev_date),1)#) and
    (cal_date <=
    #CreateDate(Year(prev_date),Month(prev_date),DaysInMonth(prev_date))#)
    </cfquery>
    This query works fine when I test the application Locally, it
    only messes up
    when I test online. The error code is:
    Syntax error or access violation: You have an error in your
    SQL syntax.
    Thanks for any assistance in advance...........and a happy
    new year to you
    all.

    I don't know the answer but, it might be that using
    createdate is not sufficient. Try wrapping that date into either a
    cfqueryparam or createodbcdate.
    Something else to bear in mind when switching db's is that
    they don't all have the same functions. I don't use mySql so I
    don't actually know, but I'd be checking the manual to make sure it
    has a day function.
    Not a syntax, but a potential logic error is that you are
    using a function called day to create an alias called theprevmonth.
    At the very least, it's misleading and might confuse you later
    on.

  • Convert the spool to xls format and email through attachment to the user

    Hi all,
    When I execute a report in background, I get spool. I need to convert the spool to xls format and email through attachment to the user.The xls file should not be saved on local system.
    If I use the Spool Recepient tab in SM37 it mails the spool list as .txt file to the mail receipient. But I need to send it as an .xls file.
    Can any one help me on this

    Did you get the solution? i have the same problem.

  • Hypertext links are not always preserved from Word to PDF, using Aperçu or Adobe, depending on OS 10 or Lion. Why? This generally works perfectly in Windows. Why are Apple and Adobe unable to correctly handle links when converting from Word to PDF?

    Hypertext links are not always preserved from Word to PDF, using Aperçu or Adobe, depending on OS 10 or Lion. Why? This generally works perfectly in Windows. Why are Apple and Adobe unable to correctly handle links when converting from Word to PDF?
    Depending on the system version, and Office Word version:
    - a pure URL link starting with http or even www sometimes works in PDF, either produced by Aperçu or Adobe, sometimes does not work;
    - other kind of links where the text under display is not a URL, never work!
    I like everything with Apple computers and software, except PDF generation. Output files are usually bigger in size, and no better quality, than under Windows. Furthermore, it is weird that something as common as hyperlinks does not work correctly!
    I related this question with Mac OS X Snow Leopard, but the problem is still there with Mac OS Lion.
    This problem seems to have been around for years, without any proper solution from Apple and/or Adobe! To me, this is very embarrassing!

    Greetings NoNameGiven,
    If I understand the problem correctly (I’m not sure I do) you would prefer ‘iii’ to be read as “eye eye eye” rather than “three”? The alt text property is the only way that I know of to make this happen. Hope this helps.
    a ‘C’ student

  • How to download data from spool to excel file

    Hi,
    I have requirement like....i need to download data from spool to excel file.
    Please let me know the process how to download...
    <removed by moderator>
    <removed by moderator>
    Thanks,
    Khasimsa
    Moderator message: please (re)search yourself before asking, do not assign priorities, do not offer re-ward
    locked by: Thomas Zloch on Sep 8, 2010 1:18 PM

    Hi try this way..
    *FM called that returns the Spool Request Number data into and internal table
      CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
        EXPORTING
          rqident              = p_spool                     "Spool Request Number
          first_line           = 1
        TABLES
          buffer               = it_spool_xls                            "Internal table that will have the Spool Request No data
        EXCEPTIONS
          no_such_job          = 1
          not_abap_list        = 2
          job_contains_no_data = 3
          selection_empty      = 4
          no_permission        = 5
          can_not_access       = 6
          read_error           = 7
          OTHERS               = 8.
    *To convert the spool data into excel format
      CALL FUNCTION 'SO_RAW_TO_RTF'
        TABLES
          objcont_old = it_spool_xls               "Internal table having spool data
          objcont_new = it_xls_spool.           "Int table having Excel format data converted from Spool data
    "call GUI down Load by passing  it_xls_spool
    Prabhudas

  • Hyperlink problem when converting Word to PDF

    Hi everyone.
    I am using Adobe Acrobat 7.0 Standard version 7.1.4 on a Windows 2000 environment.
    I am using Word XP/2002 SP3.
    I have a couple of problems when converting Word to PDF.
    When converting a long link which is in 2 lines, PDF just takes one line into account, not considering the whole link
    When I have hyperlinks that links to a web page, the link works fine in Word but in pdf, it gets the few words after the url address making the link not work.  For example.  I have a hyperlink that http://www.google.com/ and after this I have the words: "This is a sample text".  The hyperlink in pdf would then become http://www.google.comThisisasampletext
    Do you have any ideas how I can correct this?
    Thanks.

    To get the cross references, you have to use Convert to PDF (PDF Maker part of the Acrobat product). However, you first need to go to the print menu and set the printer to the Adobe PDF printer. Close the print menu and then do a reflow and link update of the document (ctrl-A, then F9 I think). This is needed to get the links correct since WORD reflows the document based on the printer (problem with them going to the wrong place).
    Printing to the Adobe PDF printer (the step of print to file is not needed, just print to the printer and the rest is automatic) does not include the links. PDF Maker is a PreProcessor for the Adobe PDF printer that adds PDF Marks to the PS file before it is sent to Distiller (OK, the printer when used normally creates a PS file and then invokes Distiller to complete the process - your steps did with the Adobe PDF printer is the same process done manually).
    Summary:
    1. Fix document after setting the printer to Adobe PDF.
    2. Use PDF Maker (create PDF button)

  • When converting from a .wav to a .mov is there a loss of audio quality when using QuickTime?

    When converting from a .wav to a .mov is there a loss of audio quality when using QuickTime?

    When converting from a .wav to a .mov is there a loss of audio quality when using QuickTime?
    That would depend on your work flow. MOV is the generic QuickTime file container and is not related to any particular data compression format. If you perform a simple "Save" or "Save As..." action that merely copies the data in the WAV file to an MOV file, then the data remains unchanged and maintains its original quality. If, on the other hand, your transcode/re-compress the original data to a different compression format, then there is always the potential for some loss in quality. Depending on the codec and/or settings, the potential loss could be inaudible to severe.

  • Overflow when converting from "3.60001e+11"

    Hi Guys,
    I'm Working with my PO using MIRO, I don't know why the error occurs. I've used the SAP Version 620 but end up with an error, then used Version 710 and successfuly created the transaction, but I'm stacked with version 620. I'm not allowed to transact it using the Version 710 that's why im looking for a patch or upgrade within 620 that i can use so that it can be solve.
    I'm in need of your help guys. I know there someone out there that can help me.
    THE ERROR
    Runtime Errors         CONVT_OVERFLOW                                              
    Exception              CX_SY_CONVERSION_OVERFLOW                                   
           Occurred on     03/28/2011 at 01:00:47                                                                               
    Overflow when converting from "3.60001e+11"                                                                               
    What happened?                                                                               
    Error in ABAP application program.                                                                               
    The current ABAP program "SAPLEINS" had to be terminated because one of the        
    statements could not be executed.                                                                               
    This is probably due to an error in the ABAP program.                                                                               
    Error analysis                                                                               
    An exception occurred. This exception is dealt with in more detail below     
    . The exception, which is assigned to the class 'CX_SY_CONVERSION_OVERFLOW', 
    was neither                                                                 
    caught nor passed along using a RAISING clause, in the procedure             
    "DISTRIBUTE_ACC_ASSIGN_RE" "(FORM)"                                         
    Since the caller of the procedure could not have expected this exception     
    to occur, the running program was terminated.                               
    The reason for the exception is:                                             
    When attempting to convert the value "3.60001e+11",                          
    an overflow occurred.                                                        
    How to correct the error                                                                               
    The exception must either be prevented, caught within the procedure   
    "DISTRIBUTE_ACC_ASSIGN_RE"                                           
    "(FORM)", or declared in the procedure's RAISING clause.              
    To prevent the exception, note the following:                         
    If the error occurred in one of your own programs or in an SAP program
    that you modified, try to correct it yourself.                                                                               
    You may able to find an interim solution to the problem               
    in the SAP note system. If you have access to the note system yourself,
    use the following search criteria:

    I won't post here if i already got the answer in SAP notes. I've spent 3 days searching for the answer. The only answer i got is the upgrade but can't be consider. OSS notes didn't provide me any answer. Hope u can help me
    Edited by: docgon on Mar 30, 2011 2:38 AM

  • Windows 8.1 account limit problem when downloading from store

    windows 8.1 account limit problem when downloading from store        
    I have 250 windows 8.1 tablets.
    I figured since you can use the same account on 81 devices id create 4 accounts.
    I need to download more than 25 free apps from the store
    on each tablet. Putting the same account don't work. (comes up with an error after putting on to many devices that you cant use this account now).
    Whats the best way to do this ? and what if I need to download a paid app ?
    Thank You.

    Hi,
    As far as I know, One Microsoft Account may bound at most five Trusted computers. There is no way to break this limitation.
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • When importing from my camera or file in Lightroom 5 my pictures are over-exposed by 1-2 stops, while they are well exposed on the camera-screen. How to get the 'right-exposed pictures on the screen?

    When importing from my camera or file in Lightroom 5 my pictures are over-exposed by 1-2 stops, while they are well exposed on the camera-screen. How to get the 'right-exposed pictures on the screen?

    There is an option in your Lightroom preferences on the General tab, "Treat JPEG files next to raw files as separate images". If you have that option checked then Lightroom will import and display both your raw and JPEG files. Are you using active D-lighting on your camera? If you are then you need to turn off that feature.

  • How do I maintain column formatting when converting from PDF to Excel?

    How do I maintain column formatting when converting from PDF to Excel? All info is no longer on the lines or in the columns they started out being in? Any help would be appreciated.

    Sara,
    Perhaps I am expecting too much from Adobe ExportPDF. The reason I subscribed to this service, for which I pay a yearly fee, was that I need a way to  convert scanned and digital documents to Word &/or Excel. I read the link you included but to be candid the more I tried to understand what was written the more confused I got. The process should not be this difficult. Currently I am using a NEAT scanner to create PDF documents of whatever I scan. After I changed the OCR setting on Adobe ExportPDF the output was much better but not to the point it was usable as it was. Information that appears to be lines and columns are sometimes not recognizing two columns and just putting them together in one. Obviously not usable. The other thing it does is bunch numbers that appear in a column that are just a bunch of numbers that I have no way of fixing. 
    Please let me speak to someone who can help me. Right now I not getting anything of value in my paid subscription.

  • Problems when waking from long sleep periods

    Suddenly this morning my iMac developed a problem when recovering from a long period of sleep. I'm having trouble finding a solution.
    I have my iMac set to ask for password when it recovers from sleep or screen saver. When I woke my iMac this morning the password dialog box appeared at the top of the screen as a garbled mess. If I put my iMac back to sleep and then wake it again it usually solves the problem.
    I don't want to turn password verification off. Has anyone seen this problem before? Any suggestions on what might be cause?

    funkyblue:
    I usually leave my Pismo on and allow it to sleep. I find that waking from sleep and general functioning of the computer works a lot better if from time to time (I do it at least weekly) I shut down the computer, start up in Safe Mode, log in, empty Trash and reboot normally. The emptying Trash part clears the font caches.
    You should consider doing other maintenance procedures, if you don't already. Gulliver's Mac OS X System Maintenance has good ideas with linked resources.
    Please do not hesitate to post back with further questions or comments.
    Good luck.
    cornelius

  • Default PR Type when convert from Planned Order

    Hi all,
    How can I default my PR Type when convert from Planned Order after MRP run. This can done via MRP Group control but how to go about controlling via Planned Order profile?
    Which planned object type and planned order profile to be used? assuming that i need my planned to be output at LA type and convert to NB1 PR type instead of the default NB PR type?
    Thanks.
    Regards,
    Andrew

    Hi,
    The system determines the document type from the stettings u are making in "planned order Profile" in Customising for MRP. There u define the order type, the procurement key and the special procurement key and also the account assignment category. So based on the procurement key and the special procurement key maintained in the Marterial master, the document type is selected.
    Production > Materials Requirement Planning > Procurement Proposals > Planned Order > Define order profile
    Choose the planned order type - NB1 Within this you specify the P req doc type to be used.
    Through MRP group and the different PR document type for MRP generated PR is possible only if you assign the document type to MRP group in the MRP configuration.
    Please try and come back.
    Regards,
    R.Brahmankar
    Edited by: R Brahmankar on Aug 28, 2008 10:54 AM

Maybe you are looking for