SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Display a picture and text stored in SAP using OLE2



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> OLE2, Excel, WinWord
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Nov 17, 2007 9:58 pm    Post subject: Display a picture and text stored in SAP using OLE2 Reply with quote

Code:
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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> OLE2, Excel, WinWord All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.