SAP OLE - Create Hyperling on a Word Document

Hi,
My next step of creating a word document using OLE is to define some hyperlinks on a document. I have ran a macro in word to 'see what it does' when manually creating a hyperlink. Below is the macro: -
    ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="", _
        SubAddress:="_Program_Z_OPEN_HRS_UPD_WRF1", ScreenTip:="", TextToDisplay _
        :="This is the program"
I have tried to implement this using ABAP with no success. Maybe because I still dont fully understand how to interprete these marcos as ABAP.
Has anybody created a hyperlink on a word document before, if so, seeing the code would be a great help.
Thanks
Martin
Edited by: Martin Shinks on Dec 21, 2011 9:52 AM

Never mind, with a bit of jiggery pokery, I fixed it myself.

Similar Messages

  • Creating table in MS Word document via OLE: how can I specify column width

    What method and properties do I need to use in order to specify the width of each column in a MSWord table created via ABAP using OLE ?  Or, better yet, how can I create a table where the columns are sized using the Autofit feature?
    I am already familiar with the standard sample code for creating a word document that contains a table (found in ZOLE_WORD_DOC_CREATE).
    Tom Eshelman

    I found a solution - although I would still be interested if anyone knows how to turn on autofit when creating a table,  The following code can be used to specify the width of one cell at the same time it is filled with data.  I found this in an old SDN posting.
    FORM write_cell_in_table  USING    p_row
                                       p_col
                                       p_text
                                       p_font
                                       p_size
                                       p_bold
                                       p_color
                                       p_width
                                       p_underline.
                                      P_ALIGNMENT.
      DATA: l_len TYPE i.
      l_len = STRLEN( p_text ).
      IF l_len IS INITIAL.
        l_len = 1.
      ENDIF.
    *--Getting cell coordinates
      CALL METHOD OF gs_table 'Cell' = gs_cell
      EXPORTING : #1 = p_row "first row
                  #2 = p_col. "first column
    *--Getting the range handle to write the text
      GET PROPERTY OF gs_cell 'Range' = gs_range .
      IF p_width > 0 AND l_len > 1.
        SET PROPERTY OF gs_cell 'PreferredWidth' = p_width.
      ENDIF.
    *--Filling the cell
      GET PROPERTY OF gs_range 'Font' = gs_font .
      SET PROPERTY OF gs_font 'Name' = p_font .
      SET PROPERTY OF gs_font 'Size' = p_size .
      SET PROPERTY OF gs_font 'Bold' = p_bold . "Not bold
      SET PROPERTY OF gs_font 'Underline' = p_underline . "Double line
      GET PROPERTY OF gs_cell 'Shading' = gs_shading .
      SET PROPERTY OF gs_shading 'BackgroundPatternColorIndex' = p_color.
      SET PROPERTY OF gs_range 'Text' = p_text(l_len) .
    ENDFORM.                    " write_cell_in_table

  • Using OLE add Header to MS Word Document in ABAP Program

    Dear Friends,
    I have a requirement where I want to add Header and Footer to MS Word through OLE in ABAP Program
    I am able to open the word document, through OLE,
    I am stuck @ the following step.
    CALL METHOD OF LO_APPLICATION 'ActiveDocument' = LO_DOCUMENT.
      IF SY-SUBRC <> 0.     EXIT.   ENDIF.
      CALL METHOD OF LO_DOCUMENT 'Sections' = LO_SECTIONS.
      IF SY-SUBRC <> 0.     EXIT.   ENDIF.
    Please let me know.
    Thanks
    Rajesh

    Hi Rajesh,
    You have to use GET PROPERTY & SET PROPERTY  attributes of OLE2_OBJECT to use headers.
    Just a sample code snippet for your reference :-
    DATA : GS_TABLE TYPE OLE2_OBJECT ,
          GS_RANGE TYPE OLE2_OBJECT,
         GS_CELLTYPE OLE2_OBJECT,
    CALL METHOD OF GS_TABLE  'Cell' = gs_cell
       EXPORTING #1 = '1'
                         #2 = '1'.
       GET PROPERTY OF gs_cell 'Range' = gs_range.
       SET PROPERTY OF gs_range 'Text' = 'VGUID'.
       CALL METHOD OF gs_table 'Cell' = gs_cell
       EXPORTING #1 = '1'
                         #2 = '2'.
    For more details search on SCN for code on creating MS word document using OLE automation.
    Regards
    Abhii

  • OLE: Why placeholders of MS Word document are not replaced?

    Hi Experts, I am using OLE to create Word Documents within a LOOP. The problem I have is that the Word Documents are created and seved well but the placeholders (&nom_prov') and (&ncod_prov') are not replaces by the values (in the example: test1 and test2).
    Anybody can help me in with that issue?
    LOOP AT lt_partner1 INTO ls_partner1.
      AT FIRST.
        CREATE OBJECT zword 'WORD.BASIC'.
        CALL METHOD OF zword 'FILEOPEN' EXPORTING #1 = 'C:\DOCS\PRUEBA_1.DOC'.
      ENDAT.
      CALL METHOD OF zword 'EDITSELECTALL'.
      CALL METHOD OF zword 'EDITCOPY'.
      CALL METHOD OF zword 'FILENEW'.
      CALL METHOD OF zword 'EDITPASTE'.
      CALL METHOD OF zword 'STARTOFDOCUMENT'.
    CALL METHOD OF zword 'WW2_EDITREPLACE' EXPORTING #1 = '&cod_prov'
        #2 = 'test 1'. "ls_partner1-nif.
      CALL METHOD OF zword 'WW2_EDITREPLACE' EXPORTING #1 = '&nom_prov'
        #2 = 'test 2'. "ls_partner1-name_org1.
      CALL METHOD OF zword 'STARTOFDOCUMENT'.
      CALL METHOD OF zword 'EDITSELECTALL'.
      CALL METHOD OF zword 'EDITCLEAR'.
      CALL METHOD OF zword 'EDITPASTE'.
      lv_contador = lv_contador + 1.
      CONCATENATE 'C:\DOCS\' 'PRUEBA' lv_contador '_' sy-datum '.DOC' INTO  lv_file_save_as.
      CALL METHOD OF zword 'FILESAVEAS' EXPORTING #1 = lv_file_save_as.
      CALL METHOD OF zword 'DOCCLOSE' EXPORTING #1 = 2.
    AT LAST.
       CALL METHOD OF zword 'APPCLOSE'.
       FREE OBJECT zword.
    ENDAT.
    ENDLOOP.

    Hello, I have found out what was the problem. In the end I have used method EDITREPLACE and not WW2_EDITREPLACE and I put the method EDITREPLACE more to the end of my ABAP Code:
    REPORT  z_prueba_oliver.
    TYPES: BEGIN OF ty_partner,
                 nif            TYPE bu_partner,
                 name_org1      TYPE bu_nameor1,
                 conting_com    TYPE c LENGTH 2,
                 fecha_efecto   TYPE zbufecha_ef,
                 END OF ty_partner.
    DATA:  lt_partner1     TYPE TABLE OF ty_partner,
                 ls_partner1     TYPE ty_partner,
                 lv_file_save_as TYPE c LENGTH 40,
                 lv_contador     TYPE n LENGTH 3.
    * Include necesario para la declaracion de objetos OLE2
    INCLUDE ole2incl.
    * Declaraciones para la llamada a WORD.
    DATA zword TYPE ole2_object.
    CLEAR zword.
    ls_partner1-nif = 'X7510034M'.
    ls_partner1-name_org1 = 'Razon Social 1'.
    APPEND ls_partner1 TO lt_partner1.
    ls_partner1-nif = 'X7510034M'.
    ls_partner1-name_org1 = 'Razon Social 2'.
    APPEND ls_partner1 TO lt_partner1.
    ls_partner1-nif = 'X7510034M'.
    ls_partner1-name_org1 = 'Razon Social 3'.
    APPEND ls_partner1 TO lt_partner1.
    ls_partner1-nif = 'X7510035M'.
    ls_partner1-name_org1 = 'Razon Social 4'.
    APPEND ls_partner1 TO lt_partner1.
    ls_partner1-nif = 'X7510035M'.
    ls_partner1-name_org1 = 'Razon Social 5'.
    APPEND ls_partner1 TO lt_partner1.
    LOOP AT lt_partner1 INTO ls_partner1.
      AT FIRST.
        CREATE OBJECT zword 'WORD.BASIC'.
    * Se abre el fichero que contiene la plantilla de la carta
        CALL METHOD OF zword 'FILEOPEN'
          EXPORTING
          #1 = 'C:DOCSPRUEBA_1.DOC'.
      ENDAT.
    * Se selecciona todo el texto del archivo PRUEBA_1.DOC
      CALL METHOD OF zword 'EDITSELECTALL'.
    * Se copia el texto seleccionado al portapapeles
      CALL METHOD OF zword 'EDITCOPY'.
    * Se crea un documento nuevo, al que WORD llama documento1
      CALL METHOD OF zword 'FILENEW'.
    * Se pega el texto del portapapeles a documento1
      CALL METHOD OF zword 'EDITPASTE'.
    * Posicionar al principio del documento
      CALL METHOD OF zword 'STARTOFDOCUMENT'.
    * Posicionar al principio del documento
      CALL METHOD OF zword 'STARTOFDOCUMENT'.
    * Se selecciona todo
      CALL METHOD OF zword 'EDITSELECTALL'.
    * Se borra la selección
      CALL METHOD OF zword 'EDITCLEAR'.
    * Se incorpora el texto original de PRUEBA_1.DOC
      CALL METHOD OF zword 'EDITPASTE'.
    *IF ls_partner1-conting_com is initial.*
       *CALL METHOD OF zword 'EDITREPLACE'*
        *EXPORTING*
        *#01 = '#linea2y3#'*
        *#02 = 'texttexttexttext'*
        *#03 = 0*
        *#04 = 0*
        *#05 = 0*
        *#06 = 0*
        *#07 = 0*
        *#08 = 0*
        *#09 = 0*
        *#10 = 1*
        *#11 = 0*
        *#12 = 1.*
    *else.*
         *CALL METHOD OF zword 'EDITREPLACE'*
        *EXPORTING*
        *#01 = '#linea2y3#'*
        *#02 = 'texttexttexttext'*
        *#03 = 0*
        *#04 = 0*
        *#05 = 0*
        *#06 = 0*
        *#07 = 0*
        *#08 = 0*
        *#09 = 0*
        *#10 = 1*
        *#11 = 0*
        *#12 = 1.*
    *ENDIF.*
      *CALL METHOD OF zword 'EDITREPLACE'*
        *EXPORTING*
        *#01 = '#codprov#'*
        *#02 = ls_partner1-nif*
        *#03 = 0*
        *#04 = 0*
        *#05 = 0*
        *#06 = 0*
        *#07 = 0*
        *#08 = 0*
        *#09 = 0*
        *#10 = 1*
        *#11 = 0*
        *#12 = 1.*
      CALL METHOD OF zword 'EDITREPLACE'
        EXPORTING
        #01 = '#nomprov#'
        #02 = ls_partner1-name_org1
        #03 = 0
        #04 = 0
        #05 = 0
        #06 = 0
        #07 = 0
        #08 = 0
        #09 = 0
        #10 = 1
        #11 = 0
        #12 = 1.
    * Se reemplaza el campo #nomprov# con el valor de la tabla interna.
      CALL METHOD OF zword 'EDITREPLACE'
        EXPORTING
        #01 = '#FECHA_EFECTO#'
        #02 = '10 de Junio de 2010'
        #03 = 0
        #04 = 0
        #05 = 0
        #06 = 0
        #07 = 0
        #08 = 0
        #09 = 0
        #10 = 1
        #11 = 0
        #12 = 1.
      lv_contador = lv_contador + 1.
      CONCATENATE 'C:DOCS' 'PRUEBA' lv_contador '_' sy-datum '.DOC' INTO lv_file_save_as.
    * Se cierra el documento activo, documento1 con opción de salir sin salvar
      CALL METHOD OF zword 'FILESAVEAS' EXPORTING #1 = lv_file_save_as.
    * Se cierra el documento activo PRUEBA.DOC con opción salir sin salvar
      CALL METHOD OF zword 'DOCCLOSE' EXPORTING #1 = 2.
      AT LAST.
    *   Se cierra WORD
        CALL METHOD OF zword 'APPCLOSE'.
    *   Se libera el objeto ZWORD
        FREE OBJECT zword.
      ENDAT.
    ENDLOOP.

  • Create PDF from a Word document within Acrobat

    Hi!
    I am having trouble to create a PDF from a Word document within Acrobat itself, and not by using PDF Maker in Word. When I try to create a PDF using Acrobat, it gives me the choice to choose any Office format file, but Word format doesn't appear. I can convert from an Excel document or a PowerPoint document, but not from a Word document, even if Word 2010 is installed and works perferctly. Why?
    I know I can make a PDF in Word itself by printing to the Adobe PDF printer or by using PDF Maker, but I want to resolve the issue in Acrobat that prevents me to select a Word document in the Create PDF dialog window. You can see the dialog box in the screenshot attached.
    Any help would be appreciated.
    I am using Acrobat X version 10.1.8 on Windows 7 Home Premium and I have Office 2010 installed (with Word 2010).

    Thanks for your reply. PDF Maker works in all of my Office applications. However, in Acrobat, the file formats available for me to create PDF from figure all the Office file formats except the one for Word. This is not normal. At my school, Acrobat X and Office 2007 are installed, and I can use there both PDF Maker in Word and creating PDF from Word document within Acrobat.
    So I think maybe there's a key in my Windows registry that is not set correctly? or something like that. I repaired the installation of Office 2010, and I did so for Acrobat X too, but it doesn't help. Any idea of how I can resolve that?

  • Creating pdf files from word document and allow copying of content

    I generate word documents and then save them in PDF format before sending out to clients.  Sometimes these documents contain quite a lot of data in table format and I want my clients to be able to copy the data from the tables and be able to paste it into excel.  How do I save as PDF and still allow copying of content?
    Thanks

    Open such a PDF in Adobe Reader: File | Properties | tab Security.  It will tell you if copying is allowed or not.
    I don't know if you can change these security options from Word; you'll have to ask Microsoft.  To change them after the PDF was created, you will need Acrobat.

  • Automatically creating fields when distilling Word document

    I have a large number of Word documents that are periodically published in pdf format. These documents contain several fields requiring user input. Is there a way I can tell Acrobat to automatically convert a Word field into a pdf field? Using the form wizard doesn't work for me as there are far too many potential fields and removing those is quite tedious. Some of these documents are updated and published on a regular basis, and inserting all the necessary fields is taking too much time. My only other option at this point is going back to Word forms, and I really would rather not...

    If the form wizard doesn't work as well as you'd like, the other option would be to make your revisions to the Word document, create a new PDF, open the old one and use "document>Replace pages. This will replace the background pages and leave the existing form fields intact. You will of course have to move them around if they're position in the updated content has changed but it's still easier than replacing all of them every time you update a document.

  • Create link to Microsoft Word document

    Hi All!
    I'm using Frame 7.2 and WebWorks just so you know that my file is being converted to html.
    I am trying to create a link to a Word document, that shows a Word icon (not the title of the document) with a pop-up (mouseover) that describes the "action" (something like: to open the worksheet, click here.)
    Any ideas?
    Cindy

    Hello CindyLL,
    You might try the following (assuming that you use WebWorks 2003)
    1. Use a special paragraph format in FM for paragraphs that contain such a link (e.g. "Link_PDF")
    2. In WWP2003 map a special WebWorks Format to this FM Format
    3. In the macro tab of this FM format add html code that
    * displays a word icon
    * and give it an alt-text that says "Click the link" or whatever
    Hope this helps,
    Franz.
    [SYSTEC - the document processing company.]
    [excessive signature deleted by host]

  • Creating pdf file to word document

    I signed up for what i thought was a free trial but the trial evidentially is not free like it states. all tho, i did get the instructions i needed to perform the process of changing from PDF to word document.  Now I go to the document and go to sign in and it wont let me type in the box for user name or password, even tho, Im signed in to the adobe site.  I don't understand this as I see I am not the only one having problems getting this to work, I have tried now for over a week to get this one page to print out, and finally it did it and I don't know what I did to make it work, but I made 3 copies of this form the other day.  Now today I'm trying again and still having the same problems that I was having the other day.  I found out that you can get dropbox for free on your computer and if you can drag the document to the dropbox or the file name, it will also change the document for you into a word format to print out the form.  Just would like to give out this information as it is very good at printing out pictures off you I phone and other devices also.

    Hi ladyl123,
    Please check out this document for instructions on converting a PDF to Word format.
    Let us know how it goes.
    Best,
    Sara

  • Create a Blackberry friendly Word document?

    I have a word document with embedded images in it. Someone just asked if I could set it up to be BlackBerry friendly. I'm not sure what to do with it. I searched around but didn't find any relevant information. Is there a template size or file format that's better suited for the BlackBerry display? He's using an 8830.
    Solved!
    Go to Solution.

    Hi and welcome to the forums!
    Does the user have Docs to Go?
    You can save a template Document on the media card and edit it then save back to the card.
    You can email it as well as upload to the PC.
    Thanks,
    Bifocals
    Please remember to resolve your thread. Put the check mark in the green box that contained your answer! Thanks 
    http://www.blackberry.com/btsc/search.do?cmd=displayKC&docType=kc&externalId=KB16408&sliceId=1&docTy...
    Click Accept as Solution for posts that have solved your issue(s)!
    Be sure to click Like! for those who have helped you.
    Install BlackBerry Protect it's a free application designed to help find your lost BlackBerry smartphone, and keep the information on it secure.

  • Create/edit word document from in Forms 6

    I want to create and or edit word documents stored in the operating system whose name (and path) is stored in the database. I have a form with a field of the doc name, how can I call word with the file name?
    I've never used OLE before so be specific.
    Thanks

    I've never used OLE before so be specific.So you know what to use. Look at Forms Help. There is no better place for this. You will get examples there.
    But Remember If you are using Forms on WEB this will give problems as OLE is not supported on WEB.
    Vij

  • How to create index in word document?

    Hello,
    Is it possible to create a index in word document from abap code (ole)?
    Thank you for response..
    Alfonso

    1.Goto the transparent table  KNA1
    2. select the button Indexes (which is next to the techincal settings button)
    3.list of alredy existing indexes are displayed
    4. in the dialog displayed select the icon create.
    5. specify the name for the index to be created ( should start with Z)
    6. screen for specify the index fields will appear, specify the details based on your requirement.
    Note:
    1.creating an index will created a sorted  copy of the DB table with data  with limited fields
    2. Try using already created indexes , only if necessary create new index
    3. Here table KNA1 is used as an example

  • Create MS Office Word document

    I want to create a MS Office Word document. Can someone tell me how to that?

    You really should start a new Topic for your new question.
    What do you mean by "local" printer? One attached to the server running Central? In my experience that isn't usually done because most of today's printers can be connected directly to the network and addressed via IP #. Actually, it doesn't make any difference what you mean.
    Once the printer is defined in the JMD you can use the
    b -zPrinterName
    parameter to specify the printer. If you do it on the ^job line and use the
    b @OtherJobTokens.
    parameter in the task definition you only need a single "jfmerge" task to be able to send print to any defined printer. If you put it directly on the task definition that task would always send print to the defined printer and you would need multiple "jfmerge" tasks for multiple printers.
    If the form is designed with multiple presentation targets you should also include the
    b -aspDriverName
    parameter on the ^job statement (for a single task handling multiple printers) or within the "jfmerge" task definition, or - better yet - in the printer definition.

  • What is the best way to work with Word documents in The InDesign CS4???

    I work in Microsoft Word 2007 and all my documents have *.doc format.
    What is the best way to work with Word documents in InDesign CS4???
    David Blatner says to avoid copying and pasting text from Word instead of placing it (Ctrl+D).
    How about pasting RTF or Text Document???
    I want to make book's layout in ID CS4 and its main feature is that there is the left page with text and the right - with graphics.
    So, as I understand to place the text on each page I must create for example 70 Word documents and place each item on 70 left pages???
    It loks like wasting time. I sthere another way of making such layout???  What kind????

    It's best to place any text.
    You can have all of your text in one file and use auto-flow to add threaded text frames and pages as required (Hold down the Shift key when you click the loaded text cursor), but it's a little non-standard to have the thread only on one side of the spread from the auto-flow perspective, so you'll have to set up properly.
    This is one case where a master text frame will work to your advantage. On your master page spread, add a text frame to the left page, but not to the right (or at least not threaded to one on the right -- for some other project you might actually want two independent text threads). Hold the loaded cursor over a frame on the left side of a document page and auto-flow. ID will add new spreads as necessary, but only put the text on the left side.
    Peter

  • My Canon MP620 just stopped printing text: it can print photos etc but when I send a word document (with a picture) it only prints the picture. Any ideas?

    Hi Everyone:
    I have a  Canon MP620 printer connected directly into my Airport base station. So far it has worked perfectly - I can print any type of document over the network from my MacBook Pro.
    Yesterday something weird happened. I have a resumé (as a word document) I was always printing but this time all that was printed was a photo and no text. I did a print preview and it looked fine. I converted to PDF and nothing was printed. I then created a brand new word document and again nothing was printed. I have no problem with images but for some strange reason no text  can be printed. All that happens is that the paper goes through and comes out blank.
    Any ideas?????
    Thanks a lot in advace!

    Hi,
    Tried all the cleaning programmes and it still will not print...I am lost.

Maybe you are looking for

  • WLS 8.1.5  console doesn't show ActiveDirectory (or custom) Users/Groups

    We currently have numerous apps running on a weblogic 8.1.4 portal domain. I am attempting to replicate this domain on 8.1.5. There are four authenticators on our old domain: a DefaultAuthenticator, an ActiveDirectoryAuthenticator, and two Custom Aut

  • C3-01 new firmware v7.51 released

    A new firmware version for Nokia C3-01 RM-640 device variant has been released. Changes I found - Date & time zone available by cities. When browsing (with network set to 3G only), the device connects via 3.5G. But if I pause to read a page, the icon

  • Black border around my flash video in internet explorer

    The website that I built, I used Adobe media encoder and flash to make it a .flv file, the website works fine as far as playing the pages with video in Safari and Firefox, when I go to the same website in internet explorer the video plays with a big

  • Order of the mp3 files

    How the MP3 files could be sort by folder- and filenames in player (and played in that order)? Now they are sort by track number in "albums" (player makes two different albums with same name to one album) and albums are in alphabetical order. I have

  • Copy from PO

    Hi All, Is it possible to filter records from choose from list form according to some condition when I click  Copy from PO Button in Good receipt PO from? I am using 2004 version thanks in advance tony