Smartform output to be send via Email

Hi Guys,
I have a custom report and output generated by Smartform, currently it is printing on printer.
My requirement is to sent this output to customer via Email.(email and perferred communication details are available from customer master)
We have a output management server which will receive this output and convert into PDF format and distribute this output to customer.
I would like to know what are the possible changes require on driver program.
Appriciate your help.
Regards
Pravin
Edited by: Pravin on Apr 16, 2008 9:23 PM
Edited by: Pravin on Apr 16, 2008 9:25 PM

Hi Pravin,
Check the following sample program. Smartform driver program. It helps you how to convert smartform output as PDF using function module CONVERT_OTF. Once it is converted mail can be sent through function module SO_NEW_DOCUMENT_ATT_SEND_API1.
Wherever u find MAI that should be mail.
REPORT  zvenkat_smartform_via_mai.
*&  Structures and Infotype Internal tables.
TABLES pernr.
INFOTYPES:
  0000,
  0001,
  0002,
  0006,
  0022,
  0023.
INCLUDE dbpnpmac.
*&  Declaration part
* Types
TYPES:
   BEGIN OF t_emp_info,
     pernr TYPE pa0001-pernr,
     ename TYPE pa0001-ename,
     bukrs TYPE pa0001-bukrs,
     persk TYPE pa0001-persk,
     stell TYPE pa0001-stell,
     gblnd TYPE pa0002-gblnd,
   END OF t_emp_info,
   BEGIN OF t_mard,
     matnr TYPE mard-matnr,
     werks TYPE mard-werks,
     labst TYPE mard-labst,
     meins TYPE mara-meins,
   END OF t_mard.
* Work areas
DATA:
  w_emp_info TYPE t_emp_info.
* Internal tables
DATA:
  i_emp_info TYPE STANDARD TABLE OF t_emp_info,
  i_mard     TYPE STANDARD TABLE OF t_mard.
"  Mai related declarations
"Variables
DATA :
     g_sent_to_all   TYPE sonv-flag,
     g_tab_lines     TYPE i.
"Types
TYPES:
     t_document_data  TYPE  sodocchgi1,
     t_packing_list   TYPE  sopcklsti1,
     t_attachment     TYPE  solisti1,
     t_body_msg       TYPE  solisti1,
     t_receivers      TYPE  somlreci1,
     t_pdf            TYPE  tline.
"Workareas
DATA :
     w_document_data  TYPE  t_document_data,
     w_packing_list   TYPE  t_packing_list,
     w_attachment     TYPE  t_attachment,
     w_body_msg       TYPE  t_body_msg,
     w_receivers      TYPE  t_receivers,
     w_pdf            TYPE  t_pdf.
"Internal Tables
DATA :
     i_document_data  TYPE STANDARD TABLE OF t_document_data,
     i_packing_list   TYPE STANDARD TABLE OF t_packing_list,
     i_attachment     TYPE STANDARD TABLE OF t_attachment,
     i_body_msg       TYPE STANDARD TABLE OF t_body_msg,
     i_receivers      TYPE STANDARD TABLE OF t_receivers,
     i_pdf            TYPE STANDARD TABLE OF t_pdf.
PARAMETERS:
           p_mai_id(99) TYPE c.
*& Start-of-selection.
START-OF-SELECTION.
GET pernr.
  PERFORM get_data.
  PERFORM show_smartform.
*& End-of-selection.
END-OF-SELECTION.
*&      Form  get_data
FORM get_data .
  rp-provide-from-last p0000 space pn-begda pn-endda.
  rp-provide-from-last p0001 space pn-begda pn-endda.
  rp-provide-from-last p0002 space pn-begda pn-endda.
  MOVE-CORRESPONDING: p0000 TO w_emp_info,
                      p0001 TO w_emp_info,
                      p0002 TO w_emp_info.
  SELECT matnr werks labst
  FROM mard
  INTO CORRESPONDING FIELDS OF TABLE i_mard.
ENDFORM.                    " get_data
*&      Form  show_smartform
FORM show_smartform .
  DATA :
    l_sform_name TYPE tdsfname,
    l_fm_name    TYPE rs38l_fnam.
  DATA :
        l_sf_control TYPE ssfctrlop,
        l_sf_options TYPE ssfcompop.
  DATA: i_otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
*        i_pdf LIKE tline OCCURS 100 WITH HEADER LINE.
  DATA: op_option TYPE ssfctrlop,
        job_output TYPE ssfcrescl.
