Issue in sending a mail using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'

HI Abappers,
     I have contents of the attachmnet to be sent in an internal table. when i pass this table to the FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' , the text attachment shows a slant format. i mean all the contents of the attachment shift to right and has  no proper alignment.
What can be done.? pLease help...

Hi,
You must have skipped some data declaration part which causes this.
Please refer to the below mentioned code for reference:
REPORT  zrat NO STANDARD PAGE HEADING.
*DATA DECLARATION
DATA : BEGIN OF wa_ccode,
        bukrs TYPE t001-bukrs,
       END OF wa_ccode.
DATA : itab_ccode LIKE TABLE OF wa_ccode.
DATA : BEGIN OF wa_emp,
        pernr TYPE pa0001-pernr,
        sachp TYPE pa0001-sachp,
        sname TYPE pa0001-sname,
       END OF wa_emp.
DATA : itab_emp LIKE TABLE OF wa_emp.
DATA : BEGIN OF wa_bdate,
        nachn LIKE pa0002-nachn,
        vorna LIKE pa0002-vorna,
        pernr TYPE pa0002-pernr,
        gbdat TYPE pa0002-gbdat,
       END OF wa_bdate.
DATA : itab_bdate LIKE TABLE OF wa_bdate.
DATA : new_date LIKE sy-datum.
DATA : diff TYPE i.
DATA : years LIKE p0347-scryy,
       months LIKE p0347-scrmm,
       days LIKE p0347-scrdd.
DATA : sup_code LIKE pa0001-sachp,
       itab_usrid LIKE t526-usrid,
       sup_pernr LIKE pa0105-pernr.
DATA : BEGIN OF wa_email,
       usrid_long LIKE pa0105-usrid_long,
       END OF wa_email.
DATA : sup_email LIKE TABLE OF wa_email.
DATA : gwa_document_data LIKE sodocchgi1,
       gc_name  TYPE so_obj_nam VALUE 'RETIREMENT',
       gc_senst TYPE so_obj_sns VALUE 'P',
       gc_size  TYPE so_doc_siz VALUE '510',
       gi_obj_cnt LIKE TABLE OF solisti1 WITH HEADER LINE,
       gi_recievers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
       gwa_obj_cnt LIKE LINE OF gi_obj_cnt.
DATA : smtp_addr LIKE adr6-smtp_addr.
DATA : wa_date LIKE sy-datum,
       entries LIKE sy-tabix,
       name(15),
       line1(18) TYPE c,
       line2(20) TYPE c,
       line3(20) TYPE c,
       line4(23) TYPE c,
       line5(10) TYPE c,
       line6(45) type c,
       date(2) TYPE c,
       month(2) TYPE c,
       year(4) TYPE c.
*START OF SELECTION
SELECT bukrs
FROM t001
INTO TABLE itab_ccode
WHERE land1 EQ 'GB'.
SORT itab_ccode.
DELETE ADJACENT DUPLICATES FROM itab_ccode.
SELECT pernr sachp sname
FROM pa0001
INTO TABLE itab_emp
FOR ALL ENTRIES IN itab_ccode
WHERE bukrs EQ itab_ccode-bukrs AND begda LE sy-datum AND
endda GE sy-datum and persg eq '1'.
SELECT nachn vorna pernr gbdat
FROM pa0002
INTO TABLE itab_bdate
FOR ALL ENTRIES IN itab_emp
WHERE pernr EQ itab_emp-pernr.
*TO CHECK EMPLOYEES WHOSE AGE IS NEAR 75 YEARS.
LOOP AT itab_bdate INTO wa_bdate.
  new_date = wa_bdate-gbdat.
*TO CALCULATE THE AGE TILL DATE
  CALL FUNCTION 'HR_HK_DIFF_BT_2_DATES'
    EXPORTING
      date1                         = sy-datum
      date2                         = new_date
     output_format                 = '05'
   IMPORTING
     years                         = years
     months                        = months
     days                          = days
  IF sy-subrc <> 0.
  ENDIF.
  IF years EQ 64 AND months EQ 4.
    IF days GE 23 AND days LE 31.
