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

Date Range Table loop from start day to last

warcsi
Participant
0 Likes
3,324

I have a range table I got from a Select-Option that is filled with dates

I would like to get all days individually so I can make a selection with them individually ( I am aware I can use Select IN) maybe loop them somehow if its possible or turn the dates into an internal table with dates.

Is there a way this is possible

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
3,199

AFAIK there is no avalaible database table of days from which a select coulm be performed.,

  • So process a I/BT/low/high select-options recorde with a DO / LOOP incrementing date from low to high by increment of 1 (only process low value record in case of I/EQ)
  • You should also prevernt multiple records with NO-EXTENSION option
  • You could also restrcit the select-options to single values (I/EQ/low ) and single range (I/BT/low/high) with FM SELECT_OPTIONS_RESTRICT

I have a range table I got from a Select-Option that is filled with dates

I would like to get all days individually so I can make a selection with them individually ( I am aware I can use Select IN) maybe loop them somehow if its possible or turn the dates into an internal table with dates.

Is there a way this is possible

5 REPLIES 5
Read only

RaymondGiuseppi
Active Contributor
3,200

AFAIK there is no avalaible database table of days from which a select coulm be performed.,

  • So process a I/BT/low/high select-options recorde with a DO / LOOP incrementing date from low to high by increment of 1 (only process low value record in case of I/EQ)
  • You should also prevernt multiple records with NO-EXTENSION option
  • You could also restrcit the select-options to single values (I/EQ/low ) and single range (I/BT/low/high) with FM SELECT_OPTIONS_RESTRICT
Read only

0 Likes
3,199

Thank you this is really helpfull

Read only

3,199

warcsi

I suggest you peruse my blog here: https://blogs.sap.com/2014/02/07/dates-and-select-options/

The point is that you'll often see in standard SAP programs something that looks like a standard date select option, but is actually made up of two parameters. In this way, you always have the low and high date and you don't need NO-EXTENSION and you don't need SELECT_OPTIONS_RESTRICT.

It really is the simplest way to achieve your goal.

It's what SAP do.

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,199

Do you want to include off days too? (Saturday, Sunday)

Is that just to practice ABAP, or real scenario? In that case, could you explain more?

Read only

Sandra_Rossi
Active Contributor
0 Likes
3,199

NB: I see the same question many times in the forum: