Date calculation In query

I am doing a date difference calculation on two date characteristics, i am doing this at the query level. For each date characteristics i have created a formula variable. I have then created a CKF and i have used these formula variable in that CKF to get the date difference. I am getting the date difference correctly if there are dates in both the Date 1 and Date 2 characteristics, But if either one of the date field is blank i am getting wierd value.
Date1-------   Date2 -
     Difference
9/20/2008----   9/15/2008----      5
#Blank--   9/15/2008--      -733,301
#Blank--   9/12/2008--      -733,298
I know this problem can be sorted by writing a ABAP routine in the update rule, but i dont want that solution as i want these CKF to be created by the users.
Points will be awarded.

Hi RAO,
I used your logic and it is working for the blank values but it is giving me a wrong result for the condition in which i have both the dates.
Condition 1
9/25/2008 - 9/12/2008 = -13
It should be 13.
Condition 2
Blank - 9/12/2008 = 0
I want the result for this to be blank.

Similar Messages

  • How to find the date difference in query level?

    Hi All,
      I have to find the difference between Delivery Date and Posting Date in the query level. Canyou please let me know whether it is possible or not?
    Thanks in advance!!
    Regards,
    Ramanathan.R

    Hello,
    If both infoobjects are key figures , then you can do the calculations. Create new formula and do the calculations.
    If infoobjects are characteristics, then also you can perform the calculations but you can do this by creating a formula variable using replacement path.
    Thanks,
    Praveen Tati

  • Display Current/System date in the Query

    Hi,
    Can any one tell me how i can display the current date or system date in Bex Query/report. I tried to use "0DAT" SAP exit as the key date in the "General Properties"... this helps me to execute query based on a Key date, but does not display the date. Can any one tell me, how I can use the current date in my query for some calculations and how I can display the current date.
    Thanks

    Hi Tanu
    If you want to see the query run date along witn query properties in the report output ( after you execute the report).. then go to "Layout".. (please check for Icons) >display text elements> all. ( This is if you are in BW 3.5).. if you are in BI 7.0, then simplay click on information and you will see all the details
    I see you are asking for some calcuation's also.. for that you should see what date fields you have in the backend cube/dsou2026
    Hope this helps
    Thanks
    Kalyan

  • Calculations at query level

    HI Experts,
    I need some calculations at query level,
    find the below user requirement.
    And one more thing we are not authorised to use Customer exits.
    SELECT
    [FA No] As [FA No],
    [FA Description] As [FA Description],
    Sum( CASE WHEN [Posting Date] < @fromDate THEN Amount ELSE 0 END) AS [Starting Balance],
    Sum( CASE WHEN [Posting Date] >= @fromDate AND [Posting Date] <= @toDate  THEN [Debet Amount] ELSE 0 END) AS [Debet Amount],
    Sum( CASE WHEN [Posting Date] >= @fromDate AND [Posting Date] <= @toDate  THEN [Credit Amount] ELSE 0 END) AS [Credit Amount],
    Sum( CASE WHEN [Posting Date] <= @toDate THEN Amount ELSE 0 END) AS [Ending Balance],
    Sum( CASE WHEN [Posting Date] >= @fromDate AND [Posting Date] <= @toDate  THEN [Amount] ELSE 0 END) AS [Net Change]
    FROM FA06data
    GROUP BY [FA No], [FA Description]
    Please help as early as you can.
    Thanks,
    Naveen

    Thanks for your responce.
    we are using Sql with the query designer.
    what we can use? like calculated key figure.

  • How to use Replacement Path Variables to perform Date Calculations

    Hi Experts,
    Can anyone make me clear about:How to use Replacement Path Variables to perform Date Calculations???????
    Thankyou in advance..
    shankar

    In left panel select the time Dimension
    Then hit new variable in that
    give the Name and Description for the Variable
    In processing by hit Replacement Path
    In reference characterisitcs use Calendar Day...
    As ur intention is to use it for Date
    Then in adjacent tab use
    Replace variable with Query / Variable
    Then u can use Offset length and offset start for controoling the display of your variable.
    Use as single, multiple single, interval, selection option as uwish
    HIt okey
    and you are good to go

  • Subtraction of dates in the query.

    Hi Experts, I am new here and need some help please.
    I want to subtract 2 different dates in the query. They are defined as characteristics. Can somebody help me with this please?
    Thanks

    Hi,
    As said in the previous post, Create 2 formula variables on these 2 dates. and use them in the calculation.
    Go to rows right click on structure Select New formula. Popup will come, select the formula varibles onleft below. Right click New variable slect the processing type as Replacement path. and reference char as these 2 characteristics.
    Khaja

  • Unable to access the data from Data Management Gateway: Query timeout expired

    Hi,
    Since 2-3 days the data refresh is failing on our PowerBI site. I checked below:
    1. The gateway is in running status.
    2. Data source is also in ready status and test connection worked fine too.
    3. Below is the error in System Health -
    Failed to refresh the data source. An internal service error has occurred. Retry the operation at a later time. If the problem persists, contact Microsoft support for further assistance.        
    Error code: 4025
    4. Below is the error in Event Viewer.
    Unable to access the data from Data Management Gateway: Query timeout expired. Please check 1) whether the data source is available 2) whether the gateway on-premises service is running using Windows Event Logs.
    5. This is the correlational id for latest refresh failure
    is
    f9030dd8-af4c-4225-8674-50ce85a770d0
    6.
    Refresh History error is –
    Errors in the high-level relational engine. The following exception occurred while the managed IDataReader interface was being used: The operation has timed out. Errors in the high-level relational engine. The following exception occurred while the
    managed IDataReader interface was being used: Query timeout expired. 
    Any idea what could have went wrong suddenly, everything was working fine from last 1 month.
    Thanks,
    Richa

    Never mind, figured out there was a lock on SQL table which caused all the problems. Once I released the lock it PowerPivot refresh started working fine.
    Thanks.

  • Can we use session variables in BI publisher's Data Model SQL Query?

    Hi Experts,
    We need to implement Data level security in BI Publisher 11g.
    In OBIEE we do so by using session variables, so just wanted to ask if we can use the same session variables in BI Publisher as well
    ie can we include the where clause in the Data Models SQL Query like
    Where ORG_ID = @{biServer.variables['NQ_SESSION.INV_ORG']}
    Let me know your views on this.
    PS: We are implementing EBS r12 security in BI Publisher.
    Thanks

    Read this -> OBIEE 11g: Error: "[nQSError: 23006] The session variable, NQ_SESSION.LAN_INT, has no value definition." when Creating a SQL Query using the session variable NQ_SESSION.LAN_INT in BI Publisher [ID 1511676.1]
    Follow the ER - BUG:13607750 - NEED TO BE ABLE TO SET A SESSION VARIABLE IN OBIEE AND USE IT IN BI PUBLISHER
    HTH,
    SVS

  • SAP MII 14.0 SP5 Patch 11 - Error has occurred while processing data stream Dynamic Query role is not assigned to the Data Server

    Hello All,
    We are using a two tier architecture.
    Our Corp server calls the refinery server.
    Our CORP MII server uses user id abc_user to connect to the refinery data server.
    The user id abc_user has the SAP_xMII_Dynamic_Query role.
    The data server also has the checkbox for allow dynamic query enabled.
    But we are still getting the following error
    Error has occurred while processing data stream
    Dynamic Query role is not assigned to the Data Server; Use query template
    Once we add the SAP_xMII_Dynamic_Query role to the data server everything works fine. Is this feature by design ?
    Thanks,
    Kiran

    Thanks Anushree !!
    I thought that just adding the role to the user and enabling the dynamic query checkbox on the data server should work.
    But we even needed to add the role to the data server.
    Thanks,
    Kiran

  • No data from BW-Query in BO-tools

    Hello all
    On a newly installed BO XI 3.1 with the SAP integration kit I cannot get data from my existing BW queries.
    For example, if I start Xcelsius and add my BW-system as connection I can get the structure of the query (headings) but no data is displayed, neither in the connection's preview tab nor in the web preview.
    The same happens if I create a QaaWS on this BW-query - I see the query headings, but not the actual data.
    The query shows data if I open it directly in my web browser and it's a really simple one: no variables, no extras, only a few columns and rows.
    I use SAP BW 7.01 SP6, XI 3.1 12.3.3 and XCelsius 2008 5.3.4
    In SAP BW my user has SAP_ALL as well as BOE Admin & Content producer roles.
    I'm relatively new to BO products so I have no idea where to start looking for the cause. Please help!
    BR
    Kanan

    Hi
    After I found the document "Using Xcelsius 2008 with SAP NetWeaver BW" (http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10ad2489-8956-2d10-f8ab-ed4cce2766da?quicklink=index&overridelayout=true) and followed the steps it works.
    It seems as if the error was not in the system but in front of it - a typical case of RTFM, although the manuals are not always easy to find.
    sorry & thanks.
    BR
    Kanan

  • Schedule Line Delivery Date Calculation with Transportation Scheduling

    Hi All,
    We are currently running into a problem where our Sales Order Schedule Line delivery dates are being pushed out too far into the future - because of the Calendar being used to determine the transit time.
    We have 'Delivery Scheduling' and 'Transportation Scheduling' activated for our Sales Document type
    We have Routes that are configured with a 'Transit Time' and a 'Factory Calendar'
    Order Scenario:
    'Factory Calendar' assigned to our 'Route' is setup with only one 'Workday' in a given week e.g. Wednesday
    Our 'Route' has a Transit Time of 2 days
    We create a Sales Order on Monday for a Material that is available in our Plant
    The 'Goods Issue' date is being determined correctly for the next Workday - being Wednesday
    The 'Delivery Date' is extending out over 15 days (2 Wednesdays into the future) - since it is working on 'Calendar Days' and not 'Actual Days'
    Does anyone know of a way (config or other) to only influence the 'Goods Issue' date with the 'Factory Calendar' assigned to the Route, and have the 'Delivery Date' calculated using the Transit Time on the Route and 'Actual Days' rather than Calendar days?
    All help greatly appreciated.
    Thanks,
    Ravelle<i></i>

    Hi Pathik,
    Thanks for your reply.  I have already maintained the Calendars I'm using for this business process in <SCAL> - same as <OY05>. 
    The problem I'm having though is that by assigning a Calendar directly to my route (which I doing to influence the goods issue date - using a 1 Working Day Calendar) it is also taking precedence in determining the Transit time - which in this case I don't want, as I want my Transit time to be determined using a 5 Working Day Calendar.
    I don't think this problem has a config option as a work around...I think the only possibility in this case is a development to achieve the results we need.
    Thanks,
    Ravelle

  • Key date for a query

    Dear All,
    I have created a customer exit variable on key date of a query.
    With this input variable i am first asking user to input one particular date say he enters 31.12.2010 then i am trying to add 1 more day to it and making it 01.01.2011.
    I have put a break point in the code but it does not stop the processing there.. report executes directly taking the first user input.
    I want to add 1 more day to the user entered date and this modifiied date should be the input date for key date field.
    Below is my code.
      WHEN 'ZCAL_DAY_EXT'.
        IF I_STEP = 2. "after the popup
          LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
          WHERE VNAM = 'ZCAL_DAY_EXT'.
            CLEAR L_S_RANGE.
          ENDLOOP.
          DATA: v_temp like sy-datum.
          v_temp = loc_var_range-low.
          v_temp = v_temp + 1.
          L_S_RANGE-LOW = v_temp.
          L_S_RANGE-SIGN = 'I'.
          L_S_RANGE-OPT = 'EQ'.
          APPEND L_S_RANGE TO E_T_RANGE.
        ENDIF.
    Do let me know where am i going wrong? Or is it we cannot use customer exit with Key date.
    Thanks & Regards,
    Anup
    Edited by: Anup Chaudhari on Aug 2, 2011 7:16 AM

    Hi Anup,
    Basically I_STEP = 1 is used for populating the default value which will be shown on selection screen and I_STEP = 2 is the step in which you does the processing on variable values which are entered on selection screen.
    I am surprised that your internal table is empty, actually it is supposed to contain all the variable values which are entered in I_STEP = 1.
    Can you try to add some more variables along with the current variable and check whether their value is coming in the internal table or not?
    Finally what you can try is get the user input date in one variable and then create another customer exit variable in which you will calculate the new value and use this variable in Key date, the problem might be that we are trying to modify the same variable, actually it should not be the problem but I have no clue what is happening and you can just try this alternative.
    Regards,
    Durgesh.

  • Oracle Forms - How can I create a Data Block with query

    Dear friends I have a question, I couldn't do this..
    I have a sql query, I want to show the datas of the query.. How can I do this. ?
    Data Block Wizard wants a table, view or stored procedure, but I have a query, how can I create a data block with my query.. I m waiting your helps..? Please...
    Semih

    Hi,
    You have two options
    1. create a view and base the block on the view
    2. create a block with a query Data Source Type of 'FROM clause query'
    Hope this helps
    Neil

  • "Source not found" Error creating URL Data control with query parameters

    Hi,
    I have a restful service for which i want to create a URL data control. I am able to create the URL data control successfully when i am not passing any parameters in the Source field. But if i am specifying the parameters in the source field like this Department=##ParamName##, something weird is happening. After giving the param string in the Source field, it asks for default param value to test the url. It tests the url successfully. After that i select XML as the data format in which i am mentioning the xsd like this . "file:///C:/..../something.xsd" . And this is when i am getting the error. "Invalid Connection. The source is not found". I am giving exactly same path for xsd which i gave while creating URL data control without query parameters. Infact i was able to create the URL data control with query parameters successfully till afternoon. after that it started giving me this error all of a sudden. Infact as soon as i was able to create a URL data contol with query parameter successfully, i took a backup of the application before moving further. But even that backup is not working now.
    As far as i understand, i dont think there will be any change in xsd if query params are passed to a web service. Please correct me if i am wrong.
    Just dont know what could be the issue. Please help
    Thanks

    Hi,
    xsd is used for the URL service to know what the returned data structure is so it can create the ADF DC metadata
    Frank

  • Where to get BW Metadata: owner, creation date, change date of a query / WS

    Hello,
    I need a report over the existing queries / worksheets and the owner, creation date, change date of a query etc.
    You see some of the information when you go over query properties in the query designer. But you see only the information of one (the opened) query. And you have to do this for every query ...
    My idea is to go over BW Metadata in the technical content.
    Here is the cube BW Metadata 0BWTC_C08
    (The InfoCube BW Statistics u2013 Metadata contains metadata from the Metadata Repository.)
    Is this the way to do it? Or any other suggestions u2026
    Can I get infos about used structures , etc over this way
    Thanks Markus

    I had to work on an other subject:
    But now the source of information is clear:
    RSRREPDIR - index of all queries
    RSZELTDIR -  index of all queries-components
    RSRWORKBOOK - Verwendungsnachweis für Berichte in Workbooks
    RSRWBINDEX - List of binary large objects (Excel workbooks)
    RSRWBINDEXT - Titles of binary objects (Excel workbooks) in InfoCatalog
    The tables are to join over
    RSRREPDIR.COMPUID  = RSZELTDIR.ELTUID
    RSZELTDIR.TEXTLG  contains the description
    RSRWORKBOOK.GENUID  = RSRREPDIR.GENUID
    RSRWBINDEXT and RSRWBINDEX are connected over WORKBOOKID
    I'd like to put the information of all of this tables in a cube and define a query on it.
    I have to define new datasource, infosource to get the data in the cube.
    Right?
    Now i see some existing datasource objects in the technical content.
    0TCTQUERID, 0TCTQUERID_TEXT, 0TCTQUERY, 0TCTQUERY_TEXT
    I can't open them to look in. But they might be helpfull. Anybody used them?
    Markus

