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

Datecalculation in ABAP

christian_swonke
Participant
0 Likes
615

Hallo together,

I have a problem with date calculation.

I have to select data for each day in a range.

This means:

The user has the possibility to define a start date and a end date (I tried at first a select-option for the user interface. But I think this will never work right.)

And I have to loop about this range and select for each single date some values.

Is there a functionality / function module who can handle this?

for example a function module with import parameter from and to and return value a table with all dates included.

Because it is really strange to handle this manually with days of month and so on.

Thanks for the help

Moderator message: date calculation questions = FAQ, please search before posting.

Edited by: Thomas Zloch on Dec 8, 2010 9:36 AM

Hallo together,

I have a problem with date calculation.

I have to select data for each day in a range.

This means:

The user has the possibility to define a start date and a end date (I tried at first a select-option for the user interface. But I think this will never work right.)

And I have to loop about this range and select for each single date some values.

Is there a functionality / function module who can handle this?

for example a function module with import parameter from and to and return value a table with all dates included.

Because it is really strange to handle this manually with days of month and so on.

Thanks for the help

Moderator message: date calculation questions = FAQ, please search before posting.

Edited by: Thomas Zloch on Dec 8, 2010 9:36 AM

3 REPLIES 3
Read only

Subhankar
Active Contributor
0 Likes
573

I can't understand why you not selecting data based on date range(select Option). there should be no problem.

Anyways you can do it in this way.

PARAMETERS: p_dat1 TYPE sydatum,

p_dat2 TYPE sydatum.

DO.

IF p_dat1 gt p_dat2.

exit.

ENDIF.

                    • DO you processing using P_DAT1.

  • Then Add 1 day to start date

p_dat1 = p_dat1 + 1.

ENDDO.

While adding date fields automatically handle all the stuff(like 30 days month or 31days month, lip yr etc.)

Thanks

Subhankar Garani

Read only

alex_cook
Active Participant
0 Likes
573

Howdy,

The requirement seems strange - why wouldn't you just use a select-option and select all entries for the date range into an internal table.

Then you can extract entries for single dates from the internal table.

Cheers

Alex

Read only

Former Member
0 Likes
573

Hello ,

check FM CSCP_PARA1_GET_PERIODS

regards

Prabhu