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: 

Divide data and time

Former Member
0 Kudos

Hi All,

I have a requirement in which I need to divide a given date and time range into some parts.

e.g 1July 10am - 5 July 10 am

into 1july 10am - 2 july 10am

2 july 10am - 3 july 10am

3 july 10am - 4 july 10am

4 july 10am - 5 july 10am

Is there any function module to do that or any logic I need to implement. Please help.

Regards,

Jeetu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Jeetu,

Try this :

SELECT-OPTIONS:
  s_date FOR sy-datum.

PARAMETERS :
  p_time LIKE sy-uzeit.

DATA :
  w_split LIKE sy-datum,
  w_split1 LIKE sy-datum.


w_split = s_date-low.

w_split1 = s_date-low + 1.

WHILE w_split GE s_date-low.
  IF w_split EQ s_date-high.

    EXIT.

  ELSE.
    WRITE 😕 w_split,
             '-',
             w_split1,
             p_time.
    ADD 1 TO w_split.
    ADD 1 TO w_split1.
  ENDIF.
ENDWHILE..

Regards,

Swapna.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Try this..

CONV_UTIL_ADD_DATE_AND_TIME

Regards,

Dhan

Former Member
0 Kudos

Hi Jeetu,

Try this :

SELECT-OPTIONS:
  s_date FOR sy-datum.

PARAMETERS :
  p_time LIKE sy-uzeit.

DATA :
  w_split LIKE sy-datum,
  w_split1 LIKE sy-datum.


w_split = s_date-low.

w_split1 = s_date-low + 1.

WHILE w_split GE s_date-low.
  IF w_split EQ s_date-high.

    EXIT.

  ELSE.
    WRITE 😕 w_split,
             '-',
             w_split1,
             p_time.
    ADD 1 TO w_split.
    ADD 1 TO w_split1.
  ENDIF.
ENDWHILE..

Regards,

Swapna.