*  op_option-getotf = 'X'.
  l_sform_name = 'ZVENKAT_SMARTFORM'.
  CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
      formname           = l_sform_name
    IMPORTING
      fm_name            = l_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.
  ELSE.
    CALL FUNCTION l_fm_name
      EXPORTING
        control_parameters = op_option
        output_options     = l_sf_options
        w_emp_info         = w_emp_info
IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
   job_output_info            = job_output
      TABLES
        p0006              = p0006
        p0022              = p0022
        p0023              = p0023
        i_mard             = i_mard.
    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 'CONVERT_OTF'
      EXPORTING
        format = 'PDF'
      TABLES
        otf    = job_output-otfdata
        lines  = i_pdf.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    PERFORM send_mai.
  ENDIF.
ENDFORM.                    " show_smartform
*&      Form  send_mai
FORM send_mail .
  "Subject of the mai.
  w_document_data-obj_name  = 'MAI_TO_HEAD'.
  w_document_data-obj_descr = 'Regarding Mai Program by SAP ABAP'.
  "Body of the mai
  PERFORM build_body_of_mai
    USING:space,
          'Hi,',
          'I am fine. How are you? How are you doing ? ',
          'This program has been created to send simple mai',
          'with Subject,Body with Address of the sender. ',
          'Regards,',
          'Venkat.O,',
          'SAP HR Technical Consultant.'.
  "Write Packing List for Body
  DESCRIBE TABLE i_body_msg LINES g_tab_lines.
  w_packing_list-head_start = 1.
  w_packing_list-head_num   = 0.
  w_packing_list-body_start = 1.
  w_packing_list-body_num   = g_tab_lines.
  w_packing_list-doc_type   = 'RAW'.
  APPEND w_packing_list TO i_packing_list.
  CLEAR  w_packing_list.
  "Write Packing List for Attachment
  w_packing_list-transf_bin = 'X'.
  w_packing_list-head_start = 1.
  w_packing_list-head_num   = 1.
  w_packing_list-body_start = 1.
  DESCRIBE TABLE i_attachment LINES w_packing_list-body_num.
  w_packing_list-doc_type   = 'PDF'.
  w_packing_list-obj_descr  = 'PDF Attachment'.
  w_packing_list-obj_name   = 'PDF_ATTACHMENT'.
  w_packing_list-doc_size   = w_packing_list-body_num * 255.
  APPEND w_packing_list TO i_packing_list.
  CLEAR  w_packing_list.
  "Fill the document data and get size of attachment
  w_document_data-obj_langu  = sy-langu.
  READ TABLE i_attachment INTO w_attachment INDEX g_tab_lines.
  w_document_data-doc_size = ( g_tab_lines - 1 ) * 255 + STRLEN( w_attachment ).
  "Receivers List.
  w_receivers-rec_type   = 'U'.      "Internet address
  w_receivers-receiver   = p_mai_id. "here mai Id should be given
  w_receivers-com_type   = 'INT'.
  w_receivers-notif_del  = 'X'.
  w_receivers-notif_ndel = 'X'.
  APPEND w_receivers TO i_receivers .
  CLEAR:w_receivers.
  "Function module to send mai to Recipients
  CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
      document_data              = w_document_data
      put_in_outbox              = 'X'
      commit_work                = 'X'
    IMPORTING
      sent_to_all                = g_sent_to_all
    TABLES
      packing_list               = i_packing_list
      contents_bin               = i_attachment
      contents_txt               = i_body_msg
      receivers                  = i_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.
  IF sy-subrc = 0 .
    MESSAGE i303(me) WITH 'Mai has been Successfully Sent.'.
  ELSE.
    WAIT UP TO 2 SECONDS.
    "This program starts the SAPconnect send process.
    SUBMIT rsconn01 WITH mode = 'INT'
                    WITH output = 'X'
                    AND RETURN.
  ENDIF.
ENDFORM.                    " send_mai
*&      Form  build_body_of_mai
*       text
*      -->L_MESSAGE  text
FORM build_body_of_mai  USING l_message.
  w_body_msg = l_message.
  APPEND w_body_msg TO i_body_msg.
  CLEAR  w_body_msg.
ENDFORM.                    " build_body_of_mai
I hope that it helps u .
Regards,
Venkat.O

