Application Development 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: 

OLE

Former Member
0 Kudos

Hi,

I am having two questions in the following code snippet:

create object gs_word 'Word.Basic'.

call method of gs_word 'Filenew'

exporting

#1 = 'normal.dot'.

1.I want to know how we can identify the value to be passed for each exporting parameter(here 'normal.dot').I searched in tables TOLE and OLELOAD.But I am unable to find information about the parameter values.

2.If I want to add a table in word,how the code should be using 'WORD.BASIC'.[I need code only using 'WORD.BASIC']

Any useful pointers will be appreciated.

Thanks and Regards,

J.Jayanthi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Jayanthi,

REPORT YOLE .

* This program stores or gets pictures and texts in/from SAP.
* If key has an initial value, it will store the picture and text in
* an SAP cluster.
* If key has no initial value it calls MsWord via OLE2 and displays
* the picture and the text.

TABLES : INDX.
INCLUDE OLE2INCL.
DATA: WRD TYPE OLE2_OBJECT,
      REC TYPE OLE2_OBJECT,
      PIC TYPE OLE2_OBJECT.
DATA: BEGIN OF ITAB1 OCCURS 20,
    LINE(1022) TYPE X,
END OF ITAB1.
DATA: BEGIN OF IREC OCCURS 1,
    LINE(1022) TYPE X,
END OF IREC.
DATA: BEGIN OF ITAB2 OCCURS 20,
    LINE(100),
END OF ITAB2.
*data: key like indx-srtfd value 'JJJ'.
DATA: KEY LIKE INDX-SRTFD.
DATA: MODE, SIZE TYPE I, TIM LIKE SY-UZEIT.

IF KEY <> ' '.             "Import the picture and text to SAP
  CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
            FILENAME = 'c:inputbubbles.bmp'
            FILETYPE = 'BIN'
       TABLES
            DATA_TAB = ITAB1.

  CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
            FILENAME = 'c:inputtext.txt'
            FILETYPE = 'ASC'
       TABLES
            DATA_TAB = ITAB2.

  EXPORT ITAB1 ITAB2 TO DATABASE INDX(ST) ID KEY.

ELSE.                                  "Display the picture and text
  KEY = 'JJJ'.
  IMPORT ITAB1 ITAB2 FROM DATABASE INDX(ST) ID KEY.
  MODE = ''.
  LOOP AT ITAB1.
    CLEAR IREC.REFRESH IREC.
    IREC = ITAB1.
    APPEND IREC.

    CALL FUNCTION 'WS_DOWNLOAD'
         EXPORTING
              BIN_FILESIZE = 1022
              FILENAME     = 'c:inputbub2.bmp'
              FILETYPE     = 'BIN'
              MODE         = MODE
         TABLES
              DATA_TAB     = IREC.
    MODE = 'A'.
  ENDLOOP.

  CALL FUNCTION 'WS_DOWNLOAD'
       EXPORTING
            FILENAME = 'c:inputtxt.txt'
       TABLES
            DATA_TAB = ITAB2.

 CREATE OBJECT WRD 'WORD.BASIC'.
 CALL METHOD OF WRD 'FILEOPEN' = REC EXPORTING #1 = 'C:inputtext.txt'.
 CALL METHOD OF WRD 'INSERTPICTURE' = PIC
             EXPORTING #1 = 'C:inputbub2.bmp'.
ENDIF.

AT LINE-SELECTION.
  FREE OBJECT PIC.
  FREE OBJECT REC.
  FREE OBJECT WRD.

Check this if u can get some info.

1 REPLY 1

Former Member
0 Kudos

Hi Jayanthi,

REPORT YOLE .

* This program stores or gets pictures and texts in/from SAP.
* If key has an initial value, it will store the picture and text in
* an SAP cluster.
* If key has no initial value it calls MsWord via OLE2 and displays
* the picture and the text.

TABLES : INDX.
INCLUDE OLE2INCL.
DATA: WRD TYPE OLE2_OBJECT,
      REC TYPE OLE2_OBJECT,
      PIC TYPE OLE2_OBJECT.
DATA: BEGIN OF ITAB1 OCCURS 20,
    LINE(1022) TYPE X,
END OF ITAB1.
DATA: BEGIN OF IREC OCCURS 1,
    LINE(1022) TYPE X,
END OF IREC.
DATA: BEGIN OF ITAB2 OCCURS 20,
    LINE(100),
END OF ITAB2.
*data: key like indx-srtfd value 'JJJ'.
DATA: KEY LIKE INDX-SRTFD.
DATA: MODE, SIZE TYPE I, TIM LIKE SY-UZEIT.

IF KEY <> ' '.             "Import the picture and text to SAP
  CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
            FILENAME = 'c:inputbubbles.bmp'
            FILETYPE = 'BIN'
       TABLES
            DATA_TAB = ITAB1.

  CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
            FILENAME = 'c:inputtext.txt'
            FILETYPE = 'ASC'
       TABLES
            DATA_TAB = ITAB2.

  EXPORT ITAB1 ITAB2 TO DATABASE INDX(ST) ID KEY.

ELSE.                                  "Display the picture and text
  KEY = 'JJJ'.
  IMPORT ITAB1 ITAB2 FROM DATABASE INDX(ST) ID KEY.
  MODE = ''.
  LOOP AT ITAB1.
    CLEAR IREC.REFRESH IREC.
    IREC = ITAB1.
    APPEND IREC.

    CALL FUNCTION 'WS_DOWNLOAD'
         EXPORTING
              BIN_FILESIZE = 1022
              FILENAME     = 'c:inputbub2.bmp'
              FILETYPE     = 'BIN'
              MODE         = MODE
         TABLES
              DATA_TAB     = IREC.
    MODE = 'A'.
  ENDLOOP.

  CALL FUNCTION 'WS_DOWNLOAD'
       EXPORTING
            FILENAME = 'c:inputtxt.txt'
       TABLES
            DATA_TAB = ITAB2.

 CREATE OBJECT WRD 'WORD.BASIC'.
 CALL METHOD OF WRD 'FILEOPEN' = REC EXPORTING #1 = 'C:inputtext.txt'.
 CALL METHOD OF WRD 'INSERTPICTURE' = PIC
             EXPORTING #1 = 'C:inputbub2.bmp'.
ENDIF.

AT LINE-SELECTION.
  FREE OBJECT PIC.
  FREE OBJECT REC.
  FREE OBJECT WRD.

Check this if u can get some info.