Update Date types based on actions

Hi Gurus,
I have a requirement to update date types within a date profile based on a certain action condition.
I have 3 date types:
Downtime Start
Downtime End
Total Downtime Duration
The priorities in my transaction have, x, y, z for example and x is default.
Upon selecting y, the system should take into consideration the timestamp of this change and update the Downtime Start... The moment the priority is changed to anything other than "y", it should take this timestamp and update "downtime end".
The difference between these two times would be the third date type.
Any ideas how to proceed?
Regards,
Ash

Hi
Please post DDL+DML next time :-)
-- This is the DDL! create the database structure
create table DateRange(
StartDate DATE,
FinishDate DATE,
Condition BIT
GO
create table Calendar(
CalendarDate DATE,
IsParental BIT
GO
-- This is the DML (insert some sample data)
insert DateRange
values
('2014-01-02', '2014-01-03', 1),
('2014-01-03', '2014-01-13', 0),
('2014-01-13', '2014-01-14', 1)
GO
insert Calendar(CalendarDate)
values
('2014-01-01'),
('2014-01-02'),
('2014-01-03'),
('2014-01-04'),
('2014-01-05'),
('2014-01-06'),
('2014-01-07'),
('2014-01-08'),
('2014-01-09'),
('2014-01-10')
select * from DateRange
select * from Calendar
GO
-- This is the solution
select CalendarDate
from Calendar C
where EXISTS (
select C.CalendarDate
FROM DateRange D
where C.CalendarDate between D.StartDate and D.FinishDate and D.Condition = 1
UPDATE Calendar
SET IsParental = 1
from Calendar C
where EXISTS (
select C.CalendarDate
FROM DateRange D
where C.CalendarDate between D.StartDate and D.FinishDate and D.Condition = 1
[Personal Site] [Blog] [Facebook]

Similar Messages

  • Date type based on status change

    Dear All,
    I'm now working with CRM 5.0. I would like to know if it's possible to have a date type which is based on the change of a user status/system status.
    What I mean is, for example; when a incident message is created. And later on someone change the status to "completed". The date type " completed date" should fill in the date and time of the moment the status is changed to completed.
    I believe to achieve this I need a date rule. Does anyone know if there are any SAP standaard date rule similair to this scenario? or a new date rule need to be created. And if so, how?
    Any suggestion or feedback is greatly appriciated. Thanks in advance.
    Kind regards,
    Anthony T.C Lim

    Hi!!
    That is very much possible.
    In brief.
    U need to implement a method call in action. Schedule condition for the same should be on status 'Complete'.
    In the method you should use FM CRM_ORDER_MAINTAIN to update the date as required in the import parameter 'IT_APPOINTMENT'.
    Best Regards,
    Pratik Patel
    <b>Reward with Points!</b>

  • INSERT/UPDATE date type

    I'm using an Oracle 816 and Java 2.
    There is no problem with retrieving data from the tables. My problem is "INSERT date".
    Code snip:
    (java.util.)Date dtToday = new Date();
    String strSQL = "INSERT INTO MY_DB.TABLE1 " +
    "(COLUMN1, COLUMN2) VALUES (\"bluh\", " +
    dtToday + ")";
    myStmt.executeUpdate(strSQL);
    Would you please tell me what is the right way to insert a date type (any from java.util.Date, java.sql.Date, or oracle..DATE) to an Oracle 816 table that has a date column.
    Thank you very much in advance.
    Robin Luo

    Try to use prepared statement:
    PreparedStatement pstmt =
    conn.prepareStatement ("insert into TABLE1(COLUMN1, COLUMN2) values (?, ?)");
    pstmt.setString (1, "bluh");
    pstmt.setDate (2, dtToday);
    pstmt.execute ();
    null

  • Updating data types

    Hi,
    I have the following issue: I need to extend a complex data type with a new atomic field (a string) after I already used it within my process context and a business rule. Thus I changed the data type, deleted the context and reloaded the alias in the business process. In both cases the old data type without the new added string. What else do I have to do in order to make the changes visible to both the process and the business rule?
    Thank you for your support

    Hi ,
    thank you for you answer. I can't realy follow your explaination as it mentions Webdynpro.
    Maybe I should precise my problem a bit more (if you solution will help me please explain it once more to me
    I am working with a complex data dype in the Process Development perspective. When I add another field (lets say a string) to the complex datatype usually the dialog to reimport the xsd should appear
    (I am talking about the one which can bet put on and off under Preferences > Enterprise Service Modeling > Import and Reimport)
    However, although it is put on this dialog appear in one of my projects. It event appears if I do the changes to other projects but not in this particualar one. And as the reimport does not work the added field does not appear in the process context where I use the complex type.
    Is there a manual way to start the reimport manually?

  • Problem updating data block based on a view

    Hi,
    I have a data block that is based on a fairly complex view, which I want to make update-able. The default Forms behavior, of course, is to not allow this.
    In an attempt to get around this, I defined an 'ON-LOCK' trigger, where I specified a single statement 'LOCK_RECORD;'. I also defined an ON-UPDATE trigger that will later call some stored PL/SQL procedures to effect the actual update (using INSTEAD-OF triggers and such). For now, I just display a message saying 'updation not currently supported'.
    However, a problem occurs when I make a change to an item in the data block, don't attempt to save it, yet try to navigate to the next record. The form simply hangs and the only thing I can do is kill the process.
    I'm deploying this form as within Oracle Apps 11i. I suspect this has something to do with the lock record but don't know how to get around this.
    Does any one have any suggestions?
    Thanks,
    Niranjan Ramakrishnan

    Your lock will be removed whenever the forms does a commit or rollback. In 'normal' forms processing the on-update trigger will fire as part of the commit form processing, which also includes a database commit which will remove any locks that have been taken out. Should the user clear the form a database rollback will be performed which will also remove any locks. You should not need to do any explicit removal of locks yourself.
    I would not recommend not having any kind of lock processing, as Sudha says, as this could easily lead to changes to record's being lost. As long as the locking of table(s) is always done in the same order deadlocking should not occur.
    You may make want to make the locking process a SELECT ... FOR UPDATE NOWAIT so if the record is already locked the user is informed and can try again later, rather than an unknown wait until the record becomes available.

  • Updating Condition Type based on pricing type in Sales order

    Hi ,
           I've created a sales order using BAPI. Now I want to update the condition type using pricing type 'Z' customer reserve . I'm using BAPI_SALESORDER_CHANGE.
    I'm passing the values as:
      condition-itm_number = '000000'.
          condition-CONDTYPE = 'Z'.
          condition-cond_count = '01'.
          condition-currency = w_temp_itab_so-currency.
         condition-CALCTYPCON = 'Z'.
          APPEND condition.
          conditionx-itm_number = '000000'.
          conditionx-cond_count = '01'.
          conditionx-updateflag = 'I'
          APPEND conditionx.
    But its not getting updated.
    Thanks and regards,
    Jyoti Shankar

    Hi G's
    Iam trying to get my fields hidden based on the conditon type i give, and not in a position make that hidden so, how can be that done,,
    The actual instance is:
    I am having different plants for the company and two plants have different taxation procedure and rest differemt and if i select plant with different taxation procedure the condition type should be supresses only for the particular plant...
    All your Support is Appreciated

  • Update data automatically in sql server 2005 based on condition proplem

    Hi guys i have problem I have two table
    First one is
    Second One is Vacation
    as relation one to many (vacation has foreign key of Contract No OF Table Contract) 
    what i need is to update Contract table with field status =Finish where start vacation date >end contract Date
    How i do that in sql server 2005 to make update automatically
    Ex
    contract table
    status             nvarchar(20)
    end contract    date time
    vacation table
    start vacation date time
    end vacation date time
    start vacation date is 23/10/2014
    and End
    is 26/10/2014
    Now not update status in contract table to finish because vacation date start is less from end contract
    but when date today is 27/10/2014 update contract table field status to finish
    automatically with sql server 2005 
    How i do that condition to make update to data automatically based on changing on date
    Update statement i need is 
    update Contract set status = finish where start vacation>end contract
    but problem how i write this statement to update data automatically based on date today

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. You failed again. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. Now we have to write the DDL that you did not bother with! What you did post was wrong! There is no key or constraints. There is no generic “status” in RDBMS; a "<something in particular>_status"
    is a state of being, so it needs a temporal duration. The correct idiom for this data model is: 
    CREATE TABLE Vacations
    (vacation_contract CHAR(15) NOT NULL PRIMARY KEY,
     vacation_start_date DATE NOT NULL,
     vacation_end_date DATE,
     CHECK(vacation_start_date < vacation_end_date),
    Oh, a field is nothing like a column. You need to read a basic SQL or RDBMS book; you do not know the basics. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Not able to see Enhanced Data type in SPROXY in SRM

    Hello Experts,
    We are planning to use an outbound (SRM to PI) Proxy between SRM and PI to send XML messages. Our SRM team has requested a Datatype enhancement of SAP's predelivered SCV, SAP SRM SERVER 7.0 component i.e. RFQRequest. So, In ESR we have created a new Enhanced data type based on RFQMessage (SAP's pre delivered datatype). I've added their (SRM team's) 6 extra elements to this new Enhanced Data Type, RFQMessageExtension. And, saved and activated it.
    Now, to generate the Proxy I went into SRM -> SPROXY, but I donu2019t see my Enhanced Datatype, RFQMessageExtension. Please let me if you've come across this problem or know the solution. I was following this blog [/people/michal.krawczyk2/blog/2006/11/14/xipi-data-type-enhancements-standard-business-partner|/people/michal.krawczyk2/blog/2006/11/14/xipi-data-type-enhancements-standard-business-partner]
    Thanks,
    Mayur

    Hi Mayur,
       Have you read this article?
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0bb5687-00b2-2a10-ed8f-c9af69942e5d
    Regards,
    Ravi kanth talagana

  • Data type & length in SAP side!!

    Hi all,
    i am working in a R/3 -legacy scenario.
    In R/3 side there exist one table called YMD_ARTICLE...
    now i have to make data type based on the 7 fields of that table YMD_ARTICLE..
    and I have given the field name + type(vachar,timestamp,smaal int..etc..)+filed length....in the data type template...
    Now my question is...wat should i give in type ...for the field...
    i min can i use "xsd:string" for every field..... irespective of what given in the template....
    Do we need to declare the lenght,type...for fileds of a DATA TYPE in XI...
    if the DATA type is already there in the R/3 side.....
    Can any one explain me......
    thanks....

    hi,
    >>> i min can i use "xsd:string" for every field..... irespective of what given in the template....
    string can be used to handle other datatypes as well...but try using the same data type as in R/3...
    when u know e.g the value can only be integer then use data type integer... this will also not allow values other than integer to pass...
    hope it helps,
    regards,
    latika.

  • How to dynamic set messageInputText item data type?

    Hi,
    I have a LOV and other messageInputText items on the page. I need to be able to change the messageInputText item data type based on the value selected from LOV. How can I do that?
    DD

    1)Allow PPR on the item that receives the LOV values
    2)Edit the VO query and create a SQL based column, which in turn will control the switcher. Something like –
    decode(nvl(to_char(EmployeeEO.END_DATE), 'N'), 'N', 'DataType1', 'DataType2') AS DELETE_SWITCHER
    3)Now add a switcher region with two cases in your page. Each case should represent the two possible values defined in the SQL based column ( “DataType1”, DataType2” in the above example).
    4)Add two messageTextInput items under each case, but with different datatypes.

  • Data types in pi 7.1

    Hi,
    when do you use core, free and aggregated data types?
    Thanks in advance
    regards,
    Ramya Shenoy

    This may help you,
    Introduction
    SAP delivers descriptions of Global Data Types (GDTs) as Enterprise Services Repository (ESR) content to customers. Customers can create their own data types in the ES Repository and use SAP GDTs.
    u2022
    Two ways of modeling data types are supported: Classical XSD style and new CCTS (Core Component Technical Specification) style.
    u2022
    Data types are classified as free-style (classical), core (atoms of CCTS modeling), or aggregate (complex CCTS)
    u2022
    Standard fault data types are no longer created automatically for every namespace (only when fault message type is created).
    u2022
    Additional functions in data type editor provide better support for structural changes (e.g., moving subtrees).
    More Information:
    SAP Help Portal: Global Data Types
    According to this, we distinguish between SAP Core Data Type and SAP Global Data Type. The SAP Core Data Type as well as the W3C Type (XSD type) does not have any business semantics. The SAP GDT has business semantics, it actually can be based on either a core or an aggregated DT.
    Free-style data types are directly based on the primitive data types, e.g., xsd:decimal. They do not need any further parameters to define themselves.
    More Information:
    u2022
    SAP Help Portal: Core Data Types and Aggregated Data Types Recommendation
    When to use free, core and aggregated data types
    Core data types are based on CCTS specification. Aggregated data types have business semantics, are based on CDTs, and are the basis for application-specific data types SAP-wide.
    Customers who adhere to the CCTS specification or have business scenarios dealing with SAP backend systems, should try and reuse the existing core and aggregated data types delivered by SAP. However, customers who wish to use their own schema for defining the data types, free-style data type is the preferred approach.
    While transferring the business scenarios from XI 3.0/PI 7.0 to PI 7.1, all the data types in the design objects will be transferred as free-style data types by default.
    While creating new objects in PI 7.1x, it is recommended to reuse the core and aggregated global data types provided by SAP.
    The detailed list of SAP delivered data types is available on SAP Developer Network (SDN) at ES Workplace.
    https://www.sdn.sap.com/irj/sdn/esworkplace
    Core data types
    Core data types are based on representation terms which are ISO 15000 5 (ebCCTS) compliant.
    SAP delivers core data types with the same name as representation terms. Applying the standard methodology simplifies the implementation of cross-company processes.
    CDTs are intermediate data types, and are a level above primitive data types like decimal, string, etc. They are defined by representation terms such as Amount, Identifier, etc. They are themselves not yet application-specific and are therefore referred to as context-free.
    While creating core data type based on any given representation term, we get an option to either use a default XSD type or reuse an existing core data types.
    For using the standard XSD types we select Type as u2018XSD Typeu2019
    For reusing already existing core data type we select Type as u2018Data Typeu2019 Prerequisite
    Define a dependency on the SWC SAP Global to reuse any of the standard core data types shipped by SAP.
    xample

  • Reference data types in interface objects?

    How do you create reference data type based on data type in interface object??

    First create the reference DT1 in IR then create a new data type DT2 and if you want to create a reference to DT1 then in  the editor select Type (3rd coloum) as the DT1 which you can get by double click on Type and then you select "search help" and select DT1 from the list.
    Cheer's

  • Date types update

    Dear CRM Guru,
    I have a requirement to update custom date types and an indicator. When a customer should receive an e-mail notification based on service ticket status (either ticket is open or close). When a user sent e-mail to contact person, the date types need to be updated. How I can accomplish this remedy? Your response is appreciated.

    Hi,
    Are you planning to send the e-mail using the action profile?
    If so, in the method that sends the e-mail maybe you can change it to calling a function that executes these changes in the document.
    Regards,
    Susana Messias

  • Help! Update a column in LONG data type

    I am looking for help on how to update a column with the long data type in a oracle 7.34 table on sun Solaris 2.6.:
    SQL> desc searchengine;
    Name Null? Type
    ENGINE_ID NOT NULL NUMBER(38)
    ENGINEHTML LONG
    SQL> set long 10000
    Then when I run the following update statement I always get the error
    ERROR at line 1:
    ORA-01489: result of string concatenation is too long
    Here is the update statement:
    SQL> update searchengine set enginehtml = '<FORM ACTION="../ndClickMe/pgSearchEng" METHOD="GET" target=_top><TR><TD COLSPAN=2>
    <IMG SRC=/gifs/start/looksmart_websearch.gif width=85 height=25 ALIGN=BOTTOM BORDER=0><BR>
    </TD></TR><TR><TD HEIGHT=20 VALIGN=TOP COLSPAN=2><INPUT TYPE=hidden NAME=URL VALUE=http://www.looksmart.com/r_search>
    <input type=hidden name=search value=0><input type=hidden name=comefrom value="izbx-search">
    <input type=hidden name=isp value=zbx><INPUT NAME=key SIZE="22"><br><center>
    <INPUT TYPE="IMAGE" SRC=/gifs/start/search.gif WIDTH=53 HEIGHT=15 ALIGN=BOTTOM border=0 NAME=search
    value="Search!"><br></center></TD></TR></FORM><FORM name="Go3"><tr><td>
    <SELECT name="select" onChange="dropDown(document.Go3.select.options[Go3.select.selectedIndex].value);">
    <option value="">...or select a category</option>
    <option value="http://www.looksmart.com/eus1/eus53930/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus53930" target=_top>Automotive</option>
    <option value="http://www.looksmart.com/eus1/eus65300/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus65300" target=_top>Business</option>
    <option value="http://www.looksmart.com/eus1/eus151538/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus151538" target=_top>Chat</option>
    <option value="http://www.looksmart.com/eus1/eus53832/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus53832" target=_top>Computing</option>
    <option value="http://www.looksmart.com/eus1/eus52213/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus52213" target=_top>Entertainment</option>
    <option value="http://www.looksmart.com/eus1/eus53671/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus53671" target=_top>Family</option>
    <option value="http://www.looksmart.com/eus1/eus53940/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus53940" target=_top>Health</option>
    <option value="http://www.looksmart.com/eus1/eus141561/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus141561" target=_top>Hobbies</option>
    <option value="http://www.looksmart.com/eus1/eus53706/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus53706" target=_top>Reference</option>
    <option value="http://www.looksmart.com/eus1/eus74544/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus74544" target=_top>Shopping</option>
    <option value="http://www.looksmart.com/eus1/eus51605/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus51605" target=_top>Society</option>
    <option value="http://www.looksmart.com/eus1/eus62704/r?' &#0124; &#0124; '&' &#0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus62704" target=_top>Sports</option>
    <option value="http://www.looksmart.com/eus1/eus62920/r?' &#0124; &#0124; '&' & #0124; &#0124; 'izbx' &#0124; &#0124; '&' &#0124; &#0124; 'comefrom=izbx-eus62920" target=_top>Travel</option>
    </select><hr noshade size="1"></td></tr></form>' where engine_id = 0;
    Is there any way to resolve it?
    Thanks,
    Judy

    Yes Prathap, I need to update a single column of type number in the search results table.but each of that column value would be updated with different values like one row in that column will take a value 325 while another will take 500 etc based on user input.
    Your help in this is very much appreciated, Thanks in advance !

  • Sort all the Records in Data manager based on Update Date

    How to sort the reocrds in Data Manager based on Date or something ?
    And also I have three records for a same customer in ( for three different company codes ) and when I search for this customer with the Customer number then it is showing three records , but when I search with Update Date then no records are fetched ...what is the reason ?

    If you make a field as type "Time Stamp" in your data model using the MDM Console, make sure that the option Sort Index is set to Normal.  If this is the case, whenever a record is updated in the repository, the date will be updated.  If the sort index is normal, then MDM will allow you to sort the records based on the date and time by which they were updated.  You can do this by finding your time stamp field in the MDM data manager and clicking on it.  If there is an up and down arrow next to the name of your field, it means it can be sorted.  Also, to answer your other question, you can definitely search based on date.  Use the Free-Form Search on the left hand side of the data manager at the bottom of the screen.  Simply select a date, and it will show you all the records updated on that date.

