Using a query with condition as a source to fill an ODS

Hi all,
i need your help guys, i got the task to take the data from a BI Query and fill and ODS monthly, it means, i need taking like a picture of the data of the report at the end of each month, in this way i bring the data and fill a ods or cube monthly.
I tried to do it with APD and doesnt work because this query has many conditions, now i tried with the RSCRM_BAPI and this when execute last too much, this execution has 2 days and doesnt finish yet, i can think this is not a factible way either, what else can i do? help

hi,
You need to write a code to get the key figure and characterstics value.
First step is to defined the structure of all the field that you want to read.
This table I_AXIS_DATA will contain the characterstics.
This table I_CELL_DATA will contain the keyfigure.
Please find the code.
            READ TABLE I_AXIS_DATA INTO WA_AXIS_DATA WITH KEY AXIS = '001' .
            IF SY-SUBRC = 0.
              LOOP AT WA_AXIS_DATA-SET INTO WA_SET.
                    INDEX = INDEX + 1.
                    IF WA_SET-CHANM = 'infoobject name'.
                      WA_ROW_COL-fields = WA_SET-CHAVL_EXT .
                    ENDIF.
                    IF WA_SET-CHANM = 'infoobject name'.
                      WA_ROW_COL-field2 = WA_SET-CHAVL_EXT.
                    ENDIF.
              ENDLOOP.
            ENDIF.
******* POPULATE COLUMNS AGAINST ROWS
            CLEAR WA_ROW_COL.
            V_COUNT = 1.
            INDEX = 1.
            LOOP AT IT_ROW_COL INTO WA_ROW_COL.
              WHILE ( V_COUNT <= V_NUMOFKEYF ).
                    READ TABLE I_CELL_DATA INTO WA_CELL_DATA INDEX INDEX.
                    IF V_COUNT = 1.
                      WA_ROW_COL-keyfigure = WA_CELL_DATA-FORMATTED_VALUE.
                    ENDIF.
                    V_COUNT = V_COUNT + 1.
                    INDEX = INDEX + 1.
                    CLEAR WA_CELL_DATA.
              ENDWHILE.
              APPEND WA_ROW_COL TO IT_R_C_H.
              V_COUNT = 1.
Hope this is helpful.
Thanks,
Saveen Kumar

