Send spool id output (sap script) via email in PDF format

Dear friends,
Looking for sample program to send spool id output of sapscript via email in PDF format.
Regards,
Praveen Lobo

Hi,
Try this code..
* Parameters.
PARAMETERS: p_email(50) LOWER CASE.
PARAMETERS: p_spool LIKE tsp01-rqident.
* Data declarations.
DATA: plist LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: document_data LIKE sodocchgi1.
DATA: so_ali LIKE soli OCCURS 100 WITH HEADER LINE.
DATA: real_type LIKE soodk-objtp.
DATA: sp_lang LIKE tst01-dlang.
DATA: line_size TYPE i VALUE 255.
DATA: v_name LIKE soextreci1-receiver.
DATA rec_tab LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
* Get the spool data.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = p_spool
first_line = 1
last_line = 0
desired_type = ' '
IMPORTING
real_type = real_type
sp_lang = sp_lang
TABLES
buffer = so_ali
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
OTHERS = 8.
* Check the return code.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'Error'.
LEAVE LIST-PROCESSING.
ENDIF.
* Prepare the data.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 0.
plist-body_num = 0.
plist-doc_type = 'RAW'.
plist-obj_descr = 'Spool data'.
APPEND plist.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
DESCRIBE TABLE so_ali LINES plist-body_num.
plist-doc_type = real_type.
* Get the size.
READ TABLE so_ali INDEX plist-body_num.
plist-doc_size = ( plist-body_num - 1 ) * line_size
+ STRLEN( so_ali ).
APPEND plist.
* Move the receiver address.
MOVE: p_email TO rec_tab-receiver,
'U' TO rec_tab-rec_type.
APPEND rec_tab.
IF NOT sp_lang IS INITIAL.
document_data-obj_langu = sp_lang.
ELSE.
document_data-obj_langu = sy-langu.
ENDIF.
v_name = sy-uname.
* Subject.
document_data-obj_descr = 'Spool attached'.
* Send the email.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
sender_address = v_name
sender_address_type = 'B'
TABLES
packing_list = plist
contents_bin = so_ali
receivers = rec_tab
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 e208(00) WITH 'Error in sending email'.
ENDIF.
COMMIT WORK.
* Send the email immediately.
SUBMIT rsconn01
WITH mode = 'INT'
AND RETURN.
* Success message.
MESSAGE s208(00) WITH 'Email sent'.
Thanks
Naren

