Skip to Content
author's profile photo Former Member
Former Member

How to use the DOI METHOD(Insert_table and Insert_table)

Hello All,

I want insert some data into MS Office word.(The word template has some table)

(I know the DOI function is good solution.)

I have use the METHOD search to get the area.then use the METHOD insert_table can add data to MS Office Word.

The METHOD search can get right area. But the METHOD insert_table can not add data into the MS office word.

Code as below:

***********************************************************************************************************

*Get the area

CALL METHOD ref_word_document->search

EXPORTING

search_string = '<Search1>'

pos = '0'

flag = space

IMPORTING

retcode = g_retcode.

lw_info-colindex = 0.

APPEND lw_info TO lt_info.

*Insert tabel to current area.

TYPES:BEGIN OF ty_data,

lv_char TYPE char20,

END OF ty_data.

DATA: lw_data TYPE ty_data.

DATA: lt_data TYPE TABLE OF ty_data.

lw_data-lv_char = 'test the insert data to word'.

APPEND lw_data TO lt_data.

*Insert above data to Word file.

CALL METHOD ref_word_document->insert_table

EXPORTING

data_table = p_lt_data[]

info_table = p_lt_info[]

lowerbound = 0 " propose 1

upperbound = 0 " table rows to be counted first but review parameter wholetable

doctable_number = 1 " to be figured out what is table number logic in WORD

clearoption = 1 " I would leave 1

startrow = 1 " I would leave 1

varsize = 'X'

no_flush = 'X'

wholetable = 'X'

IMPORTING

retcode = g_retcode

error = g_error.

************************************************************************************************

the g_retcode value is "CONTROL_INTERNAL_ERROR".

Can you give me a example about how to use the Call METHOD I_OI_WORD_PROCESSOR_DOCUMENT->insert_table?

I have refer to the SAP help,But it still can not add data to Word.

(MS Office 2003 and 2007 Version,SAP Version:7200.1.0.1050,Windows Version:Windows 7 and XP).

Best Regards

Roy Cai

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 01, 2010 at 01:42 AM

    Please give me some comments for this question, anything.

    Thanks.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.