Skip to Content

Okay, so you have created your smart form and you can successfully print it and also take a sneak in the print preview. Well done! Great job accomplished! But now client comes back asking you to send this smart form output to email as PDF attachment.

This blog will help you to achieve such requirements, right from correctly configuring the output type to conversion of OTF output into PDF in a format as required to send mail. For example purpose, the issue delivery output to smart form is taken as an example in this blog.

Prerequisite: This blog presumes that you have adequate knowledge of how to create customized smart form and output type for printing the output.

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

      1. Former Member
        Hi Gaurav,

        That was very very good one i got all the problems sorted out with your blog…now the client came back with an extra req the size of the attachement created is around 2 MB i there a way to reduce the size..?

          1. Former Member
            that was an excellent link which you provided .it might be of great help in solving our problems…i will update you as soon as we find the solution…

            your help is very much appereciated.

    1. Former Member Post author
      Hi Vibha,

      Thanks for your valuable comment. I struggled to find solution while resolving and thought that we might help others for a quick solution of such simple problems.

  1. Steffen Froehlich
    Hi Gaurav,

    nice blog! I just want to add that older OTF documents can be convert with FM CONVERT_OTF_2_PDF into PDF data:

    DATA: lt_lines       TYPE TABLE OF tline,
          lt_doctab      TYPE TABLE OF docs,
          l_pdf_len      TYPE i,
          l_otf_data     TYPE ssfcrescl.

    *    USE_OTF_MC_CMD               = ‘X’
    *    ARCHIVE_INDEX                =
        BIN_FILESIZE                 = l_pdf_len
        otf                          = l_otf_data-otfdata
        doctab_archive               = lt_doctab
        lines                        = lt_lines
        ERR_CONV_NOT_POSSIBLE        = 1
        ERR_OTF_MC_NOENDMARKER       = 2
        OTHERS                       = 3

    The LT_LINES table can be input to your SX_TABLE_LINE_WIDTH_CHANGE changing parameter or use it for direct download:

    CALL METHOD cl_gui_frontend_services=>gui_download
        BIN_FILESIZE              = l_pdf_len
        filename                  = l_fullpath
        FILETYPE                  = ‘BIN’
      CHANGING   data_tab         = lt_lines

    regards, Steffen

    1. Former Member Post author
      Hi Steffan,

      Danke! Thank you for your valuable comment and providing insight to another way of achieving same functionality. These kind of inputs would definitely improve knowledge of fellow SDNers.

    1. Former Member Post author
      Hi Clint,

      Thanks for your reply.

      If I am not mistaking, VV31 is used to maintain  condition records to application V3. The email address are maintained in XD02 transaction which links to customer number.

      It is possible to add email to CC with function module ‘SO_NEW_DOCUMENT_SEND_ATT_API1’.

      Gaurav Parmar

  2. Great blog very helpful as I’m in the process of doing this now.  However, I notice a few things that I’m confused about.

    1.  bin_filsize isn’t declared and what is it used for when coverting OTF to PDF?
    2.  doc_chng isn’t declared and filled what is it used for when mailing.
    3.  objeah, objtxt, reclist aren’t declared or filled for the mailing function module. What do these tables need to be filled with?


  3. Former Member

    The above bolg is excellent, but the thing is , mail should be sent to vendor when PO is saved.
    Could you please tell me. I have my custom smartform.

    1. Former Member Post author

      Can you please elaborate your requirement and if possible, join SDN so that you can have an identity?


      1. Former Member
        Hi Gaurav,

        thanks for ur response.
        I have developed a custom smartform.
        my requirement is: when PO is saved , mail should be sent to vendor.
        So, I have copied SAPFM06p into Zprogram and called my smartform in include zFM06PE02 (copied from FM06PE02).
        I am able to see print preview of my smartform, but mail has to sent to vendor, when PO is saved.
        what should I do?
        i did all the configurations in MN04 and in me22n, assigned output in communication method and further data.

        but sapfm06p is calling script medruck, i have commented that open_form function module.

        can you please suggest me.



Leave a Reply