ME23N Script convert to PDF and send thru mail to the user created by

Hi,
I have created a custom PO SAP scirpt for the tcode ME23N and configured the same in tcode NACE Application 'EF' , output type 'NEU'
But the client requirement is to send  this SAP Scipt PO converted to pdf & then send thru email to the user who created PO (ME23N)?
How do u get this functionality please let me know?
Regards,
Anil

Hello,
that is easy, you only need to keep the steps to do in mind:
1) find a suitable point to place in your code to do all this for you
2) create a FM that will convert your form into PDF (search a little, this has been done like zillion times here)
3) create a FM that will send the PDF stream (hex data which is accepted by the BCS class as the attachment data)
4) check the email customizing in your system
5) run and enjoy
All the parts has been done here many times, shouldn´t be a problem.
Otto

Similar Messages

  • Script- converting in PDF and sending by mail.

    Hi.
    I have a sap-script for account statement.Now the same needs to be sent to customers by mail.The file format i need is PDF.
    Can anyone suggest the steps I need to take

    Helloo!
    You first need to get the OTF code from the sapscript.
    Then you should pass this to the email-function module.
    REPORT Zscript_mail.
    Here is a sample program.
    DATA: ITCPO LIKE ITCPO,
          TAB_LINES LIKE SY-TABIX.
    Variables for EMAIL functionality
    DATA: MAILDATA   LIKE SODOCCHGI1.
    DATA: MAILPACK   LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
    DATA: MAILHEAD   LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
    DATA: MAILBIN    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILTXT    LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
    DATA: MAILREC    LIKE SOMLREC90 OCCURS 0  WITH HEADER LINE.
    DATA: SOLISTI1   LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    PERFORM SEND_FORM_VIA_EMAIL.
          FORM  SEND_FORM_VIA_EMAIL                                      *
    FORM  SEND_FORM_VIA_EMAIL.
      CLEAR:    MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
      REFRESH:  MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
    Creation of the document to be sent File Name
      MAILDATA-OBJ_NAME = 'TEST'.
    Mail Subject
      MAILDATA-OBJ_DESCR = 'Subject'.
    Mail Contents
      MAILTXT-LINE = 'Here is your file'.
      APPEND MAILTXT.
    Prepare Packing List
      PERFORM PREPARE_PACKING_LIST.
    Set recipient - email address here!!!
      MAILREC-RECEIVER = '[email protected]'.
      MAILREC-REC_TYPE  = 'U'.
      APPEND MAILREC.
    Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
           EXPORTING
                DOCUMENT_DATA              = MAILDATA
                PUT_IN_OUTBOX              = ' '
           TABLES
                PACKING_LIST               = MAILPACK
                OBJECT_HEADER              = MAILHEAD
                CONTENTS_BIN               = MAILBIN
                CONTENTS_TXT               = MAILTXT
                RECEIVERS                  = MAILREC
           EXCEPTIONS
                TOO_MANY_RECEIVERS         = 1
                DOCUMENT_NOT_SENT          = 2
                OPERATION_NO_AUTHORIZATION = 4
                OTHERS                     = 99.
    ENDFORM.
         Form  PREPARE_PACKING_LIST
    FORM PREPARE_PACKING_LIST.
      CLEAR:    MAILPACK, MAILBIN, MAILHEAD.
      REFRESH:  MAILPACK, MAILBIN, MAILHEAD.
      DESCRIBE TABLE MAILTXT LINES TAB_LINES.
      READ TABLE MAILTXT INDEX TAB_LINES.
      MAILDATA-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( MAILTXT ).
    Creation of the entry for the compressed document
      CLEAR MAILPACK-TRANSF_BIN.
      MAILPACK-HEAD_START = 1.
      MAILPACK-HEAD_NUM = 0.
      MAILPACK-BODY_START = 1.
      MAILPACK-BODY_NUM = TAB_LINES.
      MAILPACK-DOC_TYPE = 'RAW'.
      APPEND MAILPACK.
    Creation of the document attachment
    This form gets the OTF code from the SAPscript form.
    If you already have your OTF code, I believe that you may
    be able to skip this form.  just do the following code, looping thru
    your SOLISTI1 and updating MAILBIN.
      PERFORM GET_OTF_CODE.
      LOOP AT SOLISTI1.
        MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
        APPEND MAILBIN.
      ENDLOOP.
      DESCRIBE TABLE MAILBIN LINES TAB_LINES.
      MAILHEAD = 'TEST.OTF'.
      APPEND MAILHEAD.
    Creation of the entry for the compressed attachment
      MAILPACK-TRANSF_BIN = 'X'.
      MAILPACK-HEAD_START = 1.
      MAILPACK-HEAD_NUM = 1.
      MAILPACK-BODY_START = 1.
      MAILPACK-BODY_NUM = TAB_LINES.
      MAILPACK-DOC_TYPE = 'OTF'.
      MAILPACK-OBJ_NAME = 'TEST'.
      MAILPACK-OBJ_DESCR = 'Subject'.
      MAILPACK-DOC_SIZE = TAB_LINES * 255.
      APPEND MAILPACK.
    ENDFORM.
         Form  GET_OTF_CODE
    FORM  GET_OTF_CODE.
      DATA: BEGIN OF OTF OCCURS 0.
              INCLUDE STRUCTURE ITCOO .
      DATA: END OF OTF.
      DATA: ITCPO LIKE ITCPO.
      DATA: ITCPP LIKE ITCPP.
      CLEAR ITCPO.
      ITCPO-TDGETOTF = 'X'.
    Start writing OTF code
      CALL FUNCTION 'OPEN_FORM'
           EXPORTING
                FORM     = 'ZTEST_FORM'
                LANGUAGE = SY-LANGU
                OPTIONS  = ITCPO
                DIALOG   = ' '
           EXCEPTIONS
                OTHERS   = 1.
      CALL FUNCTION 'START_FORM'
           EXCEPTIONS
                ERROR_MESSAGE = 01
                OTHERS        = 02.
      CALL FUNCTION 'WRITE_FORM'
           EXPORTING
                WINDOW        = 'MAIN'
           EXCEPTIONS
                ERROR_MESSAGE = 01
                OTHERS        = 02.
    Close up Form and get OTF code
      CALL FUNCTION 'END_FORM'
           EXCEPTIONS
                ERROR_MESSAGE = 01
                OTHERS        = 02.
      MOVE-CORRESPONDING ITCPO TO ITCPP.
      CALL FUNCTION 'CLOSE_FORM'
           IMPORTING
                RESULT  = ITCPP
           TABLES
                OTFDATA = OTF
           EXCEPTIONS
                OTHERS  = 1.
    Move OTF code to structure SOLI form email
      CLEAR SOLISTI1. REFRESH SOLISTI1.
      LOOP AT OTF.
        SOLISTI1-LINE = OTF.
        APPEND SOLISTI1.
      ENDLOOP.
    ENDFORM.
    Thanks,
    Susmitha

  • Script Converting into PDF and Sent by Mail -

    Hi Experts,
                   I have faced one problem in Script Converting into PDF format and Sent it thro Mail.
    I have used to SX_OBJECT_CONVERT_OTF_PDF FM to convert into PDF format.
    and I have used SO_NEW_DOCUMENT_ATT_SEND_API1 FM for sending a Mail.
                 Now my Problem is, How is use these FM s Correctly. what are the parameters to be passed to send a mail.
             Kindly give the Coding for sending a Mail  using these above FMs .
    With Thanks,
    Neptune.M

    hi use this...this is good for sending a smartform in pdf format to spool..
    REPORT  zspooltopdf.
    PARAMETER: p_email1 LIKE somlreci1-receiver,
                          p_sender LIKE somlreci1-receiver,
                          p_delspl  AS CHECKBOX.
    *DATA DECLARATION
    DATA: gd_recsize TYPE i.
    Spool IDs
    TYPES: BEGIN OF t_tbtcp.
            INCLUDE STRUCTURE tbtcp.
    TYPES: END OF t_tbtcp.
    DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
          wa_tbtcp TYPE t_tbtcp.
    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.
    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.
    CONSTANTS: c_dev LIKE  sy-sysid VALUE 'DEV',
               c_no(1)     TYPE c   VALUE ' ',
               c_device(4) TYPE c   VALUE 'LOCL'.
    *START-OF-SELECTION.
    START-OF-SELECTION.
    Write statement to represent report output. Spool request is created
    if write statement is executed in background. This could also be an
    ALV grid which would be converted to PDF without any extra effort
      WRITE 'Hello World'.
      new-page.
      commit work.
      new-page print off.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
    Alternative way could be to submit another program and store spool
    id into memory, will be stored in sy-spono.
    *submit ZSPOOLTOPDF2
           to sap-spool
           spool parameters   %_print
           archive parameters %_print
           without spool dynpro
           and return.
    Get spool id from program called above
    IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
        PERFORM convert_spool_to_pdf.
        PERFORM process_email.
        if p_delspl EQ 'X'.
          PERFORM delete_spool.
        endif.
        IF sy-sysid = c_dev.
          wait up to 5 seconds.
          SUBMIT rsconn01 WITH mode   = 'INT'
                          WITH output = 'X'
                          AND RETURN.
        ENDIF.
      ELSE.
        SKIP.
        WRITE:/ 'Program must be executed in background in-order for spool',
                'request to be created.'.
      ENDIF.
          FORM obtain_spool_id                                          *
    FORM obtain_spool_id.
      CHECK NOT ( gd_jobname IS INITIAL ).
      CHECK NOT ( gd_jobcount IS INITIAL ).
      SELECT * FROM  tbtcp
                     INTO TABLE it_tbtcp
                     WHERE      jobname     = gd_jobname
                     AND        jobcount    = gd_jobcount
                     AND        stepcount   = gd_stepcount
                     AND        listident   <> '0000000000'
                     ORDER BY   jobname
                                jobcount
                                stepcount.
      READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
      IF sy-subrc = 0.
        message s004(zdd) with gd_spool_nr.
        gd_spool_nr = wa_tbtcp-listident.
        MESSAGE s004(zdd) WITH gd_spool_nr.
      ELSE.
        MESSAGE s005(zdd).
      ENDIF.
    ENDFORM.
          FORM get_job_details                                          *
    FORM get_job_details.
    Get current job details
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
           IMPORTING
                eventid                 = gd_eventid
                eventparm               = gd_eventparm
                external_program_active = gd_external_program_active
                jobcount                = gd_jobcount
                jobname                 = gd_jobname
                stepcount               = gd_stepcount
           EXCEPTIONS
                no_runtime_info         = 1
                OTHERS                  = 2.
    ENDFORM.
          FORM convert_spool_to_pdf                                     *
    FORM convert_spool_to_pdf.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = gd_spool_nr
                no_dialog                = c_no
                dst_device               = c_device
           IMPORTING
                pdf_bytecount            = gd_bytecount
           TABLES
                pdf                      = it_pdf_output
           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.
      CHECK sy-subrc = 0.
    Transfer the 132-long strings to 255-long strings
      LOOP AT it_pdf_output.
        TRANSLATE it_pdf_output USING ' ~'.
        CONCATENATE gd_buffer it_pdf_output 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.
    ENDFORM.
          FORM process_email                                            *
    FORM process_email.
      DESCRIBE TABLE it_mess_att LINES gd_recsize.
      CHECK gd_recsize > 0.
      PERFORM send_email USING p_email1.
    perform send_email using p_email2.
    ENDFORM.
          FORM send_email                                               *
    -->  p_email                                                       *
    FORM send_email USING p_email.
      CHECK NOT ( p_email IS INITIAL ).
      REFRESH it_mess_bod.
    Default subject matter
      gd_subject         = 'Subject'.
      gd_attachment_desc = 'Attachname'.
    CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
      it_mess_bod        = 'Message Body text, line 1'.
      APPEND it_mess_bod.
      it_mess_bod        = 'Message Body text, line 2...'.
      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
                                          'Example .xls documnet attachment'
                                          'PDF'
                                          gd_attachment_name
                                          gd_attachment_desc
                                          p_sender
                                          gd_sender_type
                                 changing gd_error
                                          gd_reciever.
    ENDFORM.
          FORM delete_spool                                             *
    FORM delete_spool.
      DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
      ld_spool_nr = gd_spool_nr.
      CHECK p_delspl <> c_no.
      CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
           EXPORTING
                spoolid = ld_spool_nr.
    ENDFORM.
    *&      Form  SEND_FILE_AS_EMAIL_ATTACHMENT
          Send email
    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_address.
      ld_sender_address_type = p_sender_addres_type.
    Fill the document data.
      w_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
      w_doc_data-obj_langu = sy-langu.
      w_doc_data-obj_name  = 'SAPRPT'.
      w_doc_data-obj_descr = ld_mtitle .
      w_doc_data-sensitivty = 'F'.
    Fill the document data and get size of attachment
      CLEAR w_doc_data.
      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 = ld_email.
      t_receivers-rec_type = 'U'.
      t_receivers-com_type = 'INT'.
      t_receivers-notif_del = 'X'.
      t_receivers-notif_ndel = 'X'.
      APPEND t_receivers.
      CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
           EXPORTING
                document_data              = w_doc_data
                put_in_outbox              = 'X'
                sender_address             = ld_sender_address
                sender_address_type        = ld_sender_address_type
                commit_work                = 'X'
           IMPORTING
                sent_to_all                = w_sent_all
           TABLES
                packing_list               = t_packing_list
                contents_bin               = t_attachment
                contents_txt               = it_message
                receivers                  = t_receivers
           EXCEPTIONS
                too_many_receivers         = 1
                document_not_sent          = 2
                document_type_not_exist    = 3
                operation_no_authorization = 4
                parameter_error            = 5
                x_error                    = 6
                enqueue_error              = 7
                OTHERS                     = 8.
    Populate zerror return code
      ld_error = sy-subrc.
    Populate zreceiver return code
      LOOP AT t_receivers.
        ld_receiver = t_receivers-retrn_code.
      ENDLOOP.
    ENDFORM.
    regards,
    venkat.

  • How to convert script output to excel and send through mail in the report

    I need a solution for Converting script into EXCEL  and sending Excel as a attachment to the mail. In my current Program I am getting OTF data from script and converting into PDF using Function module ' CONVERT_OTF'
    And sending PDF as a mail attachment using Function module 'SO_NEW_DOCUMENT_SEND_API1' it is working fine but
    My current requirement is I need to send Excel as a mail attachment instead of PDF.
    Hope it is clear for you, please give me possible solutions with sample code..

    hi
    good
    CONSTANTS: CON_CRET TYPE X VALUE '0D',  "OK for non Unicode
                 CON_TAB TYPE X VALUE '09'.   "OK for non Unicode
    *If you have Unicode check active in program attributes thnen you will
    *need to declare constants as follows
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
       con_cret type c value cl_abap_char_utilities=>CR_LF.
      CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
             INTO IT_ATTACH SEPARATED BY CON_TAB.
      CONCATENATE CON_CRET IT_ATTACH  INTO IT_ATTACH.
      APPEND  IT_ATTACH.
      LOOP AT IT_EKPO INTO WA_CHAREKPO.
        CONCATENATE WA_CHAREKPO-EBELN WA_CHAREKPO-EBELP
                    WA_CHAREKPO-AEDAT WA_CHAREKPO-MATNR
               INTO IT_ATTACH SEPARATED BY CON_TAB.  " Check here
        CONCATENATE CON_CRET IT_ATTACH  INTO IT_ATTACH.  " Check here
        APPEND  IT_ATTACH.
      ENDLOOP.
    thanks
    mrutyun^

  • How i can send a mail to the user SAP Office mailbox through the spool.

    hi all,
    I have created an report and scheduled for background and it generated a spool now how i can send a mail to the user SAP Office mailbox through that spool.
                          please provide me the sample code if possible.
                   thanks.

    Read the spool number with this...
        SELECT RQIDENT
        INTO (T_TSP01-RQIDENT)
        FROM TSP01
        WHERE RQOWNER EQ SY-UNAME
          AND RQCLIENT EQ SY-MANDT.
        APPEND T_TSP01.
        ENDSELECT.
    Use this FM RSPO_IRETURN_RAW_DATA to read the content of the spool into an Internal Table...
    Finally use this FM SO_OBJECT_SEND to send the mail to an SAP Office user...
    Greetings,
    Blag.

  • How to send external mails to the user

    Dears,
    How to send external mails to the user who creates the sales document (Quotation)
    Can you please suggest what modification required in the FM
    Thanks,
    pinky

    You can have a partner function like 'Created by' and use an exit to populate the User ID to this partner function(dont have the system right now but i think this can be done with standard partner detr. procedure also)
    Then, create an Output type for that Partner function with transmission medium as 'External Send'. You can use the standard SAP program to trigger the email. To send the actual email after the output is trigerred, the link connection has to be set up be BASIS but if you want to check, then goto SOST and see if the email got trigerred or not.

  • Reg: HRforms converted to PDF and send email to individual employee

    Hi Experts,
    The requirement is convert the HR form output to pdf and send email to respective employee in standard transaction. I copied RPCEDTX0 to  ZRPCEDTX0 and include RPCEDS09 to ZRPCEDS09, the changes need to be done for individual PERNR, I have modified the include as shown below.
       CALL FUNCTION 'HRPY_PROCESS_SET_PERNR_STATUS' after this, i have written my code
    * start of changes ARAFIQUE
      DATA: formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
            fm_name TYPE rs38l_fnam,
            pinfo LIKE pc407 OCCURS 0 WITH HEADER LINE,
            pform type tt_pc408,
            pform_l like pc408 OCCURS 0 WITH HEADER LINE.
      IF xform[] IS NOT INITIAL.
        pform_l = xform.
        APPEND pform_1 TO pform.
        pinfo-molga = '99'.
        pinfo-forml = 'ZACC'.
        APPEND pinfo.
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
          EXPORTING
            formname                 = formname
    *       VARIANT                  = ' '
    *       DIRECT_CALL              = ' '
         IMPORTING
           fm_name                  = fm_name
         EXCEPTIONS
           no_form                  = 1
           no_function_module       = 2
           OTHERS                   = 3
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CALL FUNCTION fm_name
          EXPORTING
            pinfo                      =
            pform                      = xform[]
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    * end of changes ARAFIQUE
    I found out in internet that the smartform 'HR_ESS_PAYSLIP_TO_PDF' will convert to PDF and then i can send email to PERNRS.

    Hi Experts,
    I have written the below code, the payslip is getting converted to PDF and it is getting saved in presentation server. I need to pick this file and mail, I created a customized function module for sending mail. I'm not able to send email to external addresses.
    Please find my code below. I will post the function module later.
    * start of changes ARAFIQUE
      DATA: "formname TYPE tdsfname VALUE 'HR_ESS_PAYSLIP_TO_PDF',
            "fm_name TYPE rs38l_fnam,
            p_info LIKE pc407 OCCURS 0 WITH HEADER LINE,
            "pform type tt_pc408,
            p_form LIKE pc408 OCCURS 0 WITH HEADER LINE,
            pdf_content TYPE xstring,
            pdf_fsize TYPE i,
            lv_output_length TYPE i,
            lt_binary_data TYPE STANDARD TABLE OF sdokcntbin,
            it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
            it_message LIKE solisti1 OCCURS 0 WITH HEADER LINE.
      IF xform[] IS NOT INITIAL.
        p_form[] = xform[].
        p_info-molga = '99'.
        p_info-forml = 'ZACC'.
        p_info-pcols = 1.
        p_info-psize = 1.
        APPEND p_info.
        CALL FUNCTION 'CONVERT_PAYSLIP_TO_PDF'
          EXPORTING
            p_info      = p_info
          IMPORTING
            pdf_content = pdf_content
            pdf_fsize   = pdf_fsize
          TABLES
            p_form      = p_form[]
          EXCEPTIONS
            empty_form  = 1
            OTHERS      = 2.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
          EXPORTING
            buffer        = pdf_content
          IMPORTING
            output_length = lv_output_length
          TABLES
            binary_tab    = lt_binary_data.
        CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              filename                        = 'C:\Test\Testing.pdf'
              filetype                        = 'BIN'
            TABLES
              data_tab                        = lt_binary_data
    *     FIELDNAMES                      =
           EXCEPTIONS
             file_write_error                = 1
             no_batch                        = 2
             gui_refuse_filetransfer         = 3
             invalid_type                    = 4
             no_authority                    = 5
             unknown_error                   = 6
             header_not_allowed              = 7
             separator_not_allowed           = 8
             filesize_not_allowed            = 9
             header_too_long                 = 10
             dp_error_create                 = 11
             dp_error_send                   = 12
             dp_error_write                  = 13
             unknown_dp_error                = 14
             access_denied                   = 15
             dp_out_of_memory                = 16
             disk_full                       = 17
             dp_timeout                      = 18
             file_not_found                  = 19
             dataprovider_exception          = 20
             control_flush_error             = 21
             OTHERS                          = 22
        it_receivers-receiver = 'gmailid'.
        it_receivers-rec_type = 'U'.
        it_receivers-com_type = 'INT'.
        APPEND it_receivers .
        it_message-line = 'Test for sending email'.
        APPEND it_message.
        CALL FUNCTION 'ZSEND_MAIL_ATTACHMENT'
          EXPORTING
            v_file_path  = 'C:\Test\Testing.pdf'
            v_subject    = 'Test Mail'
          TABLES
            it_receivers = it_receivers[]
            it_message   = it_message[].
        IF sy-subrc EQ 0.
          COMMIT WORK.
    *   Push mail out from SAP outbox
          SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
        ENDIF.

  • SO_NEW_DOCUMENT_ATT_SEND_API1 pdf attachment sending thru mail ecc 6.0

    Hi All,
    I'm using ECC 6.0 version, I'm trying to attach a pdf file to a mail using the function module SO_NEW_DOCUMENT_ATT_SEND_API1. But gtting error as "wasn't decoded correctly", but the same coding is working fine in 4.6 version. What changes i should do while using this function module in ECC 6.0 to get it corrected.
    Thanks & Regards,
    Sabu.

    Hi ,
    I tried with SBWP, I'm able to see the pdf file attached while sending from SBWP.
    Please see the below coding
          FORM make_the_message                                         *
    FORM make_the_message.
    Create Message Body
    Title and Description
      CLEAR : docdata,
              objtxt[],
              objpack[],
              objbin[].
      docdata-obj_name  = sy-repid.
      docdata-obj_descr = p_subj.
    Main Text
      LOOP AT gt_text INTO objtxt.
        APPEND objtxt.
      ENDLOOP.
    Write Packing List (Main)
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ     TABLE objtxt INDEX tab_lines.
      docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
      CLEAR objpack-transf_bin.
      objpack-head_start = 1.
      objpack-head_num   = 0.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
    Sabu
      objpack-doc_type   = 'RAW'.
    objpack-doc_type   = 'PDF'.
    End Sabu
      APPEND objpack.
    *Start of Upgrade ECC 6.0
      Data: l_mi_bytecount TYPE i.
    *End of Upgrade ECC 6.0
    Create Message Attachment (As read earlier from frontend)
    Write Packing List (Attachment)
    Handle the attached file.
      objbin[] = gt_pdffile[].
      att_type = 'PDF'.
      DESCRIBE TABLE objbin LINES tab_lines.
      READ     TABLE objbin INDEX tab_lines.
      objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
    *****Sabu 8496
    objpack-head_num   = 0.
      objpack-head_num   = 1.
    End Sabu
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
    *Start of Upgrade ECC 6.0
      objpack-doc_type   = att_type.
      objpack-obj_name   = 'ATTACHMENT.pdf'.
      objpack-obj_descr  = 'Attached Document'.
    *End of Upgrade ECC 6.0
      APPEND objpack.
    Create receiver list
    Generate ALV list for either Customers/Vendors/Contact persons etc.
    ENDFORM.                    "make_the_message
          FORM fill_the_distribution_list                               *
    FORM fill_the_distribution_list USING i_test
                                          i_fax
                                          i_faxcntry
                                          i_email.
    Just as a test...
      CLEAR: reclist, reclist[].
      IF i_test EQ 'X'.
        CASE 'X'.
          WHEN p_sndfax.
          By Fax
            rec_fax-rec_fax   = i_fax.
            rec_fax-rec_state = i_faxcntry.
    Start of Changes 07/09/2008
           reclist-receiver  = rec_fax.
            ASSIGN reclist-receiver TO <fs_reclist> CASTING.
            <fs_reclist> = rec_fax.
           rec_fax = <fs_reclist>.
    End of Changes 07/09/2008
            reclist-rec_type  = 'F'.
            APPEND reclist.
          WHEN p_sndint.
          By Email
            reclist-receiver = i_email.
            reclist-rec_type = 'U'.
            reclist-BLIND_COPY = 'X'.
            APPEND reclist.
        ENDCASE.
      ELSE.
      This is not a test....
        LOOP AT gt_detail INTO gs_detail.
          CHECK gs_detail-flag EQ icon_green_light.
          CASE 'X'.
            WHEN p_sndfax.
            By Fax
              rec_fax-rec_fax   = gs_detail-faxnr.
              rec_fax-rec_state = gs_detail-land1.
    Start of Changes 07/09/2008
              ASSIGN reclist-receiver TO <fs_reclist> CASTING.
              <fs_reclist> = rec_fax.
              rec_fax = <fs_reclist>.
             reclist-receiver  = rec_fax
    End of Changes 07/09/2008
              reclist-rec_type  = 'F'.
              APPEND reclist.
            WHEN p_sndint.
            By Email
              reclist-receiver = gs_detail-email.
              reclist-rec_type = 'U'.
              reclist-BLIND_COPY = 'X'.
              APPEND reclist.
          ENDCASE.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "fill_the_distribution_list
          FORM send_the_messages                                        *
    FORM send_the_messages.
    Send Message
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
              document_data                    = docdata
              put_in_outbox                    = 'X'
              commit_work                      = 'X'
        IMPORTING
            SENT_TO_ALL                      =
            NEW_OBJECT_ID                    =
          TABLES
              packing_list                     = objpack
              object_header                    = objhead
              contents_bin                     = objbin
              contents_txt                     = objtxt
            OBJECT_PARA                      =
            OBJECT_PARB                      =
              receivers                        = reclist
           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.
      IF sy-subrc <> 0.
        MESSAGE ID     'SO'
                TYPE   'S'
                NUMBER '023'
                WITH   docdata-obj_name.
      ELSE.
        PERFORM popup.
      ENDIF.
    ENDFORM.                    "send_the_messages
    Thanks & Regards,
    Sabu

  • PO output type to send a mail  to the user along with PO output as PDF file

    Hi Friends,
    I have one requirement from client.
    Client wants the PO output to be converted to PDF format and sent to User while doing the PO release through e-mail. Can anybody guide me how to Configure a New Output Type and convert the PO output into PDF and send to User through e-mail.
    Thanks
    Nazer

    This can be done with the standard form itself.
    first find out the output type u r using.
    Then goto T-code NACE and then choose EF- purchase order and then select the output type u r using.
    Then goto the 'processing Routines' at the lefe side of the screen.
    There u can find out the output forms for this output typr u r using. Here add 'Simple mail-7' in the list and then give the program name and the smartform or the script u r using.
    We can also give the mail texts for this output form.
    After that goto ME22N and then choose the 'Messages' tab and then click the simple mail and in the 'communication method' kindly provide the mail id for which the PO mail has to be sent.
    And then the mail can be viewed in the inbox of the recipient.
    in this way we can sent the PO mail to the corresponding mail address,.
    I guess this will solve ur issue.
    Thanks and Regards
    Siva
    Edited by: Sivaprakash R on Apr 20, 2009 1:00 PM
    Edited by: Sivaprakash R on Apr 20, 2009 1:00 PM

  • How to send a mail to the user with attachement

    Hi Experts,
    I have a requirement where user needs to get the automatic mail which has the updated information sheet as the attachement.
    Kindly give me a clue on this.
    if any body has model program for this...kidnly send it to [email protected]
    Thanks in Advance,
    Aiswarya

    HI
    good
    go throug this link
    http://help.sap.com/saphelp_nw04s/helpdata/en/38/71f865c2c9a94ab1dce95792187c16/content.htm
    /people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
    go through this report=>
    : Report  ZSAPTALK                                                   :
    : Author  SAPdev.co.uk                                               :
    : Description :                                                      :
    : Send mail message to SAP mail inbox.                               :
    :                     Please visit www.sapdev.co.uk for further info :
    REPORT ZSAPMAIL NO STANDARD PAGE HEADING.
    TABLES: DRAD,
            QINF,
            DRAW,
            SOUC,
            SOFD,
            DRAP.
    DATA: P_RETURN_CODE LIKE SY-SUBRC.
    data: d_username LIKE DRAP-PRNAM.
    mail declarations
    DATA : BEGIN OF NEW_OBJECT_ID.         " the newly created email object
            INCLUDE STRUCTURE SOODK.
    DATA : END OF NEW_OBJECT_ID.
    DATA : BEGIN OF FOLDER_ID.             " the folder id of the outbox
            INCLUDE STRUCTURE SOODK.
    DATA : END OF FOLDER_ID.
    DATA : BEGIN OF REC_TAB OCCURS 5.     " the table which will contain the
            INCLUDE STRUCTURE SOOS1.       " information on the destination
    DATA : END OF REC_TAB.
    DATA : BEGIN OF OBJECT_HD_CHANGE.      " the table which contains the
            INCLUDE STRUCTURE SOOD1.       " info for the object we will be
    DATA : END OF OBJECT_HD_CHANGE.        " creating
    DATA : OBJECT_TYPE LIKE SOOD-OBJTP.    " the type of object
    DATA : BEGIN OF OBJHEAD OCCURS 5.      " the header of the object
            INCLUDE STRUCTURE SOLI.
    DATA : END OF OBJHEAD.
    DATA : BEGIN OF OBJCONT OCCURS 0.      " the contents of the object
            INCLUDE STRUCTURE SOLI.        " i.e. the text etc
    DATA : END OF OBJCONT.
    DATA : BEGIN OF OBJPARA OCCURS 5.      " formatting options
            INCLUDE STRUCTURE SELC.
    DATA : END OF OBJPARA.
    DATA : BEGIN OF OBJPARB OCCURS 5.      " formatting options
            INCLUDE STRUCTURE SOOP1.
    DATA : END OF OBJPARB.
    DATA : BEGIN OF T_MAIL_TEXT OCCURS 0,  "Message table for messages to
            STRING(255),                   "user via mailbox
           END OF T_MAIL_TEXT.
    Parameter: p_uname like sy-uname.
    **START-OF-SELECTION
    START-OF-SELECTION.
        d_username = p_uname.
        PERFORM POPULATE_EMAIL_TEXT.
        PERFORM SETUP_TRX_AND_RTX_MAILBOXES USING P_RETURN_CODE.
        PERFORM CREATE_AND_SEND_MAIL_OBJECT.
          FORM POPULATE_EMAIL_TEXT                                      *
          Inserts text for email message                                *
    FORM POPULATE_EMAIL_TEXT.
      CLEAR T_MAIL_TEXT-STRING.            "puts a blank line in
      APPEND T_MAIL_TEXT.
      APPEND T_MAIL_TEXT.
    adds failed list  on to end of success list.
      T_MAIL_TEXT-STRING = 'Test email message line 1'.
      APPEND T_MAIL_TEXT.
      T_MAIL_TEXT-STRING = 'Test email message line 1'.
      APPEND T_MAIL_TEXT.
      CLEAR T_MAIL_TEXT-STRING.            "puts a blank line in
      APPEND T_MAIL_TEXT.
      T_MAIL_TEXT-STRING = 'Header1    Header2    Header3'.
      APPEND T_MAIL_TEXT.
      T_MAIL_TEXT-STRING = '----
      APPEND T_MAIL_TEXT.
    ENDFORM.
    *&      Form  SETUP_TRX_&_RTX_MAILBOXES
      Ensure that the mailboxes of the sender (INTMGR) are set up OK
    FORM SETUP_TRX_AND_RTX_MAILBOXES USING P_RETURN_CODE.
    get the user no of the sender in order to add the mail to the
    user name's outbox for future reference
      SELECT SINGLE * FROM SOUC
               WHERE SAPNAM = SY-UNAME.    "SAP name of a SAPoffice user
      IF SY-SUBRC NE 0.
        "Error finding the SAPoffice user info for the user
        MESSAGE E064(ZR53) WITH SY-UNAME.
        P_RETURN_CODE = 1.
        EXIT.
      ENDIF.
    *Get the outbox No for the sender from the user No where the folder
                                           " type is an outbox
      SELECT * FROM SOFD WHERE OWNTP = SOUC-USRTP   "Owner type from ID
                           AND OWNYR = SOUC-USRYR   "Owner year from the ID
                           AND OWNNO = SOUC-USRNO   "Owner number from the I
                           AND FOLRG = 'O'."Output box
      ENDSELECT.
      IF SY-SUBRC NE 0.
        " Error getting folder information for the user
        MESSAGE E065(ZR53) WITH SY-UNAME.
        P_RETURN_CODE = 1.
        EXIT.
      ENDIF.
    ENDFORM.                               " SETUP_TRX_&_RTX_MAILBOXES
    *&      Form  CREATE_AND_SEND_MAIL_OBJECT
    FORM CREATE_AND_SEND_MAIL_OBJECT.
      FOLDER_ID-OBJTP = SOFD-FOLTP.        " the folder type ( usually FOL )
      FOLDER_ID-OBJYR = SOFD-FOLYR.        " the folder year ( usually 22 )
      FOLDER_ID-OBJNO = SOFD-FOLNO.        " the folder no.
      OBJECT_TYPE     = 'RAW'.             " the type of object being added
    build up the object information for creating the object
      OBJECT_HD_CHANGE-OBJLA  = SY-LANGU.  " the language of the email
      OBJECT_HD_CHANGE-OBJNAM = 'PS to DM Interface'. " the object name
    mail subject 'Mass Linking of QA, pass/fail'
      MOVE TEXT-002 TO OBJECT_HD_CHANGE-OBJDES.
      OBJECT_HD_CHANGE-DLDAT = SY-DATUM.   " the date of the email
      OBJECT_HD_CHANGE-DLTIM = SY-UZEIT.   " the time of the email
      OBJECT_HD_CHANGE-OBJPRI = '1'.       " the priority ( highest )
      OBJECT_HD_CHANGE-OBJSNS = 'F'.       " the object sensitivity
    F is functional, C - company sensitive
    object_hd_change-skips  = ' '.       " Skip first screen
    object_hd_change-acnam  = 'SM35'.    " Batch imput transaction
    object_hd_change-vmtyp  = 'T'.       " Transaction type
    add the text lines into the contents of the email
      CLEAR OBJCONT.
      REFRESH OBJCONT.
    free objcont.      " added this to delete the mail contents records
      LOOP AT T_MAIL_TEXT.
        OBJCONT-LINE = T_MAIL_TEXT-STRING.
        APPEND OBJCONT.
      ENDLOOP.
      CLEAR OBJCONT.
    build up the table of receivers for the email
      REC_TAB-RCDAT = SY-DATUM.            " the date to send the email
      REC_TAB-RCTIM = SY-UZEIT.            " the time to send the email
    the SAP username of the person who will receive the email
      REC_TAB-RECNAM = D_USERNAME.
    the user type of the person who will send the email ( USR )
      REC_TAB-SNDTP = SOUC-USRTP.
    the user year of the person who will send the email ( 22 )
      REC_TAB-SNDYR = SOUC-USRYR.
    the user number of the person who will send the email
      REC_TAB-SNDNO = SOUC-USRNO.
    the sap username of the person who will send the email
      REC_TAB-SNDNAM = SY-UNAME.
    get the user info for the receiver of the document
      SELECT SINGLE * FROM SOUC WHERE SAPNAM = D_USERNAME.
      IF SY-SUBRC NE 0.
        WRITE : / TEXT-001, D_USERNAME.    "usnam.
        EXIT.
      ENDIF.
    the user number of the person who will receive the email ( USR )
      REC_TAB-RECNO = SOUC-USRNO.
    the user type of the person who will receive the email ( USR )
      REC_TAB-RECTP = SOUC-USRTP.
    the user year of the person who will receive the email ( USR )
      REC_TAB-RECYR = SOUC-USRYR.
    the priority of the email ( highest )
      REC_TAB-SNDPRI = '1'.
    check for delivery on the email
      REC_TAB-DELIVER = 'X'.
    send express so recipient knows there is a problem
      REC_TAB-SNDEX = 'X'.
    check for a return receipt
      REC_TAB-READ = 'X'.
    the sap username of the person receiving the email
      REC_TAB-ADR_NAME = D_USERNAME.       "usnam.
    add this receiver to the internal table
      APPEND REC_TAB.
      CLEAR REC_TAB.
    call the function to create the object in the outbox of the sender
      CALL FUNCTION 'SO_OBJECT_INSERT'
           EXPORTING
                FOLDER_ID                  = FOLDER_ID
                OBJECT_HD_CHANGE           = OBJECT_HD_CHANGE
                OBJECT_TYPE                = OBJECT_TYPE
                OWNER                      = SY-UNAME
           IMPORTING
                OBJECT_ID                  = NEW_OBJECT_ID
           TABLES
                OBJCONT                    = OBJCONT
                OBJHEAD                    = OBJHEAD
                OBJPARA                    = OBJPARA
                OBJPARB                    = OBJPARB
           EXCEPTIONS
                ACTIVE_USER_NOT_EXIST      = 1
                COMMUNICATION_FAILURE      = 2
                COMPONENT_NOT_AVAILABLE    = 3
                DL_NAME_EXIST              = 4
                FOLDER_NOT_EXIST           = 5
                FOLDER_NO_AUTHORIZATION    = 6
                OBJECT_TYPE_NOT_EXIST      = 7
                OPERATION_NO_AUTHORIZATION = 8
                OWNER_NOT_EXIST            = 9
                PARAMETER_ERROR            = 10
                SUBSTITUTE_NOT_ACTIVE      = 11
                SUBSTITUTE_NOT_DEFINED     = 12
                SYSTEM_FAILURE             = 13
                X_ERROR                    = 14
                OTHERS                     = 15.
      IF SY-SUBRC NE 0.
        MESSAGE A063(ZR53) WITH SY-SUBRC.
        EXIT.
      ENDIF.
    call the function to send the already created email to the receivers
      CALL FUNCTION 'SO_OBJECT_SEND'
           EXPORTING
                FOLDER_ID                  = FOLDER_ID
                OBJECT_ID                  = NEW_OBJECT_ID
                OUTBOX_FLAG                = 'X'
                OWNER                      = SY-UNAME
           TABLES
                RECEIVERS                  = REC_TAB
           EXCEPTIONS
                ACTIVE_USER_NOT_EXIST      = 1
                COMMUNICATION_FAILURE      = 2
                COMPONENT_NOT_AVAILABLE    = 3
                FOLDER_NOT_EXIST           = 4
                FOLDER_NO_AUTHORIZATION    = 5
                FORWARDER_NOT_EXIST        = 6
                NOTE_NOT_EXIST             = 7
                OBJECT_NOT_EXIST           = 8
                OBJECT_NOT_SENT            = 9
                OBJECT_NO_AUTHORIZATION    = 10
                OBJECT_TYPE_NOT_EXIST      = 11
                OPERATION_NO_AUTHORIZATION = 12
                OWNER_NOT_EXIST            = 13
                PARAMETER_ERROR            = 14
                SUBSTITUTE_NOT_ACTIVE      = 15
                SUBSTITUTE_NOT_DEFINED     = 16
                SYSTEM_FAILURE             = 17
                TOO_MUCH_RECEIVERS         = 18
                USER_NOT_EXIST             = 19
                X_ERROR                    = 20
                OTHERS                     = 21.
      IF SY-SUBRC EQ 0.
        MESSAGE I035(ZR53) WITH NEW_OBJECT_ID D_USERNAME. "usnam.
      ELSE.
        MESSAGE I036(ZR53) WITH D_USERNAME."      sy-subrc.
      ENDIF.
    ENDFORM.                               " CREATE_AND_SEND_MAIL_OBJECT
    thanks
    mrutyun

  • Send a mail to the user after first time login

    How to send mail  to the user after the user login for the first time in oim 11g r2

    How to send mail  to the user after the user login for the first time in oim 11g r2

  • Sap script convert to pdf and then send to email

    Hi,
    good day sap guys
    ive dev the sap scipt for customer statemnet one which is used the t.code is f.27.
    i need to convert the sap script to pdf and then send to email.
    plz let me know..
    how to do it.
    regards
    chandu

    Hi,
       I script program use the following (go to the "call function 'CLOSE_FORM'")
    data: binfilesize type i.
      data: pdftab type table of tline with header line.
      data: i_itcpp like itcpp.
      data: g_t_otfdata type standard table of itcoo with header line.
      call function 'CLOSE_FORM'
       IMPORTING
         RESULT  = i_itcpp
          tables
            otfdata = g_t_otfdata[]
          exceptions
            others  = 1.
      if sy-subrc ne 0.
        retcode = sy-subrc.
        perform protocol_update.
      endif.
      call function 'CONVERT_OTF'
    exporting
    format = 'PDF'
    importing
    bin_filesize = binfilesize
    BIN_FILE =
    tables
    otf = g_t_otfdata[]
    lines = pdftab[].
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    concatenate file_path  '.pdf' into filename.
    call function 'GUI_DOWNLOAD'
      exporting
      bin_filesize = binfilesize
      filename = filename
      filetype = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
      tables
      data_tab = pdftab[]
    FIELDNAMES =
      exceptions
      file_write_error = 1
      no_batch = 2
      gui_refuse_filetransfer = 3
      invalid_type = 4
      no_authority = 5
      unknown_error = 6
      header_not_allowed = 7
      separator_not_allowed = 8
      filesize_not_allowed = 9
      header_too_long = 10
      dp_error_create = 11
      dp_error_send = 12
      dp_error_write = 13
      unknown_dp_error = 14
      access_denied = 15
      dp_out_of_memory = 16
      disk_full = 17
      dp_timeout = 18
      file_not_found = 19
      dataprovider_exception = 20
      control_flush_error = 21
      others = 22
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.

  • Smart Form convert to Pdf and send to email

    hi,
    ive dev the smart for me21n. its  working fine. Standard programme is SAPLMEGUI.
    now new requirement is , convert the smart form to pdf and then sending the pdf through email to customer.
    Can any plz tell me is there any stadard programme or else need to custmise the print programme?
    Regards

    Kirans belong to convert the smart form to pdf.
    there is standard programme RSTXPDFT4
    but after convert the form to pdf. i need to send it thorough mail.
    iam checking other link one which is send by mr.naresh..
    thank you
    Regards

  • Invoice to convert  in PDF and send by E-Mail

    I would like to Convert the OutPut of Invoice to PDF format and send it through E-Mail.
    Is there any SAP standard programme available to this or what is the process?

    This is OK, but kindly let me know the what paramter I have to enter, I entered some parameter and some parameter I cant understand, marked as '?'.
    Import parameters               Value
    FORMAT_SRC                      OTF    
    FORMAT_DST                      PDF    
    ADDR_TYPE                       5      
    DEVTYPE                              ?  
    FUNCPARA                            ? 
    Changing parameters             Value       
    TRANSFER_BIN                          ?      
    CONTENT_TXT                        0 Entries
    CONTENT_BIN                        0 Entries
    OBJHEAD                            0 Entries
    LEN                                          ?
    Thanks
    Awadhesh

  • How to convert smartform into pdf and send through mail

    Hi Guru,
    I want to send smartform to mail after converting into pdf format.
    if anyof u gives solution its greate.
    Thanks & Regards,
    Lakshmi..

    Hi,
    i can help you till
    downloading the smartform as pdf format
    check this
    DATA: GIT_BSIK LIKE BSIK OCCURS 0 WITH HEADER LINE.
    Variable declarations
    DATA:
    W_FORM_NAME TYPE TDSFNAME VALUE 'ZFII_EDD001',
    W_FMODULE TYPE RS38L_FNAM,
    W_CPARAM TYPE SSFCTRLOP,
    W_OUTOPTIONS TYPE SSFCOMPOP,
    W_BIN_FILESIZE TYPE I, " Binary File Size
    W_FILE_NAME TYPE STRING,
    W_FILE_PATH TYPE STRING,
    W_FULL_PATH TYPE STRING.
    Internal tables declaration
    Internal table to hold the OTF data
    DATA:
    T_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
    Internal table to hold OTF data recd from the SMARTFORM
    T_OTF_FROM_FM TYPE SSFCRESCL,
    Internal table to hold the data from the FM CONVERT_OTF
    T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE.
    This function module call is used to retrieve the name of the Function
    module generated when the SMARTFORM is activated
        CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
        FORMNAME = W_FORM_NAME
        VARIANT = ' '
        DIRECT_CALL = ' '
        IMPORTING
        FM_NAME = W_FMODULE
        EXCEPTIONS
        NO_FORM = 1
        NO_FUNCTION_MODULE = 2
        OTHERS = 3
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Calling the SMARTFORM using the function module retrieved above
    GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
    format of the output
    W_CPARAM-NO_DIALOG = 'X'.
    W_CPARAM-PREVIEW = SPACE. " Suppressing the dialog box
    " for print preview
    W_CPARAM-GETOTF = 'X'.
    Printer name to be used is provided in the export parameter
    OUTPUT_OPTIONS
    W_OUTOPTIONS-TDDEST = 'ZPC_'.
          CALL FUNCTION W_FMODULE
          EXPORTING
          ARCHIVE_INDEX =
          ARCHIVE_INDEX_TAB =
          ARCHIVE_PARAMETERS =
          CONTROL_PARAMETERS = W_CPARAM
          MAIL_APPL_OBJ =
          MAIL_RECIPIENT =
          MAIL_SENDER =
          OUTPUT_OPTIONS = W_OUTOPTIONS
          USER_SETTINGS = 'X'
          IMPORTING
          DOCUMENT_OUTPUT_INFO =
          JOB_OUTPUT_INFO = T_OTF_FROM_FM
          JOB_OUTPUT_OPTIONS =
               TABLES
                ITAB                       = GIT_BSIK
          EXCEPTIONS
          FORMATTING_ERROR = 1
          INTERNAL_ERROR = 2
          SEND_ERROR = 3
          USER_CANCELED = 4
          OTHERS = 5.
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    T_OTF[] = T_OTF_FROM_FM-OTFDATA[].
    Function Module CONVERT_OTF is used to convert the OTF format to PDF
          CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
          FORMAT = 'PDF'
          MAX_LINEWIDTH = 132
          ARCHIVE_INDEX = ' '
          COPYNUMBER = 0
          ASCII_BIDI_VIS2LOG = ' '
          PDF_DELETE_OTFTAB = ' '
          IMPORTING
          BIN_FILESIZE = W_BIN_FILESIZE
          BIN_FILE =
          TABLES
          OTF = T_OTF
          LINES = T_PDF_TAB
          EXCEPTIONS
          ERR_MAX_LINEWIDTH = 1
          ERR_FORMAT = 2
          ERR_CONV_NOT_POSSIBLE = 3
          ERR_BAD_OTF = 4
          OTHERS = 5
          IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *To display File SAVE dialog window
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
    WINDOW_TITLE =
    DEFAULT_EXTENSION =
    DEFAULT_FILE_NAME =
    FILE_FILTER =
    INITIAL_DIRECTORY =
    WITH_ENCODING =
    PROMPT_ON_OVERWRITE = 'X'
    CHANGING
    filename = w_FILE_NAME
    path = w_FILE_PATH
    fullpath = w_FULL_PATH
    USER_ACTION =
    FILE_ENCODING =
    EXCEPTIONS
    CNTL_ERROR = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    others = 4
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
    presentation server
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE = W_bin_filesize
    filename = w_FULL_PATH
    FILETYPE = 'BIN'
    APPEND = ' '
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = 'X'
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    CONFIRM_OVERWRITE = ' '
    NO_AUTH_CHECK = ' '
    CODEPAGE = ' '
    IGNORE_CERR = ABAP_TRUE
    REPLACEMENT = '#'
    WRITE_BOM = ' '
    TRUNC_TRAILING_BLANKS_EOL = 'X'
    WK1_N_FORMAT = ' '
    WK1_N_SIZE = ' '
    WK1_T_FORMAT = ' '
    WK1_T_SIZE = ' '
    IMPORTING
    FILELENGTH =
    tables
    data_tab = T_pdf_tab
    FIELDNAMES =
    EXCEPTIONS
    FILE_WRITE_ERROR = 1
    NO_BATCH = 2
    GUI_REFUSE_FILETRANSFER = 3
    INVALID_TYPE = 4
    NO_AUTHORITY = 5
    UNKNOWN_ERROR = 6
    HEADER_NOT_ALLOWED = 7
    SEPARATOR_NOT_ALLOWED = 8
    FILESIZE_NOT_ALLOWED = 9
    HEADER_TOO_LONG = 10
    DP_ERROR_CREATE = 11
    DP_ERROR_SEND = 12
    DP_ERROR_WRITE = 13
    UNKNOWN_DP_ERROR = 14
    ACCESS_DENIED = 15
    DP_OUT_OF_MEMORY = 16
    DISK_FULL = 17
    DP_TIMEOUT = 18
    FILE_NOT_FOUND = 19
    DATAPROVIDER_EXCEPTION = 20
    CONTROL_FLUSH_ERROR = 21
    OTHERS = 22
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    thanks & regards,
    Venkatesh