*FETCH THE DATA IF THE AGE IS NEARING 75 YEARS
      SELECT SINGLE sachp FROM pa0001 INTO sup_code WHERE pernr EQ
      wa_bdate-pernr AND begda LE sy-datum AND endda GE sy-datum.
      SELECT SINGLE usrid FROM t526 INTO itab_usrid WHERE sachx EQ
      sup_code.
      SELECT SINGLE pernr FROM pa0105 INTO sup_pernr WHERE usrid EQ
      itab_usrid AND subty EQ '0001'.
      clear sup_email[].
      SELECT usrid_long FROM pa0105 INTO TABLE sup_email WHERE pernr EQ
      sup_pernr AND subty EQ '0010'.
*EMAIL ADDRESS OF THE SUPERVISOR TO BE NOTIFIED
      CLEAR gi_obj_cnt.
      CLEAR gi_recievers.
      CLEAR gwa_document_data.
      Loop at sup_email into wa_email.
      write sy-uline+0(5).
      write sy-uline+10(5).
      write sy-uline+20(5).
      write sy-uline+30(5).
      write sy-uline+40(5).
      write sy-uline+50(5).
      write sy-uline+60(5).
      write sy-uline+70(5).
      smtp_addr = wa_email-usrid_long.
      gi_recievers-receiver = smtp_addr.
      gi_recievers-rec_type = 'U'.
      gi_recievers-com_type = 'INT'.
      APPEND gi_recievers.
      Endloop.
      smtp_addr = '[email protected]'.
      gi_recievers-receiver = smtp_addr.
      gi_recievers-rec_type = 'U'.
      gi_recievers-com_type = 'INT'.
      APPEND gi_recievers.
      gwa_document_data-obj_name    = gc_name.
      gwa_document_data-obj_descr   = 'RETIRE'.
      gwa_document_data-sensitivty  = gc_senst.
      gwa_document_data-obj_langu = sy-langu.
*CONTENT OF THE EMAIL TO BE SENT
      line1 = 'Please note that  '.
      line2 = wa_bdate-vorna.
      line3 = wa_bdate-nachn.
      line4 = ' will be 65 years on  '.
      line50(4) = wa_bdate-gbdat4(4).
      date = line5+2(2).
      month = line5+0(2).
      year = wa_bdate-gbdat+0(4) + 65.
      CONCATENATE date month year INTO line5 SEPARATED BY '.'.
      line6 = '.Please complete the Retirement Procedure.'.
      CONCATENATE line1 line2 line3 line4 line5 line6 INTO gwa_obj_cnt
      SEPARATED BY space.
      APPEND gwa_obj_cnt TO gi_obj_cnt.
      CLEAR gwa_obj_cnt.
      DESCRIBE TABLE gi_obj_cnt LINES entries.
      READ TABLE gi_obj_cnt INDEX entries.
