Error to send a report via mail with BI Publisher

Hello,
I am working with BIP 10.1.3.4 over Windows Server 2003 Standard Edition, and I would like to send a report via mail.
I added one Email server navigation via Admin>Delivery Configuration > Email with the server name and host.
Then Send report via Email, got error.
oracle.apps.xdo.service.delivery.DeliveryException: oracle.apps.xdo.delivery.DeliveryException: smtp
     at oracle.apps.xdo.service.delivery.impl.DeliveryServiceImpl.deliverToEmail(DeliveryServiceImpl.java:228)
     at oracle.apps.xdo.servlet.scheduler.XDOJob.deliver(XDOJob.java:1190)
     at oracle.apps.xdo.servlet.scheduler.XDOJob.execute(XDOJob.java:478)
     at org.quartz.core.JobRunShell.run(JobRunShell.java:195)
     at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
Caused by: oracle.apps.xdo.delivery.DeliveryException: smtp
     at oracle.apps.xdo.delivery.smtp.SMTPDeliveryRequestHandler.submitRequest(Unknown Source)
     at oracle.apps.xdo.delivery.AbstractDeliveryRequest.submit(Unknown Source)
     at oracle.apps.xdo.service.delivery.impl.DeliveryServiceImpl.deliverToEmail(DeliveryServiceImpl.java:222)
     ... 4 more
Caused by: javax.mail.NoSuchProviderException: smtp
     at javax.mail.Session.getService(Session.java:764)
     at javax.mail.Session.getTransport(Session.java:689)
     at javax.mail.Session.getTransport(Session.java:632)
     at javax.mail.Session.getTransport(Session.java:612)
     ... 7 more
I have followed this SR, and I applied the solution, but it isn't solved the issue (ID: 1072742.1)
https://support.oracle.com/CSP/ui/flash.html#tab=KBHome%28page=KBHome&id=%28%29%29,%28page=KBNavigator&id=%28from=BOOKMARK&viewingMode=1143&bmDocTitle=BI%20Publisher%20With%20JDE%20Fails%20To%20Send%20Email,%20Error:%20javax.mail.NoSuchProviderException:&bmDocID=1072742.1&bmDocType=PROBLEM&bmDocDsrc=KB%29%29
Regards,
Mónica.

Hi Christian.
You could put the lines of your list in a table of type SOLISTI1 and then use the function module SO_NEW_DOCUMENT_SEND_API1 to send the content of this table. You have to fill the table RECEIVERS with the address you want to send the report to.
Hope that helps,
Timo.

