Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Add fields in a word Form using DOI

Former Member
0 Likes
1,733

Hi all,

Here is my problem : I want to create a form under Word, and fill the fields with SAP.

So I created my form under Word, adding a field name. Then I inserted it in the BDN through transaction OAOR.

In my Abap program, I open this BDS doc using method OPEN_DOCUMENT of a I_OI_DOCUMENT_PROXY instance.

This works fine.

But I instance a I_OI_FORM object using method GET_FORM_INTERFACE of my I_OI_DOCUMENT_PROXY instance, and I want to retrieve the fields of my form using method GET_DATA of the I_OI_FORM instance.

But this results in an empty table, and my field "name" is not found.

Could anyone help find what I missed there ?

Thanx for ur help.

Olivier


  CALL METHOD i_control->get_document_proxy
    EXPORTING
      document_type      = 'Word.Document'
      register_container = 'X'
    IMPORTING
      document_proxy     = i_document.

*item_url contains the document's URL, so call open_document to open it
  CALL METHOD i_document->open_document
    EXPORTING
      open_inplace = w_inplace
      document_url = w_url.

*check if desktop application supports mail merge, and if yes get an
*instance of the interface
  CALL METHOD i_document->has_mail_merge_interface
    IMPORTING
      is_available = has.
  IF NOT has IS INITIAL.
    CALL METHOD i_document->get_form_interface
      IMPORTING
        f_interface = handle.
    IF NOT handle IS INITIAL.
      CALL METHOD handle->protect
        EXPORTING
          protect = ' '.

      CALL METHOD handle->get_data
        EXPORTING
          all    = 'X'
        IMPORTING
          fields = tabel.

Hi all,

Here is my problem : I want to create a form under Word, and fill the fields with SAP.

So I created my form under Word, adding a field name. Then I inserted it in the BDN through transaction OAOR.

In my Abap program, I open this BDS doc using method OPEN_DOCUMENT of a I_OI_DOCUMENT_PROXY instance.

This works fine.

But I instance a I_OI_FORM object using method GET_FORM_INTERFACE of my I_OI_DOCUMENT_PROXY instance, and I want to retrieve the fields of my form using method GET_DATA of the I_OI_FORM instance.

But this results in an empty table, and my field "name" is not found.

Could anyone help find what I missed there ?

Thanx for ur help.

Olivier


  CALL METHOD i_control->get_document_proxy
    EXPORTING
      document_type      = 'Word.Document'
      register_container = 'X'
    IMPORTING
      document_proxy     = i_document.

*item_url contains the document's URL, so call open_document to open it
  CALL METHOD i_document->open_document
    EXPORTING
      open_inplace = w_inplace
      document_url = w_url.

*check if desktop application supports mail merge, and if yes get an
*instance of the interface
  CALL METHOD i_document->has_mail_merge_interface
    IMPORTING
      is_available = has.
  IF NOT has IS INITIAL.
    CALL METHOD i_document->get_form_interface
      IMPORTING
        f_interface = handle.
    IF NOT handle IS INITIAL.
      CALL METHOD handle->protect
        EXPORTING
          protect = ' '.

      CALL METHOD handle->get_data
        EXPORTING
          all    = 'X'
        IMPORTING
          fields = tabel.

6 REPLIES 6
Read only

Former Member
0 Likes
1,248

Hello Oliver,

Did you solve this problem ? I am encountering the same problem that you are describing.

If you solved this problem can you send me de solution.

Thanks in advanced.

Regards Hicham

Read only

Former Member
0 Likes
1,248

Did you guys figure this out?

There is a difference between a FORM interface and a MAILMERGE interface.

I have made use of the following to retrieve the list of mailmerge fields defined in the Word document:

CALL METHOD DOCUMENT->HAS_MAIL_MERGE_INTERFACE

IMPORTING

IS_AVAILABLE = HAS.

IF NOT HAS IS INITIAL.

CALL METHOD DOCUMENT->GET_MAIL_MERGE_INTERFACE

IMPORTING

MM_INTERFACE = MM_HANDLE.

IF NOT MM_HANDLE IS INITIAL.

refresh: mm_fieldnames_tab.

CALL METHOD MM_HANDLE->GET_FIELDS

IMPORTING

descr_list = mm_fieldnames_tab.

....

Regards,

Bruce de Wet

Read only

Former Member
0 Likes
1,248

Hello,

I had the same problem. The problem is because the MS-Word document properties are not correctly set. Have a look (in Word) under File > Properties on the Personalization tab. For every form field you create you must create a connection at that place.

Then and only then the structure returned by GET/SET_DATA is correctly recognized.

Read only

0 Likes
1,248

Hi,

Please send the setting you have done in Office - 2007 for Mail Merge.I'm facing the same issue.I didn't find any Personalized Tab in File -> Properties.

Thanks and Regards,

Kumar

Read only

0 Likes
1,248

Hi, can anyone please show me how to do the settings in word 2007, cause I'm facing the same problem and didn't find any Personalized Tab in File -> Properties.

Thanks and Regards.

Guy

Read only

0 Likes
1,248

Hi, can anyone please show me how to do the settings in word 2007, cause I'm facing the same problem and didn't find any Personalized Tab in File -> Properties.

Thanks and Regards.

Guy