Tcode IW32 and Printing Word Docs Attached to Equipment

Hello,
This is my fist attempt to use SND so I am hoping for a fast reply that will get me to long on more often.  Here goes.
I want to be able to print the word documents that are attached to an equipment that is used in the PM order.  When the order is printed a SAP Script form is automatically output.  I want to be able to print the documents attached to the equipment at the same time.  Is that possible.  I have tried the OLE classes but I get a short dump when I try to print the order through the menu Order->Print Order.
Any help would be appreciated.
Thanks

Yes, its possible thru OLE,  first, if not already done, you must in configuration, make it so that the printing happens in the foreground as opposed to the background, then in you print program, you need to retrieve the attached documents.  Here is a routine that is working for us in production now. 
This is the call of the subroutine,  send thru the business object id, and the BO key, along with a flag
for print preview on/off.
perform retrieve_and_print_documents
       using 'BUS1019'
             your_object_key  " Probably Equipment Number
             device.
Here is the routine.  It handles .Doc and .Xls attachments only.
*     Form  RETRIEVE_AND_PRINT_DOCUMENTS
form retrieve_and_print_documents using objtyp
                                        objkey
                                        device.
  tables: plko, sood.
  type-pools ole2 .
  data: documents type standard table of neighbor.
  data: document  type neighbor.
  data: docs      like line of documents.
  data: xobject like borident.
  data: objects type standard table of sood4.
  data: object  type sood4.
  data: word type ole2_object.
  data: excel type ole2_object.
  data: workbooks type ole2_object.
  data: app type ole2_object.
  data: filename(200) type c.
* If background, then do even try it!
  check sy-batch <> 'X'.
* Retrieve Documents
  xobject-objtype = objtyp.
  xobject-objkey  = objkey.
  clear document. refresh documents.
  call function 'SREL_GET_NEXT_NEIGHBORS'
       EXPORTING
            object       = xobject
            roletype     = 'APPLOBJ'
            relationtype = 'ATTA'
       TABLES
            neighbors    = documents.
* If no documents, then exit.
  if documents[] is initial.
    exit.
  endif.
  loop at documents into docs.
    select single * from sood
                    where objtp = docs-objkey+17(3)
                      and objyr = docs-objkey+20(2)
                      and objno = docs-objkey+22(12).
    if sy-subrc <> 0.
      continue.
    endif.
* Create the Microsoft Application Object
    case sood-file_ext.
      when 'DOC'.
        create object word  'WORD.BASIC'.
      when 'XLS'.
        create object excel 'EXCEL.APPLICATION'.
    endcase.
* Open Document.....
    clear object.
    clear objects. refresh objects.
    object = docs-objkey.  append object to objects.
    call function 'SO_DOCUMENT_DISPATCH_MANAGER'
         EXPORTING
              activity = 'DISP'
         TABLES
              objects  = objects.
    if device <> c_preview.
* Hide Microsoft Application
      case sood-file_ext.
        when 'DOC'.
          call method of word 'APPHIDE'.
        when 'XLS'.
          set property of excel 'VISIBLE' = 0.
      endcase.
      wait up to 2 seconds.
* Print the Document
      case sood-file_ext.
        when 'DOC'.
          call method of word 'FILEPRINT'.
        when 'XLS'.
          get property of excel 'ACTIVEWORKBOOK' = workbooks.
          call method of workbooks 'PRINTOUT'.
      endcase.
      wait up to 8 seconds.
* Close Microsoft Application
      case sood-file_ext.
        when 'DOC'.
          call method of word 'APPCLOSE'.
        when 'XLS'.
          call method of excel 'QUIT'.
      endcase.
    else.
* Minimize Microsoft Application
      case sood-file_ext.
        when 'DOC'.
          call method of word 'APPMINIMIZE'.
        when 'XLS'.
          get property of excel 'APPLICATION' = app.
          set property of app 'WINDOWSTATE' = 2.
      endcase.
    endif.
* Free the Object
    case sood-file_ext.
      when 'DOC'.
        free object word.
      when 'XLS'.
        free object excel.
    endcase.
  endloop.
endform.
Regards,
Rich Heilman

