Skip to Content
0
Former Member
Jul 09, 2007 at 04:37 PM

Abap OO and BEx - start query-id.

37 Views

Hi,

I wish to start a BEX query via ABAP. Using VBA this is possible following the steps:

' Launch Excel

Dim app

1) set app = createobject("Excel.Application")

' Make it visible

2) app.Visible = true

' Open xla file

3) app.Workbooks.Open("C:\Program Files\SAP\FrontEnd\Bw\sapbex.xla")

' Logon onto BW

4) Call logonToBW -->

' Run the workbook report.

5) app.Run "SAPBEX.xla! SAPBEXreadWorkbook", "3P5SUTCVPVAQOUU094TZ5KZRG"

' Give the user control of Excel

6)app.UserControl = true

I'm not very skilled in OO Abap then I ask you an help.

If I try for the step (3) it works correctly using:

cl_gui_frontend_services=>execute(

EXPORTING

DOCUMENT = 'C:\Program Files\SAP\FrontEnd\Bw\wdbpwpub.exe'

  • APPLICATION = APPLICATION

  • PARAMETER = PARAMETER

  • DEFAULT_DIRECTORY = DEFAULT_DIRECTORY

  • MAXIMIZED = MAXIMIZED

  • MINIMIZED = MINIMIZED

  • SYNCHRONOUS = SYNCHRONOUS

  • OPERATION = 'OPEN'

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

BAD_PARAMETER = 3

FILE_NOT_FOUND = 4

PATH_NOT_FOUND = 5

FILE_EXTENSION_UNKNOWN = 6

ERROR_EXECUTE_FAILED = 7

SYNCHRONOUS_FAILED = 8

NOT_SUPPORTED_BY_GUI = 9

others = 10

)

For steps (1) and (5), for exaple I can use (include OLE2INCL)

create object ole_excel 'EXCEL.APPLICATION'.

call method of ole_excel 'Run' = launcher_return

exporting

#1 = launcher_macro_direct (SAPBEX.xla! SAPBEXreadWorkbook)

#2 = sysno

#3 = sy-uname

#4 = i_workbookid

#5 = i_genuniid

#6 = ''

#7 = ''

#8 = sy-host.

But don't work.

Maybe I have a little confusion in using OO Abap.

Any idea to develop a right source code?

Thaks in advance.

Regards,

Giovanni