How to send a smartform result through mail?

How to send a smartform result through mail?

HI,
YOu can convert the output of Smartform into a attachment say PDF file & then send it across through mail.
Refer following program:
<a href="http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm">http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</a>
Best regards,
Prashant

Similar Messages

  • How to send internal table data through mail from report in foreground

    hi all,
    iam trying  to convert the internal table data into excel format and sending it through mail by runnning the report in foreground.
    mail is going sucessfully with excel format,but iam facing the problem in the excel format of the material column as follows:
    the matrno shows the wrong format -2.63E+11  instead of displaying correct format-263215000000.
    Pls suggest the alternative process for the above mentioned problem.
    Thanks,
    Sivagopal R.

    Hi Siva,
      Try to copy 263215000000 in one of the cells of excel sheet and press enter.It will automatically convert into -2.63E+11 .
      This means the default formatting of the excel sheet makes this happen.If you convert the format of the cell to "NUMBER" then u will get the required result.
      But I doubt whether or not it is possible through ABAP programming.
    Regards,
    Vimal.

  • Urgent ...how to send output of sap through mail

    Could you please guide me how to send output of SAP Script  through mail in PDF format.
    Thanks in Advance....
    Regards,
    Kumar.

    *& Report  ZSPOOLTOPDF                                                 *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program must be run as a background job in-order for the write *
    *& commands to create a Spool request rather than be displayed on      *
    *& screen                                                              *
    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

  • Send the MRP results through mail to the user.

    Dear SAP Gurus,
      My client have a requirement where in they want that the MRP results as displayed in MRP list should be sent through mail to the user after the MRP run. Is it possible through the standard functionality ?
    Regards'
    Ankush

    Dear ,
    In MD04/MD05 -Check there is an option called Sending e-mail at the header ( Envelope sysmbol ) .From here you can send e-mail to MRP Controller if your user is identified  as MRP Controller .
    In Customizing for MRP, you can maintain a mail link to inform an MRP controller by using the mail connection function you can do it.In Customizing for MRP, you have entered a mail recipient (individual recipient or recipient group) for the MRP controller in the IMG activity Define MRP controller. You can also integrate the sending of the mail into a workflow .
    If you want to send the mail directly to just one MRP controller and include the MRP list or stock/requirements list automatically, you can use the function for variable printing. When using variable printing, the data is displayed in the form of a list that can be processed and printed. A separate mail function also appears, which you can use to send this print list.
    MRP controller will get mail in that case you are planned to use Workflow to trigger mails for a given condition of MRP evaluation.
    SPROMRP- -EvalutionActivate workflow  mail to mrp controller .Also check SAP Note 426648
    Explore this above functionality with this information and try to check the same
    Regards
    JH

  • How to send Dynamic Interactive Forms through mail?

    Hi all,
    I'm trying to sent Interactive Forms as attachment through mails.
    Everything works fine as long as the Content of this Interactive Form stays static.
    When I add dynamic elements and test this in SFP, they work.
    However when they get sent by mail, the dynamic content is lost and gets back Static.
    Does anyone has ABAP code or any other solutions so that the PDF gets send as an Dynamic Form?
    Thanks in advance.
    Kind Regards,
    Maarten

    Hi,
    I'm working from the Web UI. This is BSP. Here I add 2 Methods (GET_PDF and SEND_MAIL).
    The GET_PDF gets all data for the form and then sends the FORMOUTPUT to the SEND_MAIL method.
    Here I add the PDF as following:
    First I convert it to BINARY and then I add it as attachment.
    Do I need to add it as another TYPE or ....
    +  CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
        EXPORTING
          BUFFER                = ip_formoutput-PDF "PDF file from function module
        APPEND_TO_TABLE       = ' '
      IMPORTING
        OUTPUT_LENGTH         =
        TABLES
          BINARY_TAB            = lt_att_content_hex
      lo_document->add_attachment(
        EXPORTING
          i_attachment_type    = 'PDF'
          i_attachment_subject = 'Your appointment Details'
          i_att_content_hex    = lt_att_content_hex ).+
    Kind Regards,
    Maarten

  • How to send existing excel file through mail

    Hello Friends,
    I have to send mail with Excel File attachement. i have already exist Excel file and that file i hv to send through mail. so pl help me out for sending existing excel file .
    i.e. user pickup the exist excel file and that file would be sent to particular mail id.
    thank you,
    Marmik

    Hi marmik,
    1. There is some trick involved
    in the binary files.
    2. I have made a program (and it works fantastic)
    ONLY 6 LINES FOR EMAILING
    BELIEVE ME
    ITS A FANTASTIC PROGRAM.
    IT WILL WORK LIKE OUTLOOK EXPRESS !
    3. The user is provided with
    a) file name
    b) email address to send mail
    and it sends ANY FILE (.xls,.pdf .xyz..)
    Instantaneously !
    4. Make two things first :
    1. Include with the name : ZAMI_INCLFOR_MAIL
    2. Report with the name : ZAM_TEMP147 (any name will do)
    3. Activate both and execute (2)
    4. After providing filename, email adress
    5. Code for Include :
    10.08.2005 Amit M - Created
    Include For Mail (First Req F16)
    Modification Log
    Data
    DATA: docdata LIKE sodocchgi1,
    objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
    objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
    objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
    objhex LIKE solix OCCURS 10 WITH HEADER LINE,
    reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
    DATA: tab_lines TYPE i,
    doc_size TYPE i,
    att_type LIKE soodk-objtp.
    DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
    FORM
    FORM ml_customize USING objname objdesc.
    Clear Variables
    CLEAR docdata.
    REFRESH objpack.
    CLEAR objpack.
    REFRESH objhead.
    REFRESH objtxt.
    CLEAR objtxt.
    REFRESH objbin.
    CLEAR objbin.
    REFRESH objhex.
    CLEAR objhex.
    REFRESH reclist.
    CLEAR reclist.
    REFRESH listobject.
    CLEAR listobject.
    CLEAR tab_lines.
    CLEAR doc_size.
    CLEAR att_type.
    Set Variables
    docdata-obj_name = objname.
    docdata-obj_descr = objdesc.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addrecp USING preceiver prec_type.
    CLEAR reclist.
    reclist-receiver = preceiver.
    reclist-rec_type = prec_type.
    APPEND reclist.
    ENDFORM. "ml_customize
    FORM
    FORM ml_addtxt USING ptxt.
    CLEAR objtxt.
    objtxt = ptxt.
    APPEND objtxt.
    ENDFORM. "ml_customize
    FORM
    FORM ml_prepare USING bypassmemory whatatt_type whatname.
    IF bypassmemory = ''.
    Fetch List From Memory
    CALL FUNCTION 'LIST_FROM_MEMORY'
    TABLES
    listobject = listobject
    EXCEPTIONS
    OTHERS = 1.
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'LIST_FROM_MEMORY'.
    ENDIF.
    CALL FUNCTION 'TABLE_COMPRESS'
    IMPORTING
    COMPRESSED_SIZE =
    TABLES
    in = listobject
    out = objbin
    EXCEPTIONS
    OTHERS = 1
    IF sy-subrc <> 0.
    MESSAGE ID '61' TYPE 'E' NUMBER '731'
    WITH 'TABLE_COMPRESS'.
    ENDIF.
    ENDIF.
    Header Data
    Already Done Thru FM
    Main Text
    Already Done Thru FM
    Packing Info For Text Data
    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.
    objpack-doc_type = 'TXT'.
    APPEND objpack.
    Packing Info Attachment
    att_type = whatatt_type..
    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.
    objpack-head_num = 0.
    objpack-body_start = 1.
    objpack-body_num = tab_lines.
    objpack-doc_type = att_type.
    objpack-obj_name = 'ATTACHMENT'.
    objpack-obj_descr = whatname.
    APPEND objpack.
    Receiver List
    Already done thru fm
    ENDFORM. "ml_prepare
    FORM
    FORM ml_dosend.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = docdata
    put_in_outbox = 'X'
    commit_work = 'X' "used from rel. 6.10
    IMPORTING
    SENT_TO_ALL =
    NEW_OBJECT_ID =
    TABLES
    packing_list = objpack
    object_header = objhead
    contents_bin = objbin
    contents_txt = objtxt
    CONTENTS_HEX = objhex
    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.
    ENDIF.
    ENDFORM. "ml_customize
    FORM
    FORM ml_spooltopdf USING whatspoolid.
    DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
    Call Function
    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
    EXPORTING
    src_spoolid = whatspoolid
    TABLES
    pdf = pdf
    EXCEPTIONS
    err_no_otf_spooljob = 1
    OTHERS = 12.
    Convert
    PERFORM doconv TABLES pdf objbin.
    ENDFORM. "ml_spooltopdf
    FORM
    FORM doconv TABLES
    mypdf STRUCTURE tline
    outbin STRUCTURE solisti1.
    Data
    DATA : pos TYPE i.
    DATA : len TYPE i.
    Loop And Put Data
    LOOP AT mypdf.
    pos = 255 - len.
    IF pos > 134. "length of pdf_table
    pos = 134.
    ENDIF.
    outbin+len = mypdf(pos).
    len = len + pos.
    IF len = 255. "length of out (contents_bin)
    APPEND outbin.
    CLEAR: outbin, len.
    IF pos < 134.
    outbin = mypdf+pos.
    len = 134 - pos.
    ENDIF.
    ENDIF.
    ENDLOOP.
    IF len > 0.
    APPEND outbin.
    ENDIF.
    ENDFORM. "doconv
    CODE FOR PROGRAM
    5.
    REPORT zam_temp147 .
    INCLUDE zami_inclfor_mail.
    DATA
    DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
    DATA : file_name TYPE string.
    data : path like PCFILE-PATH.
    data : extension(5) type c.
    data : name(100) type c.
    SELECTION SCREEN
    PARAMETERS : receiver TYPE somlreci1-receiver lower case.
    PARAMETERS : p_file LIKE rlgrap-filename
    OBLIGATORY.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CLEAR p_file.
    CALL FUNCTION 'F4_FILENAME'
    IMPORTING
    file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
    PERFORM ml_customize USING 'Tst' 'Testing'.
    PERFORM ml_addrecp USING receiver 'U'.
    PERFORM upl.
    PERFORM doconv TABLES itab objbin.
    PERFORM ml_prepare USING 'X' extension name.
    PERFORM ml_dosend.
    SUBMIT rsconn01
    WITH mode EQ 'INT'
    AND RETURN.
    FORM
    FORM upl.
    file_name = p_file.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename = file_name
    filetype = 'BIN'
    TABLES
    data_tab = itab
    EXCEPTIONS
    file_open_error = 1
    file_read_error = 2
    no_batch = 3
    gui_refuse_filetransfer = 4
    invalid_type = 5
    no_authority = 6
    unknown_error = 7
    bad_data_format = 8
    header_not_allowed = 9
    separator_not_allowed = 10
    header_too_long = 11
    unknown_dp_error = 12
    access_denied = 13
    dp_out_of_memory = 14
    disk_full = 15
    dp_timeout = 16
    OTHERS = 17.
    path = file_name.
    CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
    EXPORTING
    complete_filename = path
    CHECK_DOS_FORMAT =
    IMPORTING
    DRIVE =
    EXTENSION = extension
    NAME = name
    NAME_WITH_EXT =
    PATH =
    EXCEPTIONS
    INVALID_DRIVE = 1
    INVALID_EXTENSION = 2
    INVALID_NAME = 3
    INVALID_PATH = 4
    OTHERS = 5
    ENDFORM. "upl
    regards,
    amit m.

  • How To Send A Text Attachment Through MAIL Adapter

    Hi Experts,
       I Did A Scenario that is  By using file adapter at the sender side and PI as a middle ware i have sent one text file to database
    Now here my question is
    I have to send the same text file which i have sent database... my using Mail Adapter
    Simply  File to Mail Scenario
    FILE         PI                MAIL
    But I have to send the same text file which i sent to database... by using mail adapter... Here all the configuration are done ... And the channels are working properly... only thing  here is..to send same text file using mail adapter..
    It will be good if  any one can explain step by step..
    Regards
    aravindh

    Hi Rajendra,
       Tanq for connecting me ... This  Blog helped me a lot ....And it is a useful answer to me..
    For this file to mail scenario we have got .txt as an attachment ... Its fine ... But her my Client is asking me to add CONTENT in the mail... Content in the sense..
    Example of content...
    Hi,
    Please find the attachment
    Regards,
    sap pi,
    They need in the form of like this...  To add content in the mail  What i have to do...DO i need to add more configurations if it is what are they...
    Please solve the issue.. It is appreciated  some one can explain me step by step or .. By sending me screen charts..
    Thanks in  advance....
    Regards
    vinay

  • How to send ALV report Output through mail in background !

    Hi ,
    I had an ALV Report. I want to send this report output to patricular email id every day ! Presenty i do this manually. I run the report and send the output to the particular email address. Now i want to schecule the report daily in background and the out put of the report should be mailed to particular email ids in background itself. How can i do this ?
    Is there and method or setting through which we can do this ?
    Regards

    Hi Nau,
    For this requirement you will have to write another program.
    This program will convert the spool requests into PDF document and sends an email  to the recipients that you specify.
    These are the threads which are already posted in The SDN.
    *http://wiki.sdn.sap.com/wiki/display/Snippets/Converts+spool+request+into+PDF+document+and+emails*
    *<a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="353650"></a>*
    *<a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="902985"></a>*
    You need to use the Function module :
    -- Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    I will provide you with the code to get this functionality.
    *&      Form  SEND_EMAIL
    form SEND_EMAIL .
    DATA:   t_mailpack   TYPE sopcklsti1 OCCURS 0 WITH HEADER LINE,
              t_mailhead   TYPE solisti1   OCCURS 0 WITH HEADER LINE,
              t_mailbin    TYPE solisti1   OCCURS 0 WITH HEADER LINE,
              t_mailtxt    TYPE solisti1   OCCURS 0 WITH HEADER LINE,
              t_mailrec    TYPE somlreci1  OCCURS 0 WITH HEADER LINE.
      DATA: wa_maildata    TYPE sodocchgi1,
            l_filename(50) TYPE c,
            l_fldname(30)  TYPE c,
            l_fldval(100)  TYPE c,
            l_lines        TYPE i,
            l_text         TYPE text128 .
      DATA: w_email_subrc  TYPE i.
      DATA: w_ship like vbfa-vbeln.
      CLEAR: wa_maildata,
             t_mailtxt,
             t_mailbin,
             t_mailpack,
             t_mailhead,
             t_mailrec.
      REFRESH: t_mailtxt,
               t_mailbin,
               t_mailpack,
               t_mailhead,
               t_mailrec.
    *-- Fill output file
    *- Fill header
      CLEAR: t_mailbin.
    *  t_mailbin[] = pdf_tab[].
      t_mailbin[] = it_att[].     "Uthaman
    *This line is added to get the shipment no in Subject Line
    SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
                                AND vbtyp_v EQ c_vbtyp_v_j
                                AND vbtyp_n EQ c_vbtyp_n_8.
    w_ship = vbfa-vbeln.
    shift w_ship left deleting leading '0'.
    *-- File name
    if nast-kschl EQ 'ZFPL'.
      CLEAR l_filename.
      CONCATENATE 'Packing List -'
                  sy-datum+4(2) sy-datum+6(2) sy-datum(4) '.PDF' INTO l_filename.
    *-- Creation of the document to be sent File Name
      wa_maildata-obj_name = 'Packing List'.
    *-- Mail Subject
      CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
    *-- Mail Contents
      t_mailtxt-line = 'Packing List'.
      APPEND t_mailtxt.
    ENDIF.
    if nast-kschl EQ 'ZFBA'.
      CLEAR l_filename.
      CONCATENATE 'Booking Advice -'
                  sy-datum+4(2) sy-datum+6(2) sy-datum(4) '.PDF'
                  INTO l_filename.
    *-- Creation of the document to be sent File Name
      wa_maildata-obj_name = 'Booking Advice'.
    *-- Mail Subject
      CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
    *-- Mail Contents
      t_mailtxt-line = 'Packing List'.
      APPEND t_mailtxt.
    ENDIF.
    *-- Prepare Packing List
    *-- Write Packing List (Main Subject)
      CLEAR: l_lines, t_mailpack.
      DESCRIBE TABLE t_mailtxt LINES l_lines.
    *  READ TABLE t_mailtxt INDEX l_lines.
      t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailtxt ).
    *  CLEAR t_mailpack-transf_bin.
      t_mailpack-transf_bin = ' '.
      t_mailpack-head_start = 1.
      t_mailpack-head_num = 0.
      t_mailpack-body_start = 1.
      t_mailpack-body_num = l_lines.
      t_mailpack-doc_type = 'RAW'.
      APPEND t_mailpack.
      t_mailhead = l_filename.
      APPEND t_mailhead.
    *-- Write Packing List (Attachment)
      CLEAR: l_lines, t_mailpack.
      DESCRIBE TABLE pdf_tab[] LINES l_lines.
    *  READ TABLE pdf_tab INDEX l_lines.
      t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailbin ).
      t_mailpack-transf_bin = 'X'.
      t_mailpack-head_start = 1.
      t_mailpack-head_num = 1.
      t_mailpack-body_start = 1.
      t_mailpack-body_num = l_lines.
      t_mailpack-doc_type = 'PDF'.
      t_mailpack-obj_name = l_filename.
      t_mailpack-obj_descr = l_filename.
      t_mailpack-obj_langu = 'E'.
      APPEND t_mailpack.
    *-- Set recipients
    tables :  ztotcemail.
    SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
                                AND vbtyp_v EQ c_vbtyp_v_j
                                AND vbtyp_n EQ c_vbtyp_n_8.
    CLEAR vttk.
    SELECT SINGLE * FROM vttk WHERE tknum EQ vbfa-vbeln.
    SELECT SINGLE * FROM ztotcemail WHERE tplst = vttk-tplst
                                      AND lifnr = vttk-tdlnr.
    IF SY-SUBRC EQ 0.
      t_mailrec-receiver = ztotcemail-smtp_addr. "'Here you will give the email address'.
      t_mailrec-rec_type  = 'U'.
      APPEND t_mailrec.
    ENDIF.
    **-- Sending the document
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          document_data              = wa_maildata
          put_in_outbox              = 'X'
    *      commit_work                = 'X'  " N-16
        TABLES
          packing_list               = t_mailpack
          object_header              = t_mailhead
          contents_bin               = t_mailbin[]
          contents_txt               = t_mailtxt[]
          receivers                  = t_mailrec
        EXCEPTIONS
          too_many_receivers         = 1
          document_not_sent          = 2
          operation_no_authorization = 4
          OTHERS                     = 99.
      w_email_subrc = sy-subrc.
      IF sy-subrc EQ 0.
        MESSAGE s000(zotc) WITH 'Email output sent successfully'.
      ELSE.
        MESSAGE s000(zotc) WITH 'Can not send email output'.
      ENDIF.
    endform.                    " SEND_EMAIL
    Hope the above information will be helpful.
    Regards,
    Kittu

  • How to send the form data through mail with pdf format?

    forms 6i
    Hi to all,
    i am developed one master detail form.example is based on the dept number emp details will be displayed.here my requirment is whatever displayed on the form
    the data ,these data send to mail with any format.is it possible? if is possible any one give a proper solution.
    Regards,
    Stevie
    Edited by: 994418 on 6 May, 2013 11:15 PM

    Hello,
    you can create a Report that accepts the search parameters from the Forms mask and generates a PDF. You also have the option to send the report via mail.
    Personally I would generate the report with a tool like as_pdf
    http://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/
    Then you can send the mail using utl_mail or utl_smtp.
    www.google.com/search?q=site:forums.oracle.com+utl_mail+utl_smtp
    Regards
    Marcus

  • How to send purchase order via e-mail.

    Please could someone let me know how to send purchase order via e-mail.
    I am an BC.
    e-mailing is functionning however I am not very familiar in settings for MM

    No, you do not need to touch ME_PRINT_PO. You need to put code before and after ME_PRINT_PO in the print program.
    Step 1 - Copy the standard print program SAPFM06P to make a Z version, lets call it ZSAPFM06P
    Step 2 - Copy include FM06PE02 to make a Z version, lets call that ZFM06PE02.
    Step 3 - ZSAPFM06P change the statement "Include FM06PE02" to read "Include ZFM06PE02".
    Step 4 - In include ZFM06PE02 you will find a subroutine called "ENTRY_NEU". In this subroutine you will see it first calls ME_READ_PO_FOR_PRINTING then calls ME_PRINT_PO. Before it calls ME_PRINT_PO just put:
    l_nast-nacha = 1.
    CLEAR l_nast-dimme.
    This means that ME_PRINT_PO will not e-mail, it will create a spool request.
    Step 5 - Still in ZFM06PE02, after ME_PRINT_PO has been called, add new code. First check that ent_retco EQ 0. If it does not then exit.
    Step 6 - Get the spool ID created by ME_PRINT_PO by either moving sy-msgv1 to a variable or select from NAST.
    Step 7 - Call function CONVERT_OTFSPOOLJOB_2_PDF using the spool ID from step 6, and put the result from table PDF into an internal table you can use later. ALso store the export variable pdf_bytecount, you will need it later.
    Step 8 - Call function SX_TABLE_LINE_WIDTH_CHANGE using the table from step 7 as content_in and put the results from content_out into a new internal table.
    Step 9 - Add some text into a internal table of type solisti1, this will be the body text of the e-mail.
    Step 10 - Add whatever receivers you want into an internal table of type somlreci1. If you just want it to go to the address that the PO would have gone to anyway, select the e-mail address from ADR6 where the address number = l_doc-xekko-adrnr, that is the data from the PO.
    Step 11 - Populate an internal table of type sopcklsti1 with data relevant to your PDF table from step 8 and the text table from step 9. You will have to put the size of the PDF from step 7 (pdf_bytecount) on the PDF line and the size of the text will be the number of lines of text * 255.
    Step 12 - Add info to a structure of type sodocchgi1. You can add the e-mail title in here, field obj_descr. Also add the size of the PDF and the size of the text from step 12 into doc_size, and give the doc a name in field obj_name. This can be anything, ZPDFPO for example.
    Step 13 - Call SO_DOCUMENT_SEND_API1 using the tables from steps 8, 9, 10 and 11 and the structure from step 12. You can amend the sending e-mail also. Set commit_work to space.
    Step 14 - That is all you need, but I actually call function RSPO_R_RDELETE_SPOOLREQ to delete the spool request created in step 4, then call NAST_PROTOCOL_UPDATE to add some more messages to the processing log of the PO.
    That is all.

  • How to sending simple text in the mail body

    Hi friends,
                 How to send simple text in the mail body through ABAP code
       plz send me the related code and setting for that mail.
      Thanks&Regards,
      Srinivas

    try this...
    FORM send_file_as_email_attachment .
      DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
      DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
      DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
      DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
      DATA : i_body TYPE soli_tab WITH HEADER LINE.
    DATA: it_attach LIKE it_display1 OCCURS 0 WITH HEADER LINE.
      DATA: doc_chng LIKE sodocchgi1.
      DATA: tab_lines LIKE sy-tabix.
      DATA: att_lines TYPE i.
    DATA: lv_lines TYPE i.
      DATA: file TYPE string.
      data: g_datum like sy-datum.
      data: g_datum1(10) type c.
      DATA: len TYPE n.
      LOOP AT it_email.
        CLEAR : objpack,
                objhead,
                objbin,
                objtxt,
                reclist.
        REFRESH: objpack,
                 objhead,
                 objbin,
                 objtxt,
                 reclist.
        g_datum =     sy-datum - 1.
        concatenate g_datum6(2) '.' g_datum4(2) '.' g_datum+0(4) into
        g_datum1.
    doc_chng-obj_descr = 'Aged Stock more than 45 Days'.
        CONCATENATE 'Aged Stock more than 45 Days' '-' it_email-vkbur INTO
        doc_chng-obj_descr.
        CONCATENATE 'Please find enclosed Aged Stock Details ( >45days ) report as on'
        g_datum1
        INTO objtxt-line SEPARATED BY space.
        APPEND objtxt.
        objtxt-line = ' '.
        APPEND objtxt.
        objtxt-line = 'Regards'.
        APPEND objtxt.
        objtxt-line = 'LIS SAP Projects'.
        APPEND objtxt.
        objtxt-line =
        'PS: Pls send feedback for futher improvements to SAP office.'.
        APPEND objtxt.
        DESCRIBE TABLE objtxt LINES tab_lines.
        READ TABLE objtxt INDEX tab_lines.
        doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
       CLEAR objpack-transf_bin.
        objpack-head_start = 1.
        objpack-head_num = 1.
        objpack-body_start = 1.
        objpack-body_num = tab_lines.
        objpack-doc_type = 'TXT'.
       objpack-obj_name = 'Run_prog'.
       objpack-obj_descr = 'Agestock.txt'.
       lv_lines = tab_lines.
        APPEND objpack.
    *CONCATENATE 'Plant'   'Material Number' 'Qty(More than 45days)'
    *'Amount' INTO
           it_display SEPARATED BY space.
           append objbin.
           clear: objbin.
        CLEAR:it_display2.
        REFRESH it_display2.
        it_display2-werks = 'Plant|'.
        it_display2-matnr = 'Material Number'.
        it_display2-qty = '|Qty > 45 days'.
        it_display2-amount = '      |Amount'.
        APPEND it_display2.
        it_display2-werks = ''.
        it_display2-matnr = ''.
        it_display2-qty = ''.
        it_display2-amount = ''.
        APPEND it_display2.
        CLEAR : it_display2.
        sort it_display1 by amount descending.
        LOOP AT it_display1 WHERE werks = it_email-vkbur.
         AT FIRST.
    *CONCATENATE 'Plant    '   'Material Number' 'Qty(More than 45days)'
    *'Amount' INTO
           objbin-line SEPARATED BY space.
           append objbin.
           clear: objbin.
         ENDAT.
          CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
            EXPORTING
              input  = it_display1-matnr
            IMPORTING
              output = it_display1-matnr.
          it_display1-qty = TRUNC( it_display1-qty ).
          MOVE-CORRESPONDING it_display1 TO it_display2.
          APPEND it_display2.
          CLEAR:it_display1,it_display2,objbin.
          CLEAR:it_display1.
        ENDLOOP.
        objbin[] = it_display2[].
        DESCRIBE TABLE objbin LINES tab_lines.
        objhead = 'Suug'.
        APPEND objhead.
        objpack-transf_bin = 'X'.
        objpack-head_start = 3.
        objpack-head_num = 1.
        objpack-body_start = 1.
        objpack-body_num = tab_lines.
        objpack-doc_type = 'RAW'.
        objpack-obj_name = 'Run_prog'.
        objpack-obj_descr = 'Agestock.txt'.
        APPEND objpack.
        reclist-receiver = '[email protected]'.
        reclist-rec_type = 'U'.
        APPEND reclist.
    =====================================================================
        CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
          EXPORTING
            document_data              = doc_chng
            commit_work                = 'X'
          TABLES
            packing_list               = objpack
            object_header              = objhead
            contents_bin               = objbin
            contents_txt               = objtxt
            receivers                  = reclist
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            operation_no_authorization = 4
            OTHERS                     = 99.
        CLEAR : it_email.
      ENDLOOP.
    ENDFORM.                    "send_mail
    Message was edited by:
            Sugumar Ganesan

  • How can send a script as a mail.

    Hi
    this is fazil.
    Please tell me any body How can send a script as a mail.
    Thanks & Regards
    Fazil
    [email protected]

    Hi Fazil,
    First convert your script to Smartform and then use this type of coding to mail it.
    Check this code.
    REPORT zptpfrm202p_pogr_pr_instr MESSAGE-ID zmm.
    TABLES *
    Database table made for getting information about PRINTPREVIEW and
    PRINT command more than one times
    TABLES: zgr_table.
    TYPE-POOLS:syscr.
    GLOBAL TYPE DECLARATION *
    DATA: zdoc_output_info TYPE ssfcrespd, "SF:Return Document Inf.
    zjob_output_info TYPE ssfcrescl, "SF:Return value at end of
    form printing
    i_control TYPE ssfctrlop ,
    i_output_options TYPE ssfcompop,
    zjob_output_opts TYPE ssfcresop. "SF:Return value at start
    of form printing
    *This internal table is used for storing Document Segment: Material
    DATA: BEGIN OF i_mseg.
    INCLUDE STRUCTURE mseg.
    DATA: END OF i_mseg.
    This internal table is used for storing Header: Material Document
    DATA: BEGIN OF i_mkpf.
    INCLUDE STRUCTURE mkpf.
    DATA: END OF i_mkpf.
    *Variables
    DATA flag(1) TYPE c.
    DATA: vfile TYPE string.
    SELECTION-SCREEN *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
    PARAMETERS:p_mblnr TYPE mkpf-mblnr OBLIGATORY MATCHCODE OBJECT zganesh,
    p_mjahr TYPE mkpf-mjahr OBLIGATORY MATCHCODE OBJECT zganesh1,
    p_zeile TYPE mseg-zeile OBLIGATORY MATCHCODE OBJECT zganesh2.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 10.
    PARAMETER:r_disp RADIOBUTTON GROUP g1 USER-COMMAND u1 DEFAULT 'X'.
    SELECTION-SCREEN:COMMENT 15(10) text-002 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 10.
    PARAMETERS: r_down RADIOBUTTON GROUP g1.
    SELECTION-SCREEN:COMMENT 15(10) text-003.
    *PARAMETERS: v_file LIKE rlgrap-filename .
    *SELECTION-SCREEN:COMMENT 70(50) text-005.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 10.
    PARAMETERS: r_print RADIOBUTTON GROUP g1 .
    SELECTION-SCREEN:COMMENT 15(10) text-004.
    SELECTION-SCREEN END OF LINE.
    PARAMETERS: v_file LIKE rlgrap-filename MODIF ID g12.
    SELECTION-SCREEN END OF BLOCK b2.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR v_file.
    DATA : wlv_field_name LIKE dynpread-fieldname,
    wlv_file_name LIKE ibipparms-path.
    wlv_field_name = v_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    field_name = wlv_field_name
    IMPORTING
    file_name = wlv_file_name.
    IF sy-subrc EQ 0.
    vfile = wlv_file_name.
    v_file = wlv_file_name.
    ENDIF.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF screen-name = 'V_FILE'.
    IF r_disp EQ 'X' OR r_print EQ 'X'.
    screen-input = 0.
    ELSE.
    screen-input = '1'.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    START-OF-SELECTION EVENT *
    START-OF-SELECTION.
    CALLING CONVERSION FUNCTION MODULE 'CONVERSION_EXIT_ALPHA_INPUT' *
    *Conversion function module for appending 00 befor MBLNR FIELD
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
    input = p_mblnr
    IMPORTING
    output = p_mblnr.
    Call subroutine for fetching data from database
    PERFORM get_data.
    END-OF-SELECTION EVENT *
    END-OF-SELECTION.
    Call subroutine for calling and processing smartform
    PERFORM call_smartform.
    *& Form get_data
    Subroutine for fetching data from database
    FORM get_data .
    Fetching data from MKPF table with using parameters MBLNR and MJAHR
    SELECT SINGLE * FROM mkpf
    INTO i_mkpf
    WHERE mblnr = p_mblnr
    AND mjahr = p_mjahr.
    IF sy-subrc EQ 0.
    Fetching data from MSEG with using parameters MBLNR,ZEILE and MJAHR
    SELECT SINGLE * FROM mseg
    INTO i_mseg
    WHERE mblnr = i_mkpf-mblnr
    AND mjahr = i_mkpf-mjahr
    AND zeile = p_zeile.
    IF sy-subrc NE 0.
    CLEAR i_mseg.
    ENDIF.
    ELSE.
    MESSAGE i000.
    EXIT.
    ENDIF.
    ENDFORM. " get_data
    *& Form call_smartform
    Subroutine for calling smartform
    FORM call_smartform .
    Local template used in the processing output of smartform
    TYPES: BEGIN OF lt_ztable,
    mandt TYPE sy-mandt,
    mblnr TYPE mseg-mblnr,
    flag(1) TYPE c,
    END OF lt_ztable.
    CONSTANTS: c_x(1) TYPE c VALUE 'X'.
    Workarea
    DATA: lw_ztable TYPE lt_ztable.
    *Variable used in the smartform
    DATA: lv_form(30) TYPE c,
    lv_fm_name(30) TYPE c.
    lv_form = 'ZPTPFRM202L_POGR'.
    *Calling function module SSF_FUNCTION_MODULE_NAME which gives new name
    *to the function module that will generated by smartform.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = lv_form
    IMPORTING
    fm_name = lv_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.
    *Calling function module that will be generated by smartform
    IF r_disp = c_x.
    i_output_options-tdimmed = space.
    i_output_options-tdnewid = c_x.
    i_output_options-tddest = 'LOCL'.
    i_control-no_dialog = 'X'.
    i_control-preview = 'X'.
    ELSEIF r_print = c_x.
    i_output_options-tdimmed = c_x.
    i_output_options-tddest = 'LOCL'.
    i_control-no_dialog = c_x.
    ELSE.
    i_output_options-tdimmed = space.
    i_output_options-tdnewid = c_x.
    i_output_options-tddest = 'LOCL'.
    i_control-getotf = 'X'.
    i_control-preview = space.
    i_control-no_dialog = c_x.
    flag = c_x.
    ENDIF.
    CALL FUNCTION lv_fm_name
    EXPORTING
    control_parameters = i_control
    output_options = i_output_options
    user_settings = space
    zmkpf = i_mkpf
    zmseg = i_mseg
    IMPORTING
    document_output_info = zdoc_output_info
    job_output_info = zjob_output_info
    job_output_options = zjob_output_opts
    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.
    Modify the database table if it found the print command
    IF zjob_output_opts-tdpreview NE c_x.
    lw_ztable-mandt = sy-mandt.
    lw_ztable-mblnr = p_mblnr.
    lw_ztable-flag = c_x.
    MODIFY zgr_table FROM lw_ztable.
    CLEAR lw_ztable.
    ENDIF.
    IF flag EQ c_x.
    DATA: li_lines LIKE tline OCCURS 100 WITH HEADER LINE.
    DATA: lv_file TYPE string,
    lbin_fsiz TYPE i.
    lv_file = v_file.
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    IMPORTING
    bin_filesize = lbin_fsiz
    TABLES
    otf = zjob_output_info-otfdata
    lines = li_lines
    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.
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    bin_filesize = lbin_fsiz
    filename = lv_file
    filetype = 'BIN'
    TABLES
    data_tab = li_lines
    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.
    ENDIF.
    ENDFORM. " call_smartform
    Hope this resolves your query.
    Reward all the helpful answers.
    Regards

  • How to send multiple attachements in single mail

    Hi All,
    Currently i am using this function module SO_NEW_DOCUMENT_ATT_SEND_API1 to send mail with only one attachment.
    But now i need to send multiple attachments to a single mail.
    Can any one please tell me as how to send multiple attachments in single mail.
    Thanks in advance.

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

  • Can any one tell me how to send one PO to mutilple mail ids in vendor maste

    Hi Experts,
    Can any one tell me how to send one PO as a mail to multiple vendors who are all maintained in my vendor master record
    Suppose I have 3 mail ids in my Vendor master record and I created a PO with that vendor, will that PO goes to all the three mail ids maintained in the vendor master record  or only to one ?
    Inorder to send to multiple mail ids, Do we need to do any configure any thing in SPRO settings functionally, if so where we have to maintain?
    Or shall an Abaper needs to maintain a code for that.?
    Please suggest me, I would appreciate your feed back.
    Best Regards,
    Sairam

    Go to XK02 enter the vendor code
    go to the communication tab
    Email will be there press the ---> button
    you can add many Emails in the list.
    Please ensure that the  message output is configured by
    the  SAP BASIS team
    No need of any configuration
    G.Ganesh Kumar

  • HOW TO SEND THE REPORTS AND  THROUGH XI TO NON -SAP SYSTEM

    Hi Experts,
                 I want to know how to send the reports and  smartform through xi to another system. All the post blogs are   just explaning only about the FILE-TO-FILE, FILE-TO-IDOCS scenarios only.

    Hi,
    XI is the middleware that to be used to transfer the data between various systems and even you could design the Business Processes with it.
    In R/3 the smartforms, are generally converted to PDF and then  have to send it across to Non SAP systems. Similarly you can convert the smartforms to pdf format and keep it on application server. XI will pick up that pdf and will send it to Non SAP system either as mail or as an attachments.
    ABAP reports are normally used to re-present the data. If you need to transfer this data across the Non SAP systems then you have the IDOCs to be generated, RFC or ABAP Proxy to integrate this data with Non SAP system.
    XI is not restricted only upto file to file or file to IDOC scenarios. It have enormous capabilities to involve various Business Processes as well integrate various SAP or Non SAP systems.
    If need anymore  specific details, please let us know.
    Thanks
    Swarup

Maybe you are looking for

  • .gif files, in iPhoto?

    Do .gif files work in iPhoto?

  • Stereo Bluetooth - no support for controls and other issues

    I have tried 2 stereo headsets now and both have the same issue. No controls other than Vol +/- are supported. Pause/Play doesn't work and >| and |< don't work. It's pretty clear that the 3.0 software doesn't support these functions. One Headset is t

  • Fx5900xt not working

    I had this problem from the start, just haven't gotten around to fix it yet... Could someone help me? In windows i can do whatever i want, and it doesn't hang. As soon as i start any type of game it crashes, either to the desktop or completely. It ca

  • Navigator tool bar in jsp.

    i am very new to java. just started, can anyone help me in creating navigator tool bar in jsp. i have created table but i dnt know how to create row in same row.if i close that </tr> i will be in different row and i want to be in same row.if i creat

  • Oracle 9i scheduler

    Hi Brother, I am using 9i and just install statspack to collect db stats by hourly. I have modify the spauto.sql, and then run the script under perfstat. I see the schedule job is added to oracle scheduer but it is not run. see below. The oracle job