Similar Messages

  • Error while sending a report via alert

    Hi,
    I have created an alert to send a message which includes a report link. The alert worked fine, i did receive the report via email.But then once i started creating new alerts , i started getting errors in alert launching.I checked up with the services and found out that Event engine shows up an error which is
    EventEngine:Clause inconsistency between EventEngine and Satellites
    Start Unloading rules.
    Also i have got troubles with the user generated already and which was working well all these while. Now the error i see in Login management of Adminstrator is
    Login information for "NT AUTHORITY\NETWORK SERVICE". This login is not currently known to be a valid login.
    I would be really thankful if someone could help me with this.
    Regards,
    Lathika

    Login information for "NT AUTHORITY\NETWORK SERVICE". This login is not currently known to be a valid login.
    You get the above error message whenever you configure IIS to allow anonymous authentication for the web directory OracleBAM, using the NETWORK SERVICE profile for anonymous logins. You'll need to disable anonymous login for the BAM web directory.

  • Send User Variables via Mail with Captivate 7

    Hello,
    I am looking for a way to send some self difined user Variables via e-Mail?
    I only find solution for Quizes, but i´d like to have some of the Additional Viables als well.
    Is there a Way?
    Best Regards
    Bernhard

    You'll need JavaScript. In his video tutorials about JS for Captivate, Jim Leichliter explains the work flow:
    http://captivatedev.com/2014/01/02/javascript-video-series-adobe-captivate-7/
    Lilybiri

  • Report to send a List via mail

    Hi everybody,
    at the moment we hava a report which we have to start every day to generate a customer List. Via SAP Office we can send this list via email to a specific person. Now I like to automate this report and start it as a job which automativly send this list via mail.
    Do you have an idea how this will work?
    Thanks a lot for your help.
    Kind regards
    Christian

    Hi Christian.
    You could put the lines of your list in a table of type SOLISTI1 and then use the function module SO_NEW_DOCUMENT_SEND_API1 to send the content of this table. You have to fill the table RECEIVERS with the address you want to send the report to.
    Hope that helps,
    Timo.

  • Can't send e-mails via Mail with a Gmail e-mail address using Sky internet

    Can anyone help? My brother has an iBook G4 Mac OS X 4.1 and is trying to send e-mails via Mail with a Googlemail e-mail account. He is using Sky for his broadband. I assume it has something to do with his outgoing smtp e-mail Preferences in Mail, but for the life of me I can't figure it out. He can receive e-mails OK, its just that when he tries to send he gets the 'server can't send error'. Any ideas?

    Here's my gMail IMAP SMTP settings...
    smtp.gmail.com
    Port 25
    Authentication: Password
    SSL
    Sky may require another port to pass through...
    IMAP is port 143
    IMAP-SSL is port 993
    POP is port 110
    POP-SSL is port 995
    SMTP and SMTP-SSL is on ports 25, 587 and 465. Port 587 has to be SSL, and port 465 is enforced TLS-wrapped and is generally used by Outlook users.

  • How to send a report via e-mail

    Hello All,
               I want to send a report via e-mail.
               What should I do for that?
                Please help me out...
    Regards,
    Ravi Khattar.

    Hi,
      Please check the below code....
    data: t_objpack    like sopcklsti1 occurs 1 with header line,
            t_objhead    like solisti1   occurs 1 with header line,
            t_objtxt     like solisti1   occurs 0 with header line,
            t_objbin     like solisti1   occurs 1 with header line,
            t_reclist    like somlreci1  occurs 1 with header line,
            t_lobj       like abaplist   occurs 0 with header line,
            t_listobj    like abaplist   occurs 1 with header line.
      data: v_tab_line1  type i,
            v_tab_line2  type i,
            v_docsize    type i,
            v_len        type i,
            v_line(1250) type c,
            v_subj(132)  type c,
            v_cr(1)      type x value '0D',
            v_linefd(2)  type x value '0D0A',
            v_docdata    like sodocchgi1.
      clear: t_objpack[], t_objhead[], t_objtxt[], t_reclist[], t_listobj[].
      concatenate 'This email is generated from a SAP' sy-sysid '-'
         sy-mandt '- batch environment.' into t_objtxt separated by ' '.
      append t_objtxt.
      t_objtxt = 'Please do not respond to this email.'. append t_objtxt.
      v_docdata-obj_name = 'SAMPLE_TEST'.
      concatenate 'Sales Order Status Attachment -' sy-datum '-' sy-uzeit
             into v_subj separated by ' '.
      v_docdata-obj_descr = v_subj.
      describe table t_objtxt lines v_tab_line1.
      read table t_objtxt index v_tab_line1.
      v_docdata-doc_size   = ( v_tab_line1 - 1 ) * 255 + strlen( t_objtxt ).
      t_objpack-head_start = 1.
      t_objpack-head_num   = 1.
      t_objpack-body_start = 1.
      t_objpack-body_num   = v_tab_line1.
      t_objpack-doc_type   = 'RAW'.
      append t_objpack.
      clear v_line.
      if p_type = '1'.
        loop at t_list.
          concatenate v_line t_list v_linefd into v_line.
          v_len = strlen( v_line ).
          do 4 times.
            if v_len ge 255.
              if v_line+254(1) = v_cr.
                v_line255     = v_line254.
                v_line+254(1)  = ' '.
              endif.
              t_objtxt = v_line(255).
              v_line   = v_line+255.
              v_len    = v_len - 255.
              append t_objtxt.
            else.
              exit.
            endif.
          enddo.
        endloop.
        if v_line ne ' '.
          t_objtxt = v_line(255).
          append t_objtxt.
        endif.
        describe table t_objtxt lines v_tab_line2.
        t_objpack-doc_size   = ( v_tab_line2 - v_tab_line1 ) * 255.
        t_objpack-body_start = v_tab_line1 + 1.
        t_objpack-transf_bin = ' '.
        t_objpack-doc_type   = 'TXT'.
      else.
        t_objbin[] = html[].
        describe table t_objbin lines v_tab_line2.
        t_objpack-doc_size   = v_tab_line2 * 255.
        t_objpack-body_start = 1.
        t_objpack-transf_bin = 'X'.
        t_objpack-doc_type   = 'HTM'.
      endif.
      t_objpack-head_start = 1.
      t_objpack-head_num   = 1.
      t_objpack-body_num   = v_tab_line2.
      t_objpack-obj_name   = 'SAMPLE_TEST'.
      t_objpack-obj_descr  = 'Test'.
      append t_objpack.
      loop at s_email.
        t_reclist-receiver = s_email-low.
        t_reclist-rec_type = 'U'.
        append t_reclist.
      endloop.
      t_reclist-receiver   = sy-uname.
      t_reclist-rec_type   = 'B'.
      append t_reclist.
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                document_data = v_docdata
                put_in_outbox = ' '
           TABLES
                packing_list  = t_objpack
                object_header = t_objhead
                contents_bin  = t_objbin
                contents_txt  = t_objtxt
                receivers     = t_reclist.
      if sy-subrc = 0.
       endif.
    Cheers,
    Bujji

  • Sapscript/Smartform via mail with PDF attachment: logo is missing

    Hi all
    I'm implementing my function to send Sapscript/smartform via mail.
    I need to do it because when a message needs to be sent, I have to insert the message as attachment but also to add a text in the body mail.
    So I've just created a simple sapscript having a logo (as graphic) and a little text.
    I use the fm CONVERT_OTF to convert the OTF to PDF format and the following code to increase the pdf string from 132 to 255 char:
    LOOP AT t_pdf.
          TRANSLATE t_pdf USING ' ~'.
          CONCATENATE l_buffer t_pdf INTO l_buffer.
        ENDLOOP.
        TRANSLATE l_buffer USING '~ '.
        DO.
          MOVE l_buffer TO l_attachment.
          APPEND l_attachment TO x_attachment.
          SHIFT l_buffer LEFT BY 255 PLACES.
          IF l_buffer IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
    All seem to work fine, but as soon as I open the pdf file attached to the mail I can't see the logo
    So after calling fm CONVERT_OTF, I've created a pdf file by method GUI_DOWNLOAD, and then upload this file (by GUI_UPLOAD) into internal table for attachment and send the mail.
    Now really all work very fine, becaus I can see the logo
    Of course I don't want to dowload the file before sending a mail, but I need to send my print directly as pdf attachment
    The two ways seem to be equal, they use the same print and the same functions, only the way to upload the internal table for attachment is different:
    1) tha abap code above to expand the line from 132 to 255
    2) the method GUI_UPLOAD
    So something seems to be wrong in the first way because ithe logo is missing in the pdf attachment generated for the mail
    Max

    Hi
    I'm not working on unicode system, anyway I didn't see that parameter BIN_FILE, so I didn't use it
    I've read the note 1324547 and I've done just as it explaines: now works fine
    I don't know why it doesn't work with old manner (i.e data is treated as character-type), but it worls with the new one (If the data is treated as xstring-type)
    I can only suppose the data are corrupted while being elaborated for expand to 255 char....but I don't why
    Anyway your suggestion works for me
    Thank
    Max

  • I'm trying to unlock an Iphone 4. The celular company allready unlocked it. and send me an E Mail with the instructions to do it myself. I have done every step, and in itunes apears that my Iphone is Unlocked. But I can not use a sim CArd from another Co

    Im tying to unlock an Iphone 4.
    the celular company make it by its system, and send me an E mail with the instructions to finsh the process by myself, throug itunes.
    I did every step, and at the end appers a message telling that my Iphone is unlocked.
    but it does not work with other celular company sim card.
    It only works with the original sim Card company.
    In the Iphone appears a message teeling that has no service with another company's sim CArd.
    I don't know what to do.
    I've been doing this, with different Sim cards.
    sometimes appears a message informing that the SIM card is locked with a PIN. That i must instal the last itunes version and connect it again.
    but every Sim card I have are with PIN.
    If you can help me I;ll be very glad.
    Thank you very Much.
    nicanorfrommon

    Chrisj4203, thank you for your kind answer.
    I have done a lot of restores to the Iphone, and resets also.
    I;ve done holding both buttons as you sugested, but there is no signal appearing.
    I am in Uruguay, South America and the original company is Movistar ( Telefonica) and the new sim card is from ANTEL ( the officail and biggest company in my country).
    I don;t knoe what todo.
    I have been trying for more than one mont.
    I have gone several times to both companies. Aldo two times to Apple uruguay, and nobody can help me.

  • Opening a search service via Mail with Chrome and not Safari

    Hello all,
    Is there an option to open a search service via Mail with my default browser (Chrome) instead of Safari. This works while searching from the browser itself but not the Mail app, have not experimented with other os x apps.

    Then check the Mail preferences for a default broswer entry and change that to Chrome. Not sure if it is in there as I stopped using Mail several years ago.
    To completely get rid of this problem stop using Mac Mail.app and switch to some other mail program that actually works correctly.

  • How do I stop  my mail from send out my e-mails with the mobile me acct instead of my default provider?  I have checked the "use only this server" in my provider account.

    How do I stop  my mail from send out my e-mails with the mobile me acct instead of my default provider?  I have checked the "use only this server" in my provider account.

    There is no such option/setting on an iPhone to determine this. Whether you can view the attachment has more to do with your connection, WiFi or cellular, and the size of the attachment than anything else. There will be a paperclip indicating the message includes an attachment regardless if downloaded with the message or not. When connected to the cellular network, if an attachment is below a designated size the attachment will be downloaded automatically. If over a certain size, you must select the attached file icon in the body of the message to download the attachment. The size limit varies by carrier/provider.
    Tell her you're gonna leave her out of the Will if she doesn't stop .

  • If i send a report via icloud how am i notified

    if i send a report via iclod how do i get my response please

    Yes. On your phone make sure it is set to send messages from your phone number, not your apple id or other email address. That way when they reply it will go to your phone.

  • Send report via mail

    HI all,
    I have to send the output of the report in XL sheet thr mail.
    can any body explain the whole procedure of that

    See this example [sending external mail with XLS attachement|http://www.sapdev.co.uk/reporting/email/attach_xls.htm]
    Regards
    Marcin

  • Error while sending PO output through mail in PDF format - Urgent

    Dear friends,
    Developed program to send sapscript output through mail in pdf format, the program running properly, even function module SO_NEW_DOCUMENT_ATT_SEND_API1 returning sy-subrc 0. But the external mail is not going to user lying in SAP outbox with message <b>"Wait for communications service"</b> . SCOT is properly configured, tested mails sending through SAP office.
    Find below the source code:
    REPORT  zmm_porder_gm
                NO STANDARD PAGE HEADING.
    TABLES: ekko, ekpa, t161t, t052, komv, j_1imocomp, t001, esll.
    Internal Tables
    DATA : txt LIKE tline-tdline,  "HEADER LINE
           your_ref LIKE ekko-ihrez, "your ref
           our_ref  LIKE ekko-unsez, "our ref
           mcompname  LIKE  t001-butxt,
           itemname   LIKE  ekpo-txz01,
           del_text LIKE tline-tdline, "delivery text
           mat_po_text LIKE tline-tdline. "material po text
    DATA: g_ind TYPE i.
    DATA: it_esll LIKE esll OCCURS 0 WITH HEADER LINE.
    DATA: sub_packno LIKE esll-sub_packno.
    DATA : po_flag(1) TYPE c.
    DATA : it_erev LIKE erev OCCURS 0 WITH HEADER LINE.
    DATA : nmebeln LIKE thead-tdname,
           obj LIKE thead-tdname.
    DATA : tline LIKE tline OCCURS 0 WITH HEADER LINE.  "HEADER TEXT
    DATA  : it_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
    DATA  : it_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
    DATA  : it_zmm_porder  LIKE zmm_porder OCCURS 0 WITH HEADER LINE.
    DATA  : it_konv        LIKE konv OCCURS 0 WITH HEADER LINE.
    DATA  : it_konv_ftr    LIKE konv OCCURS 0 WITH HEADER LINE.
    DATA  : it_konv_rate   LIKE konv OCCURS 0 WITH HEADER LINE.
    DATA  : it_komv_tax    LIKE komv OCCURS 0 WITH HEADER LINE.           " For Tax Calculation
    DATA  : it_zmm_house_bank LIKE zmm_house_bank OCCURS 0 WITH HEADER LINE.
    *DATA  : mrate TYPE konv-kbetr VALUE 0, mrate1(15).  rmoved by ganes and added following logic
    DATA  : mrate TYPE p VALUE 0 DECIMALS 2, mrate1(15).
    DATA  : mrate_gm TYPE p  DECIMALS 2.
    DATA  : BEGIN OF it_konv1 OCCURS 0,
                  knumv LIKE konv-knumv,
                  kschl LIKE konv-kschl,
    END OF it_konv1.
    DATA : BEGIN OF it_t052u OCCURS 0.
            INCLUDE STRUCTURE t052u.
    DATA : END OF it_t052u.
    DATA  : mpay_terms LIKE t052u-text1.
    DATA  : mwaers     LIKE konv-waers.
    DATA : BEGIN OF xt052 OCCURS 0.
            INCLUDE STRUCTURE t052.
    DATA : END OF xt052.
    DATA : it_t16ct LIKE t16ct OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF ztext OCCURS 0.
            INCLUDE STRUCTURE ttext.
    DATA : END OF ztext.
    DATA  : it_t001      LIKE t001 OCCURS 0 WITH HEADER LINE.
    DATA  : mtext(15)    TYPE c.
    DATA  : it_adrc      LIKE adrc OCCURS 0 WITH HEADER LINE.
    DATA  : it_adrc_ven  LIKE adrc OCCURS 0 WITH HEADER LINE.
    DATA  : it_adrc_plt  LIKE adrc OCCURS 0 WITH HEADER LINE.
    DATA :  it_makt      LIKE makt OCCURS 0 WITH HEADER LINE.
    DATA :  it_eket      LIKE eket OCCURS 0 WITH HEADER LINE.               " Schedulling
    DATA :  it_eikp      LIKE eikp OCCURS 0 WITH HEADER LINE.               " Export
    DATA :  it_t001w     LIKE t001w OCCURS 0 WITH HEADER LINE.
    DATA  : it_t685t     LIKE t685t OCCURS 0 WITH HEADER LINE.
    DATA  : it_t618t     LIKE t618t OCCURS 0 WITH HEADER LINE.
    DATA  : it_t685t_ftr LIKE t685t OCCURS 0 WITH HEADER LINE.
    DATA  : it_lfa1  LIKE lfa1 OCCURS 0 WITH HEADER LINE.
    DATA : it_bapi_mltx_ga LIKE bapi_mltx_ga OCCURS 0 WITH HEADER LINE. "Material long text
    DATA : mfirst   TYPE i  VALUE 0,
           mpay_flag(1) TYPE c VALUE 'X',
           mwerks   LIKE    t001w-werks,
           msr      TYPE i  VALUE 0,
           l_rate   TYPE p  DECIMALS 2  VALUE 0,
           l_amt    TYPE p  DECIMALS 2  VALUE 0,
           mflag(1) TYPE c,
           mlctr    TYPE i  VALUE 0,
           mfamt    TYPE p DECIMALS 2 VALUE 0,
           mcfamt(15) TYPE c,
           mfword(100) TYPE c,
           mkschl   LIKE konv-kschl,
           mchgamt  TYPE p  DECIMALS 2 VALUE 0,
           mkbetr   TYPE p  DECIMALS 2 VALUE 0,
           mkwert   TYPE p  DECIMALS 2 VALUE 0.
    DATA : j_1iexcd     TYPE  j_1imocomp-j_1iexcd,
           j_1icstno    TYPE  j_1imocomp-j_1icstno,
           j_1ilstno    TYPE  j_1imocomp-j_1ilstno.
    DATA : mjmop_r    TYPE p DECIMALS 2 VALUE 0,
           mjmoq_r    TYPE p DECIMALS 2 VALUE 0,
           mjecs_r    TYPE p DECIMALS 2 VALUE 0,
           mjvcs_r    TYPE p DECIMALS 2 VALUE 0,
           mjvrd_r    TYPE p DECIMALS 2 VALUE 0,
           mjsep_r    TYPE p DECIMALS 2 VALUE 0.
    DATA : mjmop_a    TYPE p DECIMALS 2 VALUE 0,
           mjmoq_a    TYPE p DECIMALS 2 VALUE 0,
           mjecs_a    TYPE p DECIMALS 2 VALUE 0,
           mjvcs_a    TYPE p DECIMALS 2 VALUE 0,
           mjvrd_a    TYPE p DECIMALS 2 VALUE 0,
           mjsep_a    TYPE p DECIMALS 2 VALUE 0.
    DATA  : mtitle   LIKE  t161t-batxt.
    DATA :         no_ammend(10),request_by(50),ver_txt(100),ver_reason(100),stext(200).
    begin of Email data declarations**************
    DATA: BEGIN OF otf OCCURS 0.
            INCLUDE STRUCTURE itcoo .
    DATA: END OF otf.
    DATA: itcpo LIKE itcpo.
    DATA: itcpp LIKE itcpp.
    DATA: it_docs  TYPE STANDARD TABLE OF docs,
          v_bin_filesize          TYPE i,
          it_lines TYPE STANDARD TABLE OF tline,
          wa_lines TYPE tline.
    DATA : i_pdf LIKE tline OCCURS 1000 WITH HEADER LINE,
    v_pdf_bytecount TYPE i,
    v_pdf_spoolid TYPE tsp01-rqident,
    v_otf_pagecount TYPE i,
    v_btc_jobname TYPE tbtcjob-jobname,
    v_btc_jobcount TYPE tbtcjob-jobcount.
    DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
    DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    DATA: objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
    DATA: reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
    DATA: doc_chng LIKE sodocchgi1.
    DATA: tab_lines LIKE sy-tabix.
    DATA: vafilename(100) VALUE 'po_output.pdf'.
    DATA: jobdata TYPE sxjobdata.
    DATA arc_params TYPE arc_params.
    DATA print_params TYPE pri_params.
    DATA g_send_prog TYPE syrepid VALUE 'ZVF03_TEST_PROG'.
    DATA immediate TYPE btcchar1.
    DATA: i_jobname TYPE tbtcp-jobname,
    i_jobcount TYPE tbtcp-jobcount,
    i_jobstepcount TYPE tbtcp-stepcount.
    DATA recipient_obj LIKE swotobjid.
    CONSTANTS: sx_true TYPE sx_boolean VALUE 'X'.
    TABLES: tbtcp.
    end of Email data declarations**************
    SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS   : mebeln FOR ekko-ebeln OBLIGATORY .               " 75
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 12.
    SELECTION-SCREEN COMMENT (20) text-b01.
    PARAMETERS: b1 AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN : END OF BLOCK block1.
    SELECTION-SCREEN: BEGIN OF SCREEN 200 TITLE text-001 AS WINDOW.
    PARAMETERS :  p_email TYPE ad_smtpadr.     "E-Mail Address
    SELECTION-SCREEN: END OF SCREEN 200.
    INITIALIZATION.
      SET PF-STATUS 'ZMMPORD_STAT'.
    AT SELECTION-SCREEN.
      CASE sy-ucomm.
        WHEN 'EMAIL'.
          PERFORM zemail.
        WHEN '&IC1'.
          PERFORM load_data.
          PERFORM process.
          IF NOT p_email IS INITIAL.
            PERFORM send_mail.
          ENDIF.
      ENDCASE.
    *START-OF-SELECTION.
    PERFORM load_data.
    PERFORM process.
    FORM load_data .
      DATA : gindex LIKE sy-tabix.
      SELECT * FROM t16ct INTO TABLE it_t16ct WHERE spras = 'EN'.
      SELECT * FROM ekko INTO TABLE it_ekko WHERE ebeln IN mebeln.
      IF sy-subrc EQ 0.
        SELECT * FROM erev INTO CORRESPONDING FIELDS OF TABLE it_erev FOR ALL ENTRIES IN it_ekko
        WHERE edokn = it_ekko-ebeln AND rscod <> '' .
        SORT it_erev BY edokn revno DESCENDING.
        LOOP AT it_ekko.
          IF NOT ( it_ekko-frgke EQ 'O'  OR it_ekko-frgke EQ '0' ) .
            MESSAGE e000(zsd) WITH 'Purchase Order is not Realeased'.
          ENDIF.
        ENDLOOP.
        SELECT * FROM ekpo INTO TABLE it_ekpo WHERE ebeln IN mebeln.
        IF sy-subrc EQ 0.
          SELECT * INTO TABLE it_makt
          FROM   makt
          FOR    ALL ENTRIES IN it_ekpo
          WHERE  matnr EQ it_ekpo-matnr.
          SELECT * INTO TABLE it_lfa1
          FROM   lfa1
          FOR    ALL ENTRIES IN it_ekko
          WHERE  lifnr EQ it_ekko-lifnr.
        ENDIF.
        SELECT *
          INTO TABLE it_t052u
          FROM t052u
           FOR ALL ENTRIES IN it_ekko
         WHERE zterm EQ it_ekko-zterm
          AND  spras EQ 'EN'.
        IF sy-subrc EQ 0.
          SORT it_t052u BY zterm.
        ENDIF.
        SELECT * FROM eket INTO TABLE it_eket WHERE ebeln IN mebeln.
        IF sy-subrc EQ 0.
          SORT it_eket BY ebeln ebelp.
        ENDIF.
        SELECT  *
          INTO TABLE it_eikp
          FROM eikp
           FOR ALL ENTRIES IN it_ekko
         WHERE exnum EQ it_ekko-exnum.
        IF sy-subrc EQ 0.
          SORT it_eikp BY exnum.
          SELECT  *
            INTO TABLE it_t618t
            FROM t618t
             FOR ALL ENTRIES IN it_eikp
           WHERE expvz EQ it_eikp-expvz
             AND spras EQ 'E'
             AND land1 EQ 'IN'.
          IF sy-subrc EQ 0.
            SORT it_t618t BY expvz.
          ENDIF.
        ENDIF.
        REFRESH : it_zmm_porder.
        CLEAR   : it_zmm_porder.
        SELECT * INTO TABLE it_zmm_porder
          FROM zmm_porder
         WHERE flag EQ 'L'.
        IF sy-subrc EQ 0.
          SORT it_zmm_porder BY kschl.
        ENDIF.
        SELECT * FROM konv INTO TABLE it_konv
        FOR ALL ENTRIES IN it_ekko
        WHERE knumv = it_ekko-knumv
          AND  kwert NE 0.
        LOOP AT it_konv.
          gindex = sy-tabix.
          READ TABLE it_zmm_porder WITH KEY kschl = it_konv-kschl BINARY SEARCH.
          IF sy-subrc NE 0.
            DELETE it_konv INDEX gindex.
          ENDIF.
        ENDLOOP.
        IF sy-subrc EQ 0.
          SORT it_konv BY knumv kherk kschl.
        ENDIF.
        REFRESH : it_zmm_porder.
        CLEAR   : it_zmm_porder.
        SELECT * INTO TABLE it_zmm_porder
          FROM zmm_porder
         WHERE flag EQ 'F'.
        IF sy-subrc EQ 0.
          SORT it_zmm_porder BY kschl.
        ENDIF.
       SELECT * INTO TABLE IT_KONV_FTR FROM KONV
          FOR ALL ENTRIES IN IT_EKKO
         WHERE KNUMV = IT_EKKO-KNUMV
           AND  ( KSCHL = 'ZIN1'
              OR  KSCHL = 'ZIN2'
              OR  KSCHL = 'ZINS'
              OR  KSCHL = 'ZPF1'
              OR  KSCHL = 'ZPF2'
              OR  KSCHL = 'ZPF3'
              OR  KSCHL = 'ZPKG'
              OR  KSCHL = 'ZPKF'
              OR  KSCHL = 'FRA1'
              OR  KSCHL = 'FRB1'
              OR  KSCHL = 'FRC1'
              OR  KSCHL = 'FRD1'
              OR  KSCHL = 'FRD2'
              OR  KSCHL = 'FRD3'
              OR  KSCHL = 'FRD4'
              OR  KSCHL = 'FRD5'
    *****Added one condition type below ZFBC as on 05.06.2007 :Rajiv as per mail of Sadiq via mathew sir(RTDK906646)
              OR  KSCHL = 'ZFBC' )
           AND  KWERT NE 0
           AND  KPOSN GT '000000'.
          AND ( KRECH = 'B'                       " RTDK906167
           OR  KRECH = 'A' ).
        SELECT * INTO TABLE it_konv_ftr FROM konv
           FOR ALL ENTRIES IN it_ekko
          WHERE knumv = it_ekko-knumv
            AND  kwert NE 0
            AND  kposn GT '000000'.
        LOOP AT it_konv_ftr.
          gindex = sy-tabix.
          READ TABLE it_zmm_porder WITH KEY kschl = it_konv_ftr-kschl BINARY SEARCH.
          IF sy-subrc NE 0.
            DELETE it_konv_ftr INDEX gindex.
          ENDIF.
        ENDLOOP.
        IF it_konv_ftr[] IS NOT INITIAL.
          SORT it_konv_ftr BY knumv kschl.
        ENDIF.
       SELECT  KNUMV KSCHL INTO CORRESPONDING FIELDS OF TABLE IT_KONV1 FROM KONV
       FOR ALL ENTRIES IN IT_EKKO
       WHERE KNUMV = IT_EKKO-KNUMV
           and kherk = 'D'
         AND  ( KSCHL = 'ZIN1'
            OR  KSCHL = 'ZIN2'
            OR  KSCHL = 'ZINS'
            OR  KSCHL = 'ZPF1'
            OR  KSCHL = 'ZPF2'
            OR  KSCHL = 'ZPF3'
            OR  KSCHL = 'ZPKG'
            OR  KSCHL = 'ZPKF'
            OR  KSCHL = 'FRA1'
            OR  KSCHL = 'FRB1'
            OR  KSCHL = 'FRC1'
            OR  KSCHL = 'FRD1'
            OR  KSCHL = 'FRD2'
            OR  KSCHL = 'FRD3'
            OR  KSCHL = 'FRD4'
            OR  KSCHL = 'FRD5'
    *****Added one condition type below ZFBC as on 05.06.2007 :Rajiv as per mail of Sadiq via mathew sir(RTDK906646)
            OR  KSCHL = 'ZFBC' )
         AND  KWERT NE 0.
           AND ( KRECH = 'B'                       RTDK906167
            OR  KRECH = 'A' ).
        SELECT  knumv kschl INTO CORRESPONDING FIELDS OF TABLE it_konv1 FROM konv
        FOR ALL ENTRIES IN it_ekko
        WHERE knumv = it_ekko-knumv
          AND  kwert NE 0.
        DELETE ADJACENT DUPLICATES FROM it_konv1 COMPARING knumv kschl.
        LOOP AT it_konv1.
          gindex = sy-tabix.
          READ TABLE it_zmm_porder WITH KEY kschl = it_konv1-kschl BINARY SEARCH.
          IF sy-subrc NE 0.
            DELETE it_konv1 INDEX gindex.
          ENDIF.
        ENDLOOP.
        IF sy-subrc EQ 0.
          SORT it_konv1 BY knumv kschl.
        ENDIF.
        SELECT * INTO TABLE it_t685t
        FROM   t685t
        FOR    ALL ENTRIES IN it_konv
        WHERE  kschl EQ it_konv-kschl
          AND  kappl EQ it_konv-kappl
          AND  spras EQ 'E'.
        SELECT * INTO TABLE it_t685t_ftr
        FROM   t685t
        FOR    ALL ENTRIES IN it_konv_ftr
        WHERE  kschl EQ it_konv_ftr-kschl
          AND  kappl EQ it_konv_ftr-kappl
          AND  spras EQ 'E'.
        it_t685t_ftr-kschl = 'JVCS'.
        it_t685t_ftr-vtext = 'IN CST in vat'.
        APPEND it_t685t_ftr.
        SELECT * INTO TABLE it_zmm_house_bank
          FROM zmm_house_bank
         WHERE ebeln IN mebeln.
      ELSE.
        MESSAGE e899(mm) WITH 'Data not found for selection criteria...'.
      ENDIF.
    ENDFORM.                    " Load_data
    FORM process .
      DATA : mctr   TYPE i VALUE 1.
      DATA : gindex LIKE sy-tabix.
      DATA : mline(75) TYPE c.
      DATA : mlifn2    LIKE ekpa-lifn2.
      DATA :  mv_name LIKE lfa1-name1,
             madrnr  LIKE lfa1-adrnr.
      CLEAR itcpo.
      itcpo-tdgetotf = 'X'.
      CALL FUNCTION 'OPEN_FORM'
        EXPORTING
          form     = 'ZMM_PORDER'
          language = sy-langu
          OPTIONS  = itcpo
          dialog   = ' '
        EXCEPTIONS
          OTHERS   = 1.
      LOOP AT it_ekko.
        CALL FUNCTION 'START_FORM'
          EXPORTING
            form = 'ZMM_PORDER'.
        SELECT SINGLE *
         FROM  t001
         INTO  it_t001
        WHERE  bukrs EQ it_ekko-bukrs.
        mcompname = it_t001-butxt.
        TRANSLATE mcompname TO UPPER CASE.
        Document Type
        SELECT SINGLE batxt
          INTO mtitle
          FROM t161t
         WHERE bstyp EQ 'F'
         AND   spras EQ 'E'
         AND   bsart EQ it_ekko-bsart.
        REFRESH it_adrc.
        SELECT SINGLE werks
          INTO mwerks
          FROM ekpo
         WHERE ebeln EQ it_ekko-ebeln.
        SELECT SINGLE *
          INTO it_t001w
          FROM t001w
         WHERE werks EQ mwerks.
        REFRESH it_adrc.
        SELECT SINGLE *
          INTO it_adrc_plt
          FROM adrc
         WHERE addrnumber EQ it_t001w-adrnr.
        REFRESH : xt052.
        mfamt  = 0.
        msr    = 0.
    in 500c this statement failed.
       SELECT SINGLE * FROM T052 INTO XT052 WHERE ZTERM = IT_EKKO-ZTERM.
       CALL FUNCTION 'FI_TEXT_ZTERM'
         EXPORTING
           I_T052  = XT052
         TABLES
           T_ZTEXT = ZTEXT.
        As per Preeti... Shipment address should be shown on top as purchase order company address. 27.04.
        PERFORM writeform USING 'PLANT' 'PLANT'.
        SELECT  SINGLE name1 adrnr
          INTO  (mv_name,madrnr)
          FROM  lfa1
         WHERE  lifnr EQ it_ekko-lifnr.
        REFRESH it_adrc[].
        CLEAR   it_adrc[].
        FREE it_adrc[].
        SELECT SINGLE *
          INTO it_adrc_ven
          FROM adrc
         WHERE addrnumber EQ madrnr.
        READ TABLE it_lfa1 WITH KEY lifnr = it_ekko-lifnr.
        PERFORM writeform USING 'VENDOR' 'VENDOR'.
         Shipment
        SELECT SINGLE werks
          INTO mwerks
          FROM ekpo
         WHERE ebeln EQ it_ekko-ebeln.
           up to 1 rows.
        SELECT SINGLE *
          INTO it_t001w
          FROM t001w
         WHERE werks EQ mwerks.
        SELECT SINGLE j_1iexcd j_1icstno j_1ilstno
                 INTO (j_1iexcd,j_1icstno,j_1ilstno)
               FROM    j_1imocomp
                WHERE  werks  = mwerks.
        REFRESH it_adrc.
        SELECT SINGLE *
          INTO it_adrc
          FROM adrc
         WHERE addrnumber EQ it_t001w-adrnr.
        PERFORM writeform USING 'SHIPMNT' 'SHIPMNT'.
        READ TABLE it_eikp WITH KEY exnum = it_ekko-exnum.
        IF sy-subrc EQ 0.
          READ TABLE it_t618t WITH KEY expvz = it_eikp-expvz.
        ENDIF.
        your_ref = it_ekko-ihrez.
        our_ref  = it_ekko-unsez.
        READ TABLE it_erev WITH KEY edokn = it_ekko-ebeln.
        IF sy-subrc = 0.
          no_ammend  = it_erev-revno.
          request_by = it_erev-crnam.
          ver_txt    = it_erev-txz01.
          READ TABLE it_t16ct WITH KEY rscod = it_erev-rscod.
          IF sy-subrc = 0.
            ver_reason = it_t16ct-rstxt.
          ELSE.
            ver_reason = ''.
          ENDIF.
        ELSE.
          no_ammend  = ''.
          request_by = ''.
          ver_txt    = ''.
          ver_reason = ''.
        ENDIF.
        PERFORM writeform USING 'PO_INFO' 'PO_INFO'.
        IF it_zmm_house_bank[] IS NOT INITIAL.
          READ TABLE it_zmm_house_bank INDEX 1.
          PERFORM writeform USING 'BANKDTL' 'BANKDTL'.
        ENDIF.
        PERFORM writeform USING 'HDR_INFO' 'HDR_INFO'.
        PERFORM writeform USING 'BRK_TTL' 'MAIN'.
        msr     = 1.
        mlctr   = 1.
    *added by ganesh to prevent deleted items to appear in print out
       LOOP AT IT_EKPO WHERE EBELN EQ IT_EKKO-EBELN.
        LOOP AT it_ekpo WHERE ebeln EQ it_ekko-ebeln AND loekz NE 'L'.
    *end of change
          CLEAR: mrate, mrate1.
          SELECT * FROM konv INTO TABLE it_konv_rate
                   WHERE knumv EQ it_ekko-knumv
                   AND   kposn EQ it_ekpo-ebelp
                   AND  ( kschl EQ 'PBXX' OR kschl EQ 'PB00'  OR kschl EQ 'P001' ).
          LOOP AT it_konv_rate.
           IF it_konv_rate-kpein > 0.             " added by ganesh as per sudhir 12.10.2007
             mrate_gm = it_konv_rate-kbetr / it_konv_rate-kpein.
             mrate  = mrate + mrate_gm. " added by ganesh as per sudhir 12.10.2007
           ELSE.
            mrate  = mrate + it_konv_rate-kbetr.
           ENDIF.
            IF it_konv_rate-waers IS NOT INITIAL.
              mwaers = it_konv_rate-waers.
            ENDIF.
          ENDLOOP.
        For Japanies Yen   "RTDK906759
          IF it_ekko-waers = 'JPY'.
            mrate = mrate * 100.
          ENDIF.
        End for japanies Yen
          mrate1 = mrate.
               End rate
          mfirst  = 0.
                MFAMT  = MFAMT + ( IT_EKPO-NETPR * IT_EKPO-MENGE ).
          mfamt  = mfamt + ( mrate * it_ekpo-menge ).
          PERFORM get_mat_long_text.
          DATA: lt_ctr TYPE i VALUE 0,lt_ctr1 TYPE i, lt_count TYPE i VALUE 0. " Long text counter
          DESCRIBE TABLE it_bapi_mltx_ga LINES lt_count.
          CLEAR it_bapi_mltx_ga.
    *Added by Rajiv 10.05.2007 Read and if condition RTDK906165
          READ TABLE it_konv WITH KEY knumv = it_ekko-knumv
                                      kposn = it_ekpo-ebelp.
          mkbetr  = 0.
          mkwert  = 0.
          IF sy-subrc EQ 0.
            LOOP AT it_konv  WHERE knumv EQ it_ekko-knumv
                               AND kposn EQ it_ekpo-ebelp.
              IF it_konv-krech EQ 'A'.
                mkbetr  = it_konv-kbetr / 10.
              ELSE.
                mkbetr  = it_konv-kbetr.
              ENDIF.
            For Japanies Yen "RTDK906759
              IF it_ekko-waers = 'JPY'.
                mkbetr = mkbetr * 100.
              ENDIF.
            End for japaies Yen
              IF mkbetr LT '0'.
                mkbetr = mkbetr * ( -1 ).
              ENDIF.
              mkwert   = it_konv-kwert.
            For Japanies Yen "RTDK906759
              IF it_ekko-waers = 'JPY'.
                mkwert = mkwert * 100.
              ENDIF.
            End for japaies Yen
              mfamt  = mfamt + mkwert.
              IF mkwert LT '0'.
                mkwert = mkwert * ( -1 ).
              ENDIF.
              IF it_ekpo-matnr IS INITIAL.
                itemname = it_ekpo-txz01.
              ELSE.
                READ TABLE it_makt  WITH KEY matnr = it_ekpo-matnr.
                itemname = it_makt-maktx.
              ENDIF.
              READ TABLE it_t685t WITH KEY kschl = it_konv-kschl BINARY SEARCH.
              READ TABLE it_eket  WITH KEY ebeln = it_ekpo-ebeln
                                           ebelp = it_ekpo-ebelp BINARY SEARCH.
              IF mfirst EQ 0.
                PERFORM writeform USING 'BRK_INFO' 'MAIN'.
                mfirst = 1.
              ELSE.
                ADD 1 TO lt_ctr.
                CLEAR it_bapi_mltx_ga.
                READ  TABLE it_bapi_mltx_ga INDEX lt_ctr. "For long text
                IF sy-subrc NE 0.
                  CLEAR it_bapi_mltx_ga.
                ENDIF.
                PERFORM writeform USING 'BRK_INFO1' 'MAIN'.
              ENDIF.
              mlctr = mlctr + 1.
            ENDLOOP.               "   it_konv.
          ELSE.
            IF it_ekpo-matnr IS INITIAL.
              itemname = it_ekpo-txz01.
            ELSE.
              READ TABLE it_makt  WITH KEY matnr = it_ekpo-matnr.
              itemname = it_makt-maktx.
            ENDIF.
                        READ TABLE IT_T685T WITH KEY KSCHL = IT_KONV-KSCHL BINARY SEARCH.
            READ TABLE it_eket  WITH KEY ebeln = it_ekpo-ebeln
                                         ebelp = it_ekpo-ebelp BINARY SEARCH.
            mfirst = 0.
            IF mfirst EQ 0.
              PERFORM writeform USING 'BRK_INFO' 'MAIN'.
              mfirst = 1.
            ELSE.
              ADD 1 TO lt_ctr.
              CLEAR it_bapi_mltx_ga.
              READ  TABLE it_bapi_mltx_ga INDEX lt_ctr. "For long text
              IF sy-subrc NE 0.CLEAR it_bapi_mltx_ga.ENDIF.
              PERFORM writeform USING 'BRK_INFO1' 'MAIN'.
            ENDIF.
          ENDIF.
    *Commented by rajiv 10.05.2007 used this code in above condition.
    added by ganesh on 260407 to print record
                if it_konv is initial.
                        READ TABLE IT_MAKT  WITH KEY MATNR = IT_EKPO-MATNR.
                        READ TABLE IT_T685T WITH KEY KSCHL = IT_KONV-KSCHL BINARY SEARCH.
                        READ TABLE IT_EKET  WITH KEY EBELN = IT_EKPO-EBELN
                                                     EBELP = IT_EKPO-EBELP BINARY SEARCH.
                        mFirst = 0.
                        if mFirst eq 0.
                             PERFORM WRITEFORM USING 'BRK_INFO' 'MAIN'.
                             mFirst = 1.
                        else.
                             add 1 to lt_ctr.
                             clear it_bapi_mltx_ga.
                             read  table IT_BAPI_MLTX_GA index lt_ctr. "For long text
                             if sy-subrc ne 0.clear it_bapi_mltx_ga.endif.
                             PERFORM WRITEFORM USING 'BRK_INFO1' 'MAIN'.
                        Endif.
                endif.
    end of change
          REFRESH it_komv_tax.
          PERFORM get_tax_cal USING it_ekpo-ebeln
                                    it_ekpo-ebelp.
                                 Changing it_komv_tax.
          REFRESH : it_zmm_porder.
          CLEAR   : it_zmm_porder.
          SELECT * INTO TABLE it_zmm_porder
            FROM zmm_porder
           WHERE flag EQ 'T'.
          IF sy-subrc EQ 0.
            SORT it_zmm_porder BY kschl.
          ENDIF.
          LOOP AT it_komv_tax.
            gindex = sy-tabix.
            READ TABLE it_zmm_porder WITH KEY kschl = it_komv_tax-kschl BINARY SEARCH.
            IF sy-subrc NE 0.
              DELETE it_komv_tax INDEX gindex.
            ENDIF.
          ENDLOOP.
          LOOP AT it_komv_tax WHERE kwert IS NOT INITIAL.
           IF ( IT_KOMV_TAX-KSCHL EQ 'JMOP' OR
                IT_KOMV_TAX-KSCHL EQ 'JECS' OR
                IT_KOMV_TAX-KSCHL EQ 'JSEP' OR
                IT_KOMV_TAX-KSCHL EQ 'JMOQ' OR
                IT_KOMV_TAX-KSCHL EQ 'JVCS' OR
                IT_KOMV_TAX-KSCHL EQ 'JVRD' OR
                IT_KOMV_TAX-KSCHL EQ 'JMIP' OR
    *             IT_KOMV_TAX-KSCHL EQ 'JEIP' OR
                IT_KOMV_TAX-KSCHL EQ 'JSEI' OR
                IT_KOMV_TAX-KSCHL EQ 'JSRT' OR
                IT_KOMV_TAX-KSCHL EQ 'JEC3' OR
                IT_KOMV_TAX-KSCHL EQ 'JVRN' )
                AND IT_KOMV_TAX-KWERT IS NOT INITIAL.
            SELECT SINGLE vtext
                   INTO   mtext
                   FROM   t685t
                  WHERE   kschl EQ it_komv_tax-kschl
                    AND   spras EQ 'E'.
            l_rate    = it_komv_tax-kbetr / 10.
            l_amt     = it_komv_tax-kwert.
            For Japanies Yen "RTDK906759
            IF it_ekko-waers = 'JPY'.
              l_amt = l_amt * 100.
            ENDIF.
            End for japaies Yen
            ADD l_amt TO mfamt.
            IF lt_ctr LT lt_count. "Long text
              ADD 1 TO lt_ctr.
              READ TABLE it_bapi_mltx_ga INDEX lt_ctr.
            ELSE.
              CLEAR it_bapi_mltx_ga.
            ENDIF.
            IF l_rate EQ 0 OR l_amt EQ 0.
              l_rate = ''.
              l_amt  = ''.
            ENDIF.
            PERFORM writeform USING 'TAX_LINE_ITEM' 'MAIN'.
           ENDIF.
          ENDLOOP.
          IF lt_ctr LT lt_count.
            DATA mbal_line TYPE i.
            mbal_line = ( lt_count - lt_ctr ).
            DO mbal_line TIMES.
              ADD 1 TO lt_ctr.
              READ TABLE it_bapi_mltx_ga INDEX lt_ctr.
              IF sy-subrc = 0.
                PERFORM writeform USING 'LTEXT' 'MAIN'.
              ENDIF.
            ENDDO.
          ENDIF.
          CONCATENATE it_ekko-ebeln it_ekpo-ebelp INTO nmebeln.
          REFRESH tline.
          CALL FUNCTION 'READ_TEXT'
            EXPORTING
              id                      = 'F04'
              language                = sy-langu
              name                    = nmebeln
              object                  = 'EKPO'
            TABLES
              lines                   = tline
            EXCEPTIONS
              id                      = 1
              language                = 2
              name                    = 3
              not_found               = 4
              object                  = 5
              reference_check         = 6
              wrong_access_to_archive = 7
              OTHERS                  = 8.
          IF sy-subrc <> 0.
          ENDIF.
          LOOP AT tline.
            IF tline-tdline IS NOT INITIAL.
              del_text = tline-tdline.
            ENDIF.
            CONDENSE del_text.
          ENDLOOP.
          CONCATENATE it_ekko-ebeln it_ekpo-ebelp INTO nmebeln.
          REFRESH tline.
          CALL FUNCTION 'READ_TEXT'
            EXPORTING
              id                      = 'F03'
              language                = sy-langu
              name                    = nmebeln
              object                  = 'EKPO'
            TABLES
              lines                   = tline
            EXCEPTIONS
              id                      = 1
              language                = 2
              name                    = 3
              not_found               = 4
              object                  = 5
              reference_check         = 6
              wrong_access_to_archive = 7
              OTHERS                  = 8.
          IF sy-subrc <> 0.
                 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
               refresh.
          CLEAR : po_flag, mat_po_text.
          LOOP AT tline.
            IF tline-tdline IS NOT INITIAL.
              MOVE tline-tdline TO mat_po_text.
              CONDENSE mat_po_text.
              PERFORM writeform USING 'MTRL_PO_TEXT' 'MAIN'.
              po_flag = 'X'.
              CLEAR : mat_po_text.
            ENDIF.
          ENDLOOP.
    *Added lines below for Schedule delivery for line item on 09.05.2007:Rajiv
          CLEAR g_ind.
          READ TABLE it_eket  WITH KEY ebeln = it_ekpo-ebeln
                                       ebelp = it_ekpo-ebelp BINARY SEARCH.
          g_ind = sy-tabix.
          LOOP AT it_eket FROM g_ind.
            IF it_eket-ebeln EQ it_ekpo-ebeln AND it_eket-ebelp = it_ekpo-ebelp.
              PERFORM writeform USING 'SCHEDULE' 'MAIN'.
            ELSE.
              EXIT.
            ENDIF.
          ENDLOOP.
    *End Addition:Rajiv
          PERFORM writeform USING 'REQSLP' 'MAIN'.
          mlctr = mlctr + 1.
          msr = msr + 1.
          CLEAR: lt_ctr, lt_ctr1.
      following lines added by ganesh to add service po details as per Mr. sadiq 21.08.2007
          IF it_ekpo-packno IS NOT INITIAL.
            CLEAR sub_packno.
            SELECT SINGLE sub_packno INTO sub_packno FROM esll WHERE packno = it_ekpo-packno.
            IF sub_packno IS NOT INITIAL.
              CLEAR it_esll.
              REFRESH it_esll.
              SELECT * FROM esll INTO CORRESPONDING FIELDS OF TABLE it_esll
              WHERE packno = sub_packno.
              IF sy-subrc = 0.
                PERFORM writeform USING 'SERVICE_PO_TEXT' 'MAIN'.
              ENDIF.
              LOOP AT it_esll.
                CONCATENATE sub_packno it_esll-introw INTO obj.
                CALL FUNCTION 'READ_TEXT'   "4500002446  C300
                  EXPORTING
                    id       = 'LTXT'
                    language = sy-langu
                    name     = obj
                    object   = 'ESLL'
                  TABLES
                    lines    = tline
                  EXCEPTIONS
                    id                      = 1
                    language                = 2
                    name                    = 3
                    not_found               = 4
                    object                  = 5
                    reference_check         = 6
                    wrong_access_to_archive = 7
                    OTHERS                  = 8.
                IF sy-subrc <> 0.
                ENDIF.
                CLEAR stext.
                LOOP AT tline.
                  CONCATENATE stext tline-tdline  INTO stext SEPARATED BY space.
                ENDLOOP.
                FREE tline.
                CLEAR tline.
                REFRESH tline.
                PERFORM writeform USING 'SERVICE_PO' 'MAIN'.
                PERFORM writeform USING 'SERVICE_TEXT' 'MAIN'.
              ENDLOOP.
            ENDIF.
          ENDIF.
        end of change
        ENDLOOP.             " it_ekpo.
        IF mlctr < 15.
          DO 5 TIMES.
            PERFORM writeform USING 'LINEFEED' 'MAIN'.
          ENDDO.
        ENDIF.
        added by ganesh  for allding line before ECC No.
        IF it_ekko-bsart NE 'ZIM'.               " IF EXPORT NO NEED TO PRINT ECC.
          PERFORM writeform USING 'LIN' 'MAIN'.
          PERFORM writeform USING 'WERKS_TAX_DETAIL' 'MAIN'.
        ENDIF.
        end of change
         MFLAG = 'Y'.
        PERFORM writeform USING 'TERMS_VAL' 'MAIN'.
        LOOP AT it_konv1 WHERE knumv EQ it_ekko-knumv.
          mkschl = it_konv1-kschl.
          mchgamt = 0.
          LOOP AT it_konv_ftr  WHERE knumv EQ it_konv1-knumv
                               AND kschl EQ mkschl.
            mchgamt = mchgamt + it_konv_ftr-kwert.
          ENDLOOP.
            For Japanies Yen "RTDK906759
          IF it_ekko-waers = 'JPY'.
            mchgamt = mchgamt * 100.
          ENDIF.
            End for japaies Yen
          mfamt = mfamt + mchgamt.
          IF mchgamt LT '0'.
            mchgamt = mchgamt * ( -1 ).
          ENDIF.
          READ TABLE it_t685t_ftr WITH KEY kschl = mkschl.
          PERFORM writeform USING 'TERMS_FTR_VAL' 'MAIN'.
          mlctr = mlctr + 1.
        ENDLOOP.
        mflag = 'T'.
        CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
          EXPORTING
            amt_in_num         = mfamt
          IMPORTING
            amt_in_words       = mfword
          EXCEPTIONS
            data_type_mismatch = 1
            OTHERS             = 2.
        CONDENSE mebeln.
        nmebeln = it_ekko-ebeln.
        REFRESH tline.
        CALL FUNCTION 'READ_TEXT'
          EXPORTING
            id                      = 'F01'
            language                = sy-langu
            name                    = nmebeln
            object                  = 'EKKO'
          TABLES
            lines                   = tline
          EXCEPTIONS
            id                      = 1
            language                = 2
            name                    = 3
            not_found               = 4
            object                  = 5
            reference_check         = 6
            wrong_access_to_archive = 7
            OTHERS                  = 8.
        IF sy-subrc <> 0.
        ENDIF.
    *---- CHANGED BY MATHEW BECAUSE THIS STATMENT WORKING FINE IN 300 BUT NOT IN 500C.
       LOOP AT ZTEXT.
         IF ZTEXT-TEXT1 IS NOT INITIAL.
           PERFORM WRITEFORM USING 'TERMS_COND_VAL_PAY' 'MAIN'.
         ENDIF.
         MPAY_FLAG = 'Y'.
       ENDLOOP.
        READ TABLE it_t052u WITH KEY zterm = it_ekko-zterm.
        LOOP AT it_t052u WHERE zterm EQ it_ekko-zterm.
          IF it_t052u-text1 IS NOT INITIAL.
            PERFORM writeform USING 'TERMS_COND_VAL_PAY' 'MAIN'.
          ENDIF.
          mpay_flag = 'Y'.
        ENDLOOP.
        PERFORM writeform USING 'TERMS_COND_VAL' 'MAIN'.
        LOOP AT tline.
          IF tline-tdline IS NOT INITIAL.
            PERFORM writeform USING 'TERMS_COND_VAL_HDR' 'MAIN'.
          ENDIF.
          CONDENSE txt.
        ENDLOOP.
        PERFORM writeform USING 'FTR' 'FTR_LIN3'.
        PERFORM writeform USING 'FTR_LIN1' 'FTR_LIN1'.
        CALL FUNCTION 'END_FORM'.
      ENDLOOP.                    "   It_ekko.
      CALL FUNCTION 'CLOSE_FORM'
       IMPORTING
       RESULT                         = itcpp
      RDI_RESULT                     =
       TABLES
         otfdata                        = otf
       EXCEPTIONS
         unopened                       = 1
         bad_pageformat_for_print       = 2
         send_error                     = 3
         spool_error                    = 4
         codepage                       = 5
         OTHERS                         = 6.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " Process
    *&      Form  WRITEFORM
          text
         -->P_0150   text
         -->P_0151   text
    FORM writeform  USING    value(p_0150)
                             value(p_0151).
      CALL FUNCTION 'WRITE_FORM'

    Hi
    I think some basis related configuartions to be done
    Try like this and inform me
    A cyclic job runs, which processes the messages seen in the SOST queue.
    Are you sure it's not the frequency of the cyclic job, rather than the
    number of messages in the queue, that you are observing? In messages
    that are queued and before the cyclic job runs, "wait for comm. service"
    is the normal status.
    If you mean that there are always 4 items queued in SOST regardless of
    the cyclic send job, then I have no ideas. I would have thought there
    was no way to do that.
    when the send job runs it just never
    picks them up & sends them, while it picks up many others. The send job
    is somehow blind to these; no error message occurs. In this case, I
    'delete' them from the queue (in SOST) and then 'undelete' (drop down
    menu -> /Go to /Deleted Items) them and then re-queue them. THEN they
    actually get picked up & sent when the next cyclic send job executes.
    Regards
    Pavan

  • Error while sending email to external mail - Urgent

    Hi All,
    I am getting error while sending email with attachement. The Error code is 02.
    I am not able to identify the error. bold Please help me in solving this problem.
    Is it anything wrong with the code or Any Configuration with SCOT/SOST.bold
    the code i am using is :
    REPORT YVR_F MESSAGE-ID XX .
    TABLES : EDIDC, EDIDS, EDPAR.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
    PARAMETERS : P_STATUS LIKE EDIDC-STATUS DEFAULT '51'.
    SELECT-OPTIONS : S_DIRECT FOR EDIDC-DIRECT,
                     S_MESTYP FOR EDIDC-MESTYP,
                     S_CREDAT FOR EDIDC-CREDAT.
    SELECTION-SCREEN END OF BLOCK B1 .
    PARAMETER: P_EMAIL LIKE SOMLRECI1-RECEIVER,
               P_SENDER LIKE SOMLRECI1-RECEIVER no-display,
               P_DELSPL  AS CHECKBOX,
               P_ONLINE NO-DISPLAY.
    DATA : TB_EDIDC LIKE STANDARD TABLE OF EDIDC INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA : TB_EDPAR LIKE STANDARD TABLE OF EDPAR INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA : TB_KNA1 LIKE STANDARD TABLE OF KNA1 INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA : TB_ADRC LIKE STANDARD TABLE OF ADRC INITIAL SIZE 0 WITH HEADER
    LINE.
    DATA: INT_PDF TYPE TABLE OF TLINE WITH HEADER LINE.
    DATA : BEGIN OF TB_ED OCCURS 0,
             SNDPRN LIKE EDIDC-SNDPRN,
             LOC    LIKE ADRC-BUILDING,
             DOCNUM LIKE EDIDC-DOCNUM,
             IDOCTP LIKE EDIDC-IDOCTP,
             MESTYP LIKE EDIDC-MESTYP,
             DIRECT LIKE EDIDC-DIRECT,
             CREDAT LIKE EDIDC-CREDAT,
             STATUS LIKE EDIDC-STATUS,
           END OF TB_ED.
    DATA:   IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
                    WITH HEADER LINE.
    DATA:   IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
                    WITH HEADER LINE.
    Job Runtime Parameters
    DATA: GD_EVENTID LIKE TBTCM-EVENTID,
          GD_EVENTPARM LIKE TBTCM-EVENTPARM,
          GD_EXTERNAL_PROGRAM_ACTIVE LIKE TBTCM-XPGACTIVE,
          GD_JOBCOUNT LIKE TBTCM-JOBCOUNT,
          GD_JOBNAME LIKE TBTCM-JOBNAME,
          GD_STEPCOUNT LIKE TBTCM-STEPCOUNT,
          GD_ERROR    TYPE SY-SUBRC,
          GD_RECIEVER TYPE SY-SUBRC.
    DATA:  W_RECSIZE TYPE I,
           W_SPOOL_NR LIKE SY-SPONO.
          %_print LIKE pri_params.
    DATA: GD_SUBJECT   LIKE SODOCCHGI1-OBJ_DESCR,
          IT_MESS_BOD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
          IT_MESS_ATT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
          GD_SENDER_TYPE     LIKE SOEXTRECI1-ADR_TYP,
          GD_ATTACHMENT_DESC TYPE SO_OBJ_NAM,
          GD_ATTACHMENT_NAME TYPE SO_OBJ_DES.
    Spool to PDF conversions
    DATA: GD_SPOOL_NR LIKE TSP01-RQIDENT,
          GD_DESTINATION LIKE RLGRAP-FILENAME,
          GD_BYTECOUNT LIKE TST01-DSIZE,
          GD_BUFFER TYPE STRING.
    Binary store for PDF
    DATA: BEGIN OF IT_PDF_OUTPUT OCCURS 0.
            INCLUDE STRUCTURE TLINE.
    DATA: END OF IT_PDF_OUTPUT.
    DATA: GD_RECSIZE TYPE I.
    CONSTANTS: C_DEV LIKE  SY-SYSID VALUE 'DEV',
               C_NO(1)     TYPE C   VALUE ' ',
               C_DEVICE(4) TYPE C   VALUE 'LOCL'.
    DATA:   T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
            T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
            T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
            W_CNT TYPE I,
            W_SENT_ALL(1) TYPE C,
            W_DOC_DATA LIKE SODOCCHGI1.
    DATA : MSTR_PRINT_PARMS LIKE PRI_PARAMS,
           MC_VALID,
           P_REPID LIKE SY-REPID,
           WF_ID  LIKE TSP01-RQIDENT,
           LOC_BYTECOUNT TYPE I.
    *start-of-selection.
    MSTR_PRINT_PARMS-PDEST = 'LOCL'.
    P_REPID = SY-REPID.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
        authority= ' '
       COPIES                       = '1'
       COVER_PAGE                   = SPACE
       DATA_SET                     = SPACE
       DEPARTMENT                   = SPACE
       DESTINATION                  = 'LP01'
       EXPIRATION                   = '1'
       IMMEDIATELY                  = 'X'
       LAYOUT                       = 'X_65_132'
       MODE                         = SPACE
       NEW_LIST_ID                  = 'X'
       NO_DIALOG                    = 'X'
       USER                         = SY-UNAME
    IMPORTING
       OUT_PARAMETERS               = MSTR_PRINT_PARMS
       VALID                        = MC_VALID
    EXCEPTIONS
       ARCHIVE_INFO_NOT_FOUND       = 1
       INVALID_PRINT_PARAMS         = 2
       INVALID_ARCHIVE_PARAMS       = 3
       OTHERS                       = 4.
         SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                          SPOOL PARAMETERS MSTR_PRINT_PARMS.
                          AND RETURN.
    NEW-PAGE PRINT ON NO DIALOG PARAMETERS
    MSTR_PRINT_PARMS.
    perform data.
    NEW-PAGE PRINT OFF. "This marks the end of the screen for which the
    *SPOOL NO WAS GENERATED.
    WF_ID = SY-SPONO.
    *converting spool to pdf
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
         EXPORTING
              SRC_SPOOLID              = WF_ID  "SPOOL NUMBER
              NO_DIALOG                = SPACE
              PDF_DESTINATION          = 'X'
         IMPORTING
              PDF_BYTECOUNT =
                 LOC_BYTECOUNT "NUMBER OF BYTES TRANSFERRED
         TABLES
              PDF                      = INT_PDF  "TABLE FOR PDF REPORT
         EXCEPTIONS
              ERR_NO_ABAP_SPOOLJOB     = 1
              ERR_NO_SPOOLJOB          = 2
              ERR_NO_PERMISSION        = 3
              ERR_CONV_NOT_POSSIBLE    = 4
              ERR_BAD_DESTDEVICE       = 5
              USER_CANCELLED           = 6
              ERR_SPOOLERROR           = 7
              ERR_TEMSEERROR           = 8
              ERR_BTCJOB_OPEN_FAILED   = 9
              ERR_BTCJOB_SUBMIT_FAILED = 10
              ERR_BTCJOB_CLOSE_FAILED  = 11
              OTHERS                   = 12.
    *CALL FUNCTION 'DOWNLOAD'
    *EXPORTING
    *bin_filesize = loc_bytecount "NO. OF BYTES
    *filename = 'C:/EMAILPDF.PDF'
    *filetype = 'BIN'
    **IMPORTING
    **act_filename = loc_filename
    *TABLES
    *data_tab = int_pdf.
    IF P_DELSPL EQ 'X'.
      PERFORM DELETE_SPOOL.
    ENDIF.
    Transfer the 132-long strings to 255-long strings
    LOOP AT INT_PDF.
      TRANSLATE INT_PDF USING ' ~'.
      CONCATENATE GD_BUFFER INT_PDF INTO GD_BUFFER.
    ENDLOOP.
    TRANSLATE GD_BUFFER USING '~ '.
    DO.
      IT_MESS_ATT = GD_BUFFER.
      APPEND IT_MESS_ATT.
      SHIFT GD_BUFFER LEFT BY 255 PLACES.
      IF GD_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
    CHECK GD_RECSIZE > 0.
    PERFORM SENDMAIL USING P_EMAIL..
    *&      Form  sendmail
          text
    -->  p1        text
    <--  p2        text
    FORM SENDMAIL USING P_EMAIL.
      CHECK NOT ( P_EMAIL IS INITIAL ).
      REFRESH IT_MESS_BOD.
    Default subject matter
      GD_SUBJECT         = 'Subject'.
      GD_ATTACHMENT_DESC = 'IDOC LIST'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      IT_MESS_BOD        = 'List Of Failed Idocs'.
      APPEND IT_MESS_BOD.
      IT_MESS_BOD        = 'List Of Failed Idocs'.
      APPEND IT_MESS_BOD.
    If no sender specified - default blank
      IF P_SENDER EQ SPACE.
        GD_SENDER_TYPE  = SPACE.
      ELSE.
        GD_SENDER_TYPE  = 'INT'.
      ENDIF.
    Send file by email as .xls speadsheet
      PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
                                   TABLES IT_MESS_BOD
                                          IT_MESS_ATT
                                    USING P_EMAIL
                                          'Document attachment'
                                          'PDF'
                                          GD_ATTACHMENT_NAME
                                          GD_ATTACHMENT_DESC
                                          P_SENDER
                                          GD_SENDER_TYPE
                                 CHANGING GD_ERROR
                                          GD_RECIEVER.
    ENDFORM.                    " sendmail
    *&      Form  DELETE_SPOOL
          text
    -->  p1        text
    <--  p2        text
    FORM DELETE_SPOOL.
      DATA: LD_SPOOL_NR TYPE TSP01_SP0R-RQID_CHAR.
      LD_SPOOL_NR = WF_ID.   "GD_SPOOL_NR.
      CHECK P_DELSPL <> C_NO.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                SPOOLID = LD_SPOOL_NR.
    ENDFORM.                    " DELETE_SPOOL
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          text
         -->P_IT_MESS_BOD  text
         -->P_IT_MESS_ATT  text
         -->P_P_EMAIL  text
         -->P_0846   text
         -->P_0847   text
         -->P_GD_ATTACHMENT_NAME  text
         -->P_GD_ATTACHMENT_DESC  text
         -->P_P_SENDER  text
         -->P_GD_SENDER_TYPE  text
         <--P_GD_ERROR  text
         <--P_GD_RECIEVER  text
    FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES   IT_MESSAGE
                                              IT_ATTACH
                                        USING P_EMAIL
                                              P_MTITLE
                                              P_FORMAT
                                              P_FILENAME
                                              P_ATTDESCRIPTION
                                              P_SENDER_ADDRESS
                                              P_SENDER_ADDRES_TYPE
                                     CHANGING P_ERROR
                                              P_RECIEVER.
      DATA: LD_ERROR    TYPE SY-SUBRC,
             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.
      DATA:   T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
              T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
              T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
              T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
              T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
              W_CNT TYPE I,
              W_SENT_ALL(1) TYPE C,
              W_DOC_DATA LIKE SODOCCHGI1.
      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.
      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.
      READ TABLE IT_ATTACH INDEX W_CNT.
      W_DOC_DATA-DOC_SIZE =
         ( W_CNT - 1 ) * 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[] = IT_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.
      T_RECEIVERS-RECEIVER = p_EMAIL.
      T_RECEIVERS-REC_TYPE = 'U'.
      T_RECEIVERS-COM_TYPE = 'INT'.
      T_RECEIVERS-NOTIF_DEL = 'X'.
      T_RECEIVERS-NOTIF_NDEL = 'X'.
      APPEND T_RECEIVERS.
      DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
    W_SENT_ALL = 'X'.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_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
                object_header              = objhead
                CONTENTS_BIN               = T_ATTACHMENT
                CONTENTS_TXT               = IT_MESSAGE
                RECEIVERS                  = T_RECEIVERS
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
      IF SY-SUBRC NE 0.
        MESSAGE E000 WITH 'Error occurred while sending'.
      ELSE.
        MESSAGE I000 WITH 'The document was sent'.
      ENDIF.
    ENDFORM.                    " SEND_FILE_AS_EMAIL_ATTACHMENT
    *&      Form  data
          text
    -->  p1        text
    <--  p2        text
    FORM data.
    SELECT SNDPRN
             DOCNUM
             IDOCTP
             MESTYP
             DIRECT
             CREDAT
             STATUS
             FROM EDIDC
             INTO CORRESPONDING FIELDS
             OF TABLE TB_EDIDC
             WHERE STATUS = P_STATUS
             AND MESTYP IN S_MESTYP
             AND DIRECT IN S_DIRECT
             AND CREDAT IN S_CREDAT.
    SELECT KUNNR
           INPNR
           FROM EDPAR
           INTO CORRESPONDING FIELDS
           OF TABLE TB_EDPAR
           FOR ALL ENTRIES IN TB_EDIDC
           WHERE KUNNR = TB_EDIDC-SNDPRN.
    SELECT KUNNR
           ADRNR
           FROM KNA1
           INTO CORRESPONDING FIELDS
           OF TABLE TB_KNA1
           FOR ALL ENTRIES IN TB_EDPAR
           WHERE KUNNR = TB_EDPAR-INPNR.
    SELECT ADDRNUMBER
           BUILDING
           FROM ADRC
           INTO CORRESPONDING FIELDS
           OF TABLE TB_ADRC
           FOR ALL ENTRIES IN TB_KNA1
           WHERE ADDRNUMBER = TB_KNA1-ADRNR.
    LOOP AT TB_EDIDC WHERE STATUS = P_STATUS
                     AND MESTYP IN S_MESTYP
                     AND DIRECT IN S_DIRECT
                     AND CREDAT IN S_CREDAT.
      TB_ED-SNDPRN = TB_EDIDC-SNDPRN.
      TB_ED-DOCNUM = TB_EDIDC-DOCNUM.
      TB_ED-IDOCTP = TB_EDIDC-IDOCTP.
      TB_ED-MESTYP = TB_EDIDC-MESTYP.
      TB_ED-DIRECT = TB_EDIDC-DIRECT.
      TB_ED-CREDAT = TB_EDIDC-CREDAT.
      TB_ED-STATUS = TB_EDIDC-STATUS.
      READ TABLE TB_EDPAR WITH KEY KUNNR = TB_EDIDC-SNDPRN.
      READ TABLE TB_KNA1 WITH KEY KUNNR = TB_EDPAR-INPNR.
      READ TABLE TB_ADRC WITH KEY ADDRNUMBER = TB_KNA1-ADRNR.
      TB_ED-LOC = TB_ADRC-BUILDING.
      APPEND TB_ED.
    ENDLOOP.
    WRITE :/02 'CustomerNo',
            15 'Location Code',
            30 'Idoc Number',
            55 'Basic Type',
            70 'Message Type',
            95 'Direction',
            110 'Received Date',
            130 'Status'.
    ULINE.
    LOOP AT TB_ED.
      WRITE :/02 TB_ED-SNDPRN,
              15 TB_ED-LOC,
              30 TB_ED-DOCNUM,
              55 TB_ED-IDOCTP,
              70 TB_ED-MESTYP,
              95 TB_ED-DIRECT,
              110 TB_ED-CREDAT,
              130 TB_ED-STATUS.
    ENDLOOP.
    ENDFORM.                    " data
    Kindly help me in solving the issue.
    Thanks in advance.
    Suki.

    Hi,
    Check in transaction SCOT. If your mail is in error status in SCOT, you can assure that there is no problem with your code. If your message has not reached till SCOT, then the problem will be with the code.
    If the mail is there in scot with error status tell the BASIS to configure it. I feel this could be the problem.
    Regards,
    Renjith Michael.

  • Using SRW package to send a report via email

    Hi,
    Please can someone please help me resolve this issue I have been facing in using the srw package
    I have configured a report server and was trying to use the srw package to send a report out to our customers when there is an update on a particular table.
    I have succesfully use this same procedure to generate the same report to an output file and it was ok but anytime I try to generate the report as a mail and send to a DESNAME, i get mail server unavailable.
    Below is the procedure i try to execute:
    procedure testrep(new_name in varchar2) as
    myPlist SRW_PARAMLIST;
    myIdent SRW.Job_Ident;
    BEGIN
         myPlist := SRW_PARAMLIST(SRW_PARAMETER('',''));
    srw.add_parameter(myPlist,'GATEWAY','http://technorth4:7780/reports/rwservlet');
    srw.add_parameter(myPlist,'SERVER','rep_technorth4');
    srw.add_parameter(myPlist,'REPORT','c:\gens\name.rdf');
    srw.add_parameter(myPlist,'USERID','gens/[email protected]');
    srw.add_parameter(myPlist,'AUTHID','orcladmin/password1@orcl');
    srw.add_parameter(myPlist,'DESTYPE','MAIL');
    srw.add_parameter(myPlist,'DESFORMAT','PDF');
    srw.add_parameter(myPlist,'FROM','[email protected]');
    srw.add_parameter(myPlist,'DESNAME','[email protected]');
    srw.add_parameter(myPlist,'T1',new_name);
    myIdent := srw.run_report(myPlist);
    END;
    when i now start debugging i got this error:
    SQL> set serveroutput on
    SQL> exec srw.start_debugging
    * WELCOME TO EVENT-BASED-REPORTING API *
    * API-Version : 9i *
    * (C) Oracle Corporation, 2000 - 2002 *
    * Debugging turned ON **************************
    PL/SQL procedure successfully completed.
    SQL> exec testrep('TOPE');
    *** Length of Paramlist : 1
    OK : Parameter added : GATEWAY=http://technorth4:7780/reports/rwservlet
    *** Length of Paramlist : 2
    OK : Parameter added : SERVER=rep_technorth4
    *** Length of Paramlist : 3
    OK : Parameter added : REPORT=c:\gens\name.rdf
    *** Length of Paramlist : 4
    OK : Parameter added : USERID=gens/[email protected]
    *** Length of Paramlist : 5
    OK : Parameter added : AUTHID=orcladmin/password1@orcl
    *** Length of Paramlist : 6
    OK : Parameter added : DESTYPE=MAIL
    *** Length of Paramlist : 7
    OK : Parameter added : DESFORMAT=PDF
    *** Length of Paramlist : 8
    OK : Parameter added : [email protected]
    *** Length of Paramlist : 9
    OK : Parameter added : [email protected]
    *** Length of Paramlist : 10
    OK : Parameter added : T1=TOPE
    Starting run_report: building url
    *** Building URL (RUN_REPORT)
    OK : URL built :
    http://technorth4:7780/reports/rwservlet?SERVER=rep%5Ftechnorth4&REPORT=c%3A%5Cg
    ens%5Cname%2Erdf&USERID=gens%2Fgens%40technorth%2Eworld&AUTHID=orcladmin%2Fpassw
    ord1%40orcl&DESTYPE=MAIL&DESFORMAT=PDF&FROM=tope%5Folowosale%40gtbplc%2Ecom&D
    *** Submitting HTTP Request
    *** using URL
    :http://technorth4:7780/reports/rwservlet?SERVER=rep%5Ftechnorth4&REPORT=c%3A%5C
    gens%5Cname%2Erdf&USERID=gens%2Fgens%40technorth%2Eworld&AUTHID=orcladmin%2Fpass
    word1%40orcl&DESTYPE=MAIL&DESFORMAT=PDF&FROM=tope%5Folowosale%40gtbplc%2Ecom&DES
    OK : Request submitted - Return stream : <?xml version = '1.0' encoding =
    'ISO-8859-1' standalone = 'yes'?>
    <serverQueues>
    <error code="50138"
    component="REP" message="Mail server is not available"/>
    </serverQueues>
    OK : Request submitted - Length of stream : 182
    *** XML-Parsed - Following Structure discovered :
    *** Checking elements!
    serverQueues ()
    *** Checking attributes!
    error
    *** Checking attributes!
    __code = 50138
    __component = REP
    __message = Mail server is not available
    *** Finished Parsing XML
    Getting value for element: job
    Getting value for element: error
    *** Requesting value for Attribute error.component [REP]
    Getting value for element: error
    *** Requesting value for Attribute error.code [50138]
    Getting value for element: error
    *** Requesting value for Attribute error.message [Mail server is not available]
    REP-50138:Mail server is not available
    BEGIN testrep('TOPE'); END;
    ERROR at line 1:
    ORA-20999:
    ORA-06512: at "GENS.SRW", line 284
    ORA-06512: at "GENS.SRW", line 815
    ORA-06512: at "GENS.TESTREP", line 17
    ORA-06512: at line 1
    Please can someone help me with this. I can connect to the mail server using the telnet mailservername port,i get a 220 message with ***** .
    I have updated d report configuration file with the mailserver name, and d proxyinfo.xml too.I put it to bypass proxy for d mail server address and also inlclude the proxy ip and port.
    Kindly assist me as it is urgent.
    Thank you.

    You are in the wrong forum. Please try the Reports.<br><br>
    Regards,
    Rob.

Maybe you are looking for