gwa_document_data-doc_size = ( entries - 1 ) * 255 + STRLEN( gi_obj_cnt
*FUNCTION MODULE TO SEND THE EMAIL TO THE CONCERNED PERSONS
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
  EXPORTING
    document_data                    = gwa_document_data
    document_type                    = 'RAW'
         commit_work                      = 'X'
        TABLES
         object_content                   = gi_obj_cnt
          receivers                        = gi_recievers
  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
*MESSAGE TO BE DISPLAYED AFTER THE EXECUTION
     endif.
      CASE sy-subrc.
        WHEN 0.
          LOOP AT gi_recievers.
            IF gi_recievers-receiver = space.
              name = gi_recievers-rec_id.
            ELSE.
              name = gi_recievers-receiver.
            ENDIF.
            IF gi_recievers-retrn_code = 0.
              WRITE: / name, ': succesfully sent'.
            ELSE.
              WRITE: / name, ': error occured'.
            ENDIF.
          ENDLOOP.
        WHEN 1.
          WRITE: / 'Too many receivers specified !'.
        WHEN 2.
          WRITE: / 'No receiver got the document !'.
        WHEN 4.
          WRITE: / 'Missing send authority !'.
        WHEN OTHERS.
          WRITE: / 'Unexpected error occurred !'.
      ENDCASE.
    ENDIF.
  ENDIF.
ENDLOOP.
In case you have any further clarifications,do let me know.
Regards,
Puneet Jhari.

Similar Messages

  • Send excel attachment using FM SO_NEW_DOCUMENT_ATT_SEND_API1

    Hi ABAPers,
    I managed to send excel attachment using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
    Let say I send it to my own email account.
    But, when try to open the excel document, from lotus notes, there is warning message produced by the microsoft excel saying:
    "The file is not in a recognizable format.
    and so on....."
    Anyway, when I click button 'OK', excel sheet will be opened and no information lost.
    How can we code the abap program so that the message will not come each time I open the attachment from my lotus notes?
    Or this is just the tab delimited issue?
    Thank you.
    Regards,
    Edward.

    Hi Shan,
    Thank you for replying.
    I have the same as follows:
      DESCRIBE TABLE lt_contents_hex LINES lv_lines.
      lt_packing_list-transf_bin = 'X'.
      lt_packing_list-head_start = 1.
      lt_packing_list-head_num   = 1.
      lt_packing_list-body_start = 1.
      lt_packing_list-body_num   = lv_lines.
      lt_packing_list-doc_type   = 'XLS'.
      lt_packing_list-obj_name   = 'ATTACHMENT'.
      lt_packing_list-obj_descr  = 'Attachment'.
      lt_packing_list-doc_size   = lv_lines * 255.
      APPEND lt_packing_list.
    I'm using lt_contents_hex instead of lt_contents_bin.
    Still the problem is there.
    Is there any other way to calculate the doc size correctly?
    Regards,
    Edward.

  • Unable to sending a mail using odisend mail

    Hi,
    i have a need to send a mail using odi send mail, i am using gmail server getting to send a mail, but it getting error like this
    com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. d19sm1563829ibh.8
         at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1388)
         at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:959)
         at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:583)
         at javax.mail.Transport.send0(Transport.java:169)
         at javax.mail.Transport.send(Transport.java:99)
         at com.sunopsis.dwg.tools.SendMail.actionExecute(SendMail.java:220)
         at com.sunopsis.dwg.function.SnpsFunctionBase.execute(SnpsFunctionBase.java:276)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java:3430)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.executeOdiCommand(SnpSessTaskSql.java:1491)
         at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:32)
         at oracle.odi.runtime.agent.execution.cmd.OdiCommandExecutor.execute(OdiCommandExecutor.java:1)
         at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2906)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2609)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:540)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:453)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:1740)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:338)
         at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:214)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:272)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:263)
         at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:822)
         at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:123)
         at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:83)
         at java.lang.Thread.run(Thread.java:662)
    please share your opinions for this post
    Regards,
    901202

    http://www.oracle.com/technetwork/java/javamail/faq/index.html#starttls

  • How to bypass proxy when trying to send a mail using javamail smtp

    Hi,
    I am trying to make a servlet send a mail using javamail smtp protocol on port 25 but i m not able to send getting an exception, i suspect proxy is blocking, so any idea anyone how bypass a proxy.

    And if it does turn out that there's a proxy server blocking access to your target SMTP server, the best way to deal with that is to discuss the issue with the person responsible for your network configuration.

  • Sending e-mail using Mail on a new AT&T modem

    Since installing a new AT&T (Motorola) DSL modem, I cannot send e-mail using Apple Mail. AT&T tells me that it is a known issue with Apple, and that they will put me on "the list" for Apple to contact me. Has anyone gotten any satisfaction on this issue? Thank you. 

    I have experience the same email-related problem on both my new MacBook Pro and my iPod Touch.
    - There are also times when I will start one or the other device and get a message on the screen that reads, in effect, that another device is using the connection and cannot connect the second. (I thought mutliple devices could use the connection at the same time as long as they had the router's password.)
    - In addition, the connection will frequently disconnect, and I have to restart the modem to reconnect.
    - I have recently installed an Apple Airport Express router (which works just fine), and subsequently had to replace the modem. That's when the troubles started.

  • HT5225 unable to send receive mail using Mail 2.1.3

    Ever since iCloud took over, I am no longer able to send/receive mail using Mail 2.1.3 on my 10.4.11 version.  I didn't think it would affect it.  Someone please help as to how I can rectify the issue!

    Hi,
    Please review the following note:
    Note: 371830.1 - Notification Mailer Does Not Start, Remains In Status Starting
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=371830.1
    If the above does not help, I suggest you run "Workflow Diagnostics" test and see if it returns any error/warning messages.
    Note: 274764.1 - Oracle Workflow Cartridge Workflow Java Mailer Setup Test
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=274764.1
    Note: 378281.1 - How Does One Verify The Notification Mailer Is Functioning Properly?
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=378281.1
    Regards,
    Hussein

  • HT202304 Can't send e-mails using iCloud address on either my iPhone or Macs ?

    Hi guys and gals,
    I can't seem to be able to send e-mails using my iCloud address.
    No idea why that is. I don't get any error message, the e-mails 'get sent' without any fuss or ending in the outbox folder and they simply do not reach their destinations. There doesn't seem to exist any issues with Apple either. Perhaps my e-mails are being blocked, out of the blue (not by my ISP though, I'm having this problem with whatever network I'm connected to or using  internet data on my mobile). ?
    Any help would be appreciated, thanks !

    Hello,
    Is the e-mail account in question a .Mac or .Me account at all?

  • If I click on an e-mail address link in a web page instead of a blank message opening I always get a pop up screen with a log-in for googlemail. I do not have and do not want a googlemail account. I just want to be able to send e-mails using Outlook.

    If I click on an e-mail address link in a web page instead of a blank message opening I always get a pop up screen with a log-in for googlemail. I do not have and do not want a googlemail account. I just want to be able to send e-mails using Outlook.

    OUtlook was already set as the mail client for FF, and is my operating system (XP)'s default mail programme. therefore problem not solved at all. what I get whenever I follow a link in a webpage to send an e-mail is a little pop up window asking me to sign in to gmail or open an account. any other suggestions?

  • Sending e-mail using utl_smtp on oracle 9i

    Hello
    I have problem with sending e-mails using utl_smtp package.
    My code looks like this:
    lv_mail_conn := utl_smtp.open_connection(lv_mailhost_txt);
    utl_smtp.ehlo(lv_mail_conn, lv_mailhost_txt);
    res :=     utl_smtp.command(lv_mail_conn, 'AUTH LOGIN');
    res := utl_smtp.command(lv_mail_conn, <login in base64>);
    res := utl_smtp.command(lv_mail_conn, <password in base64>);
    And I get en error after sending a password to SMTP server.
    Error code: 535, text: 5.7.3 Authentication unsuccessful.
    This happens on oracle 9i.
    I have another server for testing which has oracle 10g installed. This code works fine on oracle 10g but doesn't work on oracle 9i.
    Do you have any ideas what's wrong? I assume that SMTP server (microsoft exchange) work correctlys because I can send e-mail from test server.

    Ok problem solved :)
    Problem was between oracle and MS exchange server. Live server oracle 9i is on linux, and testing server works on windows.
    So the problem was with configuration. Our admins corrected it and now works :). I don't know details.

  • How to send e-mail using PL/SQL

    I need to send e-mail using PL/SQL. Is it possible?
    Thanks in advance,
    Agnaldo

    Yes. Use the UTL_SMTP package

  • Send a mail use FM 'so_object_send' with a Script form layout

    Hi,
    I try to send a mail use FM 'so_object_send', is it possible to use a sap script form for the layout?
    Please give more details....

    Hi,
    Did you debug and check this function module 'SO_NEW_DOCUMENT_SEND_API1' ?
    As you said its giving you a sy-subrc = 2, did you check at what stage it is giving you an error ?
    Also, Commit work = 'X' has nothing to do with this as you are getting an error of Sy-subrc = 2.
    Also, while debugging are you getting the email address fetched from database table ? If no, then the sender's email has not been maintained. You will have to maintain the sender's email in the user details in SU02 under Address tab.
    I would recommend you to go for BCS to send emails wherein you specify the sender email address directly in the program rather than adding email address in every user's logon details.
    Regards,
    Danish.
    Edited by: Danish2285 on Mar 5, 2012 3:28 PM

  • After installing the notified update I am unable to send e-mails (using O/E on XP) as my system is supposedly unsecure. (I receive a message saying "... Secure(SSL): No, Error Number: 0x800CCC0F".) Everything was working fine immediately before I updated.

    After installing the notified update I am unable to send e-mails (using Outlook Express on Windows XP) as my system is now thought to be Unsecure. (I receive a message saying "... Secure(SSL): No, Error Number: 0x800CCC0F") Everything was working fine immediately before I installed the update. Can anyone (pleeeease) tell me where Flash has changed my security settings as I have looked at the setup, but everything looks okay. Thankyou!

    Branching this to a new discussion as it appear you are facing difficulties with the installation or running the programs you have been downloading and installing.

  • Cannot send e-mail using webmail or Thunderbird

    Since I was instructed to change my account password and walked through the person with a customer service rep a few weeks ago, I have been unable to send e-mail using Thunderbird.  Now, for the last week, I have been unable to send e-mail through Verizon Online (webmail).  I seem to be receiving e-mail normally online.  Also, I have 3 subaccounts that are working normally.
    Any suggestions (other than the ones on the support website--I've followed all those suggestions and changed all those setting, but nothing has worked) would be appreciated.  Thanks!

    beakersgirl13 wrote:
    Since I was instructed to change my account password and walked through the person with a customer service rep a few weeks ago, I have been unable to send e-mail using Thunderbird.  Now, for the last week, I have been unable to send e-mail through Verizon Online (webmail).  I seem to be receiving e-mail normally online.  Also, I have 3 subaccounts that are working normally.
    Any suggestions (other than the ones on the support website--I've followed all those suggestions and changed all those setting, but nothing has worked) would be appreciated.  Thanks!
    What error are you getting when attempting to send through webmail?
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • Can't send E-mails using Outlook Express on WRT300N

    Hello, I searched through the forums to find problems similar to mine, but everyone had a different router than mine, plus none of the solutions worked for me.
    I just purchaced and installed my router yesterday. Since the install, I have not been able to send e-mails using Outlook Express, but I do recieve e-mails. I am using the WRT300N Wireless-N Router.
    Trying to get my local news service up and running, and right now, e-mail communication is vital........
    Thanks.
    -Ryan French
    Tampa Bay News Online

    Well of course, but the error message says socket error, which doesn't tell how to fix it. Even the Outlook Express help site doesn't give any suggestions to fix anything, other than "Your internet connection has failed," which is not the problem.
    To the disable firewalls suggestion: I did try disabling my firewalls and all of my virus/ e-mail scan software just to check it out. The thing is, I don't see how my Windows XP Firewall, or anything I've been using could be a problem. Right now, because of the error all my sent e-mails are stuck in the outbox, when I disconnect my router and connect everything back up leaving the router out of the picture, the e-mails are sent out as normal. This problem only occurs with the router connected.
    I also need to stream live audio, and I've heard it's a pain using a wireless router...
    Thanks for the suggestions, hopefully someone will provide the winning suggestion so I don't have to call customer service!

  • Sending php mail(); using postfix. Authentication failed.

    Trying to set up my localhost to send php mail() using postfix.
    I did the following:
    Created the sasl_passwd file
    Created the sasl_passwd.db file
    Edited mail.cf in the postfix folder to include relay host: relayhost=smtp.live.com:587
    I'm trying to relay through my hotmail account. The mail.log returns the following:
    Jan 24 13:17:30 Richards-MacBook-Pro.local postfix/error[927]: E75CCE40EE4: to=<[email protected]>, relay=none, delay=1580, delays=1580/0.07/0/0, dsn=4.0.0, status=deferred (delivery temporarily suspended: SASL authentication failed; server smtp.live.com[65.55.162.200] said: 535 5.0.0 Authentication Failed)
    Any ideas what I'm doing wrong here?

    Ok problem solved :)
    Problem was between oracle and MS exchange server. Live server oracle 9i is on linux, and testing server works on windows.
    So the problem was with configuration. Our admins corrected it and now works :). I don't know details.

