Fill MS Word Document Template from ABAP

Hello friends.
I have a problem here, i wonder if you can help me. Here's my scenario...
I have a MS Word template Document, like say a letter, with bookmarks on it. These bookmarks are the actual fields to be filled.
What i would like to do is have an ABAP program that reads data from SAP and opens the template and fills the bookmarks with the information retrieved. Basicallyis one thing like we do with Mail Merge in MS Word.
Does anyone have any idea of how to make this?
Thank you
Ricardo Monteiro

Try this:
method insert_text_at_bookmark.
*--- check if bookmark exists
    get property of gs_actdoc 'Bookmarks' = gs_bookmarks.
    call method of gs_bookmarks 'Exists'
      exporting
        #1 = '<<your_bookmark_name>>'.
    if sy-subrc = 0.
*--- getting handle for bookmarks
      get property of gs_actdoc 'Bookmarks' = gs_bookmarks
        exporting
          #1 = '<<your_bookmark_name>>'.
*--- getting handle for range of bookmark
      get property of gs_bookmarks 'Range' = gs_range.
*--- insert text at bookmark
      call method of gs_range 'InsertAfter'
        exporting
          #1 = '<<your_text_at_bookmark>>'.
endmethod.
All you have to give to the method is the name of the bookmark in MS word and the text you want to print. I specially take a internal table of two fields (name and value) and fill it in another method and pass it to this method.
Harry

