Skip to Content

WD4A Word MailMerge Multi-Line Fields

Hi all!

I've got a Word Template document with MailMerge Fields Bookmarked and set as properties in the File-Properties-Custom Properties. Copying the example in package SIOS, I can use this to transmit data from my WebDynpro into the ActiveX Control, and on into the Word Document. So far so good. The problem I have is when I want to pass multi-line data (longtexts) into the receiving MailMerge field. I'm presently passing a String, I guess within that there's some character I can use that will tell Word to throw a new line in it's MailMerge field?

When I use the cl_abap_char_utilities=>cr_lf as a separator, upon calling Word I get a load of MS Errors, asking how to separate the MailMerge fields. This throws data into the wrong receiving fields.

One (non-SAP) forum I found suggested using \V though this just resulted in "\V" sitting between my texts, all of which remained frustratingly on the same line.

Any help gratefully received! 😊

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 19, 2012 at 11:13 AM

    Fixed it!

    cl_abap_char_utilities=>vertical_tab for the win!

    cl_abap_char_utilities=>cr_lf wouldn't work because the SIOS example uses that as it's "reached the end of this field" delimiter. I tried using other characters as the delimiter, but that seemed to confuse Word as the ACF was called. Word would then ask "What are we using as Tabs? What are we using as End Of Line?"

    With vertical_tab, Word has something that tells it that it needs to go onto a new line, and it can do that until it hits a "cr_lf" which tells it that it needs to go to a new field.

    Simples.


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Patrick Dean

      HI, the solution for all of the special character is easy as it can be. Just encapsulate the string with " (quotes) and you even can use the cr_lf character.