Date field manipulation

How to add 5 months to date field.
For ex: To find out the date after 5 months from today.

hi,
use the fm
   DATE_IN_FUTURE : Calculate a date N days in the future.
Program:
PARAMETERS: p_days   TYPE i,          " Number days that are added/subtracted
                      p_date   TYPE eeind.    " Date to which NUMBER_DAYS is added
DATA: addin_date     TYPE sy-datum, " Determined date in the internal format
         addex_date(10) TYPE c.            " Determined date in external format
CALL FUNCTION 'DATE_IN_FUTURE'
  EXPORTING
    anzahl_tage                       = p_days
    import_datum                    = p_date
  IMPORTING
    export_datum_ext_format   = addex_date
    export_datum_int_format    = addin_date.
WRITE:/5 'date in the internal format: ', addin_date ,
      /5 'Determined date in external:',  addex_date.
MONTH_PLUS_DETERMINE     - Add or subtract months from a date. To subtract a month, enter a negative 
parameters: date type SYDATUM,   " date
            months type i.       " no of months to  add/subtract ,
     use '-' for  subtraction.
data: newdate type SYDATUM.
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
  EXPORTING
    months        = months
    olddate       = date
IMPORTING
   NEWDATE       = newdate
write:/ 'old date:', date.
write:/ 'new date:', newdate.
regards
prasanth

