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 fuction

Former Member
0 Likes
936

Hello Experts,

I wnat to display first day of the month from any date

Ex. there is 15.10.2008 Date .

Is there is fuction module to convert date into first day of the month like 01.10.2008.

Thanks & Regards,

Rahul Shinde.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
879

hi..

Check the sample code attached for calculations of date.

Its not advisable to use Function Module for these kind of simple calculations, as when u use a FM, its whole Fun group is loaded and leads to unneccssary waste of resources.

Just execute the below code..!

TABLES: ekko.

SELECT-OPTIONS: s_bedat for ekko-bedat no INTERVALS.

data: output(10) TYPE c.
CONSTANTS: c_01(2) TYPE c VALUE '01'.

CONCATENATE  c_01 '/'
                 S_BEDAT-low+4(2) '/'
                 S_BEDAT-low(4) INTO output.

WRITE:/ output.

(or)

if u still want FM, then..one sample is,

CK_F_GET_FIRST_DAY_OF_DATE " pass k0 in p_periv

u can find many more in se37

regards,

Padma

Hello Experts,

I wnat to display first day of the month from any date

Ex. there is 15.10.2008 Date .

Is there is fuction module to convert date into first day of the month like 01.10.2008.

Thanks & Regards,

Rahul Shinde.

6 REPLIES 6
Read only

Former Member
0 Likes
880

hi..

Check the sample code attached for calculations of date.

Its not advisable to use Function Module for these kind of simple calculations, as when u use a FM, its whole Fun group is loaded and leads to unneccssary waste of resources.

Just execute the below code..!

TABLES: ekko.

SELECT-OPTIONS: s_bedat for ekko-bedat no INTERVALS.

data: output(10) TYPE c.
CONSTANTS: c_01(2) TYPE c VALUE '01'.

CONCATENATE  c_01 '/'
                 S_BEDAT-low+4(2) '/'
                 S_BEDAT-low(4) INTO output.

WRITE:/ output.

(or)

if u still want FM, then..one sample is,

CK_F_GET_FIRST_DAY_OF_DATE " pass k0 in p_periv

u can find many more in se37

regards,

Padma

Read only

Former Member
0 Likes
879

HI..

Take the data into date variable and replace the last two values with '01'.

data : date type sy-datum default '20080112'.

date+6(2) = '01.

Read only

Former Member
0 Likes
879

Hi

Check this link it has n number of function modules and coding samples for your question:

Regards

Neha

Read only

Former Member
0 Likes
879

Hi,

You can use the Function Module: RP_FORMATING_DATE

Thanks,

Chidanand

Read only

shadow
Participant
0 Likes
879

Hi rahul chek it,

first_day_of_curr_month = sy-datum.

first_day_of_curr_month+6(2) = '01'.

last_day_of_prev_month = first_day_of_curr_month - 1.

Regard's

SHAIK.

Read only

Former Member
0 Likes
879

Hi

Use this FM : CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

Regs

SB