Application Development and Automation 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: 
Read only

increment date (calday)

Former Member
0 Likes
2,356

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
Read only

Former Member
0 Likes
2,040

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

Read only

0 Likes
2,040

thank you!

Read only

Former Member
0 Likes
2,040

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

Read only

0 Likes
2,040

Hi,

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

You don't need to handle this explicitly.

Read only

0 Likes
2,040

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

Thanks a lot

Read only

Former Member
0 Likes
2,040

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.

Read only

0 Likes
2,040

I need the next date only

Read only

0 Likes
2,040

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

regards,

Advait

Read only

0 Likes
2,040

Hi,

I think this thread is done.

The required solution was found.

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

Bye.

Read only

0 Likes
2,040

I got error...

Read only

0 Likes
2,040

Hi Adrian,

Can you explain.

What kind of error?

Read only

0 Likes
2,040

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[].

Read only

0 Likes
2,040

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

Read only

0 Likes
2,040

it worked in se38. Thanks

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

Read only

0 Likes
2,040

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

Read only

Former Member
0 Likes
2,040

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.

Read only

Former Member
0 Likes
2,040

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.