<?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: Function module to add day into date not working in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548061#M2006597</link>
    <description>&lt;P&gt;DATA(day_after_april_30th) = CONV d( april_30th + 1 ). might be better&lt;/P&gt;</description>
    <pubDate>Sat, 23 Apr 2022 19:12:31 GMT</pubDate>
    <dc:creator>stefan-de-vriendt</dc:creator>
    <dc:date>2022-04-23T19:12:31Z</dc:date>
    <item>
      <title>Function module to add day into date not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548057#M2006593</link>
      <description>&lt;P&gt;Hi together,&lt;/P&gt;
  &lt;P&gt;I am trying to add a day to the date, however it is not working with various function module that I have tried. The data is as follows:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA: lv_date TYPE vkdfs-fkdat, "The first date that we are getting.
      lv_day  TYPE knvv-podtg,  "The day that we need to add to the above date.
      lv_end_date TYPE vkdfs-fkdat. "The final date that is going to be used for other functions.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Now I have tried using several function modules, such as RP_CALC_DATE_IN_INTERVAL and BKK_ADD_WORKINGDAY, however a dump is generated every time as the variable lv_day is of the knvv-podtg type and it has a data type of DEC with length 11. &lt;/P&gt;
  &lt;P&gt;I have been told not use simple addition, but rather to use function module, as we may have scenarios where the lv_date = 30.04.2022 and lv_day = 1, we may have a result of lv_end_date = 31.04.2022(which is unlogic as April has only 30 days).&lt;/P&gt;
  &lt;P&gt;Can anyone give a Function Module that can solve my issue?&lt;/P&gt;
  &lt;P&gt;Thank you all in advance!&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 15:00:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548057#M2006593</guid>
      <dc:creator>Raxph</dc:creator>
      <dc:date>2022-04-22T15:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Function module to add day into date not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548058#M2006594</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;gt;lv_date = 30.04.2022 and lv_day = 1, we may have a result of lv_end_date = 31.04.2022&lt;/P&gt;&lt;P&gt;sure? If you are working with fields of type DATS, adding days should work properly. Using the above given values, the calculation a DATS field with 20220430 + 1 should result in 20220501.&lt;/P&gt;&lt;P&gt;Did you test this?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 15:50:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548058#M2006594</guid>
      <dc:creator>jmodaal</dc:creator>
      <dc:date>2022-04-22T15:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Function module to add day into date not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548059#M2006595</link>
      <description>&lt;P&gt;Same answer as Jan + example.&lt;/P&gt;&lt;P&gt;I guess you have been wrongly advised. Probably you've been told about adding 1 to 30 the same way as numbers would give 31, but ABAP has special processing with dates, so use this feature.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(april_30th) = CONV d( '20220430' ).
DATA(day_after_april_30th) = CONV d( april_30th + 1 ).
ASSERT day_after_april_30th = CONV d( '20220501' ). " &amp;lt;=== always true&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Apr 2022 17:56:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548059#M2006595</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-04-22T17:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: Function module to add day into date not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548060#M2006596</link>
      <description>&lt;P&gt;Hi Raxophord,&lt;/P&gt;&lt;P&gt;There are a lot of FM to calculate dates, however, each one has its own input parameters that you have to send to generate the new date.&lt;/P&gt;&lt;P&gt;For example, the FM &lt;STRONG&gt;RP_CALC_DATE_IN_INTERVAL&lt;/STRONG&gt; has a parameter to increase the days, it is called DAYS and it is NUMC 2.&lt;/P&gt;&lt;P&gt;If you are going to use a FM to calculate a date, you have to use the same type parameters, so, in the previous FM that i mentioned, the days parameters must be numc 2.&lt;/P&gt;&lt;P&gt;For this purpose, you can create a new variable with the same type, then, you can use the FM with the same parameter type.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: days  TYPE t5a4a-dlydy.

days = lv_day.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
  EXPORTING
    date      = lv_date
    days      = days
    months    = month
    signum    = '+'
    years     = year
  IMPORTING
    calc_date = lv_end_date.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It can works if the number in the lv_day variable is up to 99, if it is greater than that, you can try to convert the number in months or years.&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;Greetings.&lt;/P&gt;&lt;P&gt;Esteban&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 18:06:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548060#M2006596</guid>
      <dc:creator>lemoreno</dc:creator>
      <dc:date>2022-04-22T18:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Function module to add day into date not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548061#M2006597</link>
      <description>&lt;P&gt;DATA(day_after_april_30th) = CONV d( april_30th + 1 ). might be better&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2022 19:12:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548061#M2006597</guid>
      <dc:creator>stefan-de-vriendt</dc:creator>
      <dc:date>2022-04-23T19:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Function module to add day into date not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548062#M2006598</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;stefan-de-vriendt&lt;/SPAN&gt; thanks&lt;/P&gt;</description>
      <pubDate>Sun, 24 Apr 2022 05:35:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/function-module-to-add-day-into-date-not-working/m-p/12548062#M2006598</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-04-24T05:35:05Z</dc:date>
    </item>
  </channel>
</rss>