Similar Messages

  • Why can't I share documents via email in pdf format any longer?

    Why can't I share documents via email in pdf format any longer?

    I am guessing you are using an iPad, iPhone or iPod touch. This is the forum for MacBooks, the computer, so the mail works differently.
    You will want to ask your question in the correct forum.
    Using iPad
    Using iPhone
    iPod touch

  • PO output sending to vendor via email by PDF Format

    Hi All,
    Business needs to send the PO output in PDF Format to multiple vendor contact via email. They also needs soem text in the body of the mail.
    Is it possible to config via standard SAP or we need to develop a customed program?
    Suppose If it is possible via standard SAP can some one post the detailed steps.
    Thanks in Advance
    Regards
    Karthick

    External Send - Sending PO by email
    In order to send PO, your Basis team must configure the system first so that external email can be send out from SAP.  If it is not configured, no settings you do on MM will work.
    1. You must maintain email address in vendor master data.
    2. The same applies to your user master data.  For the output type for default values, a communication strategy needs 
    to be maintained in the Customizing that supports the e-mail. You can find the definition of the communication strategy in the 
    Customizing via the following path: 
    (SPRO -> IMG -> SAP Web Application Server -> Basic Services -> Message Control -> Define Communication Strategy). 
    As a default, communication strategy CS01 is delivered. This already contains the necessary entry for the external communication. Bear in mind that without a suitable communication strategy it is not possible to communicate with a partner via Medium 5 (external sending).
    3. Use the standard SAP environment (program 'SAPFM06P', FORM routine 'ENTRY_NEU' and form 'MEDRUCK') as the processing routines.
    4. In the condition records for the output type (for example, Transaction MN04), use medium '5' (External send).
    5. You can use Transaction SCOT to trigger the output manually. The prerequisite for a correct sending is that the node is set correctly. This is not described here, but it must have already been carried out.
    6. To be able to display, for example, the e-mail in Outlook, enter PDF as the format in the node

  • Send collective invoice via (Single mail)email in pdf format

    Hi All,
    Please suggest me the solution option for the below requirement.
    The requirement is to send collective invoice to the customer via email in PDF format in a single email at the end of the day.ie they like to have a tool where they
    can enter the output type,date and other relavant info and the program should collect all the invoice and convert it to PDF and send it in single mail to customer.
    Please let me know i can use any Standard tool for this purpose.ALso is it possible to write a Zprogram reprocess the output type by using any FM? 
    Also suggest if you have any feasible solutions.
    Regards
    Raja

    Hi All,
    thanks for your comments. Sorry its my mistake that i have asked in general.
    I am looking for the following options.
    1. Any stanard program which can be used partially for my requirement?
    2. If i have to go for a new tool, then i should write a code for reprocess the output types and then convert in to one single PDF and then send it to customer in one single email.
    Here i am struck how to write an program to reprocess the ouput types? i hope the next steps can be easily implemented evenhough some watch outs are there like 'how to make a single PDF file' and some technical constraints like max size that can be send.
    Thanks and let me know your inputs.
    Regards,
    Raja

  • How do I scan a photo to a file and then send the file as an attachment via email.

    How do I scan a photo to a file and then send the file as an attachment  via email.

    All of this depends largely on what printer /software you have, which Email client you use and to some extent which OS you are running.
    Most HP printers have HP Solution Center which is used to set up scanning,choosing where to save,etc. Once a file/photo is scanned and saved to the folder, open the folder.Select the file and at the top of the window should be the option to 'Email'.
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • Make my week schedule and then send it to all my team via email in detail

    I just switched to iCal (Calendar as I have ML) and the important feature for me using Outlook before was to Make my week schedule and then send it to all my team via email. They could see my whole week outlined in detail, I could choose data ranges, wether I wanted to send details or titles and then receiving parties could add the meetings they wanted in their calendar as well.
    Am I missing something or ical completely missed the boat on that one? is Apple going Backwards?

    Hi,
    This issue is usually caused by some anti-virus programs, disable the anti-virus program you have on the PC, check if this issue will happen again.
    You may also run Outlook in Safe Mode to determine if it's 3rd-party add-ins related:
    Press Win + R and type “outlook.exe /safe” in the blank box, then press Enter.
    If there’s no problem viewing html emails in Safe Mode, disable the suspicious add-ins to verify which add-ins caused this issue. Some security programs may have such add-ins intergrated with Outlook.
    Regards,
    Melon Chen
    TechNet Community Support

  • HT4993 When I send Outlook invites to my iPhone (via email) the appointments appear 3 hours earlier? The time setting appears to be EST which is accurate so I can't figure out why the appointments don't appear in real time.  Thanks for your help, Ellen

    When I send Outlook invites to my iPhone (via email) the appointments appear 3 hours earlier? The time setting appears to be EST which is accurate so I can't figure out why the appointments don't appear in real time.  Thanks for your help, Ellen

    1) The best way to relocate the iTunes library folder is to move the entire iTunes folder with all subfolders to the new path, then press and hold down shift as start iTunes and keep holding until prompted to choose a library, then browse to the relocated folder and open the file iTunes Library.itl inside it.
    If you've done something different then provide some more details about what is where and I should be able to help.
    2) Purchases on the device should automatically transfer to a Purchased on <DeviceName> playlist, but it my depend a bit on whether automatic iCloud downloads are enabled. If there is a cloudy link then the transfer might not happen. You can use File > Devices > Transfer Purchases. In iTunes you should also check out iTunes Store > Quick Links > Purchased > Music > Not on this computer.
    3) Backup the device, then immediately restore it. In some cases you need to add a restore as new device into that equation. Obbviously not to be attempted until you're sure all your media is in your library. See Recover your iTunes library from your iPod or iOS device should it be needed.
    4) I believe there is complimentary 1 incident 90-day support with hardware purchases, but no free software support for iTunes itself. AppleCare gets you a different level of support.
    tt2

  • How do I send soft copy attachments of photos via email to windows user

    Help , need to send soft copy  attachments of photos via email to windows operator . thanks

    Not sure what you mean by soft copy attachments. But to help ensure Windows users have no problem coping with attachments from Mail Control+Click on the attachment that displays as an inline image and select 'View as Icon'. Also, in Mail>Edit>Attachments make sure 'Always send Windows-friendly attachments' is ticked.

  • Can't send a PAGES document Via email in PDF form ... used to be done by clicking share and PDF  HELOP

    creating a document on pages and trying to share it via email in PDF form used to be really easy...
    How does this work now?  help

    I always just do file->print. Then in the lower left is a menu that said "PDF" and just pick "Mail PDF" from the dropdown and a new email is composed with the PDF attached. One step to print, one click to choose mail and you're done. I just tried this on the latest Yosemite and Pages updates and it works fine.

  • Send email in pdf format

    i have a function which returns purchase orders list.
    in my program i want my program sends the purchase order document through email in pdf format when i select an order from the list.
    how can i do that.

    This reference program might help:
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm

  • Script o/p to pdf format

    How to modify a print program that is used to convert the script o/p in to PDF FORMAT .. give me procedure to develop & help me sdn..

    Re: script o/p to pdf format
    Hi Dara Rajesh,
    RSTXPDFT4 is using for download pdf from spool request but i like get the pdf form script output display.
    Kindly help me to do.
    Advance Thanks.

  • Converting Script from OTF to PDF format

    Hi Experts,
    Using FM CONVERT_OTF in SAP Script print program I am converting data of Script from OTF to PDF format but the data in PDF document srinks and looks like slightly overlapping one leter on the other, can any ony please tell me that how can I avaoid this.
    Thanks in Advance
    Best Regards
    Venkat

    Dear Venkatesh,
    I have the same scenario. I have to convert Script to PDF and then write it to FTP Server.
    Could you please provide me the code which you have used?
    Regards,
    Chaitanya A

  • I would like to build a drag n drop interface and have the results sent to my email in PDF format. Is this possible?

    I would like to build a drag n drop interface and have the results sent to my email in PDF format. Is this possible?

    Captivate is not really designed to do what you want in this instance.  It's more targeted at allowing a user to complete an assessment and then track whether or not they passed.  So it's only really set up to send information in a format that the LMS will understand and interpret as Pass/Faill and what the score was.
    You really need something more flexible than that. So I think you would need to get a programmer involved and have the solution custom made.  In my experience, any time you try to diverge Captivate from what it was designed to do, and you need to get other IT professionals involved, you can kiss thousands of dollars goodbye before you have a workable solution.

  • Sending Script via Email

    Hi Folks,
                 I am able to send Script via mail to yahoo id with PDF attachment but not able to recieve the pdf attachment in gmail i.e. I get the mail in gmail but not with PDF attachment.
    Well in scot the output type is PDF.
    Thanks for responses in Advance
    <MOVED BY MODERATOR TO THE CORRECT FORUM>
    Edited by: Alvaro Tejada Galindo on Feb 4, 2009 9:24 AM

    Hi,
    check below links,
    /people/erwan.lebrun/blog/2007/04/16/tips-tricks-email-fax-through-the-same-output-type
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/mail%2bsend%2bthrough%2boutput%2bcontrols
    Regards,
    Madhu

  • How to send scripts via email(Internet Address)

    Dear all,
    I want to send scripts/smart forms via email (Internet Address). How can I do that …please advice…?
    If any one has worked on it please send me sample code for the same.
    Thanks in Advance…
    Thanks and Regards:
    M.Manohar

    Hi Manohar,
    Check this Program.
    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

