<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: problem date format in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627926#M1281574</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I declared 2 variables : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : fDate1(10),
       fDate2(10).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I concatenate the date &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_datatab INTO wa_datatab.
    SPLIT wa_datatab at ';' into
                          wa_cepc_segm-kokrs
                          wa_cepc_segm-prctr
                          fDate1
                          fDate2.

concatenate fdate1+6(4) fdate1+3(2) fdate1(2) into wa_cepc_segm-datbi.
concatenate fdate2+6(4) fdate2+3(2) fdate2(2) into wa_cepc_segm-datab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And after I call my function module but still the same error : 'Valid To Date invalid'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        date                      = wa_cepc_segm-datbi
      EXCEPTIONS
        plausibility_check_failed = 1
        OTHERS                    = 2.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      WRITE:/ 'Valid To Date invalid'.
    ENDIF.


    append wa_cepc_segm to i_cepc_segm.
    CLEAR wa_cepc_segm.
  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2009 22:57:53 GMT</pubDate>
    <dc:creator>mrahhaoui</dc:creator>
    <dc:date>2009-05-07T22:57:53Z</dc:date>
    <item>
      <title>problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627919#M1281567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guru's &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem with a field coming from a file upload in my internal table wich should be insert in a system table in date format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i do my test to check if the field has a correct date format I always receive the error: "Valid_to_date is invalid". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the field in my csv file has this format 02.03.2009.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;I've written this code :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF t_segm2,
   kokrs    TYPE kokrs,
    prctr   TYPE prctr,
    datbi   TYPE datbi,
    datab   TYPE datab,
END OF t_segm2.

DATA: 
          wa_cepc_segm TYPE t_segm2,
           i_cepc_segm TYPE STANDARD TABLE OF t_segm2,
          it_datatab TYPE STANDARD TABLE OF string,
          wa_datatab TYPE string,

LOOP AT it_datatab INTO wa_datatab.
    SPLIT wa_datatab at ';' into
                          wa_cepc_segm-kokrs
                          wa_cepc_segm-prctr
                          wa_cepc_segm-datbi
                          wa_cepc_segm-datab.

    CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        date                      = wa_cepc_segm-datbi
      EXCEPTIONS
        plausibility_check_failed = 1
        OTHERS                    = 2.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      WRITE:/ 'Valid To Date invalid'.
    ENDIF.
    append wa_cepc_segm to i_cepc_segm.
    CLEAR wa_cepc_segm.
  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone can help me please?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mohamed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 21:12:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627919#M1281567</guid>
      <dc:creator>mrahhaoui</dc:creator>
      <dc:date>2009-05-07T21:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627920#M1281568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Probably the date in the file is in an external format like 07.05.2009, remeber the internal format is yyyymmdd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 21:29:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627920#M1281568</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T21:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627921#M1281569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so what can I do for that&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 21:30:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627921#M1281569</guid>
      <dc:creator>mrahhaoui</dc:creator>
      <dc:date>2009-05-07T21:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627922#M1281570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First use FM &lt;STRONG&gt;CONVERSION_EXIT_IDATE_INPUT&lt;/STRONG&gt; to convert date to internal format Eg: input = 01.02.2008 and Output = 20080201.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next use &lt;STRONG&gt;DATE_CHECK_PLAUSIBILITY&lt;/STRONG&gt; providing this converted date. It will work then.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 21:39:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627922#M1281570</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-05-07T21:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627923#M1281571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marcin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I save the external date in my internal table the data that I have in this internal table when in the debbuger is "30.02.20" it trunqued the last 2 digits of the year.  the test is wrong and it is normal that I receive the error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it is because of the declaration of my date in the structure : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;datbi   TYPE datbi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datbi is on 8 char but the date field is on 10 because there are '.'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a solution for this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mohamed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: rahhaoui mohamed on May 7, 2009 11:56 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 21:42:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627923#M1281571</guid>
      <dc:creator>mrahhaoui</dc:creator>
      <dc:date>2009-05-07T21:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627924#M1281572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;split the dates fields to temporal variables of the desired lenght (in your case 10) then create a routine or use the standard function modules to assign them to the date fields in wa_cepc.&lt;/P&gt;&lt;P&gt;Very easy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 22:05:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627924#M1281572</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-07T22:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627925#M1281573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes they are at least 2 solutions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) provide date from file directly following internal date format used in SAP which is YYYYMMDD i.e 01.02.2009 should be 20090201&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) in internal table type this field not as &lt;STRONG&gt;D&lt;/STRONG&gt; but as &lt;STRONG&gt;C(10)&lt;/STRONG&gt;. Then importing this column will result in 01.02.2009, but later you have to manually convert this value using FMs mentioned before, Then i.e you can store the result in separate column which is of type &lt;STRONG&gt;D&lt;/STRONG&gt; and use this column for further calculation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 22:07:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627925#M1281573</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-05-07T22:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627926#M1281574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I declared 2 variables : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA : fDate1(10),
       fDate2(10).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I concatenate the date &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT it_datatab INTO wa_datatab.
    SPLIT wa_datatab at ';' into
                          wa_cepc_segm-kokrs
                          wa_cepc_segm-prctr
                          fDate1
                          fDate2.