Maybe you are looking for

  • ESATA HDD not recognised on cold boot, OK on reboot

    Hi, I have a HP Elitebook 8740w from which I have removed the internal HDD and connected an eSATA HDD which is powered from the USB bus (I've done this for security purposes). I'm having a problem whereby when booting at  initial power-on, a Non-Syst

  • Creating a pdf from multiple jpgs?

    Is there a way to select multiple jpg image files in Bridge & or Photoshop and save them as one pdf? I have searched through the forums as I imagine this has come up before or maybe it's so easy I'm missing something in any case any advise would be v

  • USB port power failure?

    I'm a user of Macbook Pro 13'' Early 2011, OS X Lion pre-installed. I'm having a tiny problem with my USB port located the nearest from the front. Everytime I freshly boot-up to either Mac OS X or Window with a pre-plugged optical mouse I cannot move

  • Can not preview Folio on desktop anymore

    Geez, after the last update of the DPS tools, the preview folio from the File menu does nothing (that is: it builds the folio but then stops, no Content Viewer is launched) nor can I make preview on desktop work: I get a 'Content Viewer not found' me

  • Printing on 7 x 10 paper from PSE 4

    I have prepared a template in PSE 4 to print greeting cards on card stock that is 10x 7 inches in size. After printing and folding I have a finished card that is 5x7. I have a Canon PIXMAi8500 printer. I set the paper size in the printer program and