Maybe you are looking for

  • Outlook Web Access doesn't display when in a Page

    Hi guys, I have set up an IView to access Outlook Webmail, as per the normal help documents, and the IView works perfectly - displays my Inbox and everything. If I add the IView into a workset, users are able to view their Inbox too. However, If I cr

  • Help opening Adobe Acrobat XI Pro after downloading it from the Cloud?

    When I try to launch the program the first time, it opens a dialog box titled "Adobe Software License Agreement." However, the box is blank and nothing happens when I click "Accept." Has anyone had this problem?

  • Restart....and then grey

    I tried installing Leopard today, but after the iMac restarts, all I get is a light grey screen with the Apple logo on it. No installation screen. It stayed on this screen for 4 hours. Called Apple tech help and was put on hold for 56 minutes before

  • HT4587 I cant connect itunes on my pc to airplay  - icon disappeared

    After up dating my software on Airplay, and itunes, i cant connect the PC to play itunes through airplay. Airtunes is available for iphone and ipad - however most of my libary is on itunes Annoying!!

  • Error when creating new XML-Form

    Hi everybody! We are using XML-Forms to create/edit/display FAQs out of the KM-Content. We have created our own XMLForms for that and it worked fine. After our last upgrade (NW 7.0 SP-Stack 16) we have the following problem: clicking the "new FAQ" li