concatenate fdate1+6(4) fdate1+3(2) fdate1(2) into wa_cepc_segm-datbi.
concatenate fdate2+6(4) fdate2+3(2) fdate2(2) into wa_cepc_segm-datab.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And after I call my function module but still the same error : 'Valid To Date invalid'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        date                      = wa_cepc_segm-datbi
      EXCEPTIONS
        plausibility_check_failed = 1
        OTHERS                    = 2.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      WRITE:/ 'Valid To Date invalid'.
    ENDIF.


    append wa_cepc_segm to i_cepc_segm.
    CLEAR wa_cepc_segm.
  endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2009 22:57:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627926#M1281574</guid>
      <dc:creator>mrahhaoui</dc:creator>
      <dc:date>2009-05-07T22:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: problem date format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627927#M1281575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Everything seems fine with the code. I tried it myself and I got strange behaviour.&lt;/P&gt;&lt;P&gt;I used this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: datbi TYPE datbi.

fdate1 = '02.03.2009'.

concatenate fdate1+6(4) fdate1+3(2) fdate1(2) into datbi.

CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
      EXPORTING
        date                      = datbi
      EXCEPTIONS
        plausibility_check_failed = 1
        OTHERS                    = 2.
    if sy-subrc ne 0.
      write 'Wrong date'.
"    else.
"      write 'Date ok'.
    endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I leave ELSE block commented, the FM returns sy-subrc = 0 and doesn't display 'Wrong date' message. So this works as we want. But when I debug it, I can clearly see that processing goes inside IF block and tries to write the message out (even thought the condition is not fullfilled). But anyhow the message doens't appear on the screen. Strange.&lt;/P&gt;&lt;P&gt;Now when I uncomment the ELSE block, the processing seems to work fine. Don't know why it is happening but if we leave entire IF,ELSE it works fine. So try this solution. Everything else works fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Right now I tried to see if this IF block really changes some data object using:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data var type i.

call fm....
if sy-subrc ne 0.
   var = 1.
endif.

write var.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I could see that, thought processing is passed inside the block it doesn't change VAR contents. So it stays 0. But just right after it I run the program again to show it to my collegue and the processsing didn't go inside anymore. It must be something with debugger then. My collegue says once he spent some time investigating the same problem and finally he gave up. What the debugger was showing was different from what it was in fact calculating. Fortunatelly the calculation here doesn't change, just debugger is trying to cheat us showing what he is really NOT doing;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Marcin Pciak on May 8, 2009 9:31 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 May 2009 07:25:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-date-format/m-p/5627927#M1281575</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-05-08T07:25:18Z</dc:date>
    </item>
  </channel>
</rss>

