cancel
Showing results for 
Search instead for 
Did you mean: 

SIOS Word in WD4A - Office Ctrl fails when Template has other editable flds

PatrickDean
Participant
0 Kudos

Hi All...

I'm working with a word document loaded onto the Mime Repository, with 5 editable fields which get populated from a WD using the following code in the WDDOMODIFYVIEW method of the view holding the OfficeControl

The following code was adapted from the SIOS Package.


      CALL METHOD conv->convert( EXPORTING data = 'ECNNo' IMPORTING buffer = fields-fieldidentifier  ).
      CALL METHOD conv->convert( EXPORTING data = L_CXECNNO IMPORTING buffer = fields-value ).
      CALL METHOD conv->convert( EXPORTING data = cl_abap_char_utilities=>horizontal_tab IMPORTING buffer = tabulator  ).
      CALL METHOD conv->convert( EXPORTING data = cl_abap_char_utilities=>cr_lf IMPORTING buffer = endofline  ).
      wd_context->set_attribute( name = 'CXECNNO' value = L_CXECNNO ).
      APPEND fields TO fieldstable.

This works fine - i.e. the field ECNNo in the word document gets populated with the l_CXECNNO field from my WD.

If I add other repetitions of the above code for other fields, this also works.

However, if the Word Document is expecting fields that are not filled, then I get an "Invalid Merge Field" popup box. This can be bypassed by clicking "remove field from document".

So I either need to bypass the error message automatically, or have the OfficeControl tell the WD what fields it is expecting, so that all of them can be filled (even if just with null values) so I don't get this error message.

Does anyone know how to do this? Many thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Patrick,

I have the same problem, I'm not able to bypass the error pop up automatically.

Is there a way to fix this issue from Word or from SAP ?

Thanks

PatrickDean
Participant
0 Kudos

Sorry mate, I wasn't able to read the interface from SAP - so I ended up having to manually check the interface, code according to what was there  populating known fields. Kind of feels like the fields behave like function module interface fields - i.e. they HAVE to be there. There's no "optional" flag to tick.

Former Member
0 Kudos

Hi,

I found a kind of solution to avoid this issue.

to be quick, I had to fill the variable even if it's empty.

In my exemple I had a table table with 3 to 6 lines, I created 6 lines in my word document and when only 3 lines are filled, I did a describe table and a when I have to send to word the information I do : DO n times where n = empty field number. and where fieldvalue is empty.

PatrickDean
Participant
0 Kudos

Okay, quick update...

You can see the fields word's expecting in the Microsoft Script Editor in Word. (Tools->Macro->MS Script Editor)

This contains a big XML representation of the Word Document, which includes the MERGEFIELDs that the Word Document contains. I'm guessing this isn't available to SAP... anyone know for sure?