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: 

how to break range of dates into different months in mm/yyyy format

Former Member
0 Kudos

See the following eg:

MaterialNo Validfrom ValidTo RecordNo Value

A100 01.01.2007 13.05.2007 1000 1150/-

14.05.2007 24.08.2007 1001 1550/-

Now I want to break these dates into mm/yyyy format based on a condition. If the date(day) 15th lies in the range of dates

then it should pick that Value.

The output should be in this format.

MaterialNo Validfrom ValidTo Date RecordNo Value

A100 01.01.2007 13.05.2007 012007 1000 1150/-

022007 1000 1150/-

032007 1000 1150/-

042007 1000 1150/-

A100 14.05.2007 24.08.2007 052007 1001 1550/-

062007 1001 1550/-

072007 1001 1550/-

082007 1001 1550/-

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Shiva,

In your Report Program, you can define the field of type sy-datum. And then fill the fields with the date. And then you can extract the rest of it manually by this small and simple lines of code. Once you have the date extracting logic then you can output the date in any manner according to your wish.





data : lv_date  TYPE sy-datum.

data : lv_month TYPE c LENGTH 2.

data : lv_year  TYPE c LENGTH 4.

data : lv_month_year TYPE c LENGTH 6.





lv_date = sy-datum.



lv_month = lv_date+4(2).

lv_year  = lv_date+0(4).



CONCATENATE lv_month lv_year INTO lv_month_year.



Hope this helps.

Thanks,

Samantak.

3 REPLIES 3

Former Member
0 Kudos

Hi Shiva,

In your Report Program, you can define the field of type sy-datum. And then fill the fields with the date. And then you can extract the rest of it manually by this small and simple lines of code. Once you have the date extracting logic then you can output the date in any manner according to your wish.





data : lv_date  TYPE sy-datum.

data : lv_month TYPE c LENGTH 2.

data : lv_year  TYPE c LENGTH 4.

data : lv_month_year TYPE c LENGTH 6.





lv_date = sy-datum.



lv_month = lv_date+4(2).

lv_year  = lv_date+0(4).



CONCATENATE lv_month lv_year INTO lv_month_year.



Hope this helps.

Thanks,

Samantak.

0 Kudos

But my requirement is different. Please go through my requirement..

0 Kudos

Please do not ask or answer DATE questions, thank you. Tis is our requirement.

Regards,

Clemens