cancel
Showing results for 
Search instead for 
Did you mean: 

WD4A Word MailMerge Multi-Line Fields

PatrickDean
Participant
0 Kudos

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!

Accepted Solutions (1)

Accepted Solutions (1)

PatrickDean
Participant
0 Kudos

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.


Former Member
0 Kudos

Hi, Patrick, sorry for reopening the post. Did you solve the same situation with the horizontal_tab? when cl_abap_char_utilities=>horizontal_tab is used for the same purpose, the template goes crazy

PatrickDean
Participant
0 Kudos

The vertical tab was used to throw CRLFs within an individual text box.

I don't know what effect the horizontal tab would have, the only thing I can think would be that the horizontal tab is triggering a "go to the next box" in the same way it would like on a webpage.

There's nothing obvious in cl_abap_char_utilities that looks like it could do the horizontal equivalent on the page... Sorry!

If you do get a solution, please do post it here, I'd be interested!

The rough and dirty way of doing it would be to force a truetype font, and then have the backend tidy up the data, using spaces instead of tabs, but that's pretty horrible solution.

Former Member
0 Kudos

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.

Answers (0)