Similar Messages

  • How to automate sql server querry and output to send via email alerts

    Hi,
    I have MS SQL 2005 server. Daily i m running sql querry at 10:30 pm. i want to automate this process & output need to send via email. Please suggest what are the options availble.
    Thanks in advance
    ...Umesh

    Create a job and put the query in , then schedule it... You can email an output by using data base email feature
    EXEC msdb.dbo.sp_send_dbmail 
         @profile_name = 'Admin', 
         @recipients = '[email protected]', 
         @query = 'SELECT COUNT(*) FROM AdventureWorks.Person.Address', 
         @subject = 'Error Log Count', 
         @attach_query_result_as_file = 1 ;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • LMS3.2 Syslog reports very slow when send via email

    Hello,
    we have ~5000 devices in LMS3.2 and we have a problem with syslog reports.
    When I create a "severity level summary report" for 5000 devices for the last 24hours and select as run type "immediate" it needs ~2-3 minutes. That's ok.
    But when I create exactly the same report and select the run type "once" , it needs ~3 hours. ("Once" means that the report is send via email after it's finished).  It happens with report type "pdf" and "csv".
    What can be the problem ?  Or is it usual ???
    Regards
    Hendrik

    The scheduled reports can output a full list of messages where as the immediate reports output a limit of 10,000 records.  If you have a lot of syslog messages, it can take a considerable amount of additional time to generate a full report.

  • The problem is with the new operating system  and sending photo via email when used in my iPad.   From photo I selected 3 photos to send via email. I choose the upload key and choose to send by email. Typing text on the email is very slow.

    The problem is with the new operating system  and sending photo via email when used in my iPad.
    From photo I selected 3 photos to send via email. I choose the upload key and choose to send by email. Typing text on the email is very slow. This is solved by saving the email as a draft and opening the email again from mail.
    Can you amend he system to allow emails to be sent from photo as previously.

    Have you tried restarting or resetting your iPad?
    Restart: Press On/Off button until the Slide to Power Off slider appears, select Slide to Power Off and, after the iPad shuts down, then press the On/Off button until the Apple logo appears.
    Reset: Press the Home and On/Off buttons at the same time and hold them until the Apple logo appears (about 10 seconds). Ignore the "Slide to power off"

  • How do I get my photos off 1st generation itouch? I have macbook pro, ipad, iphone. Itouch syncs but does not have option to share in any capacity ie send via email, etc. Also, the computer from which photos were originally taken from has crashed.

    How do I get my photos off 1st generation itouch? I have macbook pro, ipad, iphone. Itouch syncs but does not have option to share in any capacity ie send via email, etc. Also, the computer from which photos were originally taken from has crashed.

    It has always been very basic to always maintain a backup copy of your computer.
    Did you fail to back up your pics?
    The photo sync is one way - comptuer to ipod.
    You can e-mail them to yourself (instructions in the manual), but they will not be of the original quality.

  • Changing the file name of a PDF you send via email

    Hello Support,
    I am trying to find out how to change the file name of the attachment I send via email when I click submit via email. I would like the file to be sent with the file name, not some other file name.
    How can I fix it? This is very urgent! I need HELP!
    Cheers
    Joel
    Message was edited by: J Braden

    Hi,
    you can't.
    Except you save the file under a different name before you send it.

  • "send via email" STILL not working

    Hi community - I have seen this question asked several times but none of the answers given seem to apply to me.
    I am working in a Pages document. I want to send this document as a Word file to someone else. I go to the Share menu, click Word under the "send via email" header, and then...nothing happens. No email app opens, no error message appears, nothing.
    There are no slashes or unfamiliar characters in the file name. Both Gmail and the OS mail app are set up on my computer. What am I missing? I'm working on a brand new 13-inch MacBook Pro with a version of Pages just purchased from the app store.
    And please don't recommend just exporting it as a Word doc and then emailing the file - I know I can do that already, but the point is this very important feature isn't working.
    Thanks for the help - much appreciated!

    You would get the beep sound if you click on the greyed down "Send via Email". You have to choose which kind of document you want to send. But then again if it worked for you in the new account it can't be that giving you a problem.
    I once had a problem using  Pages. It worked fine in another user account but not in my original. Deleting the plist file didn't help, maintenace didn't help. Finally I uninstalled Pages/iWork 09 using Yvan's script from here. Then I installed my MacOS system (Snow Leopard) on top of what I had. Since the Snow Leopard system you can install a system again without erazing the hard disk. You might though check that anything important to you is saved on another disk or stick. Remeber to do the updates for the system
    I did the system updates and restarted the computer. Installed iWork. I have the iWork DVD. And I did the software updates too. Then Pages worked again!

  • Create a form without the option to submit or send via email

    Just oant to know is it posible to create a form without the option to submit or send via email. I want my students to fill in the form and save it to a personal folder. The submit form button creates confusion.

    Many thanks Randy, I'll give it a go. But it means setting up the how to pay question at the top of the form. Currently we have it setup at the bottom.
    Think I can do a "Will you be paying by credit card?" check box at the top - Tick equal show Fields A (which I have already mapped to the payment option) and Unchecked Show Fields B.
    Sound logical..will be cumbersome though as there are 12 mult show/hide fileds in there already  here's the link just for the original form for future reference for anyone in the forum wanting to see what the form looks like and is facing the same problem.
    Will make the changes in a quiet perios and anyone interested can take a look next week and see how I got on.
    Appreciate your response Randy
    Roger

  • How to send business card (VCF file) through sms? it can only be send via email?

    how to send business card (VCF file) through sms? it can only be send via email?

    Go into your contacts click on the person you want to send, when the info opens scroll down to the bottom and click share contact it will as it you want to email or mms. 

  • I have a large PDF that I cannot send via email because of its size, 76 MB. How do I shrink this file or convert it to another format so I can email this, less than 20MB? Thanks for your help

    I have a large PDF that I cannot send via email because of its size, 76 MB. How do I shrink this file or convert it to another format so I can email this, less than 20MB? Thanks for your help

    Open the file in Preview and select "Save as..." from the File menu. Select "Reduce File Size" from the Quartz Filter menu and save. The size probably won't be reduced enough, though. You may have to split the file into several parts and mail them separately. Or upload it to a web server and send the link.

  • How can i reduce the pdf file size? I need to send via email, at the moment its at 10mb

    How can i reduce the pdf file size? I need to send via email, at the moment its at 10mb

    Reducing PDF file size or Optimizing PDF is the feature that is supported only by Acrobat Pro (desktop app that is not free).
    Optimizing PDFs (Acrobat Pro)
    Free Adobe Reader products (Reader XI desktop, Reader for iOS, Reader for Android, Reader Touch for Windows 8, etc) do not offer the capability.

  • No iWork programs will "send via email"

    I can not share any of my saved documents via email in pages or numbers.  When I go to the share tab along the top, "send via email" is gray and not able to be clicked.  I have seen other threads saying that the character "/" cannot be in the title and none of my documents have this issue.  Any thoughts?

    It may not be a slash, that is just the most common "illegal" character. Make sure your file name doesn't have anything other than letters, numbers, hyphens or underscores.
    But, if you're talking about the share button in the toolbar, that was to share via iWork.com (beta). That service was discontinued last year & it took Apple until the 9.3 update to remove it from the default set of icons.
    When all else fails, save the file or export it in the format you want to send & then attach it to a new e-mail message.

  • HT5260 How do you export RAW files from iphoto to burn folder or to send via email?

    How do you export RAW files from iphoto to burn folder or to send via email?

    In iPhoto export to a folder on the Desktop via the File ➙ Export ➙ File Export menu option with Kind=Original.
    OT

  • When i go onto iPhoto and choose a photo to send via email, i click send and the photo is sent and received but doesn't appear in my email sent items ?

    when i go onto iPhoto and choose a photo to send via email, i click send and the photo is sent and received but doesn't appear in my email sent items ?

    This is not the iPhoto forum. In any case in iPhoto>Preferences select Mail or whatever email program you are using to email as the desired choice. You are probably sending directly through iPhoto.

  • Will not share send via email

    All I get is a error tone when clicking share>send via email.
    This worked before I upgraded to Lion.

    JT,
    See if resetting your Mail Preferences default mail client setting helps.
    Jerry

Maybe you are looking for

  • The problems with Logic (as I see them)

    Hello Everyone, Please keep in mind that I am writing this with the intention of expressing my frustrations, and what I feel would make Logic a better program. I realize not everyone will agree with the importance of what I say, but I am a firm belie

  • Returnable transport packaging for Subcontracting material

    Dear All, I have a doubt regarding a new process to be followed in our company. We need to issue raw material to our subcontractor for processing. We also intend to send packaging material to the subcontractor along with the raw material. Ie We are s

  • PSU for Oracle Restart 11.2.0.1 AIX 6.1

    Hi Gurus, I have applied the patch 9655006 to GI for standalone i,e Oracle Restart.The patch went through fine but changed the owner on the grid directory and permissions.The grid directory under /u01/app/11.2.0/grid should be owned by root, instead

  • How to figure out ORA_12203:TNS unable to connect to destination?

    OS: WSK I have installed oracle817 and form6i in different directory in a machine and defined two oracle home for them. I can access sqlplus through OEM of oracle817, but I can not do the same thing through form6i, the error showed me: ORA_12203:TNS

  • Can anyone help with a refund

    On October 3, 2014 I went online and purchased 3 phones and prepaid plans for verizon.  Two were Galaxy S4 and one was an Iphone 5.  When I received the confirmation only two phones were listed, the iphone and a black Samsung.  I call verizon who adi