Maybe you are looking for

  • How do I get my keyboard hotkeys to work on itunes while it's minimized?

    On my keyboard I have keys for the normal stuff (pause, play, stop, forward, back) and they all work with itunes but only if itunes is open...which sort of defeats the purpose. Is there a way to get them to work while itunes is minimized to the tray?

  • Export for QT viewing.

    I recently completed a 2-minute movie that I wanted to share over the internet. I exported using QuickTime conversion, using the standard (default) settings. The result was a 31MB file which looks fine when viewed with the QT viewer. However, I thoug

  • Web Services Attachments

    Any advice on the following would be greatly appreciated! I am trying to send an attachment to CRMOD via a java web service. I am able to create the message fine in Soap UI so I know the encoding is correct and the structure of the message is correct

  • Error while deploying BPMDMTECHN06_3.sca

    Hi all I'm getting the following deployment exception while trying to import the MDM Portal Content BPMDMTECHN06_3.sca file. Starting Deployment of com.sap.pct.mdm.tech.packages.mdm_550 Aborted: development component 'com.sap.pct.mdm.tech.packages.md

  • Study material for 1Z0-200

    Hi, I am planning to appear for 1Z0-200 Oracle EBusiness Suite Fundamental exam. Please give me any link or doc ref for the study material. Thanks in advance AT