XI Spool reports

Hi Experts,
Please tell me how to access the Spool reports in XI. And what roles are needed  to access.
Thanks in advance.
MK

Hi,
I think you can have the access for Spool Request reports from SP01 in XI also.
These spool requests are for handling the print outputs for generated archiving or deleting log for the messages in XI.
Refer
http://help.sap.com/saphelp_nw04/helpdata/en/0e/80553b4d53273de10000000a114084/frameset.htm
For Authorizations of Spool system see below
You need
1.  Authorizations for Output Devices
http://help.sap.com/saphelp_nw04/helpdata/en/c7/58c902e5bf11d18e2b0000e83dd9fc/content.htm
2.  Authorizations for the System (for administrators)
http://help.sap.com/saphelp_nw04/helpdata/en/5a/4df93bad37f87ae10000000a114084/content.htm
3.  Authorizations for the output controller
http://help.sap.com/saphelp_nw04/helpdata/en/c7/58c905e5bf11d18e2b0000e83dd9fc/content.htm
Thanks
Swarup

Similar Messages

  • Problem in spool report

    Hi All,
    I have executed one report(Z report) in Production by Background, that has generated Spool report.
    My problem is some fields are cut-off(missing) from that spool report.
    Please provide the solution ASP.
    Regards,
    DSK.

    Hi DS
    Do one thing: Configure your text editor as follws:
    Go to Utilities->Settings->Downwards-Compatible Line Length(72) .
    Hope you can away from the spool request now.
    Have a look on the OSS note:
    <b>
    https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=534487&nlang=EN&smpsrv=https%3a%2f%2fwebsmp201%2esap-ag%2ede</b>
    Summary
    Symptom
    A list that includes more than 255 columns in the background is supposed to be issued. Instead of broad list lines being distributed on several printed lines for every 255 columns, only a single truncated printed line appears.
    Other terms
    Lists, print, 255 columns
    Reason and Prerequisites
    A Support Package which allows the printing of broad lists was imported. This creates a broad line of print with more than 255 columns in the spool. Generally, this is desired.However, the problem occurs if no corresponding format is defined because the default format X_65_255 truncates the line correspondingly at the print output.
    Solution
    1.) Define a format which can output the required number of printing columns.
    2.) Using the attached correction, the number of columns in the print dialog can be changed in this special case.If a column figure of 255 is now entered, the old behavior is active again.The correction is only effective if you imported note 501826 beforehand.
    Header Data
    Release Status: Released for Customer
    Released on: 13.06.2003  07:44:06
    Priority: Correction with medium priority
    Category: Program error
    Primary Component: BC-ABA-LI List Processing
    Releases
    Software
    Component Release From
    Release To
    Release And
    subsequent
    SAP_BASIS 46 46B 46B  
    SAP_BASIS 46C 46C 46D  
    Highest Implemented Support Package
    Support
    Packages Release Package
    Name
    SAP_BASIS 46B SAPKB46B44
    SAP_BASIS 46B SAPKB46B48
    SAP_BASIS 46C SAPKB46C36
    SAP_BASIS 46C SAPKB46C40
    Related Notes
    586914 - Workaround for printing signature data via CJ00 or DSAL
    Print Selected Notes (PDF) 
    Regards,
    Sree
    Message was edited by:
            sree ram

  • IN bapi- how to provide spool report with messages

    in BAPI, how to provide spool report with messages?

    >
    sujan T wrote:
    > Thanks for your reply.
    >
    >    What is the logic to call the standard report from zprogram?Inside the zpogram how to call standard report?
    >
    > Regards,
    > Sujan
    no special logic is required
    If u want to use
    RPUAUDOO IN THE ZREPORT.
    Put the submit button where ever required
    ex: In zreport after certain process reacedu want to call then use
    submit rpuaudoo and return.
    Regards
    Sas

  • I need to send sm37 Spool Report Automatically to one or more user ids.

    Hai Gurus,
    I need to send sm37 Spool Report Automatically to one or more user ids.
    Kindly guide me

    Thanks.. .
    is it possible to create Many distribution list for each & every Spool Report ?
    I mean, Can i create separate distribution list for each Reports ?. EX: ME2N Report.
    Edited by: Swetha SAP Girl on Jul 6, 2009 10:11 AM

  • SEND SPOOL REPORT AS E-MAIL

    Hi,
    How do I send a spool report as an e-mail?
    NOT as PDF file.
    If we can send it as a text file that would also be fine, but preferably as a Spool report as it is (non-editable).

    Hi,
      Have a look at this code...
    z_send_email_fax_global
    FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
    WORK TABLE AREAS
    TABLES: tsp01.
    INTERNAL TABLES
    DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
    lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
    lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
    DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
    lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
    DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
    TYPES: BEGIN OF y_files,
    file(60) TYPE c,
    END OF y_files.
    DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
    DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
    DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
    STRUCTURES
    DATA: folder_id LIKE soodk,
    object_id LIKE soodk,
    link_folder_id LIKE soodk,
    g_document LIKE sood4,
    g_header_data LIKE sood2,
    g_folmem_data LIKE sofm2,
    g_header_data LIKE sood2,
    g_receive_data LIKE soos6,
    g_ref_document LIKE sood4,
    g_new_parent LIKE soodk,
    l_folder_id LIKE sofdk,
    v_email(50).
    DATA: hd_dat like sood1.
    VARIABLES
    DATA: client LIKE tst01-dclient,
    name LIKE tst01-dname,
    objtype LIKE rststype-type,
    type LIKE rststype-type.
    DATA: numbytes TYPE i,
    arc_idx LIKE toa_dara,
    pdfspoolid LIKE tsp01-rqident,
    jobname LIKE tbtcjob-jobname,
    jobcount LIKE tbtcjob-jobcount,
    is_otf.
    DATA: outbox_flag LIKE sonv-flag VALUE 'X',
    store_flag LIKE sonv-flag,
    delete_flag LIKE sonv-flag,
    owner LIKE soud-usrnam,
    on LIKE sonv-flag VALUE 'X',
    sent_to_all LIKE sonv-flag,
    g_authority LIKE sofa-usracc,
    w_objdes LIKE sood4-objdes.
    DATA: c_file LIKE rlgrap-filename,
    n_spool(6) TYPE n.
    DATA: cancel.
    DATA: desired_type LIKE sood-objtp,
    real_type LIKE sood-objtp,
    attach_type LIKE sood-objtp,
    otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
    ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
    CONSTANTS
    CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
    c_objtp LIKE g_document-objtp VALUE 'RAW',
    c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
    =================================================================================
    z_send_email_fax2
    FUNCTION z_faian_mail_fax2.
    ""Interface local:
    *" IMPORTING
    *" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
    *" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
    *" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
    *" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
    *" TABLES
    *" LT_BODY_EMAIL STRUCTURE SOLI
    *" EXCEPTIONS
    *" ERR_NO_ABAP_SPOOLJOB
    Fist part: Verify if the spool really exists
    SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
    IF sy-subrc NE 0.
    RAISE err_no_abap_spooljob. "doesn't exist
    ELSE.
    client = tsp01-rqclient.
    name = tsp01-rqo1name.
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
    authority = 'SP01'
    client = client
    name = name
    part = 1
    IMPORTING
    type = type
    objtype = objtype
    EXCEPTIONS
    fb_error = 1
    fb_rsts_other = 2
    no_object = 3
    no_permission = 4
    OTHERS = 5.
    IF objtype(3) = 'OTF'.
    desired_type = otf.
    ELSE.
    desired_type = ali.
    ENDIF.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    EXPORTING
    rqident = src_spoolid
    desired_type = desired_type
    IMPORTING
    real_type = real_type
    TABLES
    buffer = l_objcont
    EXCEPTIONS
    no_such_job = 14
    type_no_match = 94
    job_contains_no_data = 54
    no_permission = 21
    can_not_access = 21
    read_error = 54.
    IF sy-subrc EQ 0.
    attach_type = real_type.
    ENDIF.
    CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    owner = sy-uname
    region = ou_fol
    IMPORTING
    folder_id = l_folder_id
    EXCEPTIONS
    OTHERS = 5.
    fill out informations about the header of the email
    CLEAR: g_document.
    g_document-foltp = l_folder_id-foltp.
    g_document-folyr = l_folder_id-folyr.
    g_document-folno = l_folder_id-folno.
    g_document-objtp = c_objtp.
    g_document-objdes = header_mail.
    g_document-file_ext = c_file_ext.
    g_header_data-objdes = header_mail.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING
    method = 'SAVE'
    office_user = sy-uname
    IMPORTING
    authority = g_authority
    TABLES
    objcont = lt_body_email
    attachments = lt_attachments
    CHANGING
    document = g_document
    header_data = g_header_data
    EXCEPTIONS
    OTHERS = 1.
    folder_id-objtp = l_folder_id-foltp.
    folder_id-objyr = l_folder_id-folyr.
    folder_id-objno = l_folder_id-folno.
    object_id-objtp = c_objtp.
    object_id-objyr = g_document-objyr.
    object_id-objno = g_document-objno.
    link_folder_id-objtp = l_folder_id-foltp.
    link_folder_id-objyr = l_folder_id-folyr.
    link_folder_id-objno = l_folder_id-folno.
    REFRESH lt_rec_tab.
    CLEAR lt_rec_tab.
    lt_rec_tab-sel = 'X'.
    lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
    lt_rec_tab-recnam = 'U-'.
    lt_rec_tab-deliver = 'X'.
    lt_rec_tab-not_deli = 'X'.
    lt_rec_tab-read = 'X'.
    lt_rec_tab-mailstatus = 'E'.
    lt_rec_tab-adr_name = fax_mail_number.
    lt_rec_tab-sortfield = fax_mail_number.
    lt_rec_tab-recextnam = fax_mail_number.
    lt_rec_tab-sortclass = '5'.
    APPEND lt_rec_tab.
    lt_rec_tab-recextnam = fax_mail_number.
    lt_rec_tab-recesc = object_type.
    lt_rec_tab-sndart = 'INT'.
    lt_rec_tab-sndpri = 1.
    APPEND lt_rec_tab.
    lt_files-file = c_file.
    APPEND lt_files.
    begin of insertion by faianf01
    hd_dat-objdes = header_mail.
    CALL FUNCTION 'SO_ATTACHMENT_INSERT'
    EXPORTING
    object_id = object_id
    attach_type = attach_type
    object_hd_change = hd_dat
    owner = sy-uname
    TABLES
    objcont = l_objcont
    objhead = l_objhead
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    object_type_not_exist = 17
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    x_error = 1000.
    IF sy-subrc > 0.
    ENDIF.
    end of insertion by faianf01
    send email from SAPOFFICE
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = folder_id
    object_id = object_id
    outbox_flag = outbox_flag
    link_folder_id = link_folder_id
    owner = sy-uname
    check_send_authority = 'X'
    TABLES
    receivers = lt_rec_tab
    note_text = lt_note_text
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    component_not_available = 1
    folder_no_authorization = 5
    folder_not_exist = 6
    forwarder_not_exist = 8
    object_no_authorization = 13
    object_not_exist = 14
    object_not_sent = 15
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    too_much_receivers = 73
    user_not_exist = 35.
    ENDIF.
    ENDFUNCTION.
    =================================================================================
    z_send_email_fax
    FUNCTION ZCBFS_SEND_MAIL.
    ""Interface local:
    *" IMPORTING
    *" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
    *" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
    *" TABLES
    *" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
    *" EXCEPTIONS
    *" ERR_NO_ABAP_SPOOLJOB
    DATA: vg_achou(1) TYPE n.
    Fist part: Verify if the spool really exists
    vg_achou = 1.
    DO 60 TIMES.
    SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
    IF sy-subrc IS INITIAL.
    CLEAR vg_achou.
    EXIT.
    ELSE.
    WAIT UP TO 1 SECONDS.
    ENDIF.
    ENDDO.
    IF vg_achou = 1.
    RAISE err_no_abap_spooljob. "doesn't exist
    ENDIF.
    client = tsp01-rqclient.
    name = tsp01-rqo1name.
    CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
    EXPORTING
    authority = 'SP01'
    client = client
    name = name
    part = 1
    IMPORTING
    type = type
    objtype = objtype
    EXCEPTIONS
    fb_error = 1
    fb_rsts_other = 2
    no_object = 3
    no_permission = 4
    OTHERS = 5.
    IF objtype(3) = 'OTF'.
    desired_type = otf.
    ELSE.
    desired_type = ali.
    ENDIF.
    CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
    EXPORTING
    rqident = src_spoolid
    desired_type = desired_type
    IMPORTING
    real_type = real_type
    TABLES
    buffer = l_objcont
    EXCEPTIONS
    no_such_job = 14
    type_no_match = 94
    job_contains_no_data = 54
    no_permission = 21
    can_not_access = 21
    read_error = 54.
    IF sy-subrc EQ 0.
    attach_type = real_type.
    ENDIF.
    CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
    EXPORTING
    owner = sy-uname
    region = ou_fol
    IMPORTING
    folder_id = l_folder_id
    EXCEPTIONS
    OTHERS = 5.
    fill out informations about the header of the email
    CLEAR: g_document.
    g_document-foltp = l_folder_id-foltp.
    g_document-folyr = l_folder_id-folyr.
    g_document-folno = l_folder_id-folno.
    g_document-objtp = c_objtp.
    g_document-objdes = header_mail.
    g_document-file_ext = c_file_ext.
    g_header_data-objdes = header_mail.
    CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
    EXPORTING
    method = 'SAVE'
    office_user = sy-uname
    IMPORTING
    authority = g_authority
    TABLES
    attachments = lt_attachments
    CHANGING
    document = g_document
    header_data = g_header_data
    EXCEPTIONS
    OTHERS = 1.
    folder_id-objtp = l_folder_id-foltp.
    folder_id-objyr = l_folder_id-folyr.
    folder_id-objno = l_folder_id-folno.
    object_id-objtp = c_objtp.
    object_id-objyr = g_document-objyr.
    object_id-objno = g_document-objno.
    link_folder_id-objtp = l_folder_id-foltp.
    link_folder_id-objyr = l_folder_id-folyr.
    link_folder_id-objno = l_folder_id-folno.
    REFRESH lt_rec_tab.
    LOOP AT LIST_FAX_MAIL_NUMBER.
    lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
    lt_rec_tab-recesc = 'U'.
    lt_rec_tab-sndart = 'INT'.
    lt_rec_tab-sndpri = 1.
    APPEND lt_rec_tab.
    ENDLOOP.
    lt_files-file = c_file.
    APPEND lt_files.
    hd_dat-objdes = header_mail.
    CALL FUNCTION 'SO_ATTACHMENT_INSERT'
    EXPORTING
    object_id = object_id
    attach_type = attach_type
    object_hd_change = hd_dat
    owner = sy-uname
    TABLES
    objcont = l_objcont
    objhead = l_objhead
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    object_type_not_exist = 17
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    x_error = 1000.
    IF sy-subrc > 0.
    ENDIF.
    send email from SAPOFFICE
    CALL FUNCTION 'SO_OBJECT_SEND'
    EXPORTING
    folder_id = folder_id
    object_id = object_id
    outbox_flag = outbox_flag
    link_folder_id = link_folder_id
    owner = sy-uname
    TABLES
    receivers = lt_rec_tab
    note_text = lt_note_text
    EXCEPTIONS
    active_user_not_exist = 35
    communication_failure = 71
    component_not_available = 1
    folder_no_authorization = 5
    folder_not_exist = 6
    forwarder_not_exist = 8
    object_no_authorization = 13
    object_not_exist = 14
    object_not_sent = 15
    operation_no_authorization = 21
    owner_not_exist = 22
    parameter_error = 23
    substitute_not_active = 31
    substitute_not_defined = 32
    system_failure = 72
    too_much_receivers = 73
    user_not_exist = 35.
    ENDFUNCTION.
    Please check this links for sample code.
    http://www.sap-basis-abap.com/sapac018.htm
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm
    http://www.sap-img.com/abap/sending-mail-with-attachment-report-in-background.htm
    Regards

  • Sendin Spool reports to an e-mail address.

    Just wondering how one would go about developing a process to look for a specific spool report and send it to a specific e-mail address.  I would place the reports and associated e-mail address in a Z table to be maintained by a user group.  I have no clue on how to read the spool and collect a specific report to be sent via e-mail.  Any help or suggestions would be greatly appreciated.
    Thanks,
    Scott

    Here is some sample code.  This program takes the spool from a previous job step.  It converts this spool to PDF and then inserts this PDF as an attachment in an E-mail.
    * Program Name: KEG Job Sched Run with PDF Output Creation: 03/22/2001
    * SAP Name    : ZESU_JOB_RUN_WITH_PDF_OUTPUT      Application: U       *
    * Author      : Thomas Jung                       Type: 1              *
    * Description :  This Program will read the spool produced
    * by the specified previous job step and converts it to
    * PDF.  This PDF-Formatted report is then output to a file.            *
    * Inputs: File name, job step                                          *
    * Outputs: File formatted in PDF with the report output.               *
    * External Routines
    * FILE_GET_NAME
    * CONVERT_ABAPSPOOLJOB_2_PDF
    * CONVERT_OTFSPOOLJOB_2_PDF
    * Z_E_OPEN_FILE_FOR_OUTPUT_BIN
    * Z_E_WRITE_TO_FILE_WITH_LENGTH
    * SO_NEW_DOCUMENT_ATT_SEND_API1
    * BAPI_USER_GET_DETAIL
    * Return Codes:
    * The program uses the standard function modules for File manipulation
    * therefore it has all the standard error routines for Files.          *
    * Ammendments:                                                         *
    *    Programmer        Date     Req. #            Action               *
    * ================  ==========  ======  ===============================*
    * Thomas Jung       03/27/2001  ------  Initial Program.               *
    report  zesu_job_run_with_pdf_output message-id zes_job.
    * DATA DICTIONARY TABLES                                               *
    tables: raldb. "Transfer Structure for Logical Databases
    tables: tbtcp.
    tables: icon,   "Icons table
            bapiadsmtp, "BAPI structure for e-mail addresses (central
            bapiadpag.
    * TYPE POOLS                                                           *
    type-pools: sbdst.
    * CONSTANTS                                                            *
    constants: logical_file_name like filename-fileintern
                  value 'ZEX_STANDARD_FILENAME',
               pdf_ext(4) type c
                  value '.pdf',
               pdf_type(3) type c
                  value 'PDF',
               internet(1) type c
                  value 'U',
               dist_list(1) type c
                  value 'C',
               kimball_domain(12) type c value '@kimball.com'.
    constants: kim_ftp(80) type c
    value
    'ftp://kww.kog.kimball.com/webtools/acrobat_reader/acroread40w95.exe'.
    constants: ext_ftp(80) type c
    value
    'http://www.adobe.com/products/acrobat/readermain.html'.
    * VARIABLES                                                            *
    data: length type i.
    data: f4_field like trdir-name.
    data: pathleng type i,
          nameleng type i,
          physleng type i.
    data jselect like btcselect.
    data: report like sy-repid.
    data: doc_chng         like sodocchgi1.
    data: tab_lines        like sy-tabix.
    * INTERNAL TABLES                                                      *
    data: begin of html_tab occurs 0.
            include structure w3html.
    data: end of html_tab.
    data: icontab(32) occurs 10 with header line.
    data: itab like abaplist occurs   0 with header line.
    data: ipdf        like tline      occurs 0 with header line.
    data: objpack          like sopcklsti1 occurs 2 with header line.
    data: objhead          like solisti1   occurs 1 with header line.
    data: objbin           like solisti1   occurs 10 with header line.
    data: objtxt           like solisti1   occurs 10 with header line.
    data: reclist          like somlreci1  occurs 5 with header line.
    * SELECTION SCREEN LAYOUT                                              *
    selection-screen begin of block one with frame title text-001.
    parameters: fileintn like filename-fileintern obligatory
                    default logical_file_name,
                filepath like rlgrap-filename lower case.
    parameters: file1    like rlgrap-filename obligatory lower case,
                physname like rlgrap-filename lower case.
    parameters: date1 as checkbox.
    parameters: time1 as checkbox.
    selection-screen end of block one.
    selection-screen begin of block two with frame title text-002.
    parameter: step like tbtcp-stepcount.
    parameter: abap radiobutton group one.
    parameter: oft  radiobutton group one.
    selection-screen end of block two.
    selection-screen begin of block three with frame title text-003.
    parameter: file  radiobutton group two.
    parameter: email radiobutton group two.
    selection-screen skip 1.
    parameter: int radiobutton group thre.
    parameter: dis radiobutton group thre.
    selection-screen skip 1.
    parameter: ext_user like somlreci1-receiver.
    selection-screen end of block three.
    * SELECTION SCREEN PROCESSING - OUTPUT                                 *
    at selection-screen output.
      perform filename_processing.
      loop at screen.
        if screen-name eq 'FILEPATH' or
           screen-name eq 'PHYSNAME'.
          screen-input = 0.
          modify screen.
        endif.
      endloop.
    * START OF SELECTION                                                   *
    start-of-selection.
      move sy-repid to report.
      perform auth_check.
      perform filename_processing.
      perform get_spool.
      perform convert_list_to_pdf.
      if file = 'X'.
        perform write_to_file.
      else.
        perform send_pdf_in_email.
      endif.
    *&      Form  filename_processing
    *       Prepair to conver to the logical file name to a physical name
    *  -->  p1        text
    *  <--  p2        text
    form filename_processing.
      perform get_filename using fileintn file1 physname.
      nameleng = strlen( file1 ).
      physleng = strlen( physname ).
      pathleng = physleng - nameleng.
      if pathleng > 0.
        filepath = physname(pathleng).
      endif.
    endform.                    " filename_processing
    *&      Form  get_filename
    *       Convert the logical file name into a physical file name
    *      -->P_FILEINTN  Input Logical File Name
    *      -->P_FILE1     Filename selected by input
    *      -->P_PHYSNAME  Output Physical File Name
    form get_filename using    p_fileintn
                               p_file1
                               p_physname.
      data: p_file2 like rlgrap-filename.
      clear p_file2.
      move p_file1 to p_file2.
      if date1 = 'X'.
        concatenate p_file2
                    sy-datum
                    into p_file2.
      endif.
      if time1 = 'X'.
        concatenate p_file2
                    sy-uzeit
                    into p_file2.
      endif.
      concatenate p_file2
                  pdf_ext
                  into p_file2.
      call function 'FILE_GET_NAME'
            exporting
              client                        = sy-mandt
              logical_filename              = p_fileintn
              operating_system              = sy-opsys
              parameter_1                   = p_file2
    *     PARAMETER_2                   = ' '
    *     PARAMETER_3                   = ' '
    *     USE_PRESENTATION_SERVER       = ' '
    *     WITH_FILE_EXTENSION           = ' '
    *     USE_BUFFER                    = ' '
            importing
    *     EMERGENCY_FLAG                =
    *     FILE_FORMAT                   =
              file_name                     = p_physname
            exceptions
              file_not_found                = 1
              others                        = 2
      if sy-subrc <> 0.
        message e001(zes_general) with sy-subrc.
      endif.
    endform.                    " get_filename
    *&      Form  write_to_file
    *       TRANSFER PDF DATA TO OUTPUT FILE
    *  -->  p1        text
    *  <--  p2        text
    form write_to_file.
      data: string_out type string.
      describe field objbin length length.
      call function 'Z_E_OPEN_FILE_FOR_OUTPUT_BIN'
           exporting
                filename1 = physname.
      loop at objbin.
        clear string_out.
        move objbin to string_out.
        call function 'Z_E_WRITE_TO_FILE_WITH_LENGTH'
             exporting
                  filename1        = physname
                  length           = length
                  please_open_file = 'NO'
                  string           = string_out.
      endloop.
    endform.                    " write_to_file
    *&      Form  convert_list_to_pdf
    *       Convert to Spool to PDF
    *  -->  p1        text
    *  <--  p2        text
    form convert_list_to_pdf.
      data: spool_id like tsp01-rqident.
      move tbtcp-listident to spool_id.
    ****Is this ABAP List Processing?
      if abap = 'X'.
        call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
          exporting
            src_spoolid                    = spool_id
    *       NO_DIALOG                      =
    *       DST_DEVICE                     =
    *       PDF_DESTINATION                =
    *     IMPORTING
    *       PDF_BYTECOUNT                  =
    *       PDF_SPOOLID                    =
    *       LIST_PAGECOUNT                 =
    *       BTC_JOBNAME                    =
    *       BTC_JOBCOUNT                   =
          tables
            pdf                            = ipdf
         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.
        if sy-subrc <> 0.
          message i016 with sy-subrc.
        endif.
      else.
    ****Or is this SAPscript?
        call function 'CONVERT_OTFSPOOLJOB_2_PDF'
          exporting
            src_spoolid                    = spool_id
    *       NO_DIALOG                      =
    *       DST_DEVICE                     =
    *       PDF_DESTINATION                =
    *     IMPORTING
    *       PDF_BYTECOUNT                  =
    *       PDF_SPOOLID                    =
    *       OTF_PAGECOUNT                  =
    *       BTC_JOBNAME                    =
    *       BTC_JOBCOUNT                   =
          tables
            pdf                            = ipdf
         exceptions
           err_no_otf_spooljob            = 1
           err_no_spooljob                = 2
           err_no_permission              = 3
           err_conv_not_possible          = 4
           err_bad_dstdevice              = 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.
        if sy-subrc <> 0.
          message i016 with sy-subrc.
        endif.
      endif.
      perform convert_pdf tables ipdf
                                 objbin.
    endform.                    " convert_list_to_pdf
    *&      Form  get_spool
    *   Read the job log to get the spool number for the specified step
    *  -->  p1        text
    *  <--  p2        text
    form get_spool.
      clear jselect.
    *jselect-jobname = '*'.
      jselect-username = '*'.
    ****Have this program get its own Job Name
      call function 'GET_JOB_RUNTIME_INFO'
           importing
    *         EVENTID                 =
    *         EVENTPARM               =
    *         EXTERNAL_PROGRAM_ACTIVE =
              jobcount                = jselect-jobcount
              jobname                 = jselect-jobname
    *         STEPCOUNT               =
           exceptions
                no_runtime_info         = 1
                others                  = 2.
    ****Read the spool number for this job step.
      clear tbtcp.
      select single listident from tbtcp
             into tbtcp-listident
             where jobname   = jselect-jobname
               and jobcount  = jselect-jobcount
               and stepcount = step.
      if tbtcp-listident = 0.
        message i009 with step.
      endif.
    endform.                    " get_spool
    *&      Form  convert_pdf
    *       Take the PDF information returned by the function module
    *       and convert it to a file readable format.  It currently is
    *       in a printable-only format.
    *      -->P_IPDF  PDF Source
    *      -->P_OBJBIN  PDF Destination
    form convert_pdf tables   t_source_tab structure ipdf
                              t_target_tab structure objbin.
      data:  l_hfeld(1600)      type c,
             l_offset           type p,
             l_tabix            like sy-tabix,
             l_max              type i,
             l_linecount_source type i,
             l_length_source    type i,
             l_length_target    type i.
    * Zeilenlänge des Quell-PDF-Files
      describe field t_source_tab length l_length_source.
    * Zeilenlänge der Ziel-Mime-Tabelle
      describe field t_target_tab length l_length_target.
    * Zeilenanzahl des Quell-PDF-Files
      describe table t_source_tab lines l_linecount_source.
    * Die maximale Zielgröße wird durch das Feld l_hfeld begrenzt.
      l_max = l_length_target + l_length_source.
    *  IF L_MAX > 1600.
    *    RAISE CONVERT_NOT_POSSIBLE.
    *  ENDIF.
      refresh t_target_tab.
      loop at t_source_tab.
        l_tabix = sy-tabix.
        move t_source_tab to l_hfeld+l_offset.
    * falls letzte zeile der quelltabelle erreicht
        if l_tabix = l_linecount_source.
          l_length_source = strlen( t_source_tab ).
        endif.
        l_offset = l_offset + l_length_source.
        while l_offset ge l_length_target.
          clear t_target_tab.
          t_target_tab = l_hfeld(l_length_target).
          append t_target_tab.
          shift l_hfeld by l_length_target places.
          l_offset = l_offset - l_length_target.
        endwhile.                          " l_offset ge p_length_target
    * falls letzte zeile der quelltabelle erreicht
        if l_tabix = l_linecount_source.
          if l_offset gt 0.
            clear t_target_tab.
            t_target_tab = l_hfeld(l_offset).
            append t_target_tab.
          endif.                           " l_offset gt 0
        endif.                             " l_tabix = l_linecount_lines
      endloop.                             " p_source_tab
    endform.                    " convert_pdf
    *&      Form  auth_check
    *       Perform Authorization Check
    *  -->  p1        text
    *  <--  p2        text
    form auth_check.
      authority-check object 'Z_ABAP_CHK'
                   id 'BUKRS' dummy
                   id 'ACTVT' dummy
                   id 'WERKS' dummy
                   id 'REPID' field report.
      if sy-subrc ne 0.
        message e024.
      endif.
    endform.                    " auth_check
    *&      Form  send_pdf_in_email
    *       Transfer the PDF file in an E-Mail
    *  -->  p1        text
    *  <--  p2        text
    form send_pdf_in_email.
      data: iaddsmtp type bapiadsmtp occurs 0 with header line.
      data: ireturn type bapiret2 occurs 0 with header line.
      concatenate text-010 jselect-jobname text-011
                  into doc_chng-obj_descr
                  separated by space.
      clear objtxt.
      objtxt = text-012.
      append objtxt.
      clear objtxt.
      objtxt = text-013.
      append objtxt.
      clear objtxt.
      concatenate text-014 jselect-jobname
                  into objtxt
                  separated by space.
      append objtxt.
      clear objtxt.
      objtxt = text-015.
      append objtxt.
      clear objtxt.
      objtxt = text-016.
      append objtxt.
      clear objtxt.
      append objtxt.
      clear objtxt.
      concatenate text-017 kim_ftp
                  into objtxt
                  separated by space.
      append objtxt.
      clear objtxt.
      concatenate text-018 ext_ftp
                into objtxt
                separated by space.
      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   = 0.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'RAW'.
      append objpack.
      describe table objbin lines tab_lines.
      concatenate jselect-jobname pdf_ext
                  into objhead.
      append objhead.
      objpack-transf_bin = 'X'.
      objpack-head_start = 1.
      objpack-head_num   = 1.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = pdf_type.
      objpack-obj_name   = jselect-jobname.
      concatenate text-019 jselect-jobname
                  into objpack-obj_descr
                  separated by space.
      objpack-doc_size   = tab_lines * 255.
      append objpack.
      if int = 'X'.
        clear iaddsmtp.
        refresh iaddsmtp.
        clear bapiadsmtp.
        call function 'BAPI_USER_GET_DETAIL'
             exporting
                  username = ext_user+0(12)
             tables
                  return   = ireturn
                  addsmtp  = iaddsmtp.
        loop at iaddsmtp where std_no = 'X'.
          clear bapiadsmtp.
          move iaddsmtp to bapiadsmtp.
        endloop.
        if bapiadsmtp-e_mail = ''.
          concatenate ext_user kimball_domain
                    into reclist-receiver.
        else.
          move bapiadsmtp-e_mail to reclist-receiver.
        endif.
        move internet to reclist-rec_type.
      else.
        reclist-receiver = ext_user.
        move dist_list to reclist-rec_type.
      endif.
      append reclist.
      call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        exporting
          document_data                    = doc_chng
          put_in_outbox                    = 'X'
    *   IMPORTING
    *     SENT_TO_ALL                      =
    *     NEW_OBJECT_ID                    =
        tables
          packing_list                     = objpack
          object_header                    = objhead
          contents_bin                     = objbin
          contents_txt                     = objtxt
    *     CONTENTS_HEX                     =
    *     OBJECT_PARA                      =
    *     OBJECT_PARB                      =
          receivers                        = reclist
        exceptions
         too_many_receivers               = 1
         document_not_sent                = 2
         document_type_not_exist          = 3
         operation_no_authorization       = 4
         parameter_error                  = 5
         x_error                          = 6
         enqueue_error                    = 7
         others                           = 8
      case sy-subrc.
        when 0.
          message i014 with reclist-receiver.
        when 1.
          message i015 with text-027.
        when 2.
          message i015 with text-028.
        when 3.
          message i015 with text-029.
        when 4.
          message i015 with text-030.
        when 5.
          message i015 with text-031.
        when 6.
          message i015 with text-032.
        when 7.
          message i015 with text-033.
        when 8.
          message i015 with text-036.
        when others.
          message i015 with text-036.
      endcase.
    endform.                    " send_pdf_in_email

  • Periodical spool reporting

    Hello
    Is it possible to create a background Job for a weekly spool report per printers ?
    regard
    Eric

    - Use SM36 (or programmatically) and in period values, select weekly.
    - In job step use a [variant with selection variable|http://help.sap.com/saphelp_sm32/helpdata/en/73/69ee7d55bb11d189680000e829fbbd/frameset.htm] that restrict a date field to the elapsed week
    Regards,
    Raymond

  • Spool report line width in background jobs

    Hi All,
    I wrote a report and specified the line size in the report header:
    REPORT /sappssrm/option_handler
    NO STANDARD PAGE HEADING
    LINE-SIZE 185.
    I want to run this report as background job and get a spool list with results of the report. I expected the width of the spool output to be well defined and it works in one system. However, in another systen, the line / page width is much smaller, and the system inserts line breaks in the output splitting my lines into two which causes very ugly results.
    It seems that the LINE-SIZE specified in the report header doesn't affect the output width in every system.
    Can anyone advice?
    Regards
    Wolfgang

    Hi Siggi,
    thanks for your reply. Actually I changed that already yesterday...
    But I found out what it was:
    It seems, the background job keeps old versions of the program, even if you import a new program version. I created a new job with the same program and it worked.
    Thanks again and best regards
    Wolfgang

  • Generating SP01 spool reports in background

    Good morning BASIS Gurus
    I have a quick question. I am required to generate a list of spool requests (SP01) every week, showing SP01 information for a selected group of printers. This is done for charge-backs (number of printouts for a specific unit).
    The problem is three-fold:
    1. I need to be able to run SP01 in the background.
    2. I need to create a variant to allow for the dates and the list of printers. The list of printers does not change week to week, so this is not a big deal.
    3. I need to be able to run the report and mail the resulting report to an SAP internal email. Once the report is generated I can do this part.
    The first two steps are the source of my headache.
    Any help/suggestions are greatly appreciated.
    I run ECC6.
    Thanks
    Juan

    Hola Juan,
    I think you can query the TSP01 table for those details... a simple program will do this job, talk to your abaper
    Regards
    Juan

  • Back spool report

    Hi,
    How to see the report in the spool while executing a program in background which has fields more than 255 characters? I want to see all the columns in the spool. But it is showing upto only 255 characters.
    Plz urgent

    I know that this is probably not what you want, but if you view the spool in SM37, click the "Raw" button, then you will see all of the columns,  it wraps the columns greate than 255 to the next line.    I think that this has something to do with the print format.  When you submitted the job to the background, you told it a certain format to use,  the biggest one in my system is 255.   If you want to see all of the data in the graphical view of SM37,  I believe you would have to have a format which is greater than 255.   I don't know how to set this stuff up.  Check with your basis people.
    Regards,
    Rich Heilman

  • Sm36 job executed, entries without value in spool report SAPKKA07

    Hi,
    I am checking spool of executed job in sm37 which is being executed in background report SAPKKA07
    job was executed but in spool first 36 entries without a value.
    can u advise the solution.

    Hi Narinder,
    I have tried without TO SAP-SPOOL but it doesn't work.
    Submit is automatically creating the spool request when run in background mode.
    Kind Regards
    Prafulla

  • [Interface] - Passing variety parameters/input to PL/SQL report

    Hi,
    I've the PL/SQL report which can allow passing in the parameter, i use '&'.
    the report is given to the end user who do not have the IDE for PL/SQL. the machanism of the report is generated into the spool file and import into excel format.
    now i am wondering how to create a tool using SQL or PL/SQL to allow the end user to choose the parameter(s) dynamically and passing into the PL/SQL to generate the report based on the input selected.
    the parameters like below:
    package code :
    week no :
    year :
    department :
    all the above parameters, the data would be selected from the existing lookup table. the user is allow to select more than 1 input for specified parameter for instance i want to spool report for week 1 until week 5.
    pls advise any solution on this topic. thanks

    hi scoot,
    thank for reply.
    yep, i'm using sql*plus and also sql navigator 4.0 .
    the user don't have the software to interact. i'm thinking of build an simple interface using VB and passing in the parameter then initiate the sql*plus to run the program in background mode.
    but if you have any other solution which not need to use other software to wirte such program , pls let me know immediately. thank

  • Running report with alv grid in background and exporting to excel

    Hi Guys,
                  I've created a report program that uses the alv grid. When I run the report in foreground, I can easily export it to excel. However, if I run it in background, then display the spooled report and try to export to excel, it does not put it in excel format (seems to go over as one big column rather than individual columns that are defined in the report). Is there a way to run it in background ,export to excel properly and i have to email also in Excel sheet format.?
    Thanks,
    Gopi.

    In background u cannot do a download to excel. you can do is create CSV format file
    or
    write a report for output with tabs then call that report using
      submit yXXXX exporting list to memory
               and return.
      call function 'LIST_FROM_MEMORY'
        tables
          listobject = report_list
        exceptions
          not_found  = 1
          others     = 2.
    and send the report_list to email users

  • [Report][PDF] Shrink to fit in a page

    Hi,
    I use the traditional method to output the ABAP spool report as a PDF inside a BSP Page.
    But, I encounter a <b>print problem</b> since the report is very large (the LINE-SIZE of the report is 265) and <b>it does not entirely fit into 1 page</b>.
    Is this possible to change the parameters ?
    For information I use :
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
    *   layout                 = 'X_PAPER'
        layout                 = 'X_LANDSCAPE'
        line_count             = 65
        line_size              = 265
        no_dialog              = 'X'
      IMPORTING
        out_parameters         = print_parameters
    *   out_archive_parameters = arcpar
        valid                  = val
      EXCEPTIONS
        archive_info_not_found = 1
        invalid_print_params   = 2
        invalid_archive_params = 3
        OTHERS                 = 4.
    Then:
      SUBMIT (report_name) USING SELECTION-SET variant
                           TO SAP-SPOOL
                           SPOOL PARAMETERS print_parameters
                           WITHOUT SPOOL DYNPRO
                           AND RETURN.
    And, finally:
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
        EXPORTING
          src_spoolid              = w_spono
        IMPORTING
          pdf_bytecount            = w_bytecount
        TABLES
          pdf                      = wt_pdf.
    <b>Which call should I modify, and how ?</b>
    Thanks in advance.
    Best regards,
    Guillaume
    Message was edited by: Guillaume Garcia

    Hai Check the following Code
    REPORT Z_ABAPOUTPUT_PDF.
    data: w_ident     like tsp01-rqident,
          w_doctype   like tsp01-rqdoctype,
          w_bytecount type i.
    data: itab_pdf    like tline occurs 0 with header line.
    parameter spoolnum like tsp01-rqident obligatory.
    selection-screen begin of block a2 with frame.
    parameters:  to_pc   radiobutton group a2 default 'X',
                 pcfile like rlgrap-filename lower case,
                 to_unix radiobutton group a2,
                 unixfile(255) lower case.
    selection-screen end of block a2.
    at selection-screen on block a2.
      if to_pc = 'X' and pcfile is initial.
        message e398(00) with 'Enter PC File Name.'.
      elseif to_unix = 'X' and unixfile is initial.
        message e398(00) with 'Enter Unix File Name.'.
      endif.
    at selection-screen on spoolnum.
      select single rqident rqdoctype
             into (w_ident, w_doctype)
             from tsp01
             where rqident = spoolnum.
      if sy-subrc ne 0.
        message e398(00) with 'Spool' spoolnum 'not found'.
      endif.
    at selection-screen on value-request for pcfile.
      call function 'WS_FILENAME_GET'
           exporting
                mask     = ',.,..'
           importing
                filename = pcfile
           exceptions
                others   = 1.
      if sy-subrc <> 0.
        message id sy-msgid type 'I' number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    start-of-selection.
      if w_doctype = 'LIST'.
        perform get_abap_spool_in_pdf.
      elseif w_doctype = 'OTF'.
        perform get_otf_spool_in_pdf.
      endif.
      if to_pc = 'X'.
        perform write_pdf_spool_to_pc.
      else.
        perform write_pdf_spool_to_unix.
      endif.
      message i398(00) with 'Completed OK'.
    form get_abap_spool_in_pdf.
      refresh itab_pdf.
      call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
           exporting
                src_spoolid              = w_ident
           importing
                pdf_bytecount            = w_bytecount
           tables
                pdf                      = itab_pdf
           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.
      if sy-subrc ne 0.
        message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.
      endif.
    endform.
    form get_otf_spool_in_pdf.
      refresh itab_pdf.
      call function 'CONVERT_OTFSPOOLJOB_2_PDF'
           exporting
                src_spoolid              = w_ident
           importing
                pdf_bytecount            = w_bytecount
           tables
                pdf                      = itab_pdf
           exceptions
                err_no_otf_spooljob      = 1
                err_no_spooljob          = 2
                err_no_permission        = 3
                err_conv_not_possible    = 4
                err_bad_dstdevice        = 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.
      if sy-subrc <> 0.
        message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.
      endif.
    endform.
    form write_pdf_spool_to_unix.
      open dataset unixfile for output in binary mode.
      if sy-subrc ne 0 .
        message e398(00) with 'Cannot open unix file for output:' unixfile.
      endif.
      loop at itab_pdf.
        transfer itab_pdf to unixfile.
        if sy-subrc ne 0 .
          message e398(00) with 'Cannot write to unix file:' unixfile.
        endif.
      endloop.
      close dataset unixfile.
    endform.
    form write_pdf_spool_to_pc.
      call function 'WS_DOWNLOAD'
           exporting
                bin_filesize            = w_bytecount
                filename                = pcfile
                filetype                = 'BIN'
           tables
                data_tab                = itab_pdf
           exceptions
                file_open_error         = 1
                file_write_error        = 2
                invalid_filesize        = 3
                invalid_type            = 4
                no_batch                = 5
                unknown_error           = 6
                invalid_table_width     = 7
                gui_refuse_filetransfer = 8
                customer_error          = 9
                others                  = 10.
      if sy-subrc <> 0.
        message e398(00) with 'Cannot download to PC. Error =' sy-subrc.
      endif.
    endform.
    Thanks & regards
    Sreenivasulu P

  • @ generating Spools/PDF's with landscape

    Hi,
    I need to generate a PDf frm a spool report. But the Column headings exceed the stad Spool widht. Is there any work around for this? Similar to Landscape in normal PDF's?

    Hi Anand,
    Chk the sample report
    REPORT ZSEND_SMARTFORMS .
    Internal Table declarations
    DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
    i_tline TYPE TABLE OF tline WITH HEADER LINE,
    i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
    i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    Objects to send mail.
    i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
    i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
    Work Area declarations
    wa_objhead TYPE soli_tab,
    w_ctrlop TYPE ssfctrlop,
    w_compop TYPE ssfcompop,
    w_return TYPE ssfcrescl,
    wa_doc_chng typE sodocchgi1,
    w_data TYPE sodocchgi1,
    wa_buffer TYPE string,"To convert from 132 to 255
    Variables declarations
    v_form_name TYPE rs38l_fnam,
    v_len_in LIKE sood-objlen,
    v_len_out LIKE sood-objlen,
    v_len_outn TYPE i,
    v_lines_txt TYPE i,
    v_lines_bin TYPE i.
    call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZZZ_TEST1'
    importing
    fm_name = v_form_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.
    w_ctrlop-getotf = 'X'.
    w_ctrlop-no_dialog = 'X'.
    w_compop-tdnoprev = 'X'.
    CALL FUNCTION v_form_name
    EXPORTING
    control_parameters = w_ctrlop
    output_options = w_compop
    user_settings = 'X'
    IMPORTING
    job_output_info = w_return
    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.
    i_otf[] = w_return-otfdata[].
    call function 'CONVERT_OTF'
    EXPORTING
    format = 'PDF'
    max_linewidth = 132
    IMPORTING
    bin_filesize = v_len_in
    TABLES
    otf = i_otf
    lines = i_tline
    EXCEPTIONS
    err_max_linewidth = 1
    err_format = 2
    err_conv_not_possible = 3
    others = 4.
    Fehlerhandling
    if sy-subrc <> 0.
    endif.
    loop at i_tline.
    translate i_tline using '~'.
    concatenate wa_buffer i_tline into wa_buffer.
    endloop.
    translate wa_buffer using '~'.
    do.
    i_record = wa_buffer.
    append i_record.
    shift wa_buffer left by 255 places.
    if wa_buffer is initial.
    exit.
    endif.
    enddo.
    Attachment
    refresh:
    i_reclist,
    i_objtxt,
    i_objbin,
    i_objpack.
    clear wa_objhead.
    i_objbin[] = i_record[].
    Create Message Body
    Title and Description
    i_objtxt = 'test with pdf-Attachment!'.
    append i_objtxt.
    describe table i_objtxt lines v_lines_txt.
    read table i_objtxt index v_lines_txt.
    wa_doc_chng-obj_name = 'smartform'.
    wa_doc_chng-expiry_dat = sy-datum + 10.
    wa_doc_chng-obj_descr = 'smartform'.
    wa_doc_chng-sensitivty = 'F'.
    wa_doc_chng-doc_size = v_lines_txt * 255.
    Main Text
    wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
    clear i_objpack-transf_bin.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    i_objpack-body_num = v_lines_txt.
    i_objpack-doc_type = 'RAW'.
    append i_objpack.
    Attachment
    (pdf-Attachment)
    i_objpack-transf_bin = 'X'.
    i_objpack-head_start = 1.
    i_objpack-head_num = 0.
    i_objpack-body_start = 1.
    Länge des Attachment ermitteln
    describe table i_objbin lines v_lines_bin.
    read table i_objbin index v_lines_bin.
    i_objpack-doc_size = v_lines_bin * 255 .
    i_objpack-body_num = v_lines_bin.
    i_objpack-doc_type = 'PDF'.
    i_objpack-obj_name = 'smart'.
    i_objpack-obj_descr = 'test'.
    append i_objpack.
    clear i_reclist.
    i_reclist-receiver = '[email protected]'.
    i_reclist-rec_type = 'U'.
    append i_reclist.
    call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
    EXPORTING
    document_data = wa_doc_chng
    put_in_outbox = 'X'
    TABLES
    packing_list = i_objpack
    object_header = wa_objhead
    CONTENTS_BIN = i_objbin
    contents_txt = i_objtxt
    receivers = i_reclist
    EXCEPTIONS
    too_many_receivers = 1
    document_not_sent = 2
    document_type_not_exist = 3
    operation_no_authorization = 4
    parameter_error = 5
    x_error = 6
    enqueue_error = 7
    others = 8.
    Reward Points if Useful
    Regards
    Gokul

Maybe you are looking for

  • Account-based COPA and having Cost Center as Real Object in Sales Order

    Hi, We have recently activated account-based COPA and in our SO, we realized the Profitability Segment being populated- that is not a problem in normal scenarios. However, in some cases, we would like to charge to a cost center instead of COPA. We ha

  • Swf slideshow not working with 11.7.700.169

    Adobe Flash player automatically upgraded to version 11.7.700.169 and I found out today that my slideshow with swf extension are not running anymore. It is showing the first image but then stops and does not continue with the next image. The audio is

  • Using custom class loaders with DefaultCacheServer

    Hello, Is it possible for the DefaultCacheServer to use the class loader specified when a named cache is initially created (e.g. CacheFactory.getCache(cacheName, classLoader))? We would like our application to allow cached objects to be customized an

  • Hp Dv5-2045

    Hi Im currrently a college student and am life line of a computer went to a black screen then when I restarted it the bsod popped up. so I reran windows 7 recovery disks on the computer and it worked for about a month. then bsod came again. so I trie

  • Title Slate Workspace Will NOT Expand, Can Ya Help?

    Hey everyone, we've tried and clicked everything to get this Title Slate screen to expand so we can type and create titles. But it's just stuck in the corner. Check it out here: https://s3.amazonaws.com/RickyBreslin/TitleSlate.jpg The thing won't EXP