Similar Messages

  • I want to email a Pages document as a Word doc. I used to be able to do this by clicking on share then send via mail then on Word and an email would appear with my word doc attached.  Now the email does not come up.  Why?

    I want to email a Pages document as a Word doc. I used to be able to do this by clicking on 'share' then 'send via mail' then on 'Word' and an email would appear with my word doc attached.  Now the email does not come up.  Why?

    It's difficult to do more than guess when you don't say what version of OS X or Pages you're running, but if you're on the latest, have you tried the Share menu -> Send via Mail command?
    If that doesn't help, you may have better luck if you ask in the Pages forum:
    Pages
    When you repost, be sure to include full details about your versions so that people know what it is you're working with.
    Regards.

  • Samsung CLP310 printer- printing word doc problem

    i have had a Samsung CLP310 printer for a while and its worked perfectly, however, just recently it has not allowed me to print word.doc files , i have to convert them first to a pdf and then print.
    Does anyone know if there has been a change to the driver or if i have downloaded a recent universal software upgrade that has mucked things up? Any advice well.
    (I have tried the reset printers options etc..)
    Many thanks

    I'm having the same exact problem but can't seem to get ANY response!! The link below was never responded to so I copied it here. IS THERE A WAY TO MAKE ADOBE USE THE "HP" DRIVER AND NOT THE XEROX?????
    http://www.adobeforums.com/webx/.59b4e3da/1
    We have a similar problem with 2007 Excel files embedded in Autodesk Inventor 2008. The pdf preview will look fine, but the PDF file has the black box that you are talking about. Also happens when we print to a Xerox Phaser 7300. When we print to a "HP designjet 800" it will print fine. Does it has something to do with the Xerox printer driver???? We have all the latest updates we beleive? We started with Acrobat Adobe 8.1.1, a new install shouldn't have to install 8.0 first should it?
    Specs: O.S.: XP Pro x64 Edition Version 2003 sp3
    Machine: H.P. xw9300 Workstation, AMD Opteron Processor 250,
    2.39 GHz, 4.00 GB of RAM
    Video: NVIDIA Quadro FX 3450/4000 SDI with driver version 9.1.3.6 running D3D in Inv.
    With NVIDIA Desktop Manager disabled
    3D navigator: 3DConnexion - Spaceball 5000 Driver Ver. 6.3.3

  • How to open and read pdf and micrsoft word (.doc) files or documents

    My problem is how to use my BB 9800 software version 6.0.0.546 to read/view pdf files and microsoft office documents. I have also bought documents to go from online and have installed it on my phone, but whenever i try to open it I receive a message that it is incompactible. Any help will be greatly appreciated.

    Hi, Sammy.
    Why not install a 3rd party PDF reader and Word Doc reader to help open and read pdf and micrsoft word (.doc) files or documents? You can google it and select one whose way of processing is simple and fast to help you with the related converting work.  It will be better if it is totally manual and can be customized by users according to our own favors. Remember to check its free trial package first if possible. I hope you success. Good luck.
    Best regards,
    Arron

  • How can I use Automator to open and save Word docs with links?

    Hi-
    I'm having trouble building a Workflow to open and save Word docs with links.
    My Workflow so far:
    1. Get Finder items
    2. Copy Finder items (to new folder)
    3. Rename selected items
    4. Open selected items (Word docs)
    Three problems occur.
    The first is a Word 2004 problem -- I can't get the warning "This document has links in it; do you want to open it with/without updating the links" to go away (Unilke the Macro warning toggle capability, there is nothing in the Preferences for Word 2004 that addresses the links warning, as far as I can tell; any insight you can shed on this would be terrific.)
    The second problem happens with Automator: if I manually accept the update of the first document's links, Automator opens that document but then halts completely, even though I've instructed it to open multiple documents.
    The third problem I have is that there's no Finder action in Automator that allows me to save the document that's now open (as far as I can see).
    Any suggestions for how to fix? If I can get this to work, and scheduled in iCal, it will be an unbelievable time saver.
    Thanks,
    Jeremy
    PowerPC G5   Mac OS X (10.4.6)  

    Hi there Jeremy,
    to do this you are going to have to add in some Run AppleScript steps...
    These will rely on GUI Scripting. So first you need to activate GUI Scripting.
    Now we need to add in a Run AppleScript action to the end of your workflow...
    This will replace your current number 4 in the workflow (Open Selected...)
    click here to open this script in your editor<pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">on run {input, parameters}
    set allItems to every item of input
    repeat with currItem in allItems
    tell application "TextWrangler"
    open currItem
    end tell
    activate application "TextWrangler"
    tell application "System Events"
    tell process "TextWrangler"
    delay 2
    --when the Word document is opened I have told it to press okay !
    --I don't know what key you want it to press in the dialog box
    keystroke return
    delay 2
    --save the doc
    keystroke "s" using command down
    delay 5
    --close the doc
    keystroke "w" using command down
    end tell
    end tell
    end repeat
    return input
    end run</pre>
    The above script should open each Word Document, press a button in the dialog box then do a save and then close the doc...then loop through the rest of them.
    You need to replace the name Text Wrangler with Microsoft Word (or whatever it is called!), I don't have it on my Mac.
    You will have to let me know what button needs pressing in the first dialog, if it isn't the 'highlighted ' one then we will have to amend the script...
    regards
    Ric

  • Can ipad open, revise and send word docs?

    Can Ipad open, revise and send word docs?

    Depends on what you're doing; SL doesn't really support Office docs directly. In Snow Leopard, TextEdit can open Word docs, albeit with little fidelity for anything beyond text. Try iWork if you need to really work with Word docs (note that even then it's an import/export process and not native support).

  • How can I access my Excel and MS word docs now that I down loaded Lion?

    How can I access my Excel and MS word docs now that I down loaded Lion?

    Isn't it the kind of question which would have been better asked before switching to Lion ?
    Of course it would be more logical to ask in a M…oSoft dedicated forum.
    In case you forgot it, here you are in a forum dedicated to an Apple product named Numbers
    Yvan KOENIG (VALLAURIS, France) samedi 23 juillet 2011 12:43:13
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • I can't print PDF's right with any driver I can print word docs draft qual.

    here's the dealio- my new core2duo doesn't want to communicate with my hp deskjet 832c. I was able to print through my ethernet network to a shared 832c once, and it did print right, but I can't do it again because whatever program I'm in when I try to select a shared printer crashes. That doesn't help with the usb connected printer on my machine though; the only good print I've been able to get is draft quality only in a word doc. My printer spits out tall distorted text, partial and blank pages etc. The new mac mini with the core2duo is doing the same thing with it's hp deskjet 840c.
    iMac   Mac OS X (10.4.9)  

    here's the dealio- my new core2duo doesn't want to
    communicate with my hp deskjet 832c. I was able to
    print through my ethernet network to a shared 832c
    once, and it did print right, but I can't do it again
    because whatever program I'm in when I try to select
    a shared printer crashes. That doesn't help with the
    usb connected printer on my machine though; the only
    good print I've been able to get is draft quality
    only in a word doc. My printer spits out tall
    distorted text, partial and blank pages etc. The new
    mac mini with the core2duo is doing the same thing
    with it's hp deskjet 840c.
    iMac   Mac OS X (10.4.9)  
    Well Mactopians, it seems that my wife has solved this issue by downloading and installing HP's OSXInkjet driver ( even though we're using deskjets) when she visited the HP website. The wonders never cease.

  • Print word document attached to an order

    my requirement is to print the sap script for the PM order and as well as word documents attached to the order.
    for an order, for an operations when PRT tools selected
    word documents attached to it.
    i need to print those word douments attached to PRT tools for an oparation.
    pgm used is RIPRJT00
    form PM_COMMON
    i am able to oepn the documents attached to the order in PRINT PREVIEW.
    when choosing print option it goes to update termination
    Ajay

    In order to save any type of document on your phone you need to have an app that supports that form of document.
    There are several word processing apps but I prefer Pages.  Buy this app. Once it is on your phone you can tap the Word document in your email to view it then tap the Share icon and Open in Pages.
    If you edit the document and email it you will have the choice to send it as a Pages document, a Word document or a PDF file.

  • Printer suddenty wont print Excel or Quickbooks but will print Word docs

    Help!
    My HP 6500 just decided to stop printing Excel, Quickbooks and Efax but WILL print Word documents and other files. When I hit "okay" ont he print menu the printer head goes back and forth but no ink comes out. Again, the weird thing is that Word docs are fine and print out.
    I have downloaded the driver software twice and turned printer on and off and unplugged it from back of machine.
    Help

    Hi @Salsify,
    Welcome to the HP Forums!
    I see that your HP Deskjet 3050a will print an internet page but not any documents on Windows 7. I am sorry to hear this but happy to help!
    How is the printer connected? Wireless or USB?
    Are you able to make standalone copies with the printer? Copy Text or Mixed Documents.
    In the meantime, I would recommend to try our HP Print and Scan Doctor, and let me know what happens!
    Hope to hear from you soon!
    RnRMusicMan
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to say “Thanks” for helping!

  • Failure to print word docs

    I am unable to print from a word doc. I was able to print a test page, can print from outlook and from HP web page. Any suggestions as to what the problem might be? My printer is a HP4400 all in one and I have windows XP home addition installed. Thanks

    Hi there mikekaye,
    Try downloading and running the print and scan doctor located here:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c03275041&cc=us&dlc=en&lc=en
    It can fix a lot on its own and if not give a better idea of what is going on.
    Best of Luck!
    You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too.

  • Pages and Windows Word docs

    Does anyone know if you can open Word docs created on a Windows machine in Pages for iPad if you receive them via email? I have tried this with Word docs created in Office 2003 and can't get it to work. The Pages documentation says it supports Word, but I'm starting to wonder if somehow it only supports Word files created on a Mac? Or is it just that it doesn't support older versions of Word like Office 2003? Thanks much.

    I've opened Word files created with Office 2008. I'm pretty certain I've opened files made with Win versions 2003 and 2007 (I went crazy testing the first week and naturally I didn't write down everything I did. Now I'm going back and doing some testing over ) What version are you using?

  • Inserting and retrieving Word docs from a custom table with LOB column

    Hi,
    I'm sure I'm not looking around in the right place for some docs on this.
    Basically I need to build a custom interface in Web PL/SQL to allow a MS Word doc to be uploaded for a user's browser and also a mechanism to retrieve the doc.
    Not sure what is the 'best' column datatype to use for this either.
    Portal Forms are out of the question due to inflexibility of application.
    Cheers,
    John

    bumping to the top!

  • Installed mackeeper and now word docs wont open, says they're blocked. What do I need to do ??

    Hi, Purchased and installed mackeeper, since then word docs aren't opening. Keeps saying thy're blocked open from file etc. Tried that and still not opening. Safarii isn't working as fast and now it keeps crashing. Not sure what to do. If I uninstall the programme will it all work again ?? what does everyone else use to keep their mac running soothly ??

    fayefromhalstead wrote:
    Hi, Purchased and installed mackeeper, since then word docs aren't opening. Keeps saying thy're blocked open from file etc. Tried that and still not opening. Safarii isn't working as fast and now it keeps crashing. Not sure what to do.  If I uninstall the programme will it all work again ??
    I doubt that un-installing it will solve the problem, but at least it won't do any more damage than it's evidently already done.  I would call MacKeeper Tech Support and ask them what to do.  You'll need to call them anyway in order to un-install it as it doesn't come with a script or instructions on how to do that.
    what does everyone else use to keep their mac running soothly ??
    For the most part I have hardly ever had to use anything over the twenty odd years I've owned Macs.  I have a large collection of mostly free utilities that I keep around just in case.  What sort of problems were you having before MacKeeper came on the scene?

  • Right Click convert to pdf - Gone AND Combining word docs and pdfs gone

    Hello everyone,
        I am on a Lenovo all in one think centre m92z, i have a creative cloud membership and have the most current version of acrobat xi pro. Up until 2 weeks ago i used to be able to right click and convert any file to a pdf, now that seems to have dissapeared... anyone know how to get that back?
    Right click on a word file and it doesnt give me any options for acrobat at all, except an open with
    Further more i cant even combine pdf's and word docs in the "combine files" dialogue box where you can drag and drop etc.

    I am having the same issue, I have tried repairing the installation and it did not work, I have uninstalled and then reinstalled and still no right click options. I have 3 computers with this issue and each of them when you right click will not show any of the acrobat options, but they do have a blank line (no text) that when clicked will open the combine window. Any help or suggestions would be greatly appreciated!

Maybe you are looking for