VBA In BEx

Hi All
DOes anyone has detail guide document on how to use VBA into BEx reporting tool? Any help will be great help
Thanks
AG

Hi Al,
Have you checked out the info in sap help:
http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a55f9e09411d2acb90000e829fbfe/content.htm

Similar Messages

  • What is the main purpose of   VBA   in bex analyser

    what is the main purpose of   VBA   in bex analyser

    Hi,
    you can enhance standard BEx functionality with VBA Macros (Excel).
    Pls chk This link:
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a55f9e09411d2acb90000e829fbfe/frameset.htm
    Regards
    CSM Reddy

  • Call BEX-Query from VBA with BEX-automatic login?

    Hi,
    I'm trying to call a query from VBA. I have two problems/questions:
    1. Automatic login?
    I want to do an automatic login. I found this peace of code here, but I get an error:
    Public Function  LogonToYourBW()
    ' create Logon & RFC-Handle
    logonToBW = False ‘ clear connect Flag the flag can be used to find out if connected or not
        'load SAP functionality by opening BEX file ( use your installation path)
            Workbooks.Open (“c:\sappc\bw\sapbex.xla”)
        With Run("sapbex.xla!sapbexGetConnection") ‘ call the connection
           ' Set the params for Auto logon
           .client = “YOUR CLIENT NO”
           .user = “YOUR BW USER”
           .Password = “YOUR BW PWD” ‘ I recommend to create a dummy reporting user for this task
           .Language = “YOUR LANGUAGE YOU LIKE TO USE FOR QUERY DISPLAY ( i.E.  “EN”)”
           .SystemNumber = “YOUR SYSTEM NO” ‘
           .ApplicationServer = “YOUR SERVER Name OR IP-ADDRESS”
           .UseSAPLOgonIni = FALSE 'important for automatic connection
           .logon 0, True ‘ This will provide a dialog to appear
            If .IsConnected <> 1 Then
                .logon 0, False
                If .IsConnected <> 1 Then Exit Function
            Else
                Set g_oFunction = CreateObject("SAP.Functions")
                Set g_oFunction.Connection = g_oConnection
            End If
        End With
        Run "sapbex.xla!sapbexinitConnection" ‘ this will enable the connection you just created
        logonToBW = True
    End Function
    The error is by this row:
    Set g_oFunction.Connection = g_oConnection
    Object is needed! How is the g_oConnection-object defined?
    2. How can I pass values for the parameters from VBA?
    If I open the query usually from SAP-BEX-Toolbar, after selecting the query, I get a parameter mask, where I must put in a value. How can I this automatize from VBA? Has anybody a short samplecode for that?
    Thank you for your help
    Stefan
    [email protected]

    Peter and others:
    What I really want to do … is write a stand-alone application that I can run from windows scheduler … that queries our BW for sales data for certain items (in a tabular form) … and pulls that data into a VB recordset, or a .NET dataset … so that I can insert the rows into another database (SQL Server, or Access) … I already know how to do all the data movement to/from datasets and databases … I just cannot figure out how to programmatically grab this sales data from BW … our company has “workbooks” already set up that aggregate WW sales information by region (IE, there is a separate workbook for each region of the world) … I can manually go into the Excel interface, tell it which items to pull the sales info for, and it dumps the data into the worksheet (organized by customer, and then by cat #) …
    So, what I’d like to do is write an app that will pull data every week or so from the BW (from each region’s sales invoice detail “workbook”), and insert it into another database that we use for reporting other, non-sales, data.
    Thoughts on this ?  Is there another, non-BEx method that is better ?
    thanks !!

  • VBA and Bex 7- Event to use in VB code BEFORE Query Refresh ?

    Gurus.. is there a Bex Event that I can use to 'intercept' a Refresh Query command to Bex and run some VBA first ? I'm trying to find a way to solve the analysis grid overlap problem when two queries are provided on one Excel worksheet, and navigation takes place.
    I've been able to figure out how to bring the results areas together (by deleting blank rows between them), but I'd like to be able to add a chunk of blank rows between analysis grids before the queries actually refresh.

    Hi Charlie,
    if you're interested:
    I've found a way to move the areas after the refresh - using the callback event.
    The logic is generally:
    - Check where analysis-grid for DP1 ends
    - Leave some empty lines
    - Move the offset of DP2 here.
    - Repeat the same for further DP's.
    There's only one hatch: I've got some trouble to reactivate the BEx-context-menu after this momvement.
    So far I found only the workaround "do another refresh" to solve this issue; that's ok but not 'beautiful'.
    Let me know if you need further input.
    Maybe you've got an idea for my issue:
    I'm looking for a way to execute the a routine only once after refresh - even if there are multiple queries in a workbook.
    The problem is that I do not know the order of the query-refresh or any flag that I could use to identifiy the "last query to be processed in this refresh-run".
    Kind regards,
      Marco

  • Looking for example workbooks with vba on BEx

    Hi,
    does anybody have example workbooks including VBA programming for the BEx in excel.
    i am using BW 3.5
    - such as setting filter values / setting result area for pivot tables
    - example of the use of the excel functions that are available in custom functions.
    thanks,
    Jack

    Hi,
    Please check this document:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0a89464-f697-2910-2ba6-9877e3088954
    Hope this helps.
    Regards,
    Mona

  • VBA in Bex Analyzer

    Dear Experts,
    I'm running a BI query to extract data then used VBA code to import external data from another Excel file.  After storing the external data in a variable, I'm having trouble getting back to my original worksheet using VBA command Windows("Step Pricing Query.xlsm").activate.
    Query Name: Step Pricing Query
    Workbook Name:  Step Pricing Query.xlsm
    I've checked the spelling and the file extension.  It doesn't seem to work.  I'm doing something wrong or my method is incorrect?  Your help is appreciated.
    Thanks,

    resolved.

  • Using MDX writeback from within VBA  in BEX

    Hi all,
    we want to update/insert a keyfigure from a BEX -Query-result in EXCEL.
    Is it possible to use an existing MDX command to solve this problem?
    Thanks in advance
    Regards
    Achim

    I've got the same problem. Did you find the solution?
    Thank you,

  • VBA in BEx: macro call on saving a WB

    Hi experts,
    I want to know if it's possible to execute macros after clicking on standard button on BEx toolbar "Save an existing workbook"?
    For example, the similar macro call for button "Refresh" we implemented as follows:
    Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
         Call plan_SAPBEXonRefresh(queryID, resultArea)
    End Sub
    But how can I do this for another button?
    Hope for your help!
    Thanks in advance,
         Mariya.

    Hi Mariya,
    We have a function 'SAPBEXsaveWorkbook' for maintaining a customization on buttons etc and its not meant for creating action item.
    This particular SAPBEXonRefresh provided for defining action items .
    We need to know the standard code for accessing that standard save/open buttons which is not in scope of the users.

  • Vba on bex analyzer 7.0 to block cells

    hi gurus
    i have a workbook that contains 6 queries for planning, i need to block the cells that are not for planning, i mean characteristic row values so the user is not allowed to edit, just edit the key figures columns, i guess i have to write some vba code to achieve this, someone has done this before? any suggest?
    regrads
    joker

    Is there a reason you cannot simply pre-set the Excel Protection for those columns ? If you wanted to use VBA to set the protection for those cells, you could.

  • BEx Questions

    Hello Everyone,
    I have few questions related to BEx .
    1. Can we use a function module in BEx so that ABAP code can be called while executing Bex query/report in BEx Analyzer.
    2. Can someone tell me how to use multiple structures / variables in query based on conditions.
    3. Could someone tell me how to invoke/refresh a macro in BEx automatically on executing a query in BEx Analyzer.
    Thanks.

    Hi here a short description for virtual key figure or characteristics and own variables (what Klaus means):
    1. Virtual Characteristics and Virtual Key figures
    - A virtual characteristic / key figure is an object of the InfoCube. The values are derived at query run time.
    - Examples:
    The SalesRep is derived from Product and Customer. This assignment changes frequently. Therefore the value for the characteristic SalesRep can not be stored in the Cube.
    You want to calculate with key figure-type attributes of an InfoObject. E.g. Price is an attribute of Product. Sold-quantity is an object of the InfoCube. You want to see the revenue (Sold-quantity * Price) in your query.
    You have an "Open-order-InfoCube". One InfoObject is the Orderdate. You need a list with the number of days btw. the orderdate and today.
    How to program a corresonding Include:
    1. You must firstly define the characteristics, or key figures within the InfoCube
    2. Call up transaction CMOD in the Admin. Workbench
    Create a Project
    3. Select Enhancement Components
    4. Select Enhancement RSR00002
    5. Double-click on Exit EXIT_SAPMRSRU_001
    6. Double-click on include ZXRSRU02 within the Exit
    7. Display or change coding
    8. Maintain include ZXRSRTOP
    9. Maintain include ZXRSRZZZ
    10. Don't forget to activate the Project
    Interface Importing/Exporting:
    IMPORTING:
    I_S_RKB1D -> Information about Reporting-Object; here Query (Queryname, InfoCube, ...)
    EXPORTING:
    E_T_CHANM -> Table with the name of the virtual characteristics
    E_T_KYFNM -> Table with the name of the virtual key figures
    Remarks:
    - You should note that the data records transferred can be on a different aggregation level depending on read procedure and drilldown.
    - Moreover, compound information is not automatically changed with compounded characteristics after changing a higher-level characteristic. In addition, the compound characteristic must also be defined in the mode RRKE_C_MODE-NO_SELECTION.
    - Furthermore, the fiscal year (0FISCYEAR), the fiscal year period (0FISCPER) and the fiscal year variant (0FISCVARNT) cannot be read or changed in the enhancement. (*)
    - Enhancement 999 may not be changed. Calling up serves to update information via the structure C_S_DATA. This functionality is completely taken over by form USER_INIT_GLOBALS.
    2. User Exit for variables:
    -Enhancement: RSR00001
    - The component for the enhancement is the function module EXIT_SAPLRRS0_001.
    How to program a corresponding Include:
    - Create variable with corresponding type for User Exit
    - Call up transaction CMOD in the Admin. Workbench
    - Create a Project
    - Select Enhancement Components
    - Select Enhancement RSR00001
    - Double-click on Exit EXIT_SAPLRRS0_001
    - Double-click on include ZXRSRU01 within the Exit
    - Add or change coding
    - Don't forget to activate the Project
    - Use the variable in a query
    Interface - Importing:
    I_VNAM     --> Name of the Variable; without &-signs
    I_VARTYP -->
    1: Characteristic Value
    2: Hierarchy node(s)
    3: Text
    4: Formula
    5: Hierarchy
    I_IOBJNM --> Name of the InfoObject
    I_S_COB_PRO --> Information about InfoObject(Dataelement, CheckTable, Length, Number of Decimals, ...)
    I_S_RKB1D --> Information about Reporting-Object; here Query (Queryname, InfoCube, ...)
    I_PERIV --> Fiscal year variant
    I_T_VAR_RANGE --> Table with all Variables and their values
    I_STEP     
    1: Before Variable Pop up
    2: After Variable Pop up
    E_T_RANGE --> Table to return the values
    fields: low, high, sign, opt     
    E_MEEHT     --> Unit of measure
    E_MEFAC     --> Number of Decimals for Unit
    E_WAERS     --> Currency Code
    E_WHFAC     --> Number of Decimals for Currency Value
    You can do many amazing things in BW. Well if you like you can use also ABAP in TableInterface for Web or JavaScript in Web. VBA in BEx Analyzer and many more interesting things. Just surf to http://hel.sap.com and find out!
    Regards,
    Adem

  • Macro in BEx

    Hello Experts,
    Does anyone have experience with the following requirement?
    -After executing query, run a macro that does the following...
    -Re-runs the query, allowing the user to input new selection criteria and appends results to original results
    Thanks,
    Andy

    I can't answer your entire question without actually writing the code, but I can tell you how to execute a macro when a query executes. In order to save the macro, you have to run the query and save the workbook with the macro. When you access the workbook and refresh the query, the macro will run.
    In Visual Basic:
    Sub SAPBEXonRefresh(queryID As String, resultArea As Range)
    <insert code here>
    End Sub
    In the code section, you would need to put in the function to insert a query into the workbook and where exactly it should be "appended."
    http://help.sap.com/saphelp_nw04/helpdata/en/f1/0a55f9e09411d2acb90000e829fbfe/content.htm
    This has useful information about integrating VBA w/ bex.

  • Remove comma in query output from Char used as KF

    Hello Friends,
    To be able to display a characteristic in a particular way I used formula variable and displayed it as Key Figure in the query output. By doing this I am getting the output in the required format, but only problem is that the value is being displayed with commas. As it is an order number, I want to display it without commas.
    I don't want to use VB as the query is to be published in web also.
    Please suggest if there is any way to achieve this.
    Thanks in advance.
    Praveen

    Hey Praveen, there's a few ways to skin this cat. The simplest method is to make sure that the user parameters in SU3 don't have commas for numbers. The problem is that this is a global setting so you won't get commas for other numbers in which you may want commas. Also, you'd have to make sure your replacement variable was defined as type "number". The other options include using VBA in BEx, and/or Table Interface in the Web. If you are using BW 3.5, you can use XSLT to render a table with and not have commas for that value by using the XML Query Result Set Item. Hope that helps,
    Prakash

  • Using VBA to generate varibale worksheets in BEx Report

    Hi Gurus,
    i got an BEx Analyzer report (BW 3.5) in Excel. It shows all orders generated by the customers. In the table we can see the customer number, customer name, some attributes and the sales key figures.
    For Example:
    10000, Peter, ..................., 20 EUR
    10023, Clark, ..................., 20 EUR
    12200, Bert, ..................., 20 EUR
    13200, Erny, ..................., 20 EUR
    etc.
    Now i want that Excel takes each customer number and creates a new worksheets - each with the customer number in it / or name. As the number of customers is different each week it should be flexible. Any idea with VBA? I know that i can place in SAPBExonrefresh some coding.
    Regards,
    Memoli

    Hi Memoli,
    i think i now what you want. Use the following code but check the steps:
    1. Run your query in Analyzer.
    2. Move result area to top left but hide alle headers, texts, free characteristics etc. Only the table should be available - that with customer and data fields. Better change to table view in query designer or local view.
    2. Your query should start in field A1 or A2. If you want leave a header ampty on top and write customer number in this field - in this case your table starts in A2.
    3. Delete all worksheets and leave the one with the query. Name it "Customer".
    4. Insert a button by using VBA toolbar. Doubleclick and paste following code in editor:
    Sub TabAnlegen()
       Dim wks As Worksheet
       Dim iRow As Integer
       Application.ScreenUpdating = False
       Set wks = Worksheets("Customer")
       iRow = 2
       Do Until IsEmpty(wks.Cells(iRow, 1))
          Worksheets.Add after:=Worksheets(Worksheets.Count)
          ActiveSheet.Name = wks.Cells(iRow, 1).Value
          iRow = iRow + 1
       Loop
       wks.Select
       Application.ScreenUpdating = True
    End Sub
    After that. Run your query and press the button.
    Regards,
    Adem

  • The BEx Analyzer cannot generate VBA code due to the security settings

    Hello experts,
    when I try to open a query in BEx Analyser I get this error message for each Item of the Query:
    Diagnosis
    The BEx Analyzer cannot generate VBA code due to the security settings.
    System Response
    VBA code is not generated.
    Procedure
    Choose Tools -> Macro -> Security.
    On the Trusted Publishers tab page, select Trust access to Visual Basic project.
    Choose OK.
    Close the BEx Analyzer and continue working as before.
    Access to Visual Basic project is only needed when generating VBA code.
    This only takes place in design mode or when 3.x workbooks are upgraded.
    Of course I did exactly what was recommanded in the "procedure-section" of this error message. But BEx ist still not working!
    I use SAP NetWeaver 7.0 together with MS Excel 2007
    Thanks
    Axel

    Hello experts,
    I am an additional person interested in the way this issue was solved.
    I confirm that the issue is coming from the SP2 of Microsoft Office (I have another environnement without the SP2 and everything works well), and I am in a situation where I can't remove the update.
    Regards
    Guillaume P.
    EDIT :
    Solution found : I applied the bi710sp10p_1001-10004472.exe patch
    (downloaded via the download maanger : Support Packages and Patches - Entry by Application Group" SAP Frontend Components" BI ADDON FOR SAP GUI" BI 7.0 ADDON FOR SAP GUI 7.10)
    Edited by: GUILLAUME PETIAUX on Apr 13, 2010 10:29 AM

  • BEx: VBA: Range of Data Provider

    Hi at all,
    Is there an elegant way to get the range of a data provider in VBA? I need this information for a few formatting rules and some other functions...
    (We use only the BEx Analyzer 7.x)
    Thanks in advance!
    Have a nice day,
    Alex

    Hy Pavel,
    I had this problem too.
    But I have a solution as a workaround for you.
    Good: using VBA and the API-CMd-Button
    a) use the CMD-Button from the APIs (Set_Filter ..)
    b) create a VBA CMD-Button
    within this VBA - button
    set all external parameters
    cmd
    set_filter
    Data_Provider
    collaps ...
    Filter_VALUE_LOW_EXT
    Filter_Value_High_ext
    FILTER_NODE_IOBJNM
    c) define a leading query
    move or select a navigationvalue by
    sheets("sheet").cells(row, col).value = sheets("Analyse").cells(10,3).value
    The receiving cell is part of the cmd-Parameters
    After your habe placed this parameters in the workarea of your API-Command
    you can call your button like: call sheet1.button_7_click
    Button_7 will execute the WebAPI-Funktion for you.
    I have no more problems
    hierarchy
    single values
    or intervall
    Be carefull when using interval,
    High and low must be filled and the single value too. (I don't know why)
    Enjoy
    Regards
    Roland

Maybe you are looking for

  • Remote Access VPN users unable to communicate with each other

    Hi, We have configured Remote Access VPN on Cisco IOS router. Users are able to access the inside resources but cant communicate to each other. Any suggestions on the issue? Regards Saif

  • Need Best Practice - Apex, multiple schemas, security model

    We have an oracle database which contains a) named database users with no objects b) several schemas with data tables: sales marketing accounting We need to build GUI for tables in these schemas, every database users should belong to a group, each us

  • AUTO Populate a Form's Field with MySQL Table Field(s) Data

    Hi, I can easily make forms that add, edit/update, delete. But I want to be able to populate a form field (usually a popup field) with a selection of records from a specific table. Say I have a table: CARS That has fields: MODEL, MANUFACTURER, PRICE

  • Frequency Control Word (PXI-5402): Rounded up or down?

    A further question wrt PXI-5402 standard function generation. The frequency control word is calculated by dividing the desired output frequency by the sample clock frequency (100MHz for a PXI-5402) and multiplying it by 2^N where 'N' is the width of

  • Pricing data not geting picked in business orders

    Hi All, I am facing an absurd issue related to pricing. I have maintained all settings for orders, pricing, sales area, item categories etc. Yet when i try to create an order and enter the product, the pricing does not get picked? I tried alot but do