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

MS Word OLE Implementation

Former Member
0 Likes
1,429

Hello Gurus,

We are creating a new MS word document via SAP and typing some datas and values in it, We could capture those datas into an internal table.But the challenge what we are facing is that, the data which we captured into the internal table is in RAW Format.

We even tried converting them into CHAR format.

In Both the cases(RAW and CHAR) the internal table data is like encryped data.

How can we capture the same data what we type?

Here we are referring SAPRDEMOOFFICEINTEGRATION standard program and using "i_oi_document_proxy" interface.

Waiting for your replies...

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
1,313

Hi jagan,

you will find the required information in the [documentation|http://help.sap.com/printdocu/core/print46b/en/data/en/pdf/BCCIOFFI.pdf]

If this does not help, you may post relevant parts of your code.

Regards,

Clemens

Hi jagan,

you will find the required information in the [documentation|http://help.sap.com/printdocu/core/print46b/en/data/en/pdf/BCCIOFFI.pdf]

If this does not help, you may post relevant parts of your code.

Regards,

Clemens

7 REPLIES 7
Read only

Clemenss
Active Contributor
0 Likes
1,314

Hi jagan,

you will find the required information in the [documentation|http://help.sap.com/printdocu/core/print46b/en/data/en/pdf/BCCIOFFI.pdf]

If this does not help, you may post relevant parts of your code.

Regards,

Clemens

Read only

Former Member
0 Likes
1,313

Hi Clemens,

Please let us know where we are going wrong.

The necessary coding part is pasted below.

Here the internal table DOC_TABLE contains RAW records of what we fetch from MS Word.

We tried using RRXWS_RAW_TO_CHAR function module to convert RAW format to CHAR format.

But the data is coming in encrypted format nothing understandable.

CLEAR: DOC_URL.

CALL FUNCTION 'SAP_OI_GET_UNIQUE_URL'

IMPORTING

UNIQUE_URL = DOC_URL

EXCEPTIONS

OTHERS = 0.

CALL METHOD DOCUMENT->SAVE_DOCUMENT_TO_URL

EXPORTING

URL = DOC_URL

IMPORTING

RETCODE = RETCODE.

CALL METHOD C_OI_ERRORS=>SHOW_MESSAGE

EXPORTING

TYPE = 'E'.

CALL FUNCTION 'DP_GET_STREAM_FROM_URL'

EXPORTING

URL = DOC_URL

IMPORTING

SIZE = DOC_SIZE

TABLES

DATA = DOC_TABLE.

CALL METHOD C_OI_ERRORS=>SHOW_MESSAGE

EXPORTING

TYPE = 'E'.

waiting for your replies.....

Read only

Clemenss
Active Contributor
0 Likes
1,313

Hi jagannathan kri...

probably you try to do something impossible. You think you can read the text you have typed into the word document. This is not provided by The Word Processor Interface. Here we have only methods for search and replace.

You have lot more options with Excel using The Table Interface. I never tried reading the excel, only filling with data from ABAP, but GET methods should give you cell and sheet contents.

The way used in the future will be ADOBE interactive forms, there are some good blogs for that in SCN.

Regards,

Clemens

Read only

Former Member
0 Likes
1,313

Hi Clemens,

Thanks for your guidance....Will lookout for Adobe interactive forms...

With Regards,

Jagan

Read only

Clemenss
Active Contributor
0 Likes
1,313

Hi jagannathan kri... ,

sorry, now I got a solution for you:

After opening Word and typing something, you can

CALL METHOD document->select_all
CALL METHOD document->copy_selection

to copy everything to the clipboard

and then

call function 'CLPB_IMPORT'
    importing
      empty                               = l_empty
    tables
      data_tab                            = pt_clip

l_empty is an initial CHAR01-variable, pt_clip is a text table, i.e. tape table of CHAR1024.

Sap says CLPB_IMPORT is obsolete, so you may use CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_IMPORT.

Regards,

Clemens

Read only

Former Member
0 Likes
1,313

Hi Clemens,

We are really thankful to you....

As you said we tried using the methods CALL METHOD document->select_all

CALL METHOD document->copy_selection after creating the word document.

But after creating a word document, the typed data can only be capture on the event ON_CLOSE_DOCUMENT

(please correct us if we are wrong)....

Kindly let us know how can we trigger event ON_CLOSE_DOCUMENT in I_OI_DOCUMENT_PROXY

(We tried a lot on this).....

right now we have referred the program SAPRDEMOOFFICEINTEGRATION and tried registering the events via SETHANDLER

before method CREATE_DOCUMENT.

Waiting for your reply......

Read only

Clemenss
Active Contributor
0 Likes
1,313

Hi jagannathan krishnan,

I tried it using program SAPRDEMOOFFICEINTEGRATION: Use Create Button, Word opens. Type something into WORD. Use Select All button - all is selected in WORD, Use copy Button. Then, from another program I called the 'CLPB_IMPORT' function and captured the data. Nothing observed for ON_CLOSE_DOCUMENT.

But I don't know if different WORD versions show different behavior. I don't think so because select_all and copy_selection methods of i_oi_document_proxy interface. This should work for all kind of supported documents.

Regards,

Clemens