Quantcast
Channel: SCN: Message List - ABAP Connectivity
Viewing all articles
Browse latest Browse all 3125

Re: Mail Merge

$
0
0

Hi,

Here I want to explain problem with merge fields in word for getting list of merge fields used in given document using method I_OI_MAIL_MERGE-get_fields

 

Merge fields Tags (with Problem)

Merge fields Tags(correct)

{MERGEFIELD "TAG1"}

{MERGEFIELD TAG1}

{MERGEFIELD TAG_H1}

{MERGEFIELD TAGH1}

 

*******

     CLEAR RETCODE. CLEAR ERROR.

     CALL METHOD MM_INTERFACE->GET_FIELDS

       EXPORTING

         NO_FLUSH   = ' '

       IMPORTING

         DESCR_LIST = LIST

         ERROR      = ERROR

         RETCODE    = RETCODE.


   LOOP AT TDD03L.

     LOOP AT LIST INTO WLIST WHERE ITEM_NAME = TDD03L-FIELDNAME.

       WFIELD-TABNAME = TDD03L-TABNAME.

       WFIELD-FIELDNAME = TDD03L-FIELDNAME.

       WFIELD-POSITION = TDD03L-POSITION.

       WFIELD-INTLENGTH = TDD03L-LENG.

       WFIELD-EXID = TDD03L-INTTYPE.

       WFIELD-OFFSET = T_OFFSET.

       APPEND WFIELD TO TFIELD.

     ENDLOOP.

     T_OFFSET = T_OFFSET + TDD03L-LENG.

   ENDLOOP.


*****

   CLEAR ERROR.

   CALL METHOD MM_INTERFACE->SET_DATA_SOURCE

**    EXPORTING

**      DDIC_NAME    = 'ZXXX'

****     no_flush     = 'X'

     IMPORTING

       RETCODE      = RETCODE

       ERROR        = ERROR

     CHANGING

       DATA_TABLE   = TDATA

       FIELDS_TABLE = TFIELD.


   IF RETCODE EQ C_OI_ERRORS=>RET_OK.

     " Document opened successfully

   ELSE.

     CALL METHOD C_OI_ERRORS=>RAISE_MESSAGE

       EXPORTING TYPE = 'I'.

   ENDIF.


Viewing all articles
Browse latest Browse all 3125

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>