Date formates in abap

HI ,
I am new in ABAP,
when i am dealing with date formats , i am facing some problems
can any one explain me what is difference between below two sentences
DOB4(2) = DOB4(2) + 3.
DOB = DOB+4(2) + 3.
where DOB  LIKE SY-DATUM   type.
Regards
Triveni Borse

This is not the ABAP forum. Please post your question in the appropriate forum.
Thank you!

Similar Messages

  • Issue with Date format - ABAP to XML

    Dear Users,
    We are currently facing an issue with the date formats in XML.
    We have a system (.Net), which has a webservice that we are calling for information from SAP. We created a Proxy class in SAP from the WSDL file and have attempted to use the method that gets us required information based on the Timestamp passed from SAP. However, the timestamp that the INPUT structure uses has a data element XSDDATETIME_Z.
    All we can send from SAP is a simple TIMESTAMP, but the .Net system doesn't accept it since it wants the timestamp in XML format i.e. <dd-mm-yyyy>T<hh:mm:ss>Z. SAP documentation says that the field should automatically do conversion from ABAP to XML format, but that doesn't happen. We don't want to build a string from Timestamp in the XML format and send it out since we might surely miss out on the different cases involved.
    Can anyone please suggest a way for us to send the date out in the required XML format?
    Many thanks!

    Hi Vijay,
    Look at the below sample code and it works fine, i guess there is something wrong in your code or conversion, post the actual code if you are still not able figure it out with the below example.
    DATA: l_xml_string TYPE string,
          l_dat_time TYPE xsddatetime_z.
    CALL FUNCTION 'CACS_DATE_GET_TIMESTAMP'
    EXPORTING
       I_DATE                         = sy-datum
       I_TIME                         = sy-uzeit
    IMPORTING
       E_TIMESTAMP                    = l_dat_time
    EXCEPTIONS
       DATE_NOT_FILLED_BUT_TIME       = 1
       DATE_HAS_NO_VALID_FORMAT       = 2
       OTHERS                         = 3.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CALL TRANSFORMATION id
      SOURCE root = l_dat_time
      RESULT XML l_xml_string.
    IF sy-subrc EQ 0.
    write: l_xml_string.
    ENDIF.
    Regards,
    Chen

  • Date Format problem in ABAP Proxy

    Hi All,
    We have a Inbound ABAP proxy which recieves data from XI.
    We use a date field in that which is defined as DATS datatype.
    When we trigger the interface from XI with date in format YYYYMMDD, we are getting an exception.
    when the date is sent in format YYYY-MM-DD, the interface is run successfuly.
    when we test the interface in SPROXY transaction the date is displayed in YYYY-MM-DD format.
    does it have anything to do with the defenition of the date format in XI?
    I want to know whether DATS format in XI is different from ABAP?
    should the date that is sent from XI be in YYYY-MM-DD format all the time.
    Kindly suggest a solution for the date problem when it is passed from XI to ABAP proxy

    Hi Uday,
    Check the pattern used in XI/PI for the date definition.
    If it's set to:
         pattern="[0-9]-[0-9]-[0-9]"
    Then it will enforce the pattern. You could try changing the pattern in XI to exclude the hyphen then you have a normal DATS format.
    Regards, Trevor

  • ABAP report date format

    Hello friends,
    In my report I have to display the details of the selection screen.
    I am having some problem with the date format
    HOwever when the user changes the settings in the user profile the data
    format on the report should display as what the user profile settings are.
    for EG -
    if the user has the settings as YYYY-MM-DD
    the output should be 2007-12-11.
    If the user changes the date format as MM/DD/YYYY
    the output should be 12/11/2007.
    Any suggestions.
    Ster
    REPORT  ZCP0A128  NO STANDARD PAGE HEADING
                      LINE-SIZE  80
                      LINE-COUNT 65(0)
                      MESSAGE-ID ZZ.
    TABLES : ZCAST.
    SELECT-OPTIONS: S_PSTTR  FOR ZCAST-ZEFDAT DEFAULT SY-DATUM.
    WRITE : S_PSTTR-LOW.

    Hi,
    Check this FM DATUMSAUFBEREITUNG
    I think you can also just use write statement to get the Date format as in User Profile.
    Regards,
    Satish

  • Date Format Issue IN BEX REPORT

    Hi Experts,
    we are working on BW 3.5.
    we have a ODS where data is uploaded through flat file and there are 5 to 7 date field all made of Z infoobjects.
    So now the user is putting the data for these Date fields as 20110901 = 1st sep2011. but in report its coming as 09/01/2011
    when i checked all the Z fields that are created for this date fields have reference character as Date
    only one field is character so it is coming correct as given by the user
    but rest all are appearing in different format . In ODS also the date is coming as 09/01/2011
    now the user want all the data to be in the same format as given by HIM.
    I cant even change the properties of these Z info object removing the reference info object 0Date and make them character string.
    so now please suggest how to upload the date given by the user as it is without changing the format and also how to change the format for the back data as its flat file so No data can be deleted.
    thankkkkkkkks

    hello
    Bex analyzer is an excel add-in. Date formats are based on your regional settings.
    If you want to have a different date format in the sap gui then you have to change your user profile in sap system.
    Flat file upload needs the date format in a database format (YYYYMMDD).
    You can transform the date in the transformation step with rules or with a routine( abap coding).
    Thank you
    Yiannis

  • Date format in BI query

    Hi,
    We need to display a single date format independent of date format of SAP User settings. For ex: as below.
    In a current query the  date, depending on the user's configuration could appear as:
    dd.mm.yyyy (English format)         or        yyyy-mm-dd (Swedish format)        or        mm.dd.yyyy (American format)
    I need to change some of the queries date format as below.
    a) Change all dates in query outputs and parameters to the format YYYYMMDD
    b) Change all months in query outputs and parameters to the format YYYYMM
    c) Change all financial periods in query outputs and parameters to the format YYYYPPP
    Thanks,
    Jitu

    Hi
    I think u have to use the ABAP code at the query level.
    First take the date in one variable zdate_var  and then if u want the below , then
    data : zdate_var_year type d,
               zdate_var_mm type d,
              zdate_var_dd type d.
    zdate_var_year = zdate_var(4).
    zdate_var_mm = zdate + 4(2).
    zdate_var_dd = zdate + 6(2).
    YYYYMM = zdate_var_year , zdate_var_mm.
    LIke this u can have ur o/p as per ur wish,
    Hope u got it ,
    Thanx & Regards,
    RaviChandra

  • Convert Date to Week - ABAP Routine in transformation

    Hi all,
    I am trying to convert a date to a week using ABAP in a transformation.
    The date is coming from an external database and has the format YYYYMMDD.  I want to convert this into the standard 0CALWEEK format.
    I thought that converting the date to the SAP internal format, and then running DATE_GET_WEEK on it, would work.  Firstly I am running the FM 'CONVERSION_EXIT_PDATE_OUTPUT' to get the date into the DDMMYYYY format then running DATE_GET_WEEK on the result of the first FM.
    This works up until the end of the first step; the internal date format is returned.  However, the code fails when it hits the 'DATE_GET_WEEK' FM.
    I would be really grateful if someone could tell me where I am going wrong.  Thanks, Mischa
    My code so far is:
    DATA:
    WEEK(6) TYPE C,
    CS_DT(8) TYPE C,
    TEMP_DT TYPE D,
    RESULT1 TYPE D.
    CLEAR RESULT.
    CLEAR RESULT1.
        CS_DT = SOURCE_FIELDS-CASE_DT.
    CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
      EXPORTING
        INPUT         = CS_DT
    IMPORTING
       OUTPUT        = TEMP_DT
    MOVE TEMP_DT TO RESULT1.
    CALL FUNCTION 'DATE_GET_WEEK'
      EXPORTING
        DATE               = RESULT1
    IMPORTING
       WEEK               = WEEK
    EXCEPTIONS
      DATE_INVALID       = 1
      OTHERS             = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    RESULT = WEEK.

    Hi all,
    Thanks for your replies, but the automatic conversion doesn't work.  I assume this is because the source field is a CHAR field with 8 characters, rather than a Date field as recognised by SAP.  Literally the field contains 8 characters YYYYMMDD for example 20090601. 
    If I try to assign directly, I get the error
    "Automatic time conversion is not possible for source field CASE_DT
    Cannot establish automatic time conversion to 0CALWEEK for source field CASE_DT. The source is a DataSource and consists of fields, not InfoObjects. Time conversion can only be performed automatically for InfoObjects."
    This is why I assumed I needed some ABAP code.  I  have tried assigning the time char 0CALDAY to my source field CASE_DT in the transformation, and this is not accepted either - I get the message
    "The properties of the InfoObject selected, 0CALDAY, do not match the properties of the available source field."
    Again, grateful for any help.
    Mischa

  • Date format in Flat File

    Hi Experts,
    I need to load date from flatfile. In flatfile the date format is hh:mm:ss.
    I have an infoobject with type TIMS which can store only 6 CHAR length.
    How is it possible to read 8 characters length in file with this info object ??
    Two solutions i have is to ask for a file in hhmmss format or 
    the second one is to read the date with a new infoobject and write a routine to convert date to the required format in the transforamtion.
    Is there any better way to handle this situation with out asking for a change in file ??

    Hello Narasimha,
    You can perform a conversion from 8 characters to 6 characters in the transfer rules of your flat file datasource.
    In the transfer rule of the infoobject (with type TIMS), do the following:
    1) Create an ABAP rule code
    2) Select the 8 char field in the list of source fields
    3) write the following ABAP code. This converts the data from the 8 char field to 6 chars:
    concatenate trans_structure-<your 8 char field here>(2)  trans_structure-<your 8 char field here>+3(2) trans_structure-<your 8 char field here>+6(2)  into RESULT.
    Hope this helps.

  • URGENT !!!!   Problem with Date format MM/DD/YYYY in oracle database to BW

    Hi
    I am wondering if somebody can help me urgently.
    I have oracle database where date is of the format MM/DD/YYYY and I am loading data into BW. DATE data type
    Date in oracle database: 3/30/2007
    First when I used InfoObject ZDATE (with 0DATE) reference (DATS data type) data load failed saying that
    'Value '30-MAR-0 ' of characteristic 0DATE is not a number with 000008 spaces'
    Then I created ZDATE InfoObject as CHAR Type (Length 10) with PDATE Conversion Routine.
    when I created datasource using DB Connect and checked the contents using 'Display Table Contents' after creating data source the data field distorted as
    AR/-0/30-M
    After data load. when I checked PSA
    The Date records look same as AR/-0/30-M
    In cube the field appeared as  30-MAR-0  (last digit of year disappearing)
    In BEx report also it looks like 'AR/-0/30-M'
    Can somebody help me as quickly as possible.
    What should I do if i want to still use DATS data type for ZDATE?
    should I change date format in database if so to what?
    If I should use CHAR type with PDATE or any other routine can somebody give me the routine to have the date in the report exactly as it appears in database?
    I also tried changing date format in user profile...settings. But still its the same.
    Thanks in advance.

    Hello Snrella,
    You can solve this by converting the date format from oracle to the SAP internal date format  using an ABAP routine in the transfer rules.
    Assuming the oracle data field name is ZODATE then here's the ABAP you can use in the transfer rules. Create an ABAP routine transfer rule from ZODATE to your ZDATE infoobject, and then put this ABAP code there. (this code assumes that the format of the date from oracle is MM/DD/YYYY).
    concatenate tran_structure-/BIC/ZODATE+6(4) tran_structure-/BIC/ZODATE(2) tran_structure-/BIC/ZODATE+3(2) into result.
    Hope this helps.

  • Date format in Tablecontrol....

    Dear Experts,
    I have a type '1' program in which a screen is being called. The program displays and updates some personal information (employee info )in a Z table. The screen conatain a table control. And one of the column in the table control is of type DATE (DATUM/DATS/8), which displays the joining date of employee from the Z table.
    This program works fine when the user's date format is system default ie YYYMMDD(internal date format). But if a user with a different date format runs the program (say DDMMYYYY) the date field in the table control will be displayed incorrectly ( like YY.YY.DDMM) and then the user cant trigger a PAI. System will give error message "Invalid date format".
    When i debug the report, i can find that the corresponding date fields in ABAP are in internal format (YYYYMMDD). What can be the solution?
    Do i need to change all the date values according to user parameter in the program, before display? Or is there any option in screen painter, which will automatically convert the date format according to user defaults?
    this is an urgent issue here...
    Thanking you in Anticipation
    Deepak

    Hello Friend,
    Normally incase of dates, different users may have different date settings..So the standard procedure is..
    1. take the date into a CHAR field
    2. declare a variable with type DATE (LIKE required table
       field ).
    3. assign the CHAR field to DATE field
    4. Again assign the DATE field to CHAR field using
       WRITE...TO.
    For eg.
    Please have a look at the below code.. It may help you.
        perform format_date  changing   lwa_output-DATAB_new.
    (* here 'lwa_output-DATAB_new' is an internal table field)
    FORM FORMAT_DATE CHANGING P_DAT_NEW.
      data: l_f_datum    like rv13a-datab.
      data: l_f_date(2)  type c,
            l_f_mont(2)  type c,
            l_f_year(4)  type c.
      data:  SEPER TYPE C,
             BUF(256).
    get the date fields seperator
      BUF = P_DAT_NEW.
      TRANSLATE BUF USING '0 1 2 3 4 5 6 7 8 9 '.
      CONDENSE BUF NO-GAPS.
      SEPER = BUF(1).
      clear: l_f_date, l_f_mont, l_f_year.
      SPLIT P_DAT_NEW AT SEPER INTO l_f_date
                                    l_f_mont
                                    l_f_year.
      clear p_dat_new.
    concatenate l_f_date l_f_mont l_f_year into p_dat_new.
      concatenate  l_f_year l_f_mont l_f_date into p_dat_new.
      clear l_f_datum.
      l_f_datum  =  p_dat_new.
      clear p_dat_new.
      write l_f_datum to p_dat_new.
    ENDFORM.                    " FORMAT_DATE
    Plz..Reward me if it works..

  • Changes in BSP pages date format

    Hi Floks
    i am working Business server pages i got some problem in the date format. I am  getting date as dd.mm.yyyy and i want to change this to MM/DD/YYYY format . i tried to change this in like in ABAP coding . it s not working can give how can fix this issue that i am working CRM application .so please proper code or any link to help ..Please help out
    thanks
    Preethid

    hello prithi.
    You might be entering date on your page layout's date field?
    so for that field you may be using F4 for date.if this is there then no prob ..but not using then use this.
    OR create one MIME object using Java Script and convert there as per your need. OR in OnInputproccessing you can covert using only ABAP standard FM or by hardcode.
    its working.
    Regards,
    Sujeet

  • Date format convert error in XML interface based Adobe interactive forms

    Hi experts,
    I am using XML interface based Adobe interactive form in Web Dynpro ABAP. The form just contains some date fields and numeric fields.
    When I test the WD Application, the date fields appear like 0000-00-00 at the first time. And then I set the form input disable, and get the XML from the form, at the same time I get the warning message, 'date format convert error'. By the way, I have set the edit pattern, display pattern and data pattern  of the date field to YYYYMMDD, but there seems no effect.
    Could you tell me how to set the default date format in date field Or clear the 0000-00-00?
    And another question, all of the numeric fields in the form appear like 0.0, how can I set it to empty when the form initialize?
    Best Regards,
    Guo Guo Qing

    Hi Chintan,
    Thank you for your reply.
    I have tried every possible changes on the Date field, locale, pattern. But still no effect. When the PDF come up in the WDA program, the date field is still '0000-00-00', and then I export the XML date of the form, there is also '0000-00-00' in the interface field.
    I can't clear the '0000-00-00' in initializiation event using javascript because if I need to open the form again, if I do this, the value user input could be cleared.
    I also try using Javascrip like this
    if this.rawValue == "0000-00-00"
    { this.rawValue = ""; }
    The code above can't clear the initializiation zeros too.
    Have you used the XML interface based online Adobe Forms? I have used XML PDF forms for output before, that's perfect. But the input forms seems so strange.
    Best Regards,
    Guo Guo Qing

  • Deserializing error for the Data format

    Hi,
    We have created a RFC FM. Which will be call from other non-sap system.
    Where other non-sap system was using dot net.
    While they are calling our custom RFC there are getting a problem with date format. The error says as follows
    - <n0:SimpleTransformationFault xmlns:n0="http://www.sap.com/transformation-templates">
                <MainName>/1BCDWB/WSS0070718161009712605</MainName>
                 <ProgName>/1BCDWB/WSS0070718161009712605</ProgName>
                 <Line>74</Line>
                 <Valid>X</Valid>
    - <DeserialisationFault>
                <DescriptionText>An error occurred when deserializing in the simple transformation program /1BCDWB/WSS0070718161009712605</DescriptionText>
                 <DescriptionDetailText>The date 20060728 is not a valid date according to the XML format for ABAP</DescriptionDetailText>
                <TreePosition />
                <ClassName>CX_SY_CONVERSION_NO_DATE_TIME</ClassName>
                </DeserialisationFault>
    - <Caller>
                <Class>CL_SRG_RFC_PROXY_CONTEXT</Class>
                <Method>IF_SXML_PART~DECODE</Method>
                <Positions>1</Positions>
                </Caller>
      </n0:SimpleTransformationFault>
    Could any one help me out regarding this deserialize error with date from?
    Thanks in Advance
    Regards,
    Gopinath Addepalli.

    I believe you may still have issues with your migration. I would first verify that you can perform some basic functions with PWA:
    1) Create, save and publish a new project from browser.
    2) Edit, save and publish one of the migrated projects.
    3) Before doing the migration, do you have all the approvals completed and projects published.
    4) Clear out your cache and try a different project to open.
    5) Open Server Settings, go to Delete Objects and see if your projects are listed for deletion.
    Cheers!
    Michael Wharton, MVP, MBA, PMP, MCT, MCTS, MCSD, MCSE+I, MCDBA
    Website http://www.WhartonComputer.com
    Blog http://MyProjectExpert.com contains my field notes and SQL queries

  • Date Format in SAP chart customizing - Gantt

    Hello Everybody,
    I have problems with date format in Gantt chart coding in
    ABAP using xml concatenate,
    when i am customizing the xml from chart designer.
    I want Time(X) axis  in Days but its showing in quarters or weeks.
    I also tried with LineFormat but i could not get control over it.
    can anybody please help me!!!
    here is my code:
    xml = '<?xml version="1.0" encoding="utf-8" ?><SAPChartCustomizing version="2.0">'.
      CONCATENATE xml '<GlobalSettings><Dimension>PseudoThree</Dimension>' INTO xml.
      CONCATENATE xml '  <TransparentColor>None</TransparentColor>' INTO xml.
      CONCATENATE xml '  <ColorPalette>Tradeshow</ColorPalette>' INTO xml.
      CONCATENATE xml '  <ColorOrder>Default</ColorOrder>' INTO xml.
      CONCATENATE xml '<Defaults><ChartType>Gantt</ChartType></Defaults></GlobalSettings>' INTO xml.
    CONCATENATE xml '<Values><Series><LineType>Direct</LineType><LineType1>Year</LineType1>
    <LineType2>Month</LineType2><LineType3>Day</LineType3><LineWidth>2</LineWidth>
    <MarkerShape>None</MarkerShape></Series></Values></SAPChartCustomizing>'
    INTO xml.
    *SEND CUSTOMIZING TO CHART ENGINE:
      lo_chart->set_customizing( data = xml ).
    Thanks in advance
    Bobby

    Hi Vijay,
    It's for ABAP only could you please post the solution.
    here i would like to share how i have given my series values:
    xml = '<?xml version="1.0"?>'.
      CONCATENATE xml '<ChartData>' INTO xml.
      CONCATENATE xml ' <Categories>' INTO xml.
      CONCATENATE xml '   <Category>Mat 1</Category>' INTO xml.
      CONCATENATE xml '   <Category>Mat 2</Category>' INTO xml.
      CONCATENATE xml '   <Category>Mat 3</Category>' INTO xml.
      CONCATENATE xml ' </Categories>' INTO xml.
      CONCATENATE xml ' <Series label="Op10" Customizing="Op10">' INTO xml.
      CONCATENATE xml '   <Point><Value type="time">20010101</Value>' INTO xml.
      CONCATENATE xml '   <Value type="time">20010115</Value>' INTO xml.
      CONCATENATE xml '   <Value type="time">20010120</Value>' INTO xml.
      CONCATENATE xml '   <Value type="time">20010130</Value></Point>' INTO xml.
      CONCATENATE xml '   <Point><Value type="time">20010101</Value>' INTO xml.
      CONCATENATE xml '   <Value type="time">20010125</Value></Point>' INTO xml.
      CONCATENATE xml ' </Series>' INTO xml.
    Thanks again.
    Bobby

  • Date format in user master record cannot be interpreted

    When running an Infopackage from BW to an R/3 customer extractor, the R/3 job cancels with this error message, "Date format in user master record cannot be interpreted". I can restart the R/3 job program from the ABAP editor screen using the same variant that BW issued and the job runs without cancelling.
    NOTE: This process runs without any errors on our QAS system.
    Any idea what causes this error message and how I can fix it?

    Hi Alan,
    I have resolved this issue by myself. Same just like yours mine is also a custom Datasource.
    Solution for this is go to source system check your Background user id i.e like BWALEREMOTE or ALEREMOTE which ever id you have created for setting up RFC connection between R/3 & BW. Check your Date format which has been set for your background user. Use the second format mm/dd/yy. Then run your extraction you will not face any problem.
    If you still have any problem do let me know. If this solution helps you assign points.
    Regards,
    Bhuvana.