Similar Messages

  • Performance of APD with source as 'Query with conditions'

    Hi,
    I have a question regarding the performance of an APD query with conditions when it is run in the background.
    I have an infocube with 80 million records.I have a query to find Top 15 (Condition In query) Customers per territory.
    With the help of an APD Query (Source) i wanted to populate the details (customer category , etc) of the Top 15 Customers into a DSO (Target)
    Right now it takes 6 minutes to run the query in web.
    I wanted to know how feasible it is to use an APD (run in backgrnd) to dump the results of the BEx query (which has conditions Top 15) into DSO.
    Also , what other options do i have ?
    Appreciate your answers.
    Regards

    Thomas thanks for the response.  I have checked the file on the app server and found that the lines with more than 512 characters are being truncated after 512 characters.  Basis team is not aware of any such limits on the app server.  I am sure few on the forum would have extracted data to a file on the application server using APD.  Please note that the file extraction to the client workstation is working as expected (posts lines more than 512 characters).

  • Sub query with conditions

    Hi,
    Is it possible to run a sub query with conditions? I keep receiving an error 'Registration Data' -2006.
    For example, here is a simplified query which gives the error...
    SELECT T1.CardCode FROM
    SELECT T0.CardCode FROM OCRD T0 WHERE T0.CardCode = '[%0]'
    ) T1
    FOR BROWSE
    Thanks for any help,
    Robin

    SBO SQL-parser sometimes kidding. My solution is to use temptables/views/storedprocedures.
    It's faster then "unbugging" parser <b>:)</b>
    in your case that can be like the following:
    SELECT T0.CardCode INTO #temp FROM OCRD T0 WHERE T0.CardCode = N'[%0]'
    SELECT qq.CardCode FROM #temp qq FOR BROWSE
    BTW: registration data error is usially says us about %-argument reason

  • Sql query with conditions and calculations???

    Hi,
    how I can build a query with conditions and calculations?
    E.g. I've got this table
    Start          | End     |     Working Place     |     Mandatory
    01-JAN-13 | 11-JAN-13 |     Office           |          1
    14-JAN-13 | 25-JAN-13 |     Home Office      |     0
    04-MRZ-13| 15-MRZ-13 |     Office           |          0
    11-FEB-13 | 22-FEB-13 |     Office           |          1
    Now if column working place=Office and column mandatory=0
    the new column "price" has to calculate: (End-Start)* $25.00
    and if working place=Office and column mandatory=1
    the "price" column has to calculate: (End-Start)* $20.60
    else $0.00
    I tried it with the case statement but I didn't know how
    to calculate my values and display it to the virtual column "price".
    Something like
    case
    when Working_Place = 'Office' and Mandatory=1
         then ...
    else '0.00'
    end as PRICE
    Or is it not possible?
    Edited by: DB2000 on 12.03.2013 05:09

    Use CASE:
    select  start_dt,
            end_dt,
            working_place,
            mandatory,
            case
              when working_place = 'Office' and mandatory = 0 then (end_dt - start_dt) * 25
              when working_place = 'Office' and mandatory = 1 then (end_dt - start_dt) * 20.60
              else 0
            end price
      from  tbl
    START_DT  END_DT    WORKING_PLA  MANDATORY      PRICE
    01-JAN-13 11-JAN-13 Office               1        206
    14-JAN-13 25-JAN-13 Home Office          0          0
    04-MAR-13 15-MAR-13 Office               0        275
    11-FEB-13 22-FEB-13 Office               1      226.6
    SQL> SY.

  • SQL Report query with condition (multiple parameters) in apex item?

    Hello all,
    I have a little problem and can't find a solution.
    I need to create reports based on a SQL query or I.R. Nothing hard there.
    Then I need to add the WHERE clause dynamically with javascript from an Apex item.
    Again not very hard. I defined an Apex item, set my query like this "SELECT * FROM MYTAB WHERE COL1 = :P1_SEARCH" and then I call the page setting the P1_SEARCH value. For instance COL1 is rowid. It works fine.
    But here is my problem. Let's consider that P1_SEARCH will contain several rowids and that I don't know the number of those values,
    (no I won't create a lot of items and build a query with so many OR!), I would like sotheming like "SELECT * FROM MYTAB WHERE ROWID IN (:P1_SEARCH) with something like : ROWID1,ROWID2 in P1_SEARCH.
    I also tried : 'ROWID1,ROWID2' and 'ROWID1','ROWID2'
    but I can't get anything else than filter error. It works with IN with one value but as soon as there are two values or more, it seems than Apex can't read the string.
    How could I do that, please?
    Thanks for your help.
    Max

    mnoscars wrote:
    But here is my problem. Let's consider that P1_SEARCH will contain several rowids and that I don't know the number of those values,
    (no I won't create a lot of items and build a query with so many OR!), I would like sotheming like "SELECT * FROM MYTAB WHERE ROWID IN (:P1_SEARCH) with something like : ROWID1,ROWID2 in P1_SEARCH.
    I also tried : 'ROWID1,ROWID2' and 'ROWID1','ROWID2'
    but I can't get anything else than filter error. It works with IN with one value but as soon as there are two values or more, it seems than Apex can't read the string.For a standard report, see +{message:id=9609120}+
    For an IR&mdash;and improved security avoiding the risk of SQL Injection&mdash;use a <a href="http://download.oracle.com/docs/cd/E17556_01/doc/apirefs.40/e15519/apex_collection.htm#CACFAICJ">collection</a> containing the values in a column instead of a CSV list:
    {code}
    SELECT * FROM MYTAB WHERE ROWID IN (SELECT c001 FROM apex_collections WHERE collection_name = 'P1_SEARCH')
    {code}
    (Please close duplicate threads spawned by your original question.)

  • Using sql query with parameter

    OK, I can't find any docs on this. I can insert a parameter, but how do I insert that into the sql query?

    Your first post asked how to insert a paremeter into a SQL. My example shows a value read query with a SQL function, but any SQL will work with any Query in the same pattern.
    a) You call the query with session.executeQuery(query, vectorOfArguments);
    b) You use #argument in the SQL string and then query.addArgument("argument");
    c) You pass them in a Vector of the order in which you do the addArgument's.
    - Don

  • How to use power query with sitecatalyst

    Hello,
    I need to use power query to import a table from sitecatalyst. Doing some tests I found that If remove the session from the url that has the report parameters, the app will redirect me to the login page, after entering the company, username and password
    it will load the report page with the data according to my filters.
    When I add the report url on the From Web option, excel does not allow me to add credentials. If I add the login+redirect url it allows me to add user/password but does not load the tables that appear on a regular browser.
    Is it possible to consume sitecatalyst without using Report Builder? If not, how you access the security info after you added the url.
    Thanks.

    To the best of my ability to tell, the right way to use this product from within Power Query would be to use its API. Unfortunately, we don't currently support either of the methods needed to be able to authenticate with the service (OAuth 2.0 and a relatively-custom
    digest-based method). Adding a mechanism to allow use of arbitrary OAuth-protected resources is a fairly high priority for us, and I hope we'll be able to deliver something before mid-2015.
    Scraping the website is very hard to do well -- both from an authentication and from a data discovery perspective.

  • Missing Result Rows on Query with Conditions

    I have a query that has a condition to show only items over $2500.00.   We have a result row that shows for plant when the condtions is not on but once the condition is set that result row goes away.  Does anyone know how to get a result row to show up on reports with conditions?  Thank you.
    Caroline

    Hi Caroline,
    In BI 7.0, you goto do this in Query Designer.
    Select any of your characteristic in the designer and choose Display Properties to always display result.
    Then run the query.
    Assign Points if Helps !!
    Regards,
    Naveen Rao Kattela

  • How to use WQL query with SCCM console.

    Hello,
    Sorry for my dumb question, but how can I run a wql query in SCCM console.
    Usually I use SQL query's from google to create new reports, I also find WQL query but where exactly should I place them:

    Go to General tab and select "Show Query Language".
    Paste in your statement and you're good to go.
    Gerry Hampson | Blog:
    www.gerryhampsoncm.blogspot.ie | LinkedIn:
    Gerry Hampson | Twitter:
    @gerryhampson

  • Query with condities

    Hi
    Iu2019ll try to make a query to get a material number with the price (condition). I use the tables KONP and A304, but I get no results.
    In table KONP Iu2019ve the condition record number and the amount; in table A304 Iu2019ve the condition record number and the material number. So I use as selection the material number in the table A304 to get the amount from KONP. But the query said no results.
    When i use trx SE16 for both tables i'll will get the results that i want.
    Can anyone tell me what Iu2019m doing wrong or better can give me the solution?
    Thanks,
    Peter

    Hi Peter,
    Go to Transaction SQVI and select the table join while creating the query and by default the tables are getting getting connected with many fields... remove all by right click on relation and join both the table with one field only i.e. "KNUMH" (condition record number)
    please try it and confirm.
    It is working fine.
    Thanks & Regards,
    Rahul Verulkar

  • Using a query with bind variable with columns defined as raw

    Hi,
    We are on Oracle 10.2.0.4 on Solaris 8. I have a table that has 2 columns defined as raw(18). I have a query from the front end that queries these two raw columns and it uses bind vairables. The query has a performance issue that I need to reproduce but my difficulty is that how to test the query in sqlplus using bind variables (the syntax for bind vairables fails for columns with raw datatype).
    SQL> DESC TEST
    Name                                      Null?    Type
    ID1                                                RAW(18)
    ID2                                                RAW(18)
    SQL> variable b1  RAW(18);
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
                        VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
                        NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
                        BINARY_FLOAT | BINARY_DOUBLE ] ]
    The above is the error I get - i cant declare a variable as raw.
    SQL> variable b2  RAW(18);
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
                        VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
                        NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
                        BINARY_FLOAT | BINARY_DOUBLE ] ]
    SQL> variable b3  RAW(18);
    Usage: VAR[IABLE] [ <variable> [ NUMBER | CHAR | CHAR (n [CHAR|BYTE]) |
                        VARCHAR2 (n [CHAR|BYTE]) | NCHAR | NCHAR (n) |
                        NVARCHAR2 (n) | CLOB | NCLOB | REFCURSOR |
                        BINARY_FLOAT | BINARY_DOUBLE ] ]
    --now the actual query below
    SQL> SELECT * FROM TEST WHERE ID1=:B1 AND ID2 BETWEEN :B2 AND :B3;
    SP2-0552: Bind variable "B3" not declared.
    (this fails due to the errors earlier)Also this is a third party app schema so that we don't have the option of modifying the data type of the columns.
    Thanks,
    Edited by: orausern on May 10, 2011 11:30 AM

    Try anonymous PL/SQL block:
    declare
    b1 RAW(18);
    b2 RAW(18);
    b3 RAW(18);
    begin
    b1:=..;
    b2:=..;
    b3:=..;
    SELECT col1, col2, ..
    INTO ...
    FROM TEST
    WHERE ID1=:B1
    AND ID2 BETWEEN :B2 AND :B3;
    end;
    /

  • Using Session Variable with Conditional Formatting Filter

    Hi,
    I'm trying to add a condition to my report in order to flag all opportunities that have a close date that is in the past. The way I'm trying to do this is by adding a condition to say when close date is less than current_date, flag the column with an image.
    Issue I'm having is that the filter window within conditional format tab appears to not have the session variable option as you do when you create a filter on a column the normal way. A colleague told me to use an SQL expression, but again this option seems to be unavailable too within the conditional format tab.
    Can anybody assist please?
    Thanks

    Create a new column and write a CASE WHEN condition like case when close date < current_date then 'Y' ELSE 'N' END.
    Then on your actual date column, you can do conditional analysis based on the newly created column for values having Y then the image.
    finally, you can hide the newly created column.

  • [WebIntelligence Reporting] How to use count function with condition !?

    Post Author: xuanthuyit
    CA Forum: WebIntelligence Reporting
    Hi everyone,
    I want to make a report like this  with WebIntelligence reporting.
    I want to show the number of Outlet of each chanel (Horeca, Grocery, Convenience) at the end of report !
    But I don't know how to do that with WebIntelligence Reporting.
    Please help asap. . .
    Thank you verry much,

    Post Author: jsanzone
    CA Forum: WebIntelligence Reporting
    xuanthuyit:
    Apparently =count() &#91;and use of a where&#93; was permissible in previous versions of BusObjects, however, things in XI are different (as other users tell me, being XI is my first experience w/ BusObj...), so anyhow, here is the solution to your question.
    You will have have to create two variables for each condition you have.  One variable will be the "helper" and the other variable will be the "worker".  For instance, create a variable called channel_x and the formula:  =if(channel="haney";<metric>;0)  (where "haney" is the name of your organization and <metric> is the metric you are using to count or sum things in your report).  Once channel_x is saved create another variable called channel_x_count and the formula:  =sum(&#91;channel_x&#93;).  Once channel_x_count is saved, then on your report towards the bottom you can use the Template bar to drag in a new table (perhaps you want to use the Horizontal Table type), and then you can drag channel_x_count into your new table.  You will have to repeat the creations of more channel_x type variables (maybe call it channel_y and channel_y_count) or something more descriptive, but in any case substitute the "haney" constant for the next store you want to track, etc, etc.

  • Using pre-query with 2 characteristics in rows?

    Hi @all,
    I need your help regarding the following problem:
    There are multiple conditions in one query, I'd like to do in a certain sequence.
    Because these multiple conditions in BEx where processed as "AND", for example
    companies must be part of the Top x and an key-figure of these have to be more than y.
    As a result, we have the top x companies reduced by these companies that doesn't match the key-figure condition. So there were less than x companies.
    That's why we decided to use pre-queries. Because the key-figure is a ratio of the company on a higher level that is "restricted" by a condition, we need two characteristics in rows. That seems to cause some strange results in the main query wherein not all companies where submitted.
    Does anyone know some workaround or any approach for this problem? Please let me know every idea.
    Or do you know another way to set a certain sequence of conditions?
    Many thanks for your help.
    Tobias

    I've found a hint that this can't be done by using replacement path variables. Instead we used several pre-queries.

  • Using XML Publisher with plsql package data source?

    Hi,
    I have a html gantt chart which i create using a plsql package and the use of the htp.p procedure for output to a webpage.
    I want to be able to print this to PDF and was hoping the XML Publisher may be an option for doing this. The datasource for this however seems to be a sql query or XML feed.
    Can anyone provide any suggestions on this??

    With a Pipelined Table Function you can use a function in your FROM-clause (so you'll have a normal SELECT, but in the background the data comes from a PL/SQL-function):
    SELECT * FROM TABLE( <function_name> )
    Look here:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:30404463030437
    http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14261/tuning.htm#sthref2335

Maybe you are looking for