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:\input\bubbles.bmp' FILETYPE = 'BIN' TABLES DATA_TAB = ITAB1. CALL FUNCTION 'WS_UPLOAD' EXPORTING FILENAME = 'c:\input\text.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:\input\bub2.bmp' FILETYPE = 'BIN' MODE = MODE TABLES DATA_TAB = IREC. MODE = 'A'. ENDLOOP. CALL FUNCTION 'WS_DOWNLOAD' EXPORTING FILENAME = 'c:\input\txt.txt' TABLES DATA_TAB = ITAB2. CREATE OBJECT WRD 'WORD.BASIC'. CALL METHOD OF WRD 'FILEOPEN' = REC EXPORTING #1 = 'C:\input\text.txt'. CALL METHOD OF WRD 'INSERTPICTURE' = PIC EXPORTING #1 = 'C:\input\bub2.bmp'. ENDIF. AT LINE-SELECTION. FREE OBJECT PIC. FREE OBJECT REC. FREE OBJECT WRD.