Maybe you are looking for

  • Video playing from macbook to TV

    Sorry for this odd question that may sound impossible for some or ludicrious for others but im a newbie and a computing n00b - so here goes: I have movies (AVI files) i play on my macbook but the 13" screen is bit small to enjoy the flick - so i ask:

  • Exporting HD video from FCE to Standard DV format

    CAn I export a Video captured and assembled in HD to a standard definition so it will fit on a normal DVD? How would I do that? and then How to burn to a DVD with chapters etc? You probably gathered I am new to this and learning very slowly... But ma

  • Applet Viewer Vs Internet Explorer

    I have a applet that displays popupmenus on a button click it works great when viewed through the applet viewer but under Internet explorer everything appears right but when you click on a button hNothingapp happens.

  • Installing Windows 7 via USB problem

    Hey, I was trying to install Windows-7 64bit via my usb, but when Bootcamp restarts the MacBook to install windows-7, it says there aren't any bootable disks avaible. I've allready tried booting up while holding the ALT/option key, but also there is

  • Windows Phone 10 Technical Preview for Lumia 521 Data Connection Issues.

    Hello, My name is Addiel Gutierrez and i have a question about the data connection issues that i am having for the Lumia 521. The problem is that the "4G" won't show up, there is no connection, but i can still send messages or call. My question is Is