Offset in exported spool file

Hi there,
I built a report which exports spool files in Excel or TXT files as described here:
http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
I the converted file I now get an offset in some lines which I cannot explain. It is not in the spool list if I look on the spool list output in transaction SP01.
As far as I could analyze it, it happens within the function module SO_RAW_TO_RTF or SCMS_STRING_TO_XSTRING.
Has anybody an idea what the reason could be?
Thanks in advance and regards,
Martin

Yes, Its Done.
I was doing spooling using Unix.
And checking the database using SQL.
Both were diffrent instance.
I have log in to the Unix instance using sqlplus.
Then i have check the table.
The table was containing duplicate rows there.
i have commited database on both instance.
Now its ok.

Similar Messages

  • How to export spool file into HTML file

    Hi,
    I have one Oracle procedure which meets our business requirement. I am keeping the output data into a log file and I am sharing that log file to the users.
    Sample Code:
    spool path\logile.log
    declare
    begin
    dbms_output.Put_line('output will come here');
    end;
    Now I want to spool the same output data into a HTML file and need to share with the users.
    Can any one please guide me, how to export our spool data into HTML format?
    Thanks in advance.

    Hello 909127,
    welcome to the forum.
    This is the forum for the tool Oracle Reports, not a general forum for reporting. Your question might be better posted in {forum:id=75} or {forum:id=144}.
    Nevertheless you need to give us more information, how your output looks like now and what you expect in HTML.
    Regards
    Marcus

  • Can a spool file be sent as an attachment in the decision step?

    Hi,
    I have z program that runs in background and produces a spool file. Normally, I can use tcode SP01 to display this file. At the end of this z program, I call SWW_WI_START_SIMPLE to send a workflow into SAP inbox. I want to know if I somhow can send the spool file along also? I read about attachment and SOFM object but still can't figure out what I need to do yet. Please help.
    Thank you,
    TH

    Hi Th,
    Check this code if helpful.
    FORM pdf_conversion.
      CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
           EXPORTING
                src_spoolid              = spoolno
                no_dialog                = ' '
           IMPORTING
                pdf_bytecount            = numbytes
                pdf_spoolid              = pdfspoolid
                btc_jobname              = jobname
                btc_jobcount             = jobcount
           TABLES
                pdf                      = 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.
    ENDFORM.                    " PDF_CONVERSION
          FORM SPOOL                                                    *
    FORM spool.
      PERFORM display.
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
               destination            = 'LOCL'
                immediately            = ' '
                new_list_id            = 'X'
                expiration             = '9'
                in_parameters          = p_pripar
                layout                 = 'X_65_132'
                line_count             = 65
                line_size              = 132
                mode                   = 'DEFVALS'
                no_dialog              = 'X'
           IMPORTING
                out_parameters         = p_pripar
                valid                  = val
           EXCEPTIONS
                archive_info_not_found = 1
                invalid_print_params   = 2
                invalid_archive_params = 3
                OTHERS                 = 4.
      NEW-PAGE PRINT ON NEW-SECTION PARAMETERS p_pripar NO DIALOG.
      PERFORM display.
      NEW-PAGE PRINT OFF.
      CLEAR t_filename_tx.
      CONCATENATE 'c:\temp\' p_mat '.pdf' INTO t_filename_tx.
      CONDENSE t_filename_tx.
      SELECT * FROM tsp01 INTO TABLE t_tsp01
           WHERE rqowner EQ sy-uname.
      SORT t_tsp01  BY rqcretime DESCENDING.
      LOOP AT t_tsp01.
        spoolno = t_tsp01-rqident.
        EXIT.
      ENDLOOP.
      IF sy-subrc EQ 0.
        PERFORM pdf_conversion.
      ENDIF.
    sending that inernal to mail
    FUNCTION z_p_traveler_workflow.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(V_FILE_PATH) LIKE  RLGRAP-FILENAME
    *"     REFERENCE(DOKNR) LIKE  CRVD_A-DOKNR
    *"     REFERENCE(DOKVR) LIKE  CRVD_A-DOKVR
    *"  TABLES
    *"      PDF STRUCTURE  TLINE
    D A T A
      DATA: w_gd_doc_data LIKE sodocchgi1.
    internal table for body content of the email
      DATA: t_message LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    internal table for receivers of email
      DATA: t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
    internal table for attachment data
      DATA: t_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
    *internal table for Information about structure of data tables
      DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
    internal tables for attachment data
      DATA: t_xi_pdf LIKE tline OCCURS 0  WITH HEADER LINE,
            t_xi_temp LIKE bapiqcmime OCCURS 0  WITH HEADER LINE,
            t_xi_mime(255) TYPE c OCCURS 0  WITH HEADER LINE,
            t_html LIKE solisti1   OCCURS 0  WITH HEADER LINE.
    for splitting of the filepath
      DATA : BEGIN OF t_split OCCURS 0,
                row(50),
             END OF t_split.
      DATA:  w_tab_lines LIKE sy-tabix,
             w_subject TYPE so_obj_des,                " for email header
             w_file_path1 TYPE string.                 "file path
      DATA : w_lines       TYPE i,
             w_temp(500)   TYPE c,
             w_offset      TYPE p,
             w_lineslen(2) TYPE p,
             w_mimelen(2)  TYPE p,
             w_tabix       LIKE sy-tabix.
      DATA : w_len      TYPE i,
             w_index    LIKE sy-index,
             w_doc_type TYPE  so_obj_tp,
             w_filename TYPE  so_obj_des .
    internal table for gettting personal numbers of quality engineers
      DATA: BEGIN OF t_ztptwf2 OCCURS 0,
            pernr LIKE ztptwf2-pernr,        "personal number
            END OF t_ztptwf2.
    internal table for gettting userids of quality engineers
      DATA: BEGIN OF t_pa0105 OCCURS 0,
            usrid LIKE pa0105-usrid,       " user id of the quality engineer
            END OF t_pa0105.
    move file path to w_file_path
      w_file_path1 = v_file_path.
    *assign subject of the email
      w_subject = text-006.                  "Travaler Document to Approve
    refreshing the internal tables
      REFRESH : t_objbin, t_packing_list, t_split.
      CLEAR   : t_objbin, t_packing_list, t_split.
      CLEAR   : t_xi_pdf, t_xi_temp.
      REFRESH : t_xi_pdf, t_xi_temp.
      CLEAR: w_temp, w_offset, t_xi_temp.
    move attachment data to t_xi_pdf[].
      t_xi_pdf[] = pdf[].
    Reformat the line to 255 characters wide
      DESCRIBE TABLE t_xi_pdf   LINES  w_lines.
      DESCRIBE FIELD t_xi_pdf   LENGTH w_lineslen.
      DESCRIBE FIELD t_xi_temp  LENGTH w_mimelen.
      LOOP AT t_xi_pdf.
        w_tabix = sy-tabix.
        MOVE t_xi_pdf TO w_temp+w_offset.
        IF w_tabix = w_lines.
          w_lineslen = strlen( t_xi_pdf ).
        ENDIF.
        w_offset = w_offset + w_lineslen.
        IF w_offset GE w_mimelen.
          CLEAR t_xi_temp.
          t_xi_temp = w_temp(w_mimelen).
          APPEND t_xi_temp.
          SHIFT w_temp BY w_mimelen PLACES.
          w_offset = w_offset - w_mimelen.
        ENDIF.
        IF w_tabix = w_lines.
          IF w_offset GT 0.
            CLEAR t_xi_temp.
            t_xi_temp = w_temp(w_offset).
            APPEND t_xi_temp.
          ENDIF.
        ENDIF.
      ENDLOOP.
    *move data from t_xi_temp to t_xi_mime
      LOOP AT t_xi_temp.
        t_xi_mime(255) = t_xi_temp-line.
        APPEND t_xi_mime.
        CLEAR  t_xi_mime.
      ENDLOOP.
    *move data from t_xi_mime[] to t_html[]
      t_html[] = t_xi_mime[].
    *move data from t_html[] to t_objbin.
      LOOP AT t_html.
        t_objbin-line = t_html-line.
        APPEND t_objbin.
        CLEAR t_objbin.
      ENDLOOP.
    *fill the body of email
      t_message = text-005.                        "Mail with PDF attachment
      APPEND t_message.
      CLEAR t_message.
      t_message = text-004.    "Please double click the attachment to verify
      APPEND t_message.
      CLEAR t_message.
      concatenate 'COPY FOR VIEWING ONLY-NOT TO BE'
              'USED/PRINTED FOR PRODUCTION' into t_message separated by
    space.
      APPEND t_message.
      CLEAR t_message.
      IF NOT doknr IS INITIAL.
        CONCATENATE text-001                     "The Document
                    doknr
                    text-002                     "and Version
                    dokvr
                    text-003 INTO                "is changed
                t_message SEPARATED BY space.
        APPEND t_message.
        CLEAR t_message.
      ENDIF.
      DESCRIBE TABLE t_message LINES w_tab_lines.
      READ     TABLE t_message INDEX w_tab_lines.
      w_gd_doc_data-doc_size = ( w_tab_lines - 1 ) *
                                               255 + STRLEN( t_message ).
      w_gd_doc_data-obj_langu  = sy-langu.
      w_gd_doc_data-obj_name   = 'SENDFILE'.
      w_gd_doc_data-obj_descr  = w_subject.
      w_gd_doc_data-sensitivty = 'O'.
      CLEAR t_packing_list.
      t_packing_list-head_start = 1.
      t_packing_list-head_num   = 0.
      t_packing_list-body_start = 1.
      t_packing_list-doc_type   = 'RAW'.
      t_packing_list-body_num   = w_tab_lines.
      APPEND t_packing_list.
      IF NOT w_file_path1 IS INITIAL.
        w_len = strlen( w_file_path1 ) - 3.
        w_doc_type = w_file_path1+w_len(3) .
        TRANSLATE w_doc_type TO UPPER CASE .
        SPLIT w_file_path1 AT '\' INTO TABLE t_split .
        DESCRIBE TABLE t_split LINES w_index .
        READ TABLE t_split INDEX w_index .
        w_filename = t_split-row .
        w_len = strlen( w_filename ) - 4.
        w_filename = w_filename(w_len) .
        DESCRIBE TABLE t_objbin LINES w_tab_lines.
        t_packing_list-transf_bin = 'X'.
        t_packing_list-head_start = 1.
        t_packing_list-head_num   = 1.
        t_packing_list-body_start = 1.
        t_packing_list-doc_type   = w_doc_type.
        t_packing_list-body_num   = w_tab_lines.
        t_packing_list-doc_size   = w_tab_lines * 255.
        t_packing_list-obj_descr  = w_filename.
        APPEND t_packing_list.
      ENDIF.
    fill the Receivers
      SELECT * FROM ztptwf2 INTO TABLE t_ztptwf2.
      IF NOT t_ztptwf2[] IS INITIAL.
        SELECT usrid FROM pa0105 INTO TABLE t_pa0105 FOR ALL ENTRIES IN
      t_ztptwf2 WHERE pernr = t_ztptwf2-pernr AND subty = '0001' .
        LOOP AT t_pa0105.
          t_receivers-receiver = t_pa0105-usrid.
          t_receivers-rec_type = 'B'.
          APPEND t_receivers .
          CLEAR t_receivers.
        ENDLOOP.
      ENDIF.
      IF  NOT t_receivers[] IS INITIAL.
    Call the FM to post the message to SAPMAIL
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
             EXPORTING
                  document_data              = w_gd_doc_data
                  commit_work                = 'X'
             TABLES
                  packing_list               = t_packing_list
                  contents_txt               = t_message
                  contents_bin               = t_objbin
                  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.
      ENDIF.
      FREE: t_objbin,t_message,t_packing_list,t_receivers.
    i hope this code will solve your problem.
    Sankar

  • Naming for Export dmp file in Date and Time

    Dear All,
    Please advise me how to give the file name in date and time stamp for the export dmp file and it's log file.Suggest me in Oracle 9i version.
    for example the file name get like this 020420041155.dmp and 020420041155.log where date and time are 02/04/2004 11:55 respectively...
    Kindly let me know the syntax of filename to be given along with the EXP command..
    Thanking You,
    Ragesh

    Hello
    I don't think you can get the exp command to automatically name an export for you. The only way I think you would be able to do it is through a shell script or something where you format the file name yourself and pass it to exp. If you wanted to you could generate the command line through a SQL statement and then spool it out to a file i.e.
    spool runexp.bat
    select 'exp user/pwd@tns file='||TO_CHAR(SYSDATE,'DDMMYYYYHH24MI')||'.dmp tables=(table1,table2)' from dual;
    spool offThe second option isn't as flexible as the first but if it's just a couple of exports you have to do, it will probably prove to be less work
    HTH
    David

  • How to send generated Spool file through e-mail

    Hi,
    We have a ABAP report which generates a spool file. Now there is a requirement to send this spool file to our clients external mail boxes.
    Also we would like to automate this so that whenever a spool file is generated, the system should automatically send it as an attachment to user mail inboxes.
    Any idea how I can achieve this. Thanks is advance!
    Regards,
    Vikrant.

    Hi Vikrant,
       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.
    Regards,
    Santosh

  • Script to export Security file using maxl script

    can anyone provide me the Script to export Security file using maxl script.It should create a log file and a batch file should also be there to schedule the Maxl script.Please help me with this

    Hi,
    You can use something like
    [b]login admin password on localhost;
    [b]spool on to 'c:\temp\log.txt';
    [b]export security_file to data_file C:\temp\sec_file.txt;
    [b]spool off;
    [b]logout;
    Then you can have a batch file that just calls the maxl script
    essmsh name_of_maxl_script.mxl
    The batch script can then be scheduled.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Output different with the spool file

    Hi friends,
    I have using this Tcode : S_ALR_87012301 to print GL account balances.
    once executed, the system display correct information.
    but once printed, in spool file, instead of showing the name of the company , the system displayed the environment e.g Production. If we try to print in DEV, the system will display Development.
    Your advice is highly appreciated.

    Celtic Mom
    Welcome to the Apple user to user discussion forums
    While I was organizing my photos, I realized there are about 30 or so photos that have the same exact file name as another photo. Example: There are two IMG_1243.jpg, but they are different pictures. They were taken at different times, even different years. I have used more than one camera to import photos. I have changed the name of one of the photos in the Title area in the information section of iPhoto. When I try to put the newly named photo into a folder that has the other IMG_1243, I get a message that says" An older item named "IMG_1243" already exists. Do you want to replace it with the newer one you are moving?"
    I want to have both IMG_1243.jpg photos in the same folder. How can I do this? Also, I have a few thousand pictures, so how can I tell exactly how many photos have the same file name as another photo?
    It sounds like you are using the finder inside the iPhoto library - do not do that - you will corrupt your library and lose the edits, keywords, etc that you have
    iPhoto does not care about duplicate file names - it handles it fine
    changing the title of a photo does not affect the file name - although when you export the photo you can use the title for the file name as an option
    What are you doing and what do you want to accomplish?
    Remember do not ever make any changes in the iPhoto library using the finder or any other program
    LN

  • Create  multiple spool files

    Hi All,
    Is it possible to create a mutiple spool files which contains different data from the abap program at once.
    Please let me know your thoughts.
    Thanks & Regards
    Santhosh

    If you execute the program in BACKGROUND, it will automatically create spool.
    ONLINE EXECUTION: you need to write your statements to be taken to spool within NEW_PAGE PRINT ON & OFF.
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
           EXPORTING
                COVER_PAGE          = WC_X
                DESTINATION            = <Printer Name>
                EXPIRATION              = 2
                IMMEDIATELY           = SPACE
                LAYOUT                   = 'X_65_255'
                LINE_COUNT             = 65
                LINE_SIZE                = 255
                LIST_NAME              = <LIST_NAME>
                LIST_TEXT              = <SPOOL_TITLE>
                *NEW_LIST_ID            = WC_X*    "New Spool
                NO_DIALOG              = WC_X
                SAP_COVER_PAGE  = WC_X
           IMPORTING
                OUT_PARAMETERS    = WA_PRINT_PARA
                VALID                          = WS_VALID
           EXCEPTIONS
                ARCHIVE_INFO_NOT_FOUND = 1
                INVALID_PRINT_PARAMS   = 2
                INVALID_ARCHIVE_PARAMS = 3
                OTHERS                 = 4.
      IF WS_VALID <> SPACE AND SY-SUBRC EQ 0.
        NEW-PAGE PRINT ON PARAMETERS WA_PRINT_PARA NO DIALOG.
        PERFORM DISPLAY_REPORT. "Write Statements
        NEW-PAGE PRINT OFF.
    endif.
    Reward if useful.

  • Export text files

    Hi
    I need to export text files delimited by '|', but our data is very large, i want to know if i can use some database utility.
    would you help me with this problem ?
    Felix Ramirez.

    The quickest and easiest approach is to use SQL*Plus.
    spool "someFile.txt"
    SELECT col1 || '|' || col2 || '|' || col3
      FROM someTablewill generate a pipe-delimited text file called someFile.txt. Depending on the size of your data and the nature of the query (i.e. do you need to do this with a bunch of different queries), and the timing constraints, you could also write a simple JDBC or OCI application to dump the data. I seem to recall Tom Kyte having a script on asktom.oracle.com that will use utl_file to dump a delimited text file, but that's going to be the slowest option.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Programmatically reading and processing a spool file

    Hello,
    I would like to read and process a spool file generated by a background job in my ABAP program.
    Can anyone advise if this is possible in SAP and if so, the best way to do this?
    The only information I will have in my program is the job name and the date on which the job was run. I then need to find the corresponding spool and read this into an internal table.
    Any ideas on how to do this would be appreciated.
    Thanks,
    Ruby

    DATA : it_spool      TYPE STANDARD TABLE OF rsporq    .
    *&      Form  find_spool_request_id
    FORM find_spool_request_id.
      CALL FUNCTION 'RSPO_FIND_SPOOL_REQUESTS'
        EXPORTING
          allclients          = '320'
          datatype            = '*'
          has_output_requests = '*'
          rq0name             = nast-dsnam
          rq1name             = '*'
          rq2name             = '*'
          rqdest              = 'LOCL'
          rqowner             = sy-uname
        TABLES
          spoolrequests       = it_spool
        EXCEPTIONS
          no_permission       = 1
          OTHERS              = 2.
      IF sy-subrc <> 0.
        MESSAGE i000 DISPLAY LIKE 'E' WITH text-002.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " find_spool_request_id
    READ TABLE it_spool INTO wa_spool INDEX 1.
      v_spoolno = wa_spool-rqident.
    *Get Spool request attributes
      SELECT SINGLE *
        FROM tsp01
        INTO tsp01
        WHERE rqident EQ v_spoolno.
    Edited by: K.Manas on Jan 7, 2011 6:22 AM

  • Spool files and Adobe Files in SAP

    Hi,
    Is there away to be able to see spool files and adobe pdf files , using the same screen, Ie go through and view some normal sap spools and then view adobe files from a url?
    Many thanks

    You can see this sample driver program which use ADOBE form.
    You need to specify your function module name instead of (CALL FUNCTION '/1BCDWB/SM00000043') mentioned in this program. The function module is generated when you activate your Adobe form.
    sample code :
    DATA : is_customer TYPE scustom.
    DATA : it_bookings TYPE ty_bookings.
    DATA : iv_image_url TYPE string.
    DATA : iv_sending_country TYPE adrc-country.
    DATA : it_sums TYPE TABLE OF flprice_t.
    DATA : docparams TYPE sfpdocparams.
    DATA : formoutput TYPE fpformoutput.
    DATA : outputparams TYPE sfpoutputparams.
    PARAMETERS : pa_cusid TYPE scustom-id.
    SELECT SINGLE * FROM scustom INTO is_customer
    WHERE id = pa_cusid.
    SELECT * FROM sbook
    INTO CORRESPONDING FIELDS OF TABLE it_bookings
    WHERE customid = pa_cusid.
    outputparams-nodialog = 'X'.
    outputparams-getpdf = 'X'.
    *outputparams-adstrlevel = '02'.
    CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
    ie_outputparams = outputparams
    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.
    docparams-langu = 'E'.
    docparams-country = 'US'.
    docparams-fillable = 'X'.
    CALL FUNCTION '/1BCDWB/SM00000043'
    EXPORTING
    /1bcdwb/docparams = docparams
    is_customer = is_customer
    it_bookings = it_bookings
    IV_IMAGE_URL =
    iv_sending_country = 'US'
    IT_SUMS =
    IMPORTING
    /1bcdwb/formoutput = formoutput
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4
    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 'FP_JOB_CLOSE'
    IMPORTING
    E_RESULT =
    EXCEPTIONS
    usage_error = 1
    system_error = 2
    internal_error = 3
    OTHERS = 4
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Best Regards,
    Devesh

  • Spool file creating

    hi i am running a unix loop and in that creating a sql statement. now i want to spool the result to a file . but the problem is the spool file should have time as the name. loop runs after every 2 mins.
    while [ true ];
    do
    sudo su - BATPBL<<!
    sqlplus hr/hr<<!
    spool /ankur/ank_XXXX #XXXX should be the time
    select * from guard_usr order by guard_usr_id;
    spool off
    sleep 9
    done
    Please help

    You could implement in your spool project something like this :
    [oracle@g5 ~]$ sqlplus fas_admin
    SQL*Plus: Release 11.1.0.6.0 - Production on Mon May 18 11:27:25 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> !export DATE=$(date +"%m_%_d_%y %H:%M:%S")
    SQL> spool datefile.txt$DATE
    SQL> select me from you;
    select me from you
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> spool off;
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@g5 ~]$ ls -l datefile.txt*
    -rw-r--r-- 1 oracle oinstall 137 2009-05-18 11:28 datefile.txt05_18_09 11:23:39
    [oracle@g5 ~]$also you can visit http://en.wikipedia.org/wiki/Date_(Unix)

  • Deleting the spool files that has been generated

    Hi all, currently Im facing a problem when spool files are generated after executing a report program in background. I actually need the spool files to be deleted as soon as the printing has been completed and not to remain in the sp02 transation. The real issue is with the number of spool requests that remain in the sp02 when large number of files are be printed. Need your suggestion to delete the spools that got accumulated as soon as the printing is completed.

    Fill the print parameters RELEASE "Delete immediately after printing" (see [GET_PRINT_PARAMETERS|http://help.sap.com/abapdocu_70/en/ABENPRINT_PARAMETERS_FUNCTION.htm] and [Overview of All Print Parameters |http://help.sap.com/abapdocu_70/en/ABENPRINT_PARAMETERS_OVERVIEW.htm])
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
         EXPORTING
              no_dialog = 'X'
              release   = 'X'.
    Regards,
    Raymond

  • Spool file from cron

    Hi,
    I have the following script:
    #!/bin/ksh
    ORACLE_HOME=/u01/app/oracle/product/8.1.7
    export ORACLE_SID=portal
    DATE=`date +%m%d%y`
    TIME=`date +%H:%M:%S`
    /u01/app/oracle/product/8.1.7/bin/sqlplus -s /NOLOG <<-!! 2>&1
    WHENEVER SQLERROR EXIT 999
    WHENEVER OSERROR EXIT 998
    connect scott/tiger@portal
    set heading off
    set verify off
    set feedback off
    spool /export/home/oracle/test.log
    select to_char(sysdate,'DD-MM-YY:HH:MI') from dual;
    spool off
    --when I run this script manually, it creates the spool file, but when I run this script from cronjob it's not creating the spool file. what is the problem??
    -GK

    ORACLE_HOME=/u01/app/oracle/product/8.1.7this variable is not exported.
    If you are using the same Unix user to run the script manually and from cron, it could be an environment setting problem.
    Try to insert this line as the first line in the script :
    . $HOME/.profile

  • Downloading spool files FM

    Hello,
    Need your help with downloading 108 spool files.
    I have scheduled 108 jobs and now I have to download data of all these 108 spools into excel files (from various PRD systems).
    One way is I go to System -> List -> Save -> Local File.
    However I don't want to use this.
    Neither I have option to create program in SE38, as I don't have access to same.
    Please advice if theree is any standard program or function module which can help me in this.
    Will be very thankful.

    form download_selected tables lsporq type sp01r_tview
                           changing rs_selfield type slis_selfield.
      data: rqnum like sy-tabix,
            filename like rlgrap-filename,
            dw_rc type sy-subrc.     
      perform get_selected3 tables lsporq
                            using ' ' rs_selfield changing rqnum.
      if rqnum > 0.
        loop at lsporq where selected = 'X'.
          filename(3) = lsporq-sys.
          filename+3(10) = lsporq-rqid_char.
          filename+13(4) = '.TXT'.
          move-corresponding lsporq  to tsp01sys.
          call function 'RSPO_CHECK_OUTRQ_PERMISSION'
            exporting
              spoolreq = tsp01sys
              access   = 'DOWN'
            exceptions
              others   = 1.
          if sy-subrc  0.
            out_message ti.
          MESSAGE i059 WITH tsp01sys-rqident tsp01sys-sys.
          else.
            gprog = 'RSPO_DOWNLOAD_SPOOLJOB'.
            if lsporq-sys = sy-sysid.
              call function 'RSPO_DOWNLOAD_SPOOLJOB'
                exporting
                  id     = lsporq-rqident
                  fname  = filename
                exceptions
                  others = 1.
            else.
              call function 'RSPO_DOWNLOAD_SPOOLJOB'
                destination lsporq-sys
                exporting
                  id                    = lsporq-rqident
                  fname                 = filename
                exceptions
                  communication_failure = 102  message msg_text
                  system_failure        = 103  message msg_text
                  others                = 1.
            endif.
            dw_rc = sy-subrc.        
            out_rfc_message lsporq-sys ti.
          endif.
        endloop.
        if dw_rc = 0.             
          message s028.
        endif.                     
      endif.
    endform.                    "DOWNLOAD_SELECTED

Maybe you are looking for