How to send adobe form output in mail as a attachment

i am get the adobe form output
how to attach in a mail ....
Regards
Anbu B

my program is like this.............
  CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
    EXPORTING
      i_name                     = 'YHRIN_WELCOME'
   IMPORTING
     e_funcname                 =  lv_funcname
  gs_output-nodialog = 'X'.
  gs_output-preview = 'X'.
gs_output-getpdl = 'X'.
   gs_output-getpdf = 'X'.
   gs_output-dest = 'LP01'.
  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      ie_outputparams       = gs_output
  EXCEPTIONS
    CANCEL                = 1
    USAGE_ERROR           = 2
    SYSTEM_ERROR          = 3
    INTERNAL_ERROR        = 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.
DATA : gs_outputpara TYPE sfpdocparams.
DATA : ls_return TYPE fpformoutput .
gs_outputpara-langu = 'E'.
gs_outputpara-country = 'IN'.
  CALL FUNCTION lv_funcname
  EXPORTING
    /1bcdwb/docparams = gs_outputpara
    wa_data = wa_mail
    IMPORTING
      /1bcdwb/formoutput = ls_return
    EXCEPTIONS
      OTHERS = 1.
DATA lv_output TYPE sdokcntbins WITH HEADER LINE.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = ls_return-pdf            "PDF file from function module
TABLES
binary_tab = lv_output  .
*DATA : result TYPE sfpjoboutput WITH HEADER LINE .
  CALL FUNCTION 'FP_JOB_CLOSE'
  IMPORTING
    e_result = result
  IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
DATA : iv_len_in LIKE sood-objlen,
       it_tline TYPE TABLE OF tline WITH HEADER LINE.
PERFORM pdf_file.
DATA:   lt_imessage TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
        lt_iattach TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
        lt_ipacking_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
        lt_ireceivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
        lt_iattachment LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA  : lt_record LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA : it_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.
DATA: lv_email   TYPE somlreci1-receiver
                      VALUE 'anbu.'.
PERFORM build_xls_data .
APPEND lt_iattach.
Populate message body text
  CLEAR lt_imessage.   REFRESH lt_imessage.
  lt_imessage = 'Please find attached PDF file'.
  APPEND lt_imessage.
Send file by email as .xls speadsheet
  PERFORM send_email_with_xls TABLES lt_imessage
                                      lt_iattach
                                USING lv_email
                                      'PDF Attachment of an Employee'
                                      'PDF'
                                      'TestFileName'
                                      'Employee Detail'.
     Form  BUILD_XLS_DATA
FORM build_xls_data .
DATA :lv_buffer TYPE string.
Convert PDF from 132 to 255.
  LOOP AT it_tline.
Replacing space by ~
    TRANSLATE it_tline USING ' ~'.
    CONCATENATE lv_buffer it_tline INTO lv_buffer.
  ENDLOOP.
   replacing ~ by space
  TRANSLATE lv_buffer USING '~'.
  DO.
    lt_record = lv_buffer.
Appending 255 characters as a record
    APPEND lt_record.
    SHIFT lv_buffer LEFT BY 255 PLACES.
    IF lv_buffer IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.
  lt_iattach[] = lt_record[].
ENDFORM.
     Form  SEND_EMAIL_WITH_XLS
FORM send_email_with_xls TABLES pit_message
                                          pit_attach
                                    USING p_email
                                          p_mtitle
                                          p_format
                                          p_filename
                                          p_attdescription.
  DATA: es_xdocdata LIKE sodocchgi1,
        lv_xcnt TYPE i.
Fill the document data.
  es_xdocdata-doc_size = 1.
Populate the subject/generic message attributes
  es_xdocdata-obj_langu = sy-langu .
  es_xdocdata-obj_name  = 'SAPRPT' .
  es_xdocdata-obj_descr = p_mtitle .
Fill the document data and get size of attachment
  CLEAR es_xdocdata.
  READ TABLE lt_iattach INDEX lv_xcnt.
  es_xdocdata-doc_size =
     ( lv_xcnt - 1 ) * 255 + STRLEN( lt_iattach ).
  es_xdocdata-obj_langu  = sy-langu.
  es_xdocdata-obj_name   = 'SAPRPT'.
  es_xdocdata-obj_descr  = p_mtitle.
  CLEAR lt_iattachment.  REFRESH lt_iattachment.
  lt_iattachment[] = pit_attach[].