Maybe you are looking for

  • Firefox 29.0.1 crashes on windows 7

    Hi I also have problems with FireFox crashing since 29.0.1. Here is a list of all BP issues: bp-98ea3800-6cb4-46b9-ab45-d3b242140530 30/05/2014 11:56 bp-3fdf2f42-026e-40f8-8c61-de6342140523 23/05/2014 10:43 bp-36248d79-5f55-4c2f-9211-ca3222140515 15/

  • Why won't my iTunes 11 play more than one song at a time?

    Songs appear in "Up Next", but at the end of the song being played they disappear and nothing gets played next. This makes iTunes useless as a music player. Please help.

  • Deploy a BC4J JSP Application on IAS

    OK, I changed my classpath jserv.properties file as you suggest, but I get the following error when I run my applet from IE: wrapper.bin=K:\Ora816\Apache\jdk\bin\java.exe wrapper.env=PATH=K:\Ora816\bin # Oracle XSQL Servlet wrapper.classpath=K:\Ora81

  • If CSV file contains multiple structure...

    If CSV file contains multiple structures...then how should set vaules in file content conversion. pls mention any links regarding File Content Conversion thanks in advance.. Ramesh

  • Urgent documentation

    Hi, I want Configuration Documentation for Profitability Analysis, If any body know Pls urgent requiremtn Rgds sunfico