Similar Messages

  • Read a .dot (MS Word Document Template) from jsp

    Hi,
    I have a link to a .dot (MS Word document Template file on the jsp page. While trying to access it from a link on the browser, the file is getting displayed in binary format.
    If I try a normal word document or excel document, I am able to open/save the document.
    I tried adding the following lines in the web.xml too with the same results.
    <mime-mapping>
    <extension>dot</extension>
    <mime-type>application/msword</mime-type>
    </mime-mapping>
    and tried with this also
    <mime-mapping>
    <extension>dot</extension>
    <mime-type>application/vnd.ms-word</mime-type>
    </mime-mapping>
    Can anybody help me on this ?
    Thanks n advance, Sajiv

    As you had directed, I tried a sample jsp with just
    the link to the document. When I click on the link,
    it allows me to open/save the document and the
    default type it gives is with the extension.doc.
    I am able to save the file as a .dot itself.
    So, if this is coming from an application in a
    server, is there any particular reason why it is not
    functioning properly ?I don't fully understand if the problem is already solved or not?
    When you mean by UserAgent, what do you actually
    mean?An useragent is just a client application which can access network sources. In this case it is likely a web browser, for example Internet Explorer or Firefox. It might be useful to try as many useragents as possible so that you can exclude the useragent's default behaviour.

  • Opening Word document templates from the New Document drop down does not open Word

    I have a document library with a number of Content Types attached to it.  Each one has a different Word document attached.  We have an intermittent problem where when you click to open one of these templates from the 'New Document' drop
    down list that nothing happens. The workaround appears to be either open Word first or re-boot the computer.  I think there is a problem with SharePoint not linking in with Word correctly.  Does anyone have any suggestions on how to fix this?
    Thanks
    Julie
    J Sykes

    Hi J,
    Can you please check in your internet explorer whether MS office Add ons enable or not.
    If not enable that and restart your browser and try again.
    Also try to repair MS Office if issue still persist.
    Regards
    Soni K

  • While editing the document template from library settings

    
    I am facing this warning while editing the document template from library settings. Actually i have changed the password 2 days before. I need solution to clear this 

    Hello
    Please check this
    http://support.microsoft.com/kb/286282/en-us
    Open the Office template in the original Office program where it was created.
    On the File menu, click Save As.
    In the Save as Type list, click Word Document (*.doc) if you are in Microsoft Word, Microsoft Excel Workbook (*.xls)if you are in Microsoft Excel,
    or Presentation (*.ppt) if you are in Microsoft PowerPoint.
    Give the file a name, and then save it in the Web that contains the Document Library.
    Click Save.
    Browse to your Document Library, and then click Modify columns and settings.
    Click Change general settings.
    In the Template URL edit box, type the full path and file name to the file that you saved in step 4.
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Word document templates and Protection

    We have implemented a Portal Solution for Sales Representatives, we allow them to create word documents by using a template, Once the template is filled by the data in the application we call the Execute Macro Method so that the Macro used to protect the word document is executed in word. This works perfectly in the SAPGUI, The document is protected after population of the variables
    However, we have an issue in the portal, once the word document is loaded, the variables are filled with the data, the macro to protect the word document is not called….we understand that this call must be written, we would like some assistance with how to call the word macro when using the portal.
    The underlying application is CRM.
    Thanks Dion

    Hello Dion,
    I don't think that it's possible to get this functionality in the Portal. Has your company licensed the Adobe Document Service (ADS)? I think that would be a solution for your problem. I know a company where they use the ADS in combination with the PC-UI.
    Regards
    Gregor

  • Output word document generation from the properties.

    Hi Everybody,
                   I need to generate a word document from the Substance property values stored. How to generate a word document in a specified format..
    Thanks,
    Rajesh.

    Hi Andeas,
                  My problem is, I want to create the templates as well as i want to see the generated reports.
                   While installing WWI, i got four options called 1.Information system/labelling Workstation, 2.Install generation server, 3.Workstation for editing templates and 4.WWI file server installation. I installed only third one Workstation for editing templates. Should i install other than that as well.
                   I want to confirm the procedure for the release template as well. Before releasing a template you need to add the template through the DMS and next mention the same template in the CG42. After that create the variant (CG2B). Next go to CG02. I think while going through a help i gone through a sentence like first i need to upload file in CG3Z and Import template CGCZ things. I just checking whether they are working properly or not.
             Also while trying to create a template from WWITEMPLATE in the Layout folder, i used <i>WWI -> Insert Symbol</i> is not giving any values. Any idea on this
                  Please give me some advice..
    Thanks,
    Rajesh.
    Message was edited by:
            Rajesh Madala

  • Delete existing document templates from a workflow pattern

    Hi folks,
    I have a workflow that uses the step that creates a document from a template (MS Word). Now I want to delete two of these templates and don´t want them to appear anymore when that workflow is being executed.
    So i deleted the template from the workflow and also from the binding to the step.
    I even deleted the template using the report RSWUODEL. But the "deleted" template still appears when the workflow is called.
    I also tried to make a new version of the workflow: no use.
    How can i get rid of these templates?
    Background: I am in an IS-U system (ERP) and the workflow is called by a front office process out of the CIC.
    Any help is welcome!
    Holger

    Deleted the whole step that creates the document. Created new step to create the MS document, defined the binding new.

  • When add a people picker (user column) in Word document (Template) and try to add a name it stuck!

    When add a people picker (user column) in Word document (un the document Template) and try to add a name it stuck!
    Is it a known issue?
    keren tsur

    Hi,
    According to your description, I have tested in my environment and I  have the same behavior.
    Only if you type the wrong name in the first time, then you click the phone book to search the right name and save, it will stuck. It means if you do other operation(e.g. type the wrong name then click “resolve” button, then search in the phone book) and
    repeat the operation above, it won’t stuck.
    It is appreciate that you can submit a feedback to Microsoft:
    https://connect.microsoft.com/
    Thanks,
    Dean Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Words documents opened from portal display website instead of document

    A user is opening Word documents from a newly-created section of our portal to find that the Word document displays the website instead of the text that is supposed to be in the document. Saving the document first and then opening it works fine.
    It seems similar to this issue:
    WWC-41400 when accessing PowerPoint docs
    with the following key differences:
    1. It doesn't actually display an error. The screen that appears in the Word document looks somewhat like our login screen, but without the login text.
    2. This problem only started happening after we redid a section of our website. The new section contains the same documents, but it was rebuilt on the top level of our navigation rather than where it was before.
    3. The user only has this problem with the new section of the website--not the previous implementation of that section and not with the rest of the portal website. It only seems to be the new section we developed.
    It doesn't seem like she needs to upgrade Word, as Powerpoint was upgraded in the referenced URL above, because it's working elsewhere in the portal. Are there any issues related to us developing the new section of the website that would cause this? Thank you for any assistance.

    If Adobe documents are automatically saved instead of opened, check the Applications panel in Firefox ("Tools -> Options -> Applications") and change the action for PDF documents to either "Use Adobe Reader" if you want to use the application or "Use Adobe Acrobat (in Firefox" if you want the PDF file to open inside a Firefox browser window via the Adobe Acrobat plugin. If you want to be asked what to do with PDF files each time, select "Always Ask" for the action. See* [[Managing file types]] and [[Opening PDF files within Firefox]].
    See also [http://kb.mozillazine.org/File_types_and_download_actions]

  • Browsing ms-word document directly from portal content window.

    Hi,
    I must make ms-word document directly browsing from portal content window.
    Is there a blog mention about it?
    Thanks.

    First, thanks for your reply. It's greatly appreciated. However, the level of your response fails to address the scope of the original question. Your first supposition is incorrect, that most MS Word docs copy uneventfully into the body of Gmail emails. This only applies to the most basic of MS Word docs (i.e., those utilizing minimal formatting, such as basic letters, etc.) and otherwise runs contrary to dozens of online complaints posted by users such as myself (though not on the Firefox website). Second, everyone knows you can add an attachment to Gmail emails. In this case, the recipient will not accept attachments of any kind, and has therefore asked that the content be copied directly into the email body. This is not uncommon in these cases. Third, the very nature of Notepad makes it unable to translate/interpret any documents beyond the most basic, hence its name: Notepad. Fourth, apparently this problem is rare or virtually non existent with other browsers, as all the complaints online appear to be Firefox related. Again, however, I appreciate you taking a stab at this.

  • How can I transfer pdf and word document files from my computer to iphone 4?

    Hi,
    I have recently purchased an iphone 4,I need to know how to transfer my files from laptop to iphone, i have downloaded iTunes but can not add my iphone, basically I dont know if there is anything else i should do to be able to connect my laptop to iphone so that i can easily transfer files.
    Also,does any body know what application i can open my word documents with?
    and how easy it is to search through the file for a specific topic if its for example 1000 pages? how about in pdf files? how can i find a topic i need as fast as possible, say in an open book exam condition?!!
    thanks

    Try using the App PDF Reader Lite, I downloaded from the iTunes App store, it is free and works. Not only for PDF but Doc, page, etc.
    I Am using it and it is working oK

  • Word documents converted from pdf not legible

    How do I convert a pdf document to a word document that is legible and in the same table format?

    Sounds like you are using one of the online services, like the cloud. This forum is for the stand-alone Acrobat and I have no clue. The cloud or related forum should provide better info.

  • Word documents disappeared from iPad

    Hi!
    I recently downloaded Office for iPad and continued a book I am writing in Word, since I find it easy to use.
    After two days of writing (before i saved a back-up), I wanted to open the document (I saved it on my iPad), but it had disappeared!
    When I tried opening it from the "recently used-box" it said it had either been moved or deleted.
    I have not moved or deleted the file, I saved it on my iPad, but still it's gone.
    Is there a way to access this file?

    To recover from the iOS device, tap the '+' to start a new document and choose 'copy from iTunes'.
    To recover from iTunes, connect the device, navigate to the apps tab and scroll down to the documents section.

  • Why can't I share word documents directly from Word to mail any more?

    Hi all
    I just wondered if anyone could help with this annoying problem. It is probably to do with Mail, but it manifests itself in MS Word (latest version, updates complete).
    I use to be able to share Word docs directly into Mail, using hte file>share>email as attachment but for a few weeks now I have not been able to do this. What I get is mail opens (or my MBP switches to the space I have Mail open in) and I get a new blank mail message, but in Word I get a rainbow wheel and it no longer attaches the document directly into the mail message.
    Has anyone come across this?
    I have managed to get it working a couple of times with a re-start, but it just goes back to the fault I described above.
    Any help would be gratefully appreciated.
    Thanks
    Dave

    Check out the discussion here on this same problem https://discussions.apple.com/message/20229092#20229092
    Looks like the key is to repair permissions and then restart.

  • Displaying Word Document from a Database

    Let me try to explain this.
    I can upload and store a Word Document in an Oracle database
    (BLOB column) but now I need to extract that Word document and
    place a pointer to it on the Web. Can someone explain to me how
    this is done?
    I'm trying to do something like have an image displayed on
    the Web and when you click on it the Word Document is opened.
    Follow me on that? So, if there are 15 Word documents in the
    database, then the web page would have 15 images all pointing to
    each separate Word document.
    Has anyone done this?

    Don't take my word on this, but I think this should work;
    I've done this in the past to send dynamically-generated CSV files
    to the user, which is in a way (at least at the perspective of
    what's being outputted to the user) the same thing.
    First, obviously, you need to retrieve the Word document data
    from the database. We'll say you put that in a variable called
    'wordDoc'.
    <cfset wordDoc = someQuery.wordDataObj />
    Next, we need to set the 'Content-disposition' HTTP header,
    to tell the client's browser that we're sending a file, and that we
    want you to call it somefile.doc by default. We'll do this with the
    <cfheader> tag (note that if you use <cfflush> in the
    application, this tag (and thus, this approach)
    will not work.
    <cfheader name="Content-disposition" value="attachment;
    filename=somefile.doc" />
    Almost there. Now we need to set the Content-type HTTP
    header, to tell the browser what kind of data is coming, and then
    give it the actual file data. We'll use the <cfcontent> tag
    to do both of these things.
    <cfcontent type="application/msword"
    reset="yes">#wordDoc#</cfcontent><cfabort>
    If memory serves, this should be all you need. Note the
    <cfabort> after the closing <cfcontent> tag, I've had
    problems in the past with additional output on the page after these
    tags being appended to what gets sent to the browser, so I use a
    <cfabort> afterwards to make sure nothing more gets sent
    after the data we want. Also, at least with CFMX7, I've noticed
    that debugging output tends to get added in too regardless, so I
    typically put a <cfsetting showdebugoutput="false" /> at the
    top of the file, too.
    I can't guarantee this will work, I haven't tested this
    particular situation, but if it doesn't, it ought to be close. Let
    me know if I'm wrong.
    Attached is what should be the code without my commentary /
    rambling interspersed.

Maybe you are looking for

  • How can we pick Message ID at runtime in message mapping?

    Hi Experts, I am working on a file to file Scenario. Lets say I have a Field called SEQ_NO at target. I want to populate it this with Message ID (MONI one) at runtime. Is it possible? If Yes, How can we do this?

  • Photo stream won't update after 1000 photos

    I have reached 1000 photos in my photo stream.  I took more photos on my phone, but it won't update with the latest photos, moving out the oldest.  Help! Thanks, Jim C

  • Hierarchy selection does NOT show upper level

    Hi I am using BI 7.0 with SP 20 with WAD (No Bex Anl). I implemented Hierarchy of 0ORGUNIT and when I select a node in the middle of the Hier the reports starts with the Org from that point and it does not show the nodes above. How can I make it show

  • Inquiry on javax.mail.SendFailedException: Invalid Addresses error

    Hi, Anyone does have any idea why the following is being encountered during the email authentication process? We are using PeopleSoft application and we have notification functionality which will send a notification email to the users but email not b

  • I can't turn on the wifi on my iphone 4s

    My iPhone 4S wont let me turn wifi on the swipe button is in grey and i am unable to turn it on also I can't turn on bluetooth I restarted my phone and the network settings but didn't work