Skip to Content
0
Former Member
Jun 01, 2005 at 02:49 PM

Trouble with OLE mailmerge in header and footer of MS Word document.

112 Views

Hi,

I’m trying to create MS-Word documents using OLE..

Everything works fine, all the mailmerge-fields are replaced by the table-value, except for fields in the header or footer.

How can I solve this problem?

DESCRIBE TABLE gtb_lsd LINES ln_recs.

IF ln_recs > 0.

CALL METHOD gr_proxy->get_mail_merge_interface

IMPORTING

mm_interface = gr_mailmerge

retcode = lc_retcode.

CALL METHOD c_oi_errors=>raise_message

EXPORTING

type = 'I'.

CALL METHOD gr_mailmerge->set_data_source

IMPORTING retcode = lc_retcode

CHANGING

data_table = gtb_lsd

fields_table = gtb_lsd_fields.

CALL METHOD c_oi_errors=>raise_message

EXPORTING

type = 'I'.

IF lc_retcode NE c_oi_errors=>ret_ok.

PERFORM verzorg_melding.

ENDIF.

ln_tel = 0.

DO ln_recs TIMES.

<b>CALL METHOD gr_mailmerge->merge_one

EXPORTING index = ln_tel

IMPORTING retcode = lc_retcode</b>.

CALL METHOD c_oi_errors=>raise_message

EXPORTING

type = 'I'.

IF lc_retcode NE c_oi_errors=>ret_ok.

PERFORM verzorg_melding.

ENDIF.

CALL METHOD gr_mailmerge->view.

ln_tel = ln_tel + 1.

ENDDO.

ENDIF.<b></b>