Update Flag Field for Same Day in a Given Month Every Year in a Flag Table.

Hi,
I am trying to formulate an update query for a flag table in our database which contains dates, and flag columns. Currently the system have dates for the next ten years. The flags are updated with values 0 or 1 if a particular date falls under the required criteria.
I need to update flag column for the same day of the month in every year. e.g. 2nd Sunday of October. The value should be updated to all years in the table. Currently I am using the following query to update the current year.
UPDATE FILTERCALENDAR SET YEAR_WINDOW=1 WHERE c_date = NEXT_DAY( TO_DATE('OCT-2013','MON-YYYY'), 'SUNDAY') + (2-1)*7;
and for next year Like
UPDATE FILTERCALENDAR SET YEAR_WINDOW=1 WHERE c_date = add_months(NEXT_DAY( TO_DATE('OCT-2013','MON-YYYY'), 'SUNDAY') + (2-1)*7,+12)-1;
This is not an excellent way to do it as it does not take care of leap years and it does not scan and update values in the whole table for all years correctly.
Can any one help me to resolve this please.
Hamidch

Resolved by doing the following:
Just query the years from your table (list of distinct years) and use the above query on them.
SELECT DISTINCT TO_CHAR(c_date, 'yyyy') FROM FILTERCALENDAR
Or use this predicate
WHERE c_date = next_day(last_day(add_months (c_date, -1)), 'SUNDAY') + 7
AND TO_CHAR(c_date, 'mm') = '10'

