Skip to Content

How can we export data business object by Excel VBA/VB.net ?

Hello everyone!

In few words my need, i would like to export data to excel document from Busines Object by a macro excel (VBA). Or (VB.net) module.

Steps :

-open a request specific BO

-refresh the data (date initial-hours,date end-hours,model)

-export the results in another excel document.

Anyone has a code which allow this things ?

Thank.

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    Posted on Oct 19, 2018 at 09:22 PM

    Finally, I found a code VBA for my proyect. I share it .. maybe someone serves him.

    Thanks to everyone for your replies!

    - MT

    Sub Export_REPtoXLS ()
    Dim appBO As busobj.Application
     
      Set appBO = CreateObject("BusinessObjects.Application.12") 
    Application.StatusBar = "Login Session Business Objects..." 
    On Error GoTo exxit: 
     appBO.Logon "XXXX", "XXXX", "@box", "LABC", False, False 
     appBO.Interactive = True 
     appBO.Visible = False 
    'appBO.Window.State = boMinimized 
    Application.StatusBar = "Open Requette.rep..." 
     Set docBO = appBO.Documents.Open("I:\XXX\" & "Requette.rep") 
     docBO.Reports("SHEET").Activate 
     docBO.Variables.Item("SINCE:").Value = "19/10/2018 06:00:00" 
     docBO.Variables.Item("UNTIL:").Value = "19/10/2018 23:00:00"
    Application.StatusBar = "Refresh Requette.rep..." 
     appBO.Interactive = False 
     docBO.Refresh 
     appBO.ActiveDocument.SaveAs ("I:\XXX\" & "TEST" & ".xls")
    Application.StatusBar = "TEST.xls file was created successfully!"  
     appBO.Interactive = True  
     appBO.Visible = True 
     appBO.ActiveDocument.Save
    'appBO.ActiveDocument.Close 'or
     appBO.Quit 
    exxit:
    
    End Sub
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2018 at 11:41 AM

    this is literally what BO does out of the box. You open report, refresh it , then you can save to excel . or you can schedule report into excel. No need to use any macro's.

    p.s.

    Are you sure you are using BI platform (webi, crystal) and not some other SAP product ?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2018 at 01:46 PM

    Yes, to be precise... i'm creating an app to simplify jobs. And i need a macro in VBA or VB.net to interact with BO.

    I found this post and it is very similar to what i need.

    How can we pilot business object by Excel VBA ?

    I attach pic to clarify.

    But i dont know update with my parameters.

    Thanks.


    bo1.png (20.7 kB)
    variables.png (11.1 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2018 at 02:58 PM

    You can use the .NET SDK that is available on the Client Tools install for this. I have some sample C# code on my website that you could translate to VB.NET to get you started. http://www.dellstinnett.com/sample_code.html - look for "BO XI 3.1, Visual Studio 2008". You will use the same techniques to use the SDK in VBA in Excel as you would in VB.NET.

    Note that the SDK for this version of BOBJ will not work with any newer version of Visual Studio and I don't think it will work with Microsoft Office 2016. It should work with MS Office 2010, though.

    -Dell

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 18, 2018 at 04:04 PM

    see the sample code in my Answer under

    https://answers.sap.com/questions/560796/bo-bi-42-sp5-webi-opendocument-report-download-via.html?childToView=564039#answer-564039


    in this Example I used RESTful API in VBA to export a Report from a WebI document as HTML to XLS Sheet

    You can use it as a base, and modify it for your needs


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.