Bex Query- Use of ABAP code in Calculated Keyfigure/formula

Dear Experts.
I am wondering if there is any way to use ABAP in the formula editor of the Bex Query desinger.
I have to build a report with very complex formulas (a lot of key figures, comporations, If then else ) an I think it would be easier to build all then in ABAP.
So what I am looking for is any kind of user-exit/Badi that allows to calculate a Calculated Key figure/fomula in ABAP with the same data that is availabe in the fomula editor.
If SAP is not providing this, this is clearlly a must for next releases.
Thanks a lot and best regards,
Alfonso.

Dear Ananda.
Thnaks for your reply, but could you please extend your answer a little bit more?
As far as I know, Formula customer exit variables are only called once and they don´t provide the rest of the keyfigures and characteristic use in the drilldown level, so for my needs they are useless.
Regarding IF-then-else statement in the formula, I already know about it. Actually what I am trying to avoid is to use them. In order to build my query I might need to build really big formulas with a lot of If-then-else, making it quite complex what the formula is doing. This is the reson I want to do it on ABAP.
Please any other ideas?
Thanks a lot.

Similar Messages

  • Calculated KeyFigure Formula

    Hi All,
    I would like to write some code in Calculated KeyFigure Formula,
    I have checked the forums. pls donot include SAP Help URL's.
    Pls explain, if it is possible to write the code...
    Best Regards,
    Pandu.

    Well, not sure if you saw the info here: http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm
    But you can create the IF THEN by using ( ) in the forumla builder:
    Reqt: IF A > B THEN B + C ELSE A
    Formula: (A > B )* (B + C) + (A <= B ) * A
    Each expression in the ( ) is evaluated as True or False and accordingly outputs 1 or 0.
    Hope this helps...

  • Bex query for BW abap report/ transaction

    Hi Experts, Here is a scenario: I developed ABAP program in BW using multiple DSOs for complex logic. Since I cannot use abap program directly in BO reports, I need to develop a query in BW for my abap program. Is it possible to develop a bex query for BW abap report / transaction in BW? I have limited knowledge on BW and BO. Please help me. Thanks in advance Raghu

    First of all thanks for your suggestion Matthew..!
    As you said, I created virtual info cube based on function module.
    In the info cube, I defined (4)dimensions and (1)key figure.
    In the fucntion module, appropriate below parameters defined and code written for the data table (e_t_data)
    CALL ZFM_XXXXXXX 
    EXPORTING   
    i_infoprov =                " Name of InfoProvider   
    i_th_sfc =                  " rsdri_th_sfc: List of Characteristics    
    i_th_sfk =                  " rsdri_th_sfk: List of Key Figures
    *   i_t_range =                 " rsdri_t_range: Range List
    *   i_tx_rangetab =             " rsdri_tx_rangetab: Table from Range List
    *   i_first_call =              " rs_bool       First Call
    *   i_packagesize = 100000      " i             Package Size 
    IMPORTING   
    e_t_data =                  " standard table:  Data Table   
    e_end_of_data =             " rs_bool       :End of Data Reached   
    e_t_msg =                   " rs_t_msg      : BW: Table with Messages
    Test:
    Right click the info cube and choose "displayed data", immediately it triggered above function module.
    when I see the import parameters data,
    no characteristcs data in i_th_sfc. But, key figures has data (1 record) in i_th_sfk.
    Not sure, Did I missed anything? Please help me.
    Thanks in advance

  • Crystal Reports with BEx Query using Custom Exit Variable

    Hi,
    We have BW BEx Query using Customer User Exit variable to derive  the Fiscal Week for Last Year (called it VAR2) based on another user input variable Current Fiscal Week (called it VAR1).
    VAR2 is derived from VAR1 in CMOD via some codings and thus it DOES NOT have the "Variable is Ready for Input" flag ticked in the BEx. VAR1 is user input variable, so it has "Variable is Ready for Input" flag ticked in the BEx.
    When we create a Crystal Reports with the BEx Query using variable VAR2, and when we run it we got an error message saying "Failed to execute query; '[]<java.lang.UnsupportedOperationException: No Selection State Support!ZP_MI_LYPUBWEEK>'. Redesign your query or contact the data source maintainer to solve the problem".  (note: ZP_MI_LYPUBWEEK is VAR2 in this case).
    Could anyone please assist? Surely, CR supports BEx customer user exit variables like the above, right?. I also refer to the forum below as it seems to have a similar issue (except mine with an error message), but it does not provide a solution in it.
    Crystal Reports with BEx Query using Custom Exit Variable
    Thanks,
    Andy

    Hi Vibhav,
    We have the SAP Crystal Reports for Enterprise XI4.0 Version 14.0.0. Not sure if SP0 or other SP, got to check with Basis Team later.
    We tried that "mandatory" option and did not work either.
    Anyway, SAP has now come back again saying it is something they will fix it in next release/version. We got a phone call from them and a reply below to our OSS.
    23.08.2011 - 08:20:49 CET - Info for Customer by SAP  
    I have raised this issue on the Idea#s Place as an enhancement request
    on the below link:
    https://cw.sdn.sap.com/cw/ideas/5586
    This ER contains the information of including the customer exit
    variables in the report without checking the #input for ready# option.
    This ER can be considered for being implemented in the future
    versions. You can refer to SAP Note: 1515837 - How To: Enhancement
    Request Process - "Idea Place" for more information regarding the Idea
    Place.
    Cheers,
    Andy

  • Problem in event handling using oo abap code

    Hi,
    My requirement is i need to disply 3 blocks in ALV format.I have done that.Now my problem is if i double click on aufnr of the first block, it should call the transaction code. I have written the code in oo abap but i have used function modules for ALV.Now my doubt is 'How to write an event  once the user double click on the particular field of the first block, it should call the tcode " using object oriented code.
    How to populate the heading for each block using oo abap code.
    Thanks & Regards
    Anus

    hi.....
    Use Double_click event handler method of class cl_gui_alv_grid of first block....
    if not solved .
    Send me Your program lines ...........
    Best Regards
    Prabhakar

  • ABAP code for calculation rule in transaction M/08

    Hi,
    In M/08 transaction, we need to do this:
    When maintaining a PO, the user manually creates a condition like this:
    ZXXX Value (+10 %) positive value.
    However, in order to get the belonging negative condition (for accounting purpose), we need to automatically create that when the one above has been created:
    Automatic at the same time:
    ZYYY Value (- 10 %) negative value.
    In transaction M/08 you can enter ABAP code to each condition in the calculation rule. How can I program that ZYYY is created at the same time as ZXXX, when created for a PO ?
    Any help is appreciated.

    Hi Peter,
    This calculations rules are know as routines you can create with them using T code VOFM and then go the menu option -
    > Formula---->Condition value.Double click on that and you will get the ABAP code.
    Here you can amend the existing one or can create the way you like your logic to move and assign it to M/08 T code.
    Hope this will help you.
    Thanks,
    Birender Agnihotri

  • Bex Query using BICS running fine in Rich client but v. slow in Launchpad

    Hi guys,
    At my client client we are using BICS to use Bex Query in Web Intellience, and i created a report that takes less than 10 seconds once run in Rich client but when i create the same Webi report in Launch pad: the list of values take forever to refesh and the report runs for about 30 mins before it displays data..
    In both cases it shows data but the time difference is huge.
    Kindly direct me on what could be the possible issues considering this case.
    Regards,
    Sheikh

    Hi Sheikh,
    There are some known issues with the BICS connectivity and LOV's when retreiving data in BI4.0
    This is detailed in the note - 1581323 - BI 4.0 Web Intelligence very slow performance when using BICS
    Basically there are some registry changes which need to be made to result in quicker data retreival. The full fix is scheduled for Patch 2.1. It may not be your precise issue but the registry change should help I believe.
    Can you test with the registry fix and let me know if this improves matters for you:
    Resolution
    The following fix is planned for Patch2.1 (w/c 27th June 2011):
        Add 2 new registry entries (string keys) under
            For the 32-bit using Rich Client: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SAP BusinessObjects\Suite XI 4.0\default\WebIntelligence\Calculator]:
            For the 64-bit Web Intelligence:[HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Suite XI 4.0\default\WebIntelligence\Calculator]
    "BICSLOVChunkSize"="4000"
    "BICSResultChunkSize"="100000"
    Note 1: In a specific test case, a value of 4000 yielded good results, reducing fetch time from 20 minutes to under 5 minutes.
    Note 2: Registry key usage:
        BICSLOVChunkSize is defined as a string. It help create a chunk of List of Value of maximum the number given. The bigger the number the more likely the retrieval of the list of value will crash. Consider using a value between 100 and 5000. If you have 1000 values in your database and you set the BICSLOVChunkSize to 200. Then you will see a hierarchical view of 5 groups having eah 200 list of value.
         BICSResultChunkSize is defined as a string. It limits the number of results that can be retrieved as a List of Value. If you have a List of Value which contains 1 Millions values and set the BICSResultChunkSize to 1000 than only the first 1000 rows will be retrieved. Therefore you will get a partial result set for the list of value.
    Parallel correction for interoperability:
        A parallel fix has been delivered via component BW-BEX-OT-BICS by way of a correction attached to Note 1593802.
    Workaround:
        Set all the values of column u201COrder for F4 Helpu201D to 0 (zero) in BW Transaction RSD1 so that the attributes are not retrieved.
    -> List of members are now displayed in 20 seconds.
    I hope this is a very helpful answer to you.
    Kind regards,
    John

  • Empty query cache with ABAP code

    Hi Experts,
    Is there any way to empty the query cache using ABAP code?
    Thank you!
    Regards,
    Sam

    Sam,
    You can clear cache by using transaction RSRCACHE. Also, you can use a BDC ABAP program to do it.
    -Saket

  • Running the BEX query from webdynpro ABAP

    Hi Gurus,
    Can someone provide the code for running the BEX query from WDA.
    Thanks,
    David.

    Hi! Do you want to get query results in ABAP or to open excel from browser?

  • LSMW--- I am not seeing some variables, which r using in abap code!

    Hi Experts,
    Am enhancing the LSMW---> Create_Material, so I hv some basic doubts, pls. clarify,
    1 - In the following satemenrts of the code, the programmer used my_langu(variable?), so, Where the programmer has declared(attributes & value) the my_langu ? I searched in FIXED VALUES radio button, Global data, double clicking, abap code radio button, I culd not find it!
    Target Field: E1BP_MLTX-LANGU Language key
    E1BP_MLTX-LANGU = my_fv_langu. (like theses many variables r using in the abap code, but I culd not track them to see, thrier attributes!)
    2 - In abap code, the programmer is using <b><i>skip_transaction</i></b>! but, we dont hv skip_transaction in ABAP code?
    thanq.

    Hi,
    skip_transdaction is a LSMW Global Function and not an ABAP command:
    Global function     Description
    transfer_record.     Transfers the current record (i.e. for the current target structure) to the output buffer.
    transfer_this_record '...'.     Transfers a record of another target structure to the output buffer. The name of the target structure has to be specified as argument in single quotes.
    at_first_transfer_record.     Transfers the current record to the output buffer, if it is the first transaction.
    on_change_transfer_record.     Transfers the current record to the output buffer, if it has changed compared to the last record.
    transfer_transaction.     Writes the current transaction to an output file. All records of the output buffer are transferred to the output file.
    skip_record.     The current record is not transferred to the output buffer.
    skip_transaction.     The current transaction is not written to the output file.
    I'm not sure about the my_langu(variable?).
    Hope it helps some.

  • ABAP code for calculation rule in TK = M/08

    Hi,
    In M/08 transaction, we need the following:
    When maintaining a PO, the user manually creates a condition like this:
    ZXXX    Value (+10 %) positive value.
    However, in order to get the belonging negative condition (for accounting purpose), we need to automatically create that when the one above has been created:
    Automatic at the same time:
    ZYYY  Value (- 10 %) negative value.
    In transaction M/08 you can enter ABAP code to each condition in the calculation rule. How can I program that ZYYY is created at the same time as ZXXX, when created for a PO ?
    Any help is appreciated.

    Irrelevant

  • BI BEX Query execution from ABAP into a File w/ Text

    We are currently running BI 2004s and have a requirement from a user to load a file (preferably excel but a csv or txt file would also work) on a server with the results of a BEX Query and they need the format to look exactly like the Bex results including the columns for the char. text that are specified in the Bex query properties.  If we could run this ABAP program in background and foreground - that would be a big plus.
    I have searched and reviewed many of the FM, programs and transactions in this forum to do something like this but the text is always missing.
    Any suggestions (the simpler the better) would be appreciated.
    Thanks,
    SJ

    Sudheer,
    Yes, I did try RSCRM_BAPI.  It looks very promising but the text is not there.  Example - Business area 9160 shows up but the text for it "SAFLEX" does not and this text does show up in BEx.

  • Get BEx query name in ABAP Class

    Hi,
    I have setup a Virtual Key Figure and need to get the BEx    query name within the implemented RSR_OLAP_BADI Class Compute method.
    Is there a system variable that holds this?
    Thanks in Advance

    Hi.
    Look at among components of importing parameter I_S_RKB1D of method you mentioned.

  • MDX Query using BottomCount to limit Median calculation returns null

    I'm building a new cube that includes some person age values that aren't useful when summed, but are
    useful when the median is determined. The measure group that contains the measure for the age has a 1-1 relationship with a dimension in the cube because both use the same table as the source. This is important because I use the key attribute of the dimension
    as the set expression in the Median function to prevent any summation before the median is found. Here is the code for the original median calculation:
    MEMBER Measures.[Median Age] AS
    MEDIAN(
    [Placement Dimension].[Id Removal Episode Fact].Members,
    [Measures].[Age At Removal Months]
    This median naturally represents the half-way point in the series of values. My analysts have also requested
    median-type values at the quarter and three-quarter points in the same series. I've been able to accomplish this for the three-quarter point by nesting the TopCount function in the set expression of the Median function to limit the set to the last half of
    the records and then find the median point like this:
    MEMBER Measures.[75th Percentile] AS
    MEDIAN(
    TOPCOUNT(
    [Placement Dimension].[Id Removal Episode Fact].MEMBERS
    ,Measures.[Episode Count] / 2
    ,Measures.[Age At Removal Months]
    ,Measures.[Age At Removal Months]
    However, my attempt to use the BottomCount function in the same way as TopCount to find the quarter point
    in the whole data set by limiting the calculation's set to the first half of the data always returns null. Here is how I've formed the code:
    MEMBER Measures.[25th Percentile] AS
    MEDIAN(
    BOTTOMCOUNT(
    [Placement Dimension].[Id Removal Episode Fact].MEMBERS
    ,Measures.[Episode Count] / 2
    ,Measures.[Age At Removal Months]
    ,Measures.[Age At Removal Months]
    And here is the query that returns the values:
    SELECT
    Measures.[Episode Count]
    ,Measures.[Median Age]
    ,Measures.[25th Percentile]
    ,Measures.[75th Percentile]
    } ON 0
    ,[Date Begin].[Calendar Hierarchy].Year.&[2011]:[Date Begin].[Calendar Hierarchy].Year.&[2014] ON 1
    FROM [POC Cube]
    WHERE
    [Age at Removal Mos].[Age in Years List].[Age Year].&[0]:[Age at Removal Mos].[Age in Years List].[Age Year].&[5]
    I don't know why the end result is always null. I don't have any null values in the data for this measure, and I know what values I should be seeing because I've found the median records manually in results from a SQL Server query. I've tried using TopCount
    and multiplying Measures.[Age At Removal Months] in the TopCount function by -1 to workaround the descending sort, but I still get nulls. I've also tried separating these queries out so the quarter point and three-quarter point calculations aren't run together,
    but I still get nulls for the quarter point calculation.
    I'm open to any help fixing this situation by modifying my current code or by using alternate methods, but the end result has to be dynamic enough to be used as a calculation in the cube. Thanks!

    The links might helps.
    http://technet.microsoft.com/en-us/library/ms144864.aspx
    http://www.mssqltips.com/sqlservertip/3034/sql-server-analysis-services-ssas-2012-top-and-bottom-functions/
    http://www.sqlservercentral.com/blogs/bradleyschacht/2012/03/12/mdx-functions-bottomcount/

  • SQ01 - Join of different tables or ABAP Code in SAP Query

    Hello,
    I am trying to link some TO tables LTAK and LTAP together with the header table of the production orders AFKO.
    It seems that the SQ01 won't let me joint the LT* and the AFKO table.
    But I need to read some values from the AFKO table according to the transfer orders apart from the production order number.
    Is there a way in QUERY to join this or can I add somewhere in the query a little ABAP code?
    My aim is to avoid writing a ABAP report due to various reason.
    Any help would be nice.
    Cheers
    Uwe Neumann

    Hello,
    thanx for your answers so far.
    I was able to join in the third table.
    After a little investigation, I found out that I have to join the table AFPO with the materialnumber instead of AFKO, because the components are in AFPO.
    But this is just the one side of the material.
    Let's assume the transfer order contains of material A and B and we have production order 111.
    If I would let run the query, it would select all material A and B in table AFKO, because I have not said, just look for material A and B for production order 111. As I cannot join the field AFPO-AUFNR with LTAK-BENUM this is missing.
    Where can I specify this?
    Best regards
    Uwe Neumann

Maybe you are looking for

  • *** SOLUTIONS POST HERE - To the iOS 5 & iCloud Apple ID Fiasco...

    PLEASE POST ALL YOUR SOLUTIONS HERE There are so many topics for this now, it's mind numbing to find some answers. I'll do my best to post some realizations that I've had, and methods to work around what Apple hasn't properly explained yet. Issue: E-

  • Chance swatch panel to match illustrators

    Is there a way to chance the Swatches Panel in Photoshop so it looks and works like Illustrators?

  • Slide show issues in premier 10

    I can't seem to be able to  space slides evenly over a specific length of time.. (multi song duration) in Adobe Premier Elements 10.  any help would be apprecieated.

  • SAP PS ( Assembley )

    Guys I am novice in SAP PS  , Need Help can you please advice how to access this information from my  SAP Server , Appreciate your response Assembly Processing 1) Need a List of all materials that are impacted by assembly processing  ( Strategy group

  • Db_verify: Suspiciously high nelem Error from Berkely DB

    I have an application which uses Berkely DB ( Version 3.2.9). My application runs on Solaris. Sometime I get following error message thrown by the application - "db_verify: Suspiciously high nelem of 4294967287 on page 0 DB_VERIFY_BAD: Database verif