Similar Messages

  • How to update key fields for table

    Hi,
    how to update key fields for a table.The update statement is not working for the same.
    Regards,

    Hi,
    See the below example.
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    MOVE 'AA' TO WA-CARRID.
    MOVE '0064' TO WA-CONNID.
    MOVE 'WASHINGTON' TO WA-CITYFROM.
    UPDATE SPFLI FROM WA.
    MOVE 'LH' TO SPFLI-CARRID.
    MOVE '0017' TO SPFLI-CONNID.
    MOVE 'BERLIN' TO SPFLI-CITYFROM.
    UPDATE SPFLI.
    CARRID and CONNID are the primary key fields of table SPFLI. All fields of those lines where the primary key fields are "AA" and "0064", or "LH" and "0017", are replaced by the values in the corresponding fields of the work area WA or the table work area SPFLI.
    Regards,
    raj.

  • How Update Custom fields for EABL DB table by using BAPI_MTRREADDOC_UPLOAD

    Hi friends,
    How can I Update Custom fields for EABL DB table by using BAPI_MTRREADDOC_UPLOAD
    for the parameter EXTENSIONIN of type BAPIPAREX
    I am passing the Structure as BAPI_TE_EABL
    in that structure MRIDNUMBER as EABL-ABLBELNR field value
    ZMESSAGE some text of 30 char and
    ZSKIPC of 2 char
    but I am not able to update that data for the MRIDNUMBER (ABLBELNR ) in DB table EABL
    I am getting RETURN Structure message type E
    as
    "Upload interim entries: Maintain one table only"
    Can any one provide me solution
    Thanks in Advance
    Ganesh

    Hi,
    Refer the following SAP notes.
    1. Note 485557 - BAPI_REQUISITION_CREATE: 'EXTENSIONIN' customer enhancements
    2. Note 584902 - BAPI_REQUISITION_CHANGE: ExtensionIn not connected
    3. Note 792132 - EBAN, EBKN: user-defined fields are not filled
    Regards,
    Harish

  • I have installed Photoshop element 12 trail version in my system and i worked also for some days but it given error that "cannot load default brushes because scratch disk is full " but scratch is 158GB free

    Hi,
    I have installed Photoshop element 12 trail version in my system and i worked also for some days but it given error that "cannot load default brushes because scratch disk is full " but scratch is 158GB free why whats the problem am not getting.

    That thread helped for a time.  But now it seems as though my computer is back to slow again.  But, some of the jargon is over my head as well.  Not sure I knew quoite everything they were talking about.  But thanks a lot for that, it helped I probably just need to reread it and follow the instructions again.  Thanks so much.

  • TO GET WEEKS for a given MONTH AND YEAR

    Is there any FM to get the no of weeks for a given month, say 01 2005.
    Can i get the week numbers say 1 2 3 4 5 for the given month and year.
    Please let me know.
    Happy Holidays.
    Regards,
    Manohar E

    Hi Manohar,
       Use FM DATE_GET_WEEK twice; first time pass first day of the month and again pass the last day of the month as a parameter. So u will be having week number(yyyyxx) for the first week of the month and week number for the last week of the month. From these two, in between week numbers u can easily fetch. I hope this will help u out.
    Regards,
    Kavya Shah

  • Returning  'Day' value based on month and year parameters

    Hi,
    Is there a code that would return an end of the month  Day value based on month and year parameters?
    For example if my parameters yield 9 or September for a month value and 08 or 2008 for the year value, can a formula generate a value of 30 (the last day of the given month in the specific year)?
    This way the formula would pick up the different last day of the month in February for the leap years.
    Thank you.
    Vic

    1. Open the formula workshop.
    2. From the Repository Custom Functions, under Crystal and then Date, RIGHT click on cdlastdayofmonth, click on ADD TO REPORT.
    3. Create a new formula, in the formula workshop, under FUNCTIONS, go down the list till you see "CUSTOM FUNCTIONS", expand that till you see cdlastdayofmonth.
    4. In your formula, type cdlastdayofmonth(currentdate)
    5. Save and close and display the formula in your report, you should see 11/30/2008.
    If you want just the day then modify the formula to:
    totext(day(cdlastdayofmonth(currentdate)),0,'','');
    since you have parameters for month and year, do this:
    totext(day(cdlastdayofmonth(date({?year},{?month},01))),0,'','');
    to give you the last day of the month.

  • I am an MBA student , doing a research project on e-learning authoring tools, would like to find out no. of licences sold/active to date for adobe captivate. how many get sold every year. any pointers/help is appreciated. cheers.

    I am an MBA student , doing a research project on e-learning authoring tools, would like to find out no. of licences sold/active to date for adobe captivate. how many get sold every year. any pointers/help is appreciated. cheers.

    I doubt you'll get an answer in a user forum, sorry. This forum is meant for users to help other users when they have problems that have to be solved. You should contact Adobe itself.

  • HT4847 if you purchase $20 for 10GB for yr do you get 10more GB every year it renews or do you have to buy even more if you use it all?

    if you purchase $20 for 10GB for yr do you get 10more GB every year it renews or do you have to buy even more if you use it all?

    What a completely worthless reply. But that's your MO. Furthermore, what type of phone makes no difference when you read LG's response below.
    Anyway, Verizon does not care or they would have responded to my support request by now so they are going to lose my extra $10 a month for the service starting today.. LG did respond, and blames Verizon.  Here's LG's response:
    ------Reply to Your Inquiry-------
    Dear xxx
    I do apologize for any inconvenience this issue may have caused you.
    It seems that this is an issue with the Verizon Family Locator app. Their support forums show many customers having problems with the app on several different model phones.
    Please feel free to contact us if you have any additional questions or concerns. Thank you again for contacting LG Electronics.
    Jason F
    << Edited to remove personal information >>
    Message was edited by: Verizon Moderator

  • FB02- update XREF3 fields for G/L account also

    Hi all,
       My requirement is to update the XREF3-> fields using transaction FB02 for the all accounts (Customer, G/L , Vendor) I have used Function module FI_DOCUMENT CHANGE whcih is updating the XREF -> fields for only Customer account.I want update it for G/L account also...Can anybody tell me the solution other than BDC call transaction..
    Thanks in Advance,
    Lakshmi

    Yes, but that's a correct answer.  Perhaps your config still isn't correct.  Field display is controlled at two levels in FI documents, by the field status of the posting key and by the field status group assigned to the account.  Most likely, you also don't have the field configured as a changeable field at the line item level.

  • Create Lookup[Taxonomy] field for same taxonomy in two main tables

    In MDM 7.1 SP03, 
    1) We have two main tables MTable1 and MTable2 in repository
    2) One Taxonomy table Taxo1
    3) In MTable1, Created a Lookup[Taxonomy] field for Taxo1 table
    4) In MTable2, not able to create Lookup[Taxonomy] field for Taxo1
    table.
    Why is it not allowed to use Lookup[Taxonomy] in multiple main tables?
    Thanks,
    Rajesh
    Edited by: Rajesh Penagalapati on Nov 12, 2009 4:53 AM
    Edited by: Rajesh Penagalapati on Nov 12, 2009 4:54 AM

    Hi,
    Thats a limitation .Multiple Main tables cannnot share  the same Taxonomy table.
    You can refer the features of MDM 7.1 at
    http://help.sap.com/saphelp_nwmdm71/helpdata/en/43/D7AED5058201B4E10000000A11466F/frameset.htm
    Regards
    Nisha

  • Any way to update additional fields for SDLS with equipment at serial no cr

    Dear all,
    In the serializing procedure SDLS in the serial no profile
    there is an option to create equipment alongwith serial no
    creation. Currently it is updating only customer no into the
    equipment master .
    Is there any way to update additional fields into the equipment
    master at the time of serial no capture ?
    regards
    Magi

    I think basically the answer is no, and even if you could I don't think it would help you much. A virtual machine error is exactly that, an error in the VM, not your code. The only thing I can suggest is that, if you want to see if your app is falling over in the same place every time, you use something like log4j.

  • Updating a field for a number of forms from an external table

    Good Day All;
    This one I could not find in the help section.
    I have designed a number of forms that all use the same “rates of pay” (there are 4 categories) for calculating. I was told to expect that a few more forms will be required and these new forms will also be using the same “rates of pay”
    Currently I am using “switch” to insert the “rates of pay” when the user selects a category from a dropdown.
    Is there a way I can update all the forms from an external “table” instead of having to update each form individually?
    Thanks All
    Chomp

    Hi,
    If the form is Reader enabled with Acrobat, then that is going to cut out data connectons.
    You should have a look at John Brinkman's blog: http://blogs.adobe.com/formfeed/2010/07/shared_data_in_packages_part_2.html. Two parts.
    Also there is an example of inter-form communication here, but it may be too clunky: http://assure.ly/qQivbm.
    Good luck,
    Niall

  • Apple Mail syncing while typing, multiple updates on BB for same message.

    First of all, thanks for looking and helping. Second, it's probably my fault as I am a tweaker often to my detriment. So, with disclaimers out of the way, here's what is happening:
    I have a MacBook Pro and my mail is IMAP from my GMail account. When I respond to an email on the Apple, using Apple Mail, WHILE I AM TYPING, the BB retrieves a NEW email with the latest installment of the email!!! Here's an example that just happened:
    Open email, start replying... "Paul, I wanted to explain"
    BB announces new mail with that sentence
    I continue typing... "why I like pasta"
    BB announces new email with "Paul, I wanted to explain why I like pasta"
    Etc., etc., etc.
    So, my work around it to go to gmail.com and write the email within that program as opposed to using Apple Mail on laptop.
    My BB is Tour 9630 with 4.7.1   and the Gmail app is 2.0.7, if it matters.
    The Apple is running OS X 10.6.2 and Apple Mail is 4.2
    Oh, Bluetooth is not turned on on either device.
    Let me know if you need any further info. Thanks again for looking!
    Peace.
    Solved!
    Go to Solution.

    I have the same problem.
     Just bought the MAC book Pro and while typing on Apple mail everything is syncing on my Blackberry,...This will go on until I finish the mail..Depending on the length of the mail, I can heave more than 15 copies of the same mail that is redundant and constantly updating. Frustrating. I did unchecked the box under preferences, mail box behavior but nothing happened. Has anyone figured out what is the solution?
    Thanks

  • Update multiple fields with same/diffrent name

    I have the form is displayed  order no, message and sent_date. Mesage and Date sent are editable.  I can change value from both colums in diffrent values then hit submit for update.  My code below is loop thur message and date sent field then update them based on the pk ID.  Unfortunately, it didn't work as the expected.  Can you please help?
    Oder NO
    Message
    Date Sent
    5463
    first message
    12-10-12
    5463
    second message
    10-13-12
    <cfset myIds = ArrayNew(1)>
    <cfform name="update" method="post">
    <cfloop query="qMesg">
       <cfscript>
            ArrayAppend(myIds, "#id#");
            </cfscript>
         <cfinput type="text" value="#mesg#" name="mesg">
         <cfinput type="text" value="#dateformat(sent_date, 'mm-dd-yy')#" name="sent_date" validate="date" />
         <cfinput type="submit" name="submit" value="Update">
    </cfloop>
      <cfset myIdsList = #ArrayToList(myIds, ",")#>
       <cfinput type="hidden" name="ids" value="#myIdsList#">
    </cfform>
    <!---update--->
    <cfif isDefined("form.submit")>
    <cfloop index="idIdx" list="#newsids#" delimiters=",">
    <cfloop list="#form.mesg#" index="x">
    <cfloop list="#form.sent_date#" index="y">
          update [tblMessg]
         set mesg = <cfqueryparam value="#x#" cfsqltype="cf_sql_varchar">,
               sent_date = <cfqueryparam value="#y#" cfsqltype="cf_sql_date">
       where id = <cfqueryparam value="#idIdx#" cfsqltype="cf_sql_integer">
      </cfloop>
    </cfloop>
    </cfloop>
    </cfif>

    I am with Dan on this (identifying the field names with IDs), but prefer cfloop to cfoutput within cfform. Furthermore, I would put the submit button outside the loop.
    <cfloop query="qMesg">
        <cfscript>
        ArrayAppend(myIds, "#id#");
        </cfscript>
        <cfinput type="text" value="#mesg#" name="mesg#id#">
        <cfinput type="text" value="#dateformat(sent_date, 'mm-dd-yy')#" name="sent_date#id#" validate="date" />
    </cfloop>
    <cfinput type="submit" name="submit" value="Update">
    With proper handling, one loop should be sufficient on the action page.
    <cfloop index="idIdx" list="#form.ids#" delimiters=",">
        <cfset current_message = form["mesg" & idIdx]>
        <cfset current_date_sent = form["sent_date" & idIdx]>
        <cfquery>
        UPDATE tblMessg
        SET mesg = <cfqueryparam value="#current_message#" cfsqltype="cf_sql_varchar">,
        sent_date = <cfqueryparam value="#current_date_sent#" cfsqltype="cf_sql_date">
        WHERE id = <cfqueryparam value="#idIdx#" cfsqltype="cf_sql_integer">
        </cfquery>
    </cfloop>

  • Script to update a field for current year

    Is it possible to have a field update to finish the current year? Example 20-- (the dashes to change to whatever year it is). I'm thinking that it's not possible but if someone knows how it can be done I would really appreciate help. Thanks 
    Sorry, I guess I need it to change the entire year, not just the ending.  THanks
    I've tried a few scripts that I found here, such as; year(dateAdd('yyyy', 1, now())) with no luck. I admit I have no knowledge of scripts and may be doing something wrong. Does the script go under the Action tab as a javascript or somewhere else (validation??) Any advice or help would be appreciated. I am using Acrobt Pro version 9.

    You can not just cut and paste scripts since one needs to be aware of the object, the object's properties, and the object's methods that may need to be changed. Form your example it looks like you are trying to use a user defined function call and without the JavaScript for the function the code you posted will not work.
    You will need to use the JavaScript Date object to obtain the current date. You can then use either the 'getFullYear()' or 'getYear()' method to the get the 4 digit year or the 2 digit year and mellenium inicator. From these numbers you can extract the 2 digit year by converting the numbers to strings and then extracting a sub string from the character string.
    The following scripts are custom calculation scripts/
    // using the getFullYear() method:
    event.value = String(new Date().getFullYear()).substr(2,4);
    // using the getYearmillenniumindicator() method:
    event.value = String(new Date().getYear()).substr(2,4);
    If you want the full year:
    // using the getFullYear() method:
    event.value = new Date().getFullYear();

Maybe you are looking for

  • Creative Zen:M is not being recognized please he

    Hi,I have had a creative vision zen:M for a few months now and had no real issues with it. Except the other day i was playing a music?video around 2mins and i tried to turn the volume up and it didnt respond i then tried the rest of the buttons and n

  • Can someone help me figure out why this didn't work?

    I recently gave my iMac to my nieces....I erased and reinstalled the osx from my disks that came with the program. They HAD one of the Mac Minis (an old one...g4 I think). When we started up the iMac, I used the Firewire connection to transfer all th

  • Why cant i accept the new iOS7 i-tunes terms and conditions page?

    Why cant i accept the new iOS7 i-tunes terms and conditions page?

  • Data to be moved from one instance to another

    Hi All, I don't have any data administration experience. All i am looking for is a document or process flow on the data movement between 2 oracle 9i instances on UNIX. Suppose there are 2 Oracle 9i instances - A and B. At some point of time, some tra

  • Versioning/checkin/checkout

    I am working with a custom app which is using the versioning, checkin and checkout capabilities. The documents within this app subclass Document. The process is as follows: 1. Check out document. 2. Save it to my local machine and make changes. 3. In