Describe the body of the message
  CLEAR lt_ipacking_list.  REFRESH lt_ipacking_list.
  lt_ipacking_list-transf_bin = space.
  lt_ipacking_list-head_start = 1.
  lt_ipacking_list-head_num = 0.
  lt_ipacking_list-body_start = 1.
  DESCRIBE TABLE lt_imessage LINES lt_ipacking_list-body_num.
  lt_ipacking_list-doc_type = 'RAW'.
  APPEND lt_ipacking_list.
Create attachment notification
  lt_ipacking_list-transf_bin = 'X'.
  lt_ipacking_list-head_start = 1.
  lt_ipacking_list-head_num   = 1.
  lt_ipacking_list-body_start = 1.
  DESCRIBE TABLE lt_iattachment LINES lt_ipacking_list-body_num.
  lt_ipacking_list-doc_type   =  p_format.
  lt_ipacking_list-obj_descr  =  p_attdescription.
  lt_ipacking_list-obj_name   =  p_filename.
  lt_ipacking_list-doc_size   =  lt_ipacking_list-body_num * 255.
  APPEND lt_ipacking_list.
Add the recipients email address
  CLEAR lt_ireceivers.  REFRESH lt_ireceivers.
  lt_ireceivers-receiver = p_email.
  lt_ireceivers-rec_type = 'U'.
  lt_ireceivers-com_type = 'INT'.
  lt_ireceivers-notif_del = 'X'.
  lt_ireceivers-notif_ndel = 'X'.
   APPEND lt_ireceivers.
  CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
       EXPORTING
            document_data              = es_xdocdata
            put_in_outbox              = 'X'
            commit_work                = 'X'
       TABLES
            packing_list               = lt_ipacking_list
           contents_bin               = lt_iattachment
             CONTENTS_HEX              = lv_output
            contents_txt               = lt_imessage
            receivers                  = lt_ireceivers
       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.
      SUBMIT rsconn01 WITH mode = 'INT'
              WITH output = '' AND RETURN.
ENDFORM.

