Adding days to the date field

Hi,
I have a scenario as below.
I have to add no. of days to the exixsting date field in the program. The statement is like this.
           <b>DATE1 = DATE + XDAYS.</b>
Where <b>DATE</b> is in <b>DDMMYYYY</b> format. and XDAYS holds the number of days which will be retrieved from the standard table. And DATE1 should hold the result date.
<b>eg:</b> Let <b>DATE</b> = <b>30.08.2007</b>
           <b>XDAYS</b> = <b>15</b>
DATE1 = DATE + XDAYS.   =>   <b>DATE1 = 30.08.2007 + 15</b>.
<b>DATE1 = 14.09.2007</b>
Is there any easiest way to do this. or is there any function mdule  to do this operation.
I hope you understood the question. Please let me know if I need to be more clear.
Thanks in advance.
-Pradeep.

Hi,
The date will be in internal format of 8 digits... Like 20070830..
Directly add the number of days.. system will automatcally calculate
w_new = w_old + 15 (20070830 + 15)
w_new becomes 20070914
and when you will write this : WRITE : w_new. It will show 14.09.2007 or depending on your settings for the date format. No need to call any fm for this..
Thanks and Best Regards,
Vikas Bittera.
**Reward if useful**

Similar Messages

  • Adding days to the current date

    I'm trying to write a program that takes an order and prints an invoice for my intro to java class. The date of the order and the date of arrival (which is 14 days after the date of the order) are to appear on this invoice. I thought that I figured it out but I get a compile error. Here's what I have so far:
    SimpleDateFormat formatDate = new SimpleDateFormat("MMMMM, dd, yyyy");
        Calendar rightNow = Calendar.getInstance();
        public String dateOfOrder()
             return formatDate.format(rightNow);
        public String dateOfArrival()
             return formatDate.format(rightNow.add(DAY_OF_MONTH, 14));
        }I'm writing it in JCreator and I get "cannot find symbol variable DAY_OF_MONTH" as my compile error. It compiled just fine until I added the dateOfArrival method. I keep reading through the Calendar API but I just can't understand why it won't work. What am I doing wrong?

    masijade. wrote:
    Which class is "DAY_OF_MONTH" a part of (I know what it is, but I want you to think on it). Try adding that class name to the front of the field name, with a period between them i.e.Calendar?
    I tried making the following adjustment but just got a new error.
    public String dateOfArrival()
             return formatDate.format(rightNow.add(Calendar.DAY_OF_MONTH, 14));
        }My error this time is: 'void' type not allowed here
    It seems like it is recognizing DAY_OF_MONTH now but something else is going wrong. Where am I going wrong?

  • Can I create a field that calculates number of days from a date field?

    Hi all,
    I need a field that will calculate the number of days elapsed whatever date is entered into the date field, and update that number of days based on the calendar/computer calendar date.  Does that make sense?
    https://www.dropbox.com/s/arkmnsxjkl4r156/AFBS_FacilitySpecialCareList02.pdf
    I set up the form so that my boss can add or subtract clients from the list.  Each client needs to have its own "Days since added to the list" number. Sorta like a little aging report.
    Is this possible?
    Many thanks,
    Laura

    Wow, I'm so stumped.  I tried to copy a bit of formcalc into the exit event for my current date field to try to make this happen, but I can't get it to work.
    My  attempt at scripting is embarrassing, but here it is:
    form1.sf1.CCSub.CCGroup.#subform[0].DateField2::exit - (FormCalc, client)
    form1.sf1.CCSub.CCGroup.#subform[0].NumericField2.rawValue = Date2Num(DateField1, "MM-DD-YY") - Date2Num(DateField2, "MM-DD-YY")
    and here's the file:
    https://www.dropbox.com/s/arkmnsxjkl4r156/AFBS_FacilitySpecialCareList02.pdf
    Can anyone help me get this right?
    Sign me: One Lost Designer
    Thanks!

  • Working days between two date fields and Changing Factory Calendar

    Hi,
    I have to calculate working days between two date fields excluding the weekends and public holidays for Switzerland.
    I have written the routine using factory calender and its working fine except for two problems now:
    1. If any one of the date field is empty then teh rsult should be zero.
    2. And the below code is working from 1996 but my cleints wants it to work for years before 1996 as well.
    I also tried to change the Start date in SCAL for factory calendar but it says enter values between 1995 to 2020.
    I am new to ABAP. Please help me how i can achieve these for below code.
    DATA: IT_HOLIDAYS type TABLE OF ISCAL_DAY,
          IS_HOLIDAYS TYPE ISCAL_DAY.
    DATA: T_DATE TYPE SY-DATUM,
          P_DATE TYPE SY-DATUM.
    DATA : X_DATE(4) TYPE C.
    DATA: CNT TYPE I.
    REFRESH : IT_HOLIDAYS.
    CLEAR : IT_HOLIDAYS.
    T_DATE = SOURCE_FIELDS-/BIC/ZCCCHP812.
    P_DATE = SOURCE_FIELDS-/BIC/ZCCCHP810.
    CALL FUNCTION 'HOLIDAY_GET'
    EXPORTING
    HOLIDAY_CALENDAR = 'CH'
    FACTORY_CALENDAR = 'CH'
    DATE_FROM = P_DATE
    DATE_TO   = T_DATE
    TABLES
    HOLIDAYS = IT_HOLIDAYS
    EXCEPTIONS
    FACTORY_CALENDAR_NOT_FOUND = 1
    HOLIDAY_CALENDAR_NOT_FOUND = 2
    DATE_HAS_INVALID_FORMAT = 3
    DATE_INCONSISTENCY = 4
    OTHERS = 5.
    DESCRIBE TABLE IT_HOLIDAYS LINES CNT.
    X_DATE = T_DATE - P_DATE - CNT.
    RESULT = X_DATE.
    Please help
    Regards
    Zabina
    Edited by: Syed786 on Nov 2, 2011 9:15 AM

    Hi Zabina,
    Try this function module  'DURATION_DETERMINE'.
    Give the factory calendar and unit as DAY
    With regards,
    Rajesh

  • How to add 2 days to a date field?

    How to add 2 days to a date field if a Saturday was selected on a different date field?
    Thanks

    I am attempting to add a date field and then have a another field add an amount to a box if the date is less than 30 days. Later I want to update the form to have the today's date is less than 10 days.
    Early Registration Fee is $10.00 if posted by February 25, 2008
    Late Registration Fee is $20.00 if posted by March 17, 2008
    It seems simple, but, when you get to be 71 years old, it seems difficult. Any help will be appreciated.
    Here is a link to the form I'm working on:
    http://www.aworldwide.com/Gideon/Convention_Registration.pdf
    I am using a trial version of Adobe Acrobat 8.
    Thanks,
    Andy Anderson

  • Add 90 days to a date field.

    Hi All,
    I have a form page in which i have a field called date. The requirment is like this whenever i come to this form page the date field should 1st check the sysdate and add 13 weeks or 90 days to it and display it there. It should be like this whenever user comes to this page the date field gets loaded like this and display there. Need help to do this.
    Thanks in advance.
    Regards

    But i want this field to be dynamic. This date field is date picker. If i select 15th May from date picker it should populate 14th august. Any suggestions on thisIs this concept of selecting one date and having a completely different one appear going to be clearly understood by users? From a usability/accessibility perspective it may be a better idea to use 2 items, with the initial selection being made in a date picker and the computed value appearing in a separate display/read-only item.

  • Add Days to a Date field

    Hi all,
    I have the following requirement:
    I have a date field 0calday and the user would like to add a specific no.of days to it, like for example 10 or 15 days. Then we use this computed date field in calculations in the query. Could you please help and let me know how we can no.of days to a date field? And also how we can compute no.of days between two date fields?
    Regards,
    Ashmith Roy

    Hi Ashmith,
        When the user enters both date and no. of days, and if you want to calculate no of days from the user entered date I think you can go for an exit where you can use the available function module which calculates the no of days from starting of the month for the given date. Then you can add up the days entered by the user and use another available function module which converts it to the dat format again based on the given days and the old date. I don't remember the function module names but i am sur ethey are available.
    If the above thing is made possible then I think getting no of days between two dates is not a problem. Well i hope this will help you.

  • Add days to a date field on adobe form

    Hi,
    I have to add 15 days to a date field how i do that on javascript or formcalc?
    Thank you in advance.
    Miguel

    Hi,
    The below is in js code.
    I had a caluclated date time field on the screen which displayed the current date.
    The below code will just add 15 days to the day part of the date.
    for moving it to month if its more than 31 is to be handled by you.
      var valArray = this.rawValue.split("/");
      var newDate = valArray[1] + 15;
      var actualVal = Date.parse(newDate+"/"+valArray[0]+"/"+valArray[2]);  
    var dateType=new Date(actualVal);
    this.rawValue = dateType;
    Hope this helps you out, let me know if you need any more info.
    Cheers,
    Sai

  • How to use the manually entered Hours/Days in the Duration field for BG_ABSENCE_DURATION

    Hi All,
    How to use the manually entered Hours/Days in the Duration field for BG_ABSENCE_DURATION fast formula?
    Requirement is to restrict employees for applying for leave more than the accrued balance. In SSHR, apply leave functionality, the employee enters the start date, end date and duration manually. The entered duration must be used in the fast formula to check against available balance.
    In the BG_ABSENCE_DURATION FF, I have a function to calculate the net accrual balance as on the calculation date.
    I want to add the logic as - If to_number(Duration) /*[manually entered value]*/ > net accrual balance then
    Duration = 'FAILED'
    invalid_msg = 'Error'
    return duration, invalid_msg
    Thanks!

    Hi,
    We have a standard functionality to override the duration calculation and you don't need to add a validation for the same. Please set the value of profile option HR: Absence Duration Auto Overwrite to Yes
    When you do this user will not have to enter the duration value manually. It will get auto calculated based on the duration calculation in BG_ABSENCE_DURATION when you click on the next button.
    For not allowing negative leaves to be applied, If you are on R12 then, this is a standard functionality and you need to set profile option HR Allow Absence Negative Balance to No
    If you are on 11i then refer Note: 268171.1: How Do You Stop Accrual Plans from Going Negative?
    Try and let me know in case you need further help.
    Thanks,
    Sanjay

  • How to calculate number of days from a date field

    Dear BW Experts.
    I have a field 'Create Date' in the BEx query. Now we need to create a variable which should give the number of days from the date of running the query (sy-datum) to the Create Date.
    This will help the users to get records which are say, 30 days old (Sy-datum - create date = 30) or 10 days old etc.
    Could you suggest as to how to create this variable.
    Thanks,
    Sai

    Hi,
    Step 1: Create variable on "Create Date" with User entry processing type
    Step 2: Create a restricted KF for Sales & restrict it on "Create Date" to get "Sales on day"
    Step 3: Manipulate  the values of "Create Date" on which you could restrict  "Sales" again and again to get other values
    Step 4: Create one variable (ZPUTMNTH) for u201CMonth to Dateu201D with processing by u201CCustomer Exitu201D. This variable was created  on u201CDateu201D characteristics.
    Step 5 : Goto C-mod t-code and use EXIT_SAPLRRS0_001
    to calculate "month to date" user input is "Calday" Key Date
    WHEN 'ZPUTMNTH'.
    IF I_STEP = 2. "after the popup
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'ZPDATE'.
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(6). "low value, e.g.YYYYMM (200606) part of key date (20060625)
    L_S_RANGE-LOW+6(2) = '01'. u201C low value e..g. YYYYMM01 (20060601)
    L_S_RANGE-HIGH = LOC_VAR_RANGE-LOW. "high value = input
    L_S_RANGE-SIGN = 'I'.
    L_S_RANGE-OPT = 'BT'.
    APPEND L_S_RANGE TO E_T_RANGE.
    EXIT.
    ENDLOOP.
    ENDIF.
    Assign if helps.....
    Regards,
    Suman

  • Getting the year from the date field

    Hi,
    Please  ltet me know how to  get only YEAR form the DATE field
    Thanks in advance
    Ajay

    data:
    date like sy-datum,
    year(4) type c,
    month(2) type c,
    day(2) type c.
    year = date(4).
    month = date+4(2).
    day = date+6(2).
    Regards,
    Michael
    Please mark question as anwered if so....

  • How to add the date field in the dso and info cube

    Hi all.
    I am new to bi 7. in the earlier version v hav to button to add the date field. but in the bi 7 der is no option so can any body tell me how to add the date field in the data targets
    Thanks & Regard
    KK

    my prob is solved
    KK

  • When creating a fillable form and saving it as a pdf, the default color of the data fields is a light blue. How do I change the color to something else that will copy better, e.g. a light yellow?

    When creating a fillable form and saving it as a pdf, the default color of the data fields is a light blue. How do I change the color to something else that will copy better, e.g. a light yellow?

    It's probably the fields highlight color of the application, which you can change via Edit - Preferences - Forms.

  • Problem with the date field in Table Control

    I have created a table control in my module programming. One of the column in the table control is a date field which is I/O field.
    Now if I enter a value in date field column and hit enter the date field is reset. I dont want the field to get reset and accept valid date field.
    I have set type of the column as DATS and I havent used any dictionary fields. The column is from the internal table in the program.
    Please suggest

    In your PAI, in the LOOP AT <itab> did you
    - check date validity
    - update internal table
    * Sample
    LOOP AT itab.
      FIELD itab-field MODULE checkfield.
      MODULE updateitab.
    ENDLOOP.
    Look also at SAP documentation like [Table Controls|http://help.sap.com/abapdocu/en/ABENTABLE_CONTROL1_ABEXA.htm] or [Table Controls in ABAP Programs|http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dbac9f35c111d1829f0000e829fbfe/frameset.htm]
    Regards,
    Raymond

  • Strange error in online Adobe form for the date field

    Hi Experts,
    I am facing strange problem with online Adobe forms. I could able to save data when i click save button on the form.
    But some times in the form the date field is throwing error message 'MMDDYYYY field is invalid' when i click on save button.
    Is this the problem with versions of Adobe liveCycle designer, Adobe reader or GUI?
    Thanks in advance,
    Ram

    Hi
    Check the format (in the object pallete) of the date field in Adobe liveCycle Designer, If it is not set already set it according to your requirement. then see if it works
    Hope this helps
    Regards
    Amita

Maybe you are looking for

  • Solaris 9 x86 bug report - el_GR.ISO8859-7 & CDE

    I'm posting this article here, because I can't find any official Solaris 9 x86 bug report page. I hope the developers will notice it. I'm using Solaris 9 x86 (12/02), with the latest 9_x86_Recommended patch cluster installed, and support for Greek in

  • A print button in a Report

    I have a displayed version and a printing version of a report. I want the end-user to print the "printing version". Therefore, I cannot use print window and also because the entire report does not show in the window. I want to create a button or hype

  • Error when compiling in debug mode

    I receive an error when i try to ORA-04021 timeout occurred while waiting to lock object stringstringstringstringstring Cause: While waiting to lock a library object, a timeout is occurred. Action: Retry the operation later.

  • Divide a Paypal payment on several accounts

    Hi everyone, I'm currently integrating a Paypal payment on a webapp with IPN for notifications. All works fine, a customer can click on "Pay with Paypal" button, and will be redirected on his Paypal account to finish the payment. Now, I would know if

  • Google Books: cannot view book's pages, says loading for a long time. No problem in IE or Chrome. Settings wrong somewhere?

    Once I get to the page of a certain Google Book text, the pages are not visible. If I search for text, I can see the yellow highlight but not he text. The pages say "loading" forever and do not load. In IE or Chrome there is no problem. All the pages