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

Similar Messages

  • Can't overwrite files once sent as Mail attachments

    Apparently Mail claims a file once sent as an attachment and won't release it unless Mail is quit. Meaning you can't save over pdf's or jpegs once you email them. Puts a kink in my work flow. All day I see... can't create PDF, file is in use. No it's not! Any crafty work arounds out there? I could have sworn they fixed this in Snow Leapord. Thanks in advance.

    This is definitely a bug. Here is an other discussion:
    https://discussions.apple.com/message/23651809#23651809

  • I can not open files FH11, Is it because I have the trial version of Illustrator CC 2014?

    I can not open files FH11, Is it because I have the trial version of Illustrator CC 2014?

    FH support has been dropped in CS6.
    The FH plugin from tensai.co.uk should solve your problem.

  • Can't drop files from Downloads or Documents folder on the dock to any other Finder window

    I have been downloading some files and dragging/dropping them into another folder for the last 30 minutes or so. They're downloading to the default Downloads folder, and then I've been dragging them from that folder in the Dock, which opens like a fan, and dropping them into another folder (my Documents folder) in an open Finder window.
    All of a sudden, I can't drop files from the Downloads fan anywhere else. I also tested, and can't drop files from my Documents folder or my Screenshots folder, two other folders that are on the right side of my dock and open up like a fan.
    I can drag them, but when I hover over the folder that I want to drop them into, nothing happens. If I let go, they just stay in their original folder (the Downloads folder).
    So basically something happened with the folders on the right side of the dock that's not letting me drop the files anywhere else from the Dock. If I open the folders in their own Finder window, I can drag/drop just fine. It just won't let me do it from the Dock as I had been.
    Any ideas? I've tried restarting as well as sleeping/waking as I saw recommended on here, but no luck.

    Open Finder, press Option key, select Go > Library, open Preferences, delete com.apple.dock.plist and reboot

  • Can Xcelsius flash files be integrated also somewhere else keeping the automated updating?

    Hello all,
    I ask regarding the dashboard, i'm using Xcelsius, I was wondering if the flash reports can  be integrated also somewhere else keeping the automated updating? Which tool? Including the Objectives tool
    Thanks !
    mazin

    Hi Mazin,
    You can integrate your swf file on to any custom portal or SharePoint. Yes, you can still set it to refresh on load and get the updated data. It depends on the type of connection and from where you are pulling the data.
    Hope this helps. Incase you need more information, you might want to elaborate more on your requirement.
    Thanks,
    Amit

  • How can I spool file in SQL*Plus using sysdate as filename?

    Dear Oracle Experts,
    Would you help me to solve following problem?
    I want spool a file in SQL*Plus but using sysdate as filename.
    e.g. today is 30-Nov-1999
    then the filename is 19991130.lst
    tommorrow is 1-Dec-1999
    then the filename is 19991201.lst
    My e-mail address is [email protected]
    Thanks!!!
    Tony Sit
    null

    Tony Sit (guest) wrote:
    : Dear Oracle Experts,
    : Would you help me to solve following problem?
    : I want spool a file in SQL*Plus but using sysdate as filename.
    : e.g. today is 30-Nov-1999
    : then the filename is 19991130.lst
    : tommorrow is 1-Dec-1999
    : then the filename is 19991201.lst
    : My e-mail address is [email protected]
    : Thanks!!!
    : Tony Sit
    Tony, hi!
    Let you test this way:
    set ECHO OFF
    set TERMOUT OFF
    set FEEDBACK OFF
    set VERIFY OFF
    SET PAGESIZE 0
    SET LINESIZE 80
    SET HEADING OFF
    spool setout.sql
    SELECT 'SPOOL '

  • Can't open file - error "There was a problem reading the layer data.."

    I'm on a
    Mac Pro, 10.5.7
    PSCS3
    I have been sent a file (148MB) from a client via FTP that I can not open. The file was created on a PC, using PSCS3.
    I'm usually pretty good at troubling shooting but I have not seen this before.
    Any help, suggestions would welcomed.
    I get the following error messages: (see attached)

    It looks like the atttachement did not work
    Here are the error messages:
    First message:
    "There was a problem reading the layer data. Read the composite date instead?"
    Second Message:
    "Could not complete your request because the file is not compatiable with this version of Photoshop."

  • I can't access my inbox, sent or other folders. The only tab I can activate is "Compose".

    I'm guessing the home page for my email is not rendering properly.  While I'm here, is there a verizon email address I can use to report future problems to Verizon?
    Thanks.

    IS this the link you are using? https://mail.verizon.com/webmail/driver?nimlet=showmessages&view=emails First try clearing all cookies and temp files from your browser. If you are using Internet explorer try FireFox http://www.mozilla.org/en-US/firefox/new/ (or vice versa).
     1-800-VERIZON (1-800-837-4966
    If a forum member gives an answer you like, please give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem. Thanks !!!
    http://forums.verizon.com/t5/Verizon-net-Email/Fix-for-Missing-Inbox-sent-folders-etc-with-Internet-Explorer-11/m-p/647399

  • How can I share files between two users? or merge the user accounts

    my laptop came home from the shop with two user accounts -never noticed that before - and some files are in one user account, some in another. I want to share them so I can just use one account. I just upgraded to Lion, so that may be an issue. Best of all would be to merge the two accounts so I don't have to think about it- just like 2 weeks ago. As it is, I have to log into one account to use Quicken, and another to use iWork - else I cannot access the files

    Move the files to /Users/Shared/ and from there into the other account.
    (67841)

  • How can I convert files in Aperture to jpegs and keep the file large

    I want to upload files into istock photo and they must be as big as possible but in jpg format. I end up exporting tiny little things going from 8mb to 300kb. How can I do it? I even tried going into CS3 but that only allowed me to convert to tif. I would appreciate any help - especially if it is simple!

    Go to File >> Export >> Export Version(s)
    In the resulting dialog box you'll find a drop down called Export Preset with a list of presets. One of them is JPEG Original Size. That should do it for you.
    Also you can choose Edit at the bottom of the preset list and modify an existing preset or create a new custom preset.
    BTW: the reason you couldn't do it in Photoshop is that you need to convert it from 16bit to 8bit before you can save a JPEG. That command in Photoshop is under Image>>Mode.
    DLS

  • Can't copy files from iTunes to a folder on the desktop

    I posted this in the iTunes board and received no responses, so I'm wondering if it's more of an OS problem.
    I'm trying to clean up my iTunes library by taking out music I don't listen to that often. I created a folder on my desktop to store the music, should I decide to bring it back into iTunes in the future.
    When I select certain groups of songs and drag them onto the folder, they refuse to copy. Some copy no problem, but others just won't go in the folder. The green circle with the plus sign comes up and the folder is highlighted, but when I release the mouse button...nothing.
    Any idea why I can't copy the songs? BTW, none of the music is from the iTunes store, so it's not protected.
    1.5 Powerbook G4   Mac OS X (10.4.8)  

    I run into that problem periodically. Usually it is because one song file has the same title as another song file (for instance, Knockin' on Heavens door, one by Dylan and one by Clapton, would cause the copy failure). While iTunes has no difficulty, the Finder does, refusing to copy two "identical" items to the same location. Copy in smaller batches, so you can eyeball and make sure each item has a different name. When you run into duplicate names, copy one to another folder and rename it (I append the artist's initials), then move it into your other folder.
    Francine
    Francine
    Schwieder

  • Itunes can't locate files after I listen to it on the Ipod

    It seems that every time I listen to a song, I notice that Itunes can't locate it anymore. When I go to Itunes and look in my music folder, there is an exclamation point next to the song. When I click on it, the error message reads "cannot locate file, would you like to locate it now". At first it was only one or two songs, now it's over 50! These songs are still on my Ipod,just no longer in Itunes. I know how to recover the music b/c it's in my hard drive, I just don't want to sit there and find all these songs all over again. Help please.

    I too have been having the same problem... I am a new ipod owner and same with itunes. And being a new owner and user I got the new itunes. It has done the exclimation point since the first day I got it. But mine is simple to fix. I mearly just exit out of itunes and re-open it. I dont evn have to wait at all. It shows the exclimation point with about 20 of my songs and it hasnt gotten in my way yet. But the main problem that makes me mad is that my ipod is only 2 weeks old but I tried to get some of my friends music and she has the older version of itunes and my ipod ONLY works on the new version. Very frustrating if you ask me.
    Hp   Windows XP  

  • Can't move files from my external hard drive to the desktop?

    Hi folks, for some reason I am unable to copy files (irrespective of type) from my usb 2 external hard drive to my desktop. This is only a recent thing. Up until a few days ago I was able to transfer files back and forth without problem. Now it is only possible to move unto the harddrive and not the other way around. The harddrive is formatted in Mac OS Extended (journaled). I have tried running disk utility to repair the disc on both external and internal drives, and it advises me that no repairs were necessary. I have also checked the info and read and write is permitted and none of the files are locked. When I attempt drag a file off the harddrive to the desktop the cursor turns into a stop sign (circle with line through it). If I attempt to copy and paste, the file copies and then will not paste as "paste" does not appear in the contextual menu. I have had some limited success by dragging files off the external hard drive to the trash and then dragging then back out of trash unto the desktop. But this only seems to work sometimes?
    It would be great if someone could suggest a reason and solution for this. Thank you in advance.
    Jono

    Sure sounds like permissions are goofed up somewhere. You weren't really clear about exactly what you had checked. Since you can copy TO the drive let's assume things are OK there. How about your Desktop folder? Did you check it with GetInfo to make sure you are the owner and have read and write permissions to the Desktop folder? I have seen these get messed up before.
    Francine
    Francine
    Schwieder

  • Problem sharing and/or accessing files on the Cloud -- I can't access files after I have put them on the Cloud. Help!

    Hi -- I have files on my cloud, but can't get sharing to work so that my boss can access them.  The only thing that works is if he signs in under my username and PW (seems counter-productive).  Even then, he can only SEE the files, and cannot do anything with them... I have added him as a user on my cloud... not sure what I am/we are doing wrong.

    The file collaboration tutorial is available here Sync and share your files with collaborators | Adobe Creative Cloud Tutorials.
    From the Files page at https://creative.adobe.com/files you can either publicly share a file / folder (using the Send Link option) or you can privately collaboration (using Collaboration option).

  • IMOVIE 10.0.2 - Shared it via file then sent that to my iPhone ; the 13ses movie is OUT OF FOCUS ! HELP

    IMOVIE 10.0.2 - I created a short movie and sharing it via file then sending it to my phone ! however once my iPhone receives it and I watch the movie on my iPhone its out of focus and blurry ! I been trying to figure out why and fix the problem !

    Hey, Clinton,
         Thanks for your help!  I was able to go to iMovie 9.0.9 and import video.  I was still curious as to why it didn't work in version 10.0.2, so I contacted Apple tech support.  They were't sure at first as to why it wouldn't work, so they had me delete iMovie 10.0.2 and then re-install it just to see if something had gone wrong when it upgraded.  That didn't change anything.  In the end, they determined that 10.0.2 doesn't support the Hollywood Dazzle DV bridge.  But I have a workaround path from them that I will share so that it's possible to import to 9.0.9, then move it to 10.0.2. 
         1.  Open iMovie 9 (finder/applications/iMovie 9.0.9
         2.  Import from Dazzle Bridge to iMovie 9, note which event you are importing the clips into
         3.  Close iMovie 9
         4.  Open iMovie 10 (probably in the dock)
         5.  File/Import Media...navigate to home(this was my name, on the left side of iMovie, under Favorites)/Movies/iMovie events.  Find the event folder that contains your Dazzle clips (tip-try sorting by date modified to look at recent events.) 
         6.  Select the clips and import.  Click the blue "Import Selected" button on the bottom right.
    You may get a message that some files cannot be imported.  Click continue import.  It's a little glitchy.  It imports your clip, and also makes a copy of it, too.  On the copy, the audio is normal, but the video is choppy.  In any case, you would delete the copy, anyway.
    Hope this additional information helps somebody else.  Thanks again, Clinton for helping me!

Maybe you are looking for

  • Commit not working with actionBinding

    I am having a bit of a problem, i am trying to change a value from an iterator (this part work fine) but can't commit this value for some reason but i get no error. I click on the button that will change the value of the selected row in the table. Fi

  • Using a DVD-R

    Can I use a S-Video to USB from a DVD player to my MacBook so that I can edit a DVD I burned of old family movies? I used an old VHS tape to record the DVD-R of the movies. I no longer have a VHS video camera. I tried using the DVD-R in the MacBook w

  • Storage repository for GOS attachments outside R/3

    Greetings! For our requirement we have to extract and store GOS attachments in a DMS server. I would like to know what are all the possible soutions to store the data outside R/3 (our users will not accessing them everytime but just to have reference

  • Editor, title, dialog box, position

    hi there; when i encounter an ora-xxxx error msg, a dialog box appears normally; but the title of the box appears nearly 5 pixel over where it must be displayed. how strange? what is the reason? i would like to paste an image, unfortunately i can not

  • Creating Emoticons in a chat program

    Hi all, I wish to write a chat program which has got emoticons?What is the best way to implement emoticons in a chat program? Thank you in advance...:)...