Similar Messages

  • How to Programatically send adobe form output to Application Server?

    Has anyone got a program which calls adobe form function module and then dumps the output to App Server?

    used function 'ADS_WRITE_TO_FILE'

  • 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

  • Sending Adobe form in perzonalized mail forms

    Hi
    I created a personalized mail form and I want to send the Adobe PDF form of the contract to the customer along with the personalized mail forms.
    I know how to send  a personalized mail form, but not sure how do we attach the generate the PDF and attach it to mail form through actions.
    Regards,
    Deepthi.

    Hi Bhargavi,
    In your action method first get the  FM name for your Adobe form using
    fp_function_module_name.
    Then you need to call Adobe form FM.Importing lv_formoutput.
    Then you need to call bcs interface. sample logic
    lcl_send_request - cl_bcs=>create_persistent( ).
    lv_pdfsize = zstrlen(  lv_formoutput-pdf ).
    lt_pdfcontent = cl_document_bcs=>xstring_to_solix( ip_xstring = lv_formoutput-pdf ).
    append the mail body to lt_text.
    append  mail subject to ls_subject.
    then
    lcl_document = cl_document_bcs=>create_document( i_type = 'RAW'
                                                                                            i_text = lt_text
                                                                                             i_length = '25'
                                                                                             i_subject = ls_subject ).
    atach pdf to mail using
    call method lcl_document->add_attachment
         exporting
         i_attachment_type = 'PDF'
         i_attachment_subject = ls_mail_sub
         i_attachment_size = lv_pdf_size
         i_att_content_hex = lt_pdf_content.
    lcl_send_request->set_documnt( lcl_document ).
    lcl_receipient = cl_cam_address_bcs=>create_internet_address( i_address_string = email id ).
    lcl_send_request->add_recipient( i_recipient = lcl_recipient ).
    lcl_sender = cl_cam_address_bcs=>create_internet_address( i_address_string = sender email id ).
    lcl_send_request->set_sender( i_sender = lcl_sender ).
    lv_sent_to_all = lcl_send_request->send( i_with_error_screen = 'x' ).
    commit work.
    Regards,
    Tejaswini P.

  • 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 BIP report link by mail not the attachment.

    Hi,
    I have a requiment to send the BI Publisher report link by mail.But not to send the report as an attachment.
    can any one have solution for this requirement.

    hi,
    Alternatively, u can do this Send a report with all the report names on one side and another side link to that particular report.If any one click on that link means it will open the report(pdf/html/excel) format by referring to the url.we will get this by using RTF Template.
    Thanks,
    Saichand

  • How to send inline HTML page in mail(not as attachment)

    Hi,
    I am using JavaMail to send details to users using text mail. Its working successfully. But now i have to send the details on mails that will contain HTML page (not as attachment but as inline HTML page containing text) and details in it. Plz help me. Its urgent.
    Thanks in advance,
    Devom

    Set the contentType to "text/html" and send away.
    (If you need both text and html you will need to make a multi-part message), this is covered in the FAQ.
    http://java.sun.com/products/javamail/FAQ.html
    travis (at) overwrittenstack.com

  • How can we send the smartform output to mail.

    Dear Friends,
    My query is how can we send the smart form output to mail.
    In my company,payslip are given to the employee in printed format.instead of that we need to send payslip in mail.how can i do..plz help me.
    [email protected]

    The code below demonstrates how to retrieve a spool request and email it as a PDF document. Please note to process a spool request the program can be executed in background or foreground. Because of the additional functionality to allow this to work in both background and foreground it has made it a little more confusing soyou might want to start by looking at the background only program. Also see transaction SCOT for SAPConnect administration.
    *& Report  ZSPOOLTOPDF2                                                *
    *& Converts spool request into PDF document and emails it to           *
    *& recipicant.                                                         *
    *& Execution                                                           *
    *& This program can be run in background or online and a spool request *
    *& will still be created                                               *
    REPORT  zspooltopdf2.
    PARAMETER: p_email1 LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_sender LIKE somlreci1-receiver
                                        DEFAULT '[email protected]',
               p_delspl  AS CHECKBOX,
               p_online no-display.
    *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,
           w_spool_nr like sy-spono.
          %_print LIKE pri_params.
    DATA: gd_subject   LIKE sodocchgi1-obj_descr,
          it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
          gd_sender_type     LIKE soextreci1-adr_typ,
          gd_attachment_desc TYPE so_obj_nam,
          gd_attachment_name TYPE so_obj_des.
    Spool to PDF conversions
    DATA: gd_spool_nr LIKE tsp01-rqident,
          gd_destination LIKE rlgrap-filename,
          gd_bytecount LIKE tst01-dsize,
          gd_buffer TYPE string.
    Binary store for PDF
    DATA: BEGIN OF it_pdf_output OCCURS 0.
            INCLUDE STRUCTURE tline.
    DATA: END OF it_pdf_output.
    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 p_online = 'X'.
      Processing performed when program calls itself when run online
        gd_spool_nr = sy-spono.
        EXPORT gd_spool_nr TO MEMORY ID 'SPOOLTOPDF'.
        EXIT.
      endif.
      IF sy-batch EQ 'X'.
        PERFORM get_job_details.
        PERFORM obtain_spool_id.
      ELSE.
        gd_spool_nr = sy-spono.
    If executed online, it submits a program to perform the write statements
    instructing it to create a spool request, this could be another program
    which just performs the write statements and then exports sy-spono
    to memory. But in this example it calls itself passing X to parameter
    p_online, which takes it down an alternative procesing path.
        submit ZSPOOLTOPDF2
               with p_online = 'X'
               to sap-spool
               spool parameters   %_print
              archive parameters %_print
               without spool dynpro
               and return.
      ENDIF.
    Get spool id from program called above
      IMPORT gd_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.
          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,
    Shakti Barath

  • How to avoid printing a balnk page at the end in the Adobe form output

    Hello Experts,
        Can anyone please let me know as how to avoid/delete the blank page at the end of adobe form output.
    I have a master page with header n footer and a body page seperate.
    For ex.. I have 3 line items and i want each line item to be displayed in the new page. I am able to get this functionality . I have set the settings in the paginationb tab of the subform as
    "after " Go to Next content Area" " but an extra page is getting printed at the end. 3 + 1 extra pages total. I want to avoid this blank page. I have checked the Allow page break with in content box but it is still not working.
    Can someone guide me as how to solve this problem.
    Any help is appreciated. Thanks in advance.
    Regards,
    Mahesh

    hey mahesh,
    this normally happens because of triggering a new page manually, what u would have done is that you would be checking for the new line item and when this condition is satisfied , you are triggering a new page , the reason for the last blank page is that the condition gets satisfied ( beacuse the line item number changes from the last line item no to  initial or space).
    This can be handled by doing the following
    By knowing the number of line items by the following stmt.
    describe table itab lines v_lines.
    Now you have the value in v_lines.
    use a counter in ur form and keep it increasing it by 1  ( say v_sno ) ie v_sno = v_sno + 1 in the loop of ur internal table.
    ONLY WHEN V_LINES IS LESS THAN OR EQUAL TO V_SNO , TRIGGER THE NEW PAGE
    this should be along with the condition which u have already put, ie when ever line item no changes
    when both these conditions are satisfied , then only the new page will be triggered.
    Hope it helps,
    Reward if useful,
    Regards,
    KP.

  • Adobe Form output cropped when sent directly from SAP to printer

    I have created an Adobe Form (not interactive) that looks perfectly OK when previewed in Adobe Acrobat viewer but when printed blank margins of 4-5 millimeters are applied on all 4 paper edges. The form was designed with a coloured frame around it but the margins effectively remove most of the frame. The form content is being cropped instead of being compressed inside the margins.
    The form has been created with LiveCycle Designer via SAP transaction SFP. I am generating the form from an ABAP program
    When the form is printed from the Adobe Acrobat viewer I have the option to set Page Scaling to 'Fit to Printable Area'. This makes the form content being compressed inside the blank margins and the coloured frame remains intact. If I leave the Page Scaling setting as 'None' the output is being cropped as described above.
    The real problem occurs when I want to print without previewing first. I need to do that since previewing enables the user to skip printing and the application must know if the form has been printed or not. I have so far found no way to make the printer print on the paper edges or fit the content to printable area. Is there some setting in the output parameters than handles this?
    Also there is a need for duplex printing when sending form directly to printer. On help.sap.com there is information about duplex print for SAPscript and Smartforms but nothing for Adobe Forms.
    Here is an excerpt of the ABAP code used for printing the Adobe Form:
      DATA: zs_outparams TYPE sfpoutputparams,
                 z_fmname     TYPE rs38l_fnam.
    Set some print parameters
      zs_outparams-nodialog = abap_true.        "No user dialog
      zs_outparams-device   = 'PRINTER'.          "Output device
      zs_outparams-dest     = z_pdest.              "Printer name
      zs_outparams-reqnew   = abap_true.        "New spool request
      zs_outparams-reqimm   = abap_true.        "Print immediately
    Open print job
      CALL FUNCTION 'FP_JOB_OPEN'
        CHANGING
          ie_outputparams = zs_outparams
        EXCEPTIONS
          cancel          = 1
          usage_error     = 2
          system_error    = 3
          internal_error  = 4
          OTHERS          = 5.
      IF sy-subrc <> 0.
        RAISE print_error.
      ENDIF.
    Get FM name for form
      CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
        EXPORTING
          i_name     = 'Z_TEST_FORM'
        IMPORTING
          e_funcname = z_fmname.
    Call FM to print form
      CALL FUNCTION z_fmname
        EXPORTING
          i_header       = t_data_for_form
        EXCEPTIONS
          usage_error    = 1
          system_error   = 2
          internal_error = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
        RAISE print_error.
      ENDIF.
    Close print job
      CALL FUNCTION 'FP_JOB_CLOSE'
        EXCEPTIONS
          usage_error    = 1
          system_error   = 2
          internal_error = 3
          OTHERS         = 4.
      IF sy-subrc <> 0.
        "Ignore
      ENDIF.
    Please advise on how to
    -  avoid the content cropping
    -  enable duplex print
    when sending Adobe forms directly to the printer
    Thanks very much!
    Bernt Evensen

    Thanks for your answer, Ramachandra!
    However I need some more specific information to solve this.
    Which printer layout settings are relevant for the handling of margins and duplex printing for Adobe Forms?
    I have not set up the printer myself but when talking to the printer guy which settings should I recommend him to look at?
    I can see in transaction SPAD that there are settings specific to SmartForms but there is nothing said about Adobe Forms. Is there some way to make Adobe Forms related setting appear in SPAD for a device type?
    Maybe my problem is not related to the printer device settings but rather to the way the printer is being called. When printing duplex we will have to override the default settings of the printer anyway.
    Function module FP_JOB_OPEN has a parameter structure of the type SFPOUTPUTPARAMS. Which fields in this parameter structure are to be manipulated to get duplex print and output fitted to page size?

  • 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

  • Can I color a line of "standard text" in adobe forms output?

    Simple question: Can I color a line of "standard text" in adobe forms output?
    My standard text (SO10) has multiple lines. 
    Can I make one of the lines red?
    Ollie

    Hi Oliver,
    I believe you standard text is a table type of TDLINES.
    On the form you would display it with a table of 1 column 1 row with repeat row ticked.
    Have the like below code on the fomr ready event of your table.
    for(var i =0; i<this.Row1.nodes.length;i++)
         if(i == 1){
         this.Row1.Cell1.font.fill.color.value = "255,0,0";
         this.Row1.xx.font.fill.color.value = "255,0,0";
    Note: in my example I had a table with one row names Row1 and 2 fields cell1 type textbox,  & xx as text / label.
    If its like you have it in a text box with multiple entries, we need to spli the value such that 1st row is displayed in a text box whose parameters are by defeult set to font red, and rest of them to this text area.
    If your procedure is table the code sud work, else let me know how you get data and how do you display it on the screen.
    Cheers,
    Sai

  • How to send a report output as a FAX ?

    Hallo Experts,
    How to send a report output as a FAX ?
    Suppose if I have all the data in an internal table, I will show it as a normal list OR ALV list output.
    In the application tool bar I should have a button, and by clicking it the output should go to the customer as FAX. How can I send it to a FAX ? Any Function modules ?
    Please help me with an example program.
    Regards,
    Matt.

    Hi,
    Hope the code given below helps you.
    FORM SEND_FAX
    TABLES DOC2FAX STRUCTURE TEST_DOC
    USING COUNTRY
    NUMBER.
    DATA: SID(5) TYPE N.
    DATA BEGIN OF POPT.
    INCLUDE STRUCTURE ITCPO.
    DATA END OF POPT.
    DATA BEGIN OF PRES.
    INCLUDE STRUCTURE ITCPP.
    DATA END OF PRES.
    CLEAR POPT.
    POPT-TDCOPIES = 1. " one copy
    * POPT-TDDEST = " done internaly by script,
    * POPT-TDPRINTER = " do not fill !!!
    POPT-TDNEWID = 'X'. " do not reuse old spool request
    POPT-TDDATASET = 'TEST'(022). " fill as you want
    POPT-TDSUFFIX1 = 'FAX'(023). " fill as you want
    POPT-TDSUFFIX2 = SY-UNAME. " fill as you want
    POPT-TDIMMED = 'X'. " send now
    POPT-TDLIFETIME = 8. " keep 8 days in spool
    POPT-TDTELENUM = NUMBER. " number without country code
    POPT-TDTELELAND = COUNTRY. " country of recipient
    POPT-TDCOVER = 'test fax'(024).
    POPT-TDCOVTITLE = 'test fax'(024).
    * POPT-TDIEXIT = 'X'.
    CALL FUNCTION 'PRINT_TEXT'
    EXPORTING
    APPLICATION = 'TX'
    ARCHIVE_INDEX = ' '
    ARCHIVE_PARAMS = ' '
    DEVICE = 'TELEFAX' "<<< here we say: fax it !
    DIALOG = 'X'
    HEADER = HEADER
    OPTIONS = POPT
    IMPORTING
    RESULT = PRES
    TABLES
    LINES = DOC2FAX
    EXCEPTIONS
    OTHERS = 01.
    * do not bother with exception in sample code
    * CANCELED = 01
    * DEVICE = 02
    * FORM = 03
    * OPTIONS = 04
    * UNCLOSED = 05
    * UNKNOWN = 06
    * FORMAT = 07
    * TEXTFORMAT = 08
    * EXTERNAL = 09.
    IF SY-SUBRC = 0.
    * arriving here means we could send:
    SID = PRES-TDSPOOLID.
    IF SID > '00000'.
    MESSAGE S433 WITH SID.
    ENDIF.
    LEAVE .
    ELSE.
    * do not bother with exception in sample code
    MESSAGE A400 WITH 'PRIN_TEXT'.
    ENDIF.
    ENDFORM. " SEND_FAX
    Regards,
    Siddarth

  • 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

Maybe you are looking for

  • Partial goods receipt for PO with multiple line items

    Hello All, While doing MIGO, for a PO with multiple line items, if one line item is having error, will we be able to go ahead with goods receipt? Or entire material document is blocked for doing MIGO? We will be doing a development - in case if there

  • Purchase Order Tax Code

    Dear Experts, I just run MRP Procedure and generate Order Recommendations. In Order Recommendation created Purchase Order and got message as P.O. sent to approval. All is going well but there is one thing I just want to clarify that How can we update

  • No messages in SXMB_MONI for outbound proxy interface

    Dear All, i am executing Proxy-PI-File interface and I am not able to find any message in SXMB_MONI in the ECC side. I have done all the required proxy configurations and also the ABAP report calling the proxy is working fine but still not able to vi

  • Where can I get an iPad template since Device Central displays none?

    I notice a few others having this problem (not able to access iPad templates).  So far, I can't see anyone on this forum able to solve the mystery.  What's the go?  Regardless of which program I have open in my CS4 suite, Device Central displays no A

  • Excise document

    hi friends i have queiry regarding excise document, what is the difference between excise document date and excise document entry date these 2 are in J_1IEXCHDR table. and what is the meaning of arrived at customs which is in the same table Regards V