Maybe you are looking for

  • ISync not syncing all contacts to Moto Razr V3i

    Hi, I have a Motorola Razr V3i that I'd like to sync with my Mac address book. I'm running Leopard 10.5.1. I keep the Address Book as the reference for all my contacts. When I connect my Razr to the Mac, I want to replace all the contacts on the phon

  • How Does The Playcount Sync Across iTunes and Multiple iPhones/iPods?

    Okay, this is more of a lazy question, because I don't feel like investigating myself... So I have an iPhone with all of my music on it. I also have an iTouch with all of my music. Occasionally I will play music on my iPhone, but primarily it's only

  • HP Color Laserjet 2605dn - won't print in color

    I have an HP Color Laserjet 2605dn printer and recently purchased a new computer with Windows 7.  Our IT dept. installed an updated driver (HP Universal Printing PCCCCL 6) but now my printer will not print in color nor can I find a setting where I ca

  • How do you Sync Contacts from iPhone to MacBook?

    How do you Sync Contacts from iPhone to MacBook? Hi,  Does anyone know how to do this without the need for me to upgrade to Lion on my MAcBook Pro and use the iCloud? I put all my contacts into my iPhone and I'd like them now on my MAcBook Pro. Thank

  • How can i shorten a video file.

    Newby to Mac(pro osx 10.9), taking baby steps. I have some videos I want to shorten. Something not to complicated. I wanted to download perian so I can use in conjunction with quicktime but I saw that it was no longer going to be available. What opti