Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

increment date (calday)

Former Member
0 Kudos

Hello everybody!

I need sb to give me a hand with the issue of increasing date (calday). I initializad :

date = '01012006'.

how do I do the the increment? : date = date + 1. (in order to have date = '02012006')

or: CALL FUNCTION 'CALCULATE_DATE'

EXPORTING

days = '+1'

start_date = date

IMPORTING

result_date = date.

17 REPLIES 17

Former Member
0 Kudos

Hi Adrian,

use this.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

date = initial_date

days = 01

months = 0

signum = '+'

years = 0

IMPORTING

calc_date = increm_date.

regards,

kais

0 Kudos

thank you!

Former Member
0 Kudos

What is the data type of the field date ?

you can use the function CALCULATE_DATE

but the date format that it accepts is of type sy-datum ( yyyymmdd)

regards,

Advait

0 Kudos

Hi,

Use the function is better because its compatible with different format of dates.

You don't need to handle this explicitly.

0 Kudos

I used ddmmyyyy. It must be for that reason.....

Thanks a lot

Former Member
0 Kudos

Do you need the next working day or the next date only. For next working day you need to know the type of calender you need to use.

0 Kudos

I need the next date only

0 Kudos

Use the calculate_date function and pass the date in yyyyddmm format.

regards,

Advait

0 Kudos

Hi,

I think this thread is done.

The required solution was found.

Don't try to wast the time of the guy.

Bye.

0 Kudos

I got error...

0 Kudos

Hi Adrian,

Can you explain.

What kind of error?

0 Kudos

I'm new to abap. I intend to write a routine for a transformation rule (in BW). Here's a portion of the code: (I got red in the BW Monitor and the system points towards CALL FUNCTION 'CALCULATE_DATE' - the cursor blinks in front of CALL FUNCTION 'CALCULATE_DATE')

data: e_s_result type tys_TG_1.

data: e_t_result type tyt_TG_1.

data: data like sy-datum.

loop at RESULT_PACKAGE into e_s_result.

data = '20080101'.

do 1000 times.

if data >= e_s_result-/bic/zabdatum and data <=

e_s_result-/bic/zbisdatum.

move data to e_s_result-calday.

append e_s_result to e_t_result.

endif.

  • data = data + 1.

CALL FUNCTION 'CALCULATE_DATE'

EXPORTING

days = '+1'

start_date = data

IMPORTING

result_date = data.

*CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

*EXPORTING

*date = data

*days = 01

*months = 0

*signum = '+'

*years = 0

*IMPORTING

*calc_date = data.

*data = '20080102'.

enddo.

endloop.

refresh RESULT_PACKAGE.

move e_t_result[] to RESULT_PACKAGE[].

0 Kudos

Adrian - you're making this far too complicated. all you have to do is:

REPORT ztest LINE-SIZE 80 MESSAGE-ID 00.

DATA: date_in TYPE sy-datum VALUE '20080101',
      date_out TYPE sy-datum.

date_out = date_in + 1.

WRITE: /001 date_in, date_out.

Rob

0 Kudos

it worked in se38. Thanks

I suppose it's my code in bw routine which is at fault....

0 Kudos

Function modules can be a great help for re-usability of code. But they do have an interface which must be understood. If there is no documentation and you are new to ABAP, it's often easy to code yourself. You learn more and in this case, it's dead simple.

Rob

Former Member
0 Kudos

To get next working day you can use the FM 'BKK_ADD_WORKINGDAY'. Here you need to put the calender type used for your need.

Former Member
0 Kudos

To get next working day you can use the FM 'BKK_ADD_WORKINGDAY'. Here you need to put the calender type used for your need.