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.

Similar Messages

  • My word documents are not printing

    Hi, my deskjet 2544 will not print word documents. It will print off the internet though.

    Hi,
    Sorry to hear you are having problems printing.
    What device/operating system are you printing from?
    "Although I work for HP, I'm speaking for myself and not on behalf of HP"
    "Say "Thanks" by clicking the Kudos Star in the post that helped you.
    --Please mark the post that solves your problem as "Accepted Solution"

  • My Word documents are not opening from sharepoint

    When I attempt to open a word document from sharepoint it remains stuck at "Downloading: http://intranet/document url"
    Word 2010 and SharePoint 2010
    This occurred when we restored a server after virus issue. Also I noticed that I left one of these word documents in this "downloading state" and the next morning when I opened my station the document was open... therefore it seems to just be taking
    WAY too long to open. 

    Is this SharePoint a stand alone server, where web and database are in the same box ?
    Do you know what steps changed settings from before virus, then, after virus ? Maybe people left the anti-virus running on
    military emergency mode, and it's consuming all server resources.
    You might want to check the database files' sizes, WSS_Content mdf and ldf. Is the ldf way too big ?

  • My 2009 macbook microsoft word documents are not being accepted as files.

    My 2009 Macbook seems to be falling behind. Using Mac OS X (Version 10.6.8) and Microsoft Word for Mac 2008 (version 12.3.6).
    For some reason, my files do not work online. They are "invalid." For example, "invalid file type" popped up on my school online dropbox and my online grad school application. My files are, however, in the correct (doc, docx, pdf) file types. I had to go on campus and use a PC to upload assignments and applications.
    Not sure if it's my software or old word version.
    Anywho, I just need some answers!

    Regardless of what system you are on (Windows/Mac), a filename extension is required when transferring files online. This was noted in the error message of your initial post:
    No File Extension For This File **File  Name**
    Make sure this  file has the correct extension.
    You would have had the same problem on Windows if you neglected a filename extension.
    It might be a bit more likely to accidentally save a file without an extension on Mac because Mac has been able in the past to work without filename extensions.  This is changing. Everyone should be using filename extensions if they expect to effectively share files.

  • Why do all my word documents open when I open word

    why do all my word documents open when I open word

    You may have to compare user permissions and privileges in documents to see if there is a presence of odd permissions in the Get Info box available by single-clicking a document's ICON and see this area in each.
    How was the application installed? Are you running an Admin account? Have you repaired disk permissions in Disk Utility, or any other routine steps to see what happens next?
    There may even be a Console log of events that happen when you open and launch a document stream involving this Word phenomena, in Console utility, on or about the time these events occur. The logs can be amazingly complex, and vary in helpfulness. I use some of them to see what happens and when, or if there is a crash, some can point to hardware vs software sources of problems. Some resident experts in ASC are fairly good at knowing what they mean or how to decipher the system logs from there.
    Not sure of the exact cause...
    Good luck & happy computing!

  • Files/word documents are grey how to access to enble uploadd

    In Finder files and word documents are grey . How do I make them Black so I can access documents and upload.  Is there a fix for this problem ?
    Before upgrade of Maverick there was not a problem.

    Select
    View ▹ Show View Options
    from the menu bar. In the dialog that opens, select
    Arrange by: None

  • I am unable to attach scanned documents or Pictures to eamils. The size of the scanned documents and the pictures are well below the 20MB limit. I can connect Exl and Word documents with not problem

    When trying to attach a scanned document or picture to and email, the process goes not forever and there is no end, it just keeps working and tries to attache these documents/pictures. In the lower left hand corner of the screen it says "waiting for mail. yahoo. com"

    Purplehiddledog wrote:
    I do backup with iCloud.  I can't wait until the new iMac is available so that I can once again have my files in more than 1 location without needing to rely solely on the cloud. 
    I also rely on iTunes and my MacBook and Time Machine as well as backing up to iCloud. I know many users know have gone totally PC free, but I chose to use iCloud merely as my third backup.
    I assume that the restore would result in my ability to open Pages and Numbers and fix the problem with deleting apps, but this would also mean that if my Numbers documents still exist solely within the app and are just not on iCloud for some reason that they would be gone forever.  Is that right?
    In a word, yes. In a little more detail.... When you restore from an iCloud backup, you must erase the device and start all over again. There is no other way to access the backup in iCloud without erasing the device. Consequently, you are starting all over again. Therefore, it would also be my assumption that Pages and Numbers will work again and that the deleting apps issues would be fixed as well.
    If the documents are not in the backup, and you do not have a backup elsewhere, the documents could be gone forever.

  • Suddenly all my Word documents are gone. What happened? Are they recoverable (no back-up hard drive or time machine)

    Suddenly all my Word documents are gone. What happened? Are they recoverable (no back-up hard drive, no time machine)?

    Greetings,
    What happened right before they went missing? (software updates, "cleaning" up the computer, etc.)
    Are your other files still there like music, movies, pictures, bookmarks, etc?
    I'm sure you've already come to this conclusion yourself, you need a back up. Its easy to do with 10.5.8 and later: http://support.apple.com/kb/HT1553.
    Try searching your account for any ".doc" files (Word documents) by going to File > Find and using the options below:
    If you don't find any of the documents you are looking for in the search window and nothing else is missing then it would be wise to get a second opinion ASAP before any chance of data recovery is lost.
    Make an appointment with a Mac Genius at an Apple store (they don't do data recovery but may be able to see something we can't see from here) or contact an Apple Authorized Service Provider to see if they can look around the hard drive for you.
    If the second opinion reveals that the data is really gone off the entire computer then you will need data recovery software or service:
    Data recovery software requires you have a separate hard drive so you'll need to buy one first. Data recovery software examples:
    http://www.prosofteng.com/products/data_rescue.php
    http://www.macintosh-data-recovery.com/
    http://www.subrosasoft.com/OSXSoftware/index.php?main_page=product_info&products _id=1
    There are many nationwide / worldwide data recovery companies out there.  Here are a few examples:
    http://www.ontrackdatarecovery.com
    http://www.drivesaversdatarecovery.com/
    http://www.totalrecall.com/
    Best of luck to you.

  • Why do my Microsoft Word documents open as read-only

    I am having trouble saving my Word documents as they are opening in read-only mode. I cannot find a setting to change the way my Word documents are opening.

    Amy, are you reffering to the 'reading mode' in Word, which it uses when you open a Word document that was attached to a message?
    There are instructions on [http://myitforum.com/myitforumwp/2013/06/10/disable-reading-mode-and-protected-view-in-word-2013/ how to disable that] although it's not in the scope of Thunderbird.
    Hope this helps!

  • Why Documents are not releasing to Accounting Automatically?any reason?

    Hi,
    Is there is any reason that these documents are not automatically being passed to accounting.Please help me to fix this issue.
    Thanks
    Supriya

    Hello,
    This is not just FICO consultant issue.
    If you do not have sufficient configuration in VKOA, it cannot be generated.
    If you have closed the period in FI, obviously the entries will not be posted.
    If the user is not having authorization, obvisouly it fails to generate accounting documents.
    There is no special configuration, but this is system behaviour. If something is not available, then it cannot generate the entry.
    Hope you have gone through the points mentioned by me.
    Regards,
    Ravi

  • Just updated to Lion.  Didn't realize things like reading a Word document would not be supported.  How do I get these files back and how I do read them going forward?  When a PC user sends me a word document won't I be able to open it and read it?

    Just updated to Lion today, 11/22/11.  I did not realize things likes reading a Word document would not be supported.  "You cannot open this because PowerPC applications are no longer supported."  How am I supposed to read and open Word documents from PC users?  Any insight is helpful, thanks!

    You have Word 2004 which is PPC based. Lion is not able to execute PPC code. You have to upgrade. Or you can do as I do an open them in Pages, since I refuse to allow anything from Microsloth on my Mac.
    Allan

  • Billing document are not flowing into FI and COPA

    Hello SAP CO gurus,
    please help me out by giving possible reasons why Billing document are not flowing into FI and COPA.
    what are the settings need to check?
    is there any option to get release by manual?
    Initiatives rewards with points........
    Regards
    Chandra.

    Hello Chandra,
    Check whether any standard cost estimate is existing for that material for which your billing. If it is there then check whether costing key from COPA is able to access the cost estimate.
    I am also working on the same issue but not solved yet.
    regards
    Nivas

  • Reversed documents are not cleared

    Hello there
    I am dealing with support to customer who has following issue (among others..):
    - the settings are made so that standard SAP reversing procedure is messed up! Namely, when the user reverse FI document the SAP creates new one (reversal document) but the original and reverse documents are not cleared against each other! It is also very hard to find out the connection between these two documents.
    I have no idea where to look to check why this is happening.
    I checked the reversal reasons, and all are set to 'negative postings', but I do not believe this is just because of that!
    They have SAP ECC 5.0 version KERNEL 640
    Best regards,
    Amina
    Edited by: Amina Bisic on Feb 28, 2008 9:39 AM

    Hi
    When any transaction is cleared with another transaction either it may be customer or vendors, the first line item will become closed status.
    When you want to reverse the transaction you have to reset and reverse the transaction.
    I mean when you reset it becomes open item then you can reverse the transaction.
    Otherwise in your case it is only creating  a seperate lieme item
    Thx

  • My iWork documents are not syncing?

    My iWork documents are not syncing between my iPad, iPhone and iMac.  This seems to have happened since I upgraded to 10.8.2?  Any help?

    Thanks, I knew that though and nothing was happening.
    However, since I asked the question my documents have started to sync. No idea why, nothing has changed in my settings apart from a restart of all devices...but it's working so issue solved!
    KC

  • Backened documents are not getting updated in Classic Scenario

    Hi,
    We are using SRM 7.0 version and we are working on classic scenario where the shopping cart - RFX - Contract are created in SRM and the PO - GR - IR are created in ECC. The blackened documents which are created in ECC PO - GR and IR these documents are not getting updated in SRM system.
    Is there any business functions to be activated.

    Hi Sunil,
    You manually run report ""BBP_GET_STATUS_2" after PO is created in MM. Then check if the follow-on-docs are updated in SC.
    If it is working fine after you manully run report, you will have to properly set time to run this report automatically.
    Best Regards,
    Anu
    Edited by: Anuradha UG on May 18, 2010 8:09 PM

Maybe you are looking for

  • IPhoto, iMovie and GarageBand with multiple apple ID's.

    Hello, First of all I want to excuse myself for my bad english. It's not my native language. I've bought a Macbook Air 11" two weeks ago and I logged in the app store using an "old" apple ID. Now that I wanted to use a new apple ID to start "clean" I

  • What do I need to be able to upgrade my leopard macbook pro to the newest system software?

    I have the following Macbook Pro: Model Name:          MacBook Pro   Model Identifier:          MacBookPro5,3   Processor Name:          Intel Core 2 Duo   Processor Speed:          2.8 GHz   Number Of Processors:          1   Total Number Of Cores: 

  • Customer Statement in Balance Forward Format

    Have Oracle introduced a customer statement in a Balance Brought Forward format as yet? We need the ability to print customer statements comprising: (a) An opening balance (being the previous period's closing balance) (b) Details of all credit memos,

  • Today-Improve Scanned Text To Be Inserted into Word

    I have a hard copy that I scanned on Toshiba Scan to Pdf. so I have a pdf. The scan is a fax of text...no images. How best to improve the printed quality. I think I use Illustrator rather than Photoshop but don't know how to do it? Oh, as I was writi

  • Dual layer burns failing

    Hi all. I am at a loss regarding burning dual layer DVD+R discs. I posted a previous thread with Toast in the title but the problem has turned out much more broader than that. After half a dozen successful DVD+R DL burns, some to the full capacity of