Similar Messages

  • Manipulating Date Fields

    I have a table with two date fields.  One is a full date/time stamp.  I need to extract the Year and Month from that field and use it to update the data in another field.  For example, if Field1 has 2014-01-15 11:34, I need to populate
    Field2 with 2014-01-01 00:00.  Essentially, I need to set the date to be the start of the month.  This needs to be incorporated into a simple script that can be run using MS SQL Server Management Studio.  Internally, someone came up with
    the code below (needs to be convered to an insert field, but not sure if this is the best way to do this.  Field1 name is EventStart.  Field2 name  (the field to be updated) is CreatedPeriod.  Any help would be much appreciated.
    SELECT EventStart,CreatedPeriod,
    Convert(nvarchar(4),Year(eventStart))
    + '-'
    + '0' +
    Convert(nvarchar(2),Month(eventStart))
    + '-'
    + '01' +
    ' 00:00:00'  as newCreatedPeriod
    FROM [mgGold].[dbo].[mgEvent]

    You can just do this
    SELECT EventStart,CreatedPeriod,
    CAST(eventStart - DAY(eventStart) + 1 as date) as newCreatedPeriod
    FROM [mgGold].[dbo].[mgEvent]
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Chart report Condition fields and Data fields

    Hi all,
    i have tried chart report by adding two condion fields and one data field, the report is more meaning full in this scenario. the first condition field is taken as x-axis, the 2nd condition fields is taken as legend.
    while adding more condition fields and data fields, i feel its not showing meaningfull data.
    can anyone explain how the condition fields and data fileds are manipulated by crystal report.
    i am using CR XI R2 Server.
    Thanks
    Padmanaban V

    i am using Crystal Report XI R2 RAS Embedded in my server.
    as we can add any number condition fields programatically using the method
    ConditionField.Add(FieldObj), i would like to know how these fields are manipulated internally by the RAS server.
    that means, what is the significance of condition fieldobject 1, condition fieldobject 2,condition fieldobject 3 etc...
    if i add more than two condition fields , RAS Chart Report always returns 0 as legend value for all legends.
    Thanks in advance
    Regards,
    Padmanaban V
    Edited by: Padmanaban Viswanathan on Dec 22, 2008 9:53 AM

  • Issue with a date field

    Hi,
    I have a pl/sql page that is the output of a select statement with some conditions.
    One of the condition is like:
    AND MyColumn between (:P1_MyDateItem - 7 , :P1_MyDateItem)
    but as soon as I include an addition or substraction (:P1_datefield - 7) , I get ORA-06550: line 18, column 28: PL/SQL: ORA-00932: inconsistent datatypes: expected DATE got NUMBER
    How can I resolve that error?
    Also,
    I am trying to pass the date field to a second page in a hidden field. In a similar scenario as the one described above, how can I manipulate the date using the hidden field. ie. in my testing, I think it kind of converts the "date" into "char' format?? can I also do the same manipulation "Date-7" but this time using a hidden field instead?
    Thanks

    FabioBui wrote:
    but as soon as I include an addition or substraction (:P1_datefield - 7) , I get ORA-06550: line 18, column 28: PL/SQL: ORA-00932: inconsistent datatypes: expected DATE got NUMBER
    How can I resolve that error?Try converting it to a date first
    to_date(:P1_datefield, <date_format>)-7
    I am trying to pass the date field to a second page in a hidden field. In a similar scenario as the one described above, how can I manipulate the date using the hidden field. ie. in my testing, I think it kind of converts the "date" into "char' format?? can I also do the same manipulation "Date-7" but this time using a hidden field instead? Yes, if that's what you want to do. A date field is just a text box, made nicer with the jQuery Date Picker.
    so date picker:
    <input type="text" value="12/14/2011" />
    to a hidden item
    <input type="hidden" value="12/14/2011" />
    only difference being the display type.
    Just remember to convert it to a date in your pl/sql code.

  • Data fields in dso

    Hi
    If I need to calculate amount based on source and destination,and if these two source and destination fields char are there in data fields of dso and keyfigure amount is also in data fields of DSO can we get exact value if make report on this.
    thx
    rubane

    Actually i need to build report where in rows there will be some char
    like source plant and destination plant and in rows on the basis of source and destination the cummulated value of amount base on some other few restriction
    now my question is :-
    acc to my need I need to make genric extractor but one is already there which contains all my fields. now can i use the same extractor,but the worry is ;these all feilds are first going in dso and all are there in data fields coloumn
    What I'm thinking is; it will suppress or accumulte records on the basis of key field's(as usual).
    so can you pls let me know what to do in this scenario?
    how to build a new report using existing extractor ;can i use existing one?
    rubane

  • DSO - What key fields and data fields in dso

    Hi experts,
    I need to create a dso in between the cube and 2 data sources(2lis_11_vaitm, 2lis_12_vcscl) to stage the data. My question is: what key fields and data fields to choose for the dso? is there a standard dso to copy? please explain in detail the model to set up, whether to connect both the ds's to dso and then to cube or one ds to dso and the other to the cube. more details will help.

    Check this for standard DSO:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/fcdc387f34384f94c3227baf3837a8/content.htm
    Thanks...
    Shambhu

  • Key Fields & Data Fields in DSO.

    In Standard DSO, Maximum how many number of key fields and data fields we can enter in one DSO?
    For e.g : In Cube Char - 248      KF - 233
                  In DSO Key Fields - ?   Data Fields - ?
    Regrards,
    Nithi.

    Hi Nithi,
    Since Key fields are decide by us we can add according to our requirement.
    Key fields can only be 16 you cannot exceed this. but if you have more key fields, you can combine fields using a routine for a key field
    Max Data Fields - 749 data fields can be added in a DSO.
    Warm regards
    Gokul

  • Error While using date fields in HIbernate Criteraia

    I am trying a sample applciation using Hibernate with JPA. I am using annotations to map database table with Java class.I am using org.hibernate.Criteria to form where clause. My code looks as follows:
    EntityManagerFactory emf = Persistence.createEntityManagerFactory("PERSISTANCE_UNIT");
    EntityManger em = emf.createEntityManager();
    Session session = em.getDelegate();
    Criteria criteria = session.createCriteria(MyDO.class)
    criteria.add(Restrictions.eq("myDO.date",myDO.getDate()));
    List list = criteria.list();
    I am searching the data base based on the date field (myDO is an instance of MyDO.class which contains the mapping to the data base table). While running the application first time after publishing to server, I am getting the following error. For subsequent running of the application I am not getting any error and the appliaction was running with actual results.
    JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: -181, SQLState: 22007
    JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions THE STRING REPRESENTATION OF A DATETIME VALUE IS NOT A VALID DATETIME VALUE
    org.hibernate.exception.DataException: could not execute query
         at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)
         at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
         at org.hibernate.loader.Loader.doList(Loader.java:2223)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
         at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
    Can anybody help in fixing the problem.
    Thanks in advance.

    Resolved the issue by setting System date where expected

  • SAP R/3 Tables without Date fields

    I am trying to import data from SAP R/3 into MS SQL DWH.
    There are tables which doesnot have posting date fields.
    Can anyone tell me how to map them with those Table which will have posting date fields, so i can create view in SAP and then pull that view into SQL DWH restricting on date.
    Following tables which doesnot have date fields i want to pull date for month of July 2007;
    EKBE
    EKKO
    MAKT
    MSEG
    KSEG
    AFPO
    JEST
    JCDS
    MARA
    AUFK
    COEP
    RESB
    MARC
    I am not a ABAP developer just trying to get my data from SAP, so please answer in detail.

    BUDAT is the technical name for Posting Date field. This field is used many DB Tables/ Strucutres. Using where used option you can find the required tables.
    I suggest you to look at BSEG table for Finace Document postings by Posting Date.

  • I am working in Adobe Acrobat 9 Pro and just created a pdf form from a MS Word document. I need to find out how to have a date field in my form which will update automatically. Can some one out there help me?

    I am working in Adobe Acrobat 9 Pro and just created a pdf form from a MS Word document. I need to find out how to have a date field in my form which will update automatically.

    Update automatically under which circumstances, exactly?

  • DTP can Not extract data of date field from PSA to Target DSO

    Hi everyone.
    I enhanced several fields in datasource "2LIS_12_VCITM". that is date field "BLDAT" and another date type fields.
    The data of date type fields are extracted very well from datasource to PSA.
    But only field "BLDAT" among them are NOT extracted from PSA to target DSO.
    Another date type fields is good. but only "BLDAT" field is empty.
    I added "BLDAT" later than another date fields.
    Is that the reason??
    I don't know why.
    Let me know the solution. pls~~~~

    Hi,
    Try deleting and recreating the DTP and loading again.
    This solution refers to note 925941 and should be solved in SPS10.
    Best regards,
    Olav

  • BI Publisher Word Template The report does not contain any data fields.

    I have OBIEE BI Publisher report (10.3.4) working fine using BIP but using MS Word 2003 I want to create new template and want to add charts etc.
    Step 1. In MS Word I successfully login Oracle BI Publisher as Administrator
    2. Oracle BI Publisher -> Open (I open the report)
    3. Go to Insert -> Table Wizard
    I get this error:
    The report does not contain any data fields. Please make sure that the reports generates data with the default settings or provide a valid XML file.
    Please help

    Hi
    How do I load XML data? Also why XML data load is required? Do I have to export XML data from BIP View screen and load from the same file from the word?
    Please clarify
    Thanks

  • Cannot add hub-managed content type with external list lookup columns to a list -- Error:Id field is not set on the external data field

    This is a variation on the issue mentioned in this
    post
    We are using SP 2010 Content Hub to manage our content types.  On the content hub we've created a couple of exteranl lists, and then created some site columns as lookups against these lists.  We then added the columns to one of our content types
    and set it to publish.
    After the publishing job executed, I tried adding the content type (which now appears on the subscriber sites) to one of the document libraries on one of the subscriber sites.  When I did that it threw the following error:
    Microsoft.SharePoint.WebControls.BusinessDataListConfigurationException: Id field is not set on the external data field    
    at Microsoft.SharePoint.SPBusinessDataField.CreateIdField(SPAddFieldOptions op)     
    at Microsoft.SharePoint.SPBusinessDataField.OnAdded(SPAddFieldOptions op)     
    at Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol)     
    at Microsoft.SharePoint.SPContentType.ProvisionFieldOnList(SPField field, Boolean bRecurAllowed)     
    at Microsoft.SharePoint.SPContentType.ProvisionFieldsOnList()     
    at Microsoft.SharePoint.SPContentType.DeriveContentType(SPContentTypeCollection cts, SPContentType& ctNew)     
    at Microsoft.SharePoint.SPContentTypeCollection.AddContentTypeToList(SPContentType contentType)     
    at Microsoft.SharePoint.SPContentTypeCollection.AddContentType(SPContentType contentType, Boolean updateResourceFileProperty, Boolean checkName, Boolean setNextChildByte)     
    at Microsoft.SharePoint.SPContentTypeCollection.Add(SPContentType contentType)     
    at Microsoft.SharePoint.ApplicationPages.AddContentTypeToListPage.Update(Object o, EventArgs e)     
    at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     
    at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     
    at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)     
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)    b55297ed-717f-466d-8bdc-297b20344d3f
    I checked the external  content type configuration and it did specify an "id column".  Anyone know if what I am attempting to do is possible and if so, what special configurations are required?
    Thanks

    The issue is not External Content type or external list but the look up column.
    It's not possible to publish a look up column via the Content Type Hub.
    If you need to do this then an alternate way is to use a Managed Metadata column instead, otherwise you will have to implement this via a feature.
    Varun Malhotra
    =================
    If my post solves your problem could you mark the post as Answered or Vote As Helpful if my post has been helpful for you.

  • 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

  • Filling Data fields of a DSO in End Routine

    Hi Everyone,
    The data fields of a DSO contains 2 key figures and a characteristic.
    In the End routine of the transformation, i have assigned constant values for the infoobjects in the data field.
    After executing the DTP, if I check in the New Table of the DSO, these constant values are present.  But when I activate the DSO, the values for key figures gets initialised and the values for the characterisitic becomes empty (NULL).
    Is it not possible to assign values for the infoobjects in the data field? If so, why is this limitation?
    Thanks in advance,
    Uma

    Uma,
    To populate any field in the end routine, you have to assign some constant in the transformation first and then re-populate them using the end routine.
    Sometimes if you dont assign any constant in transformation, the values remain initial and even after you write a code fo that field, it is not populated in the end routine.
    All you have to do is assign constant 0 to the key figures you are populating in the end routine and run the DTP again.
    Thanks
    Sachin

Maybe you are looking for

  • USB to SATA Converter

    Hi, I would like to upgrade the HDD of a MacBook Pro to a Solid Sate Hybrid Drive (MacBook Pro 5.1 late 2008). Before removing the original internal HDD I would like to install the Mac OS on the new drive, make sure it works ok. I have looked online

  • Not able to scroll up in BDC for J1IJ

    Hi, I am trying to create a BDC for J1IJ transaction.The problem comes if there are multiple excise invoices for a delivery document (program SAPMJ1IJ screen 400). For the first line item ,the scroll is initialized automatically to the first record i

  • Pro Cam pictures problem - reframing option broken

    Ok not the best description of a problem!  But let me tell you what has happened. I took some 200 photos on my new Lumia 1020 on a recent holiday in Ibiza using Pro Cam (5mp & 34mp mode).  When I got home I *moved* all of these photos (both "pro" and

  • When I open itunes, it blanks out as soon as it gets the store open.  How do I fix this?

    When I open itunes, it blanks out as soon as it gets the store open...completely blank.  How do I fix this?

  • Display first letter as caps and rest in small

    hi , this is the scenario...i have an internal table in which one field is a character...and the records in the internal table field has names in it..and i have to print in form in the way that first letter is capital and rest is small hear is am exa