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

Regarding Date

sreeramkumar_madisetty
Active Contributor
0 Likes
998

Hi Folks

I have some simple requirement.

Suppose if i will pass today's date : 03.04.2007

I have to get the result : Apr 07

Can anyone suggest me any Function Modules or logic.

Points are assured for correct answers.

Regards,

kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
972

hi,

parameters p_date type sy-datum.

data:w_date type string,

w_month(10).

case p_date+4(2).

WHEN 1.

w_month = 'jan'.

WHEN 2.

w_month = 'Feb'.

WHEN 3.

w_month = 'March'.

WHEN 4.

w_month = 'April'.

WHEN 5.

w_month = 'May'.

WHEN 6.

w_month = 'June'.

WHEN 7.

w_month = 'July'.

WHEN 8.

w_month = 'Aug'.

WHEN 9.

w_month = 'Sept'.

WHEN 10.

w_month = 'Oct'.

WHEN 11.

w_month = 'Nov'.

WHEN 12.

w_month = 'Dec'.

endcase.

concatenate w_month p_date+2(2) into w_date.

write w_date.

regards,

ananth.

Message was edited by:

ananth

8 REPLIES 8
Read only

Former Member
0 Likes
972

Hi,

Check this..

DATA: V_INPUT(8) VALUE '20112006'.

DATA: V_CHAR(25).

data: date type sydatum.

DATA: MONTH_NAMES LIKE T247.

SELECT SINGLE * FROM T247

INTO MONTH_NAMES

WHERE SPRAS = SY-LANGU

AND MNR = V_INPUT+2(2).

CONCATENATE MONTH_NAMES-KTX V_INPUT+4(4)

INTO V_CHAR SEPARATED BY SPACE.

write: / V_CHAR.

Hope this works..

Thanks,

Naren

Read only

Former Member
0 Likes
972

Hi.., This code give the date in Words..

parameter date type d.

DATA :

w_month(10) TYPE c, " To hold month.

w_char1(3) TYPE c, " To hold month.

yrmon(20) type c.

w_month = date+4(2).

CASE w_month.

WHEN '01'.

w_char1 = 'Jan'(008).

WHEN '02'.

w_char1 = 'Feb'(009).

WHEN '03'.

w_char1 = 'Mar'(010).

WHEN '04'.

w_char1 = 'Apr'(011).

WHEN '05'.

w_char1 = 'May'(012).

WHEN '06'.

w_char1 = 'Jun'(013).

WHEN '07'.

w_char1 = 'Jul'(014).

WHEN '08'.

w_char1 = 'Aug'(015).

WHEN '09'.

w_char1 = 'Sep'(016).

WHEN '10'.

w_char1 = 'Oct'(017).

WHEN '11'.

w_char1 = 'Nov'(018).

WHEN '12'.

w_char1 = 'Dec'(019).

ENDCASE. " CASE w_month.

CONCATENATE w_char1 date+2(2) INTO yrmon SEPARATED BY space.

write yrmon.

reward all helpful answers,

sai ramesh

Read only

Former Member
0 Likes
972

hi

call Function 'DATE_CONVERT_TO_FACTORYDATE'

exporting

CORRECT_OPTION = '+'

DATE = sy-datum

FACTORY_CALENDAR_ID = 'US'

importing

FACTORYDATE = l_fdate2.

no_of_days = l_fdate2 - l_fdate1.

DATE_COMPUTE_DAY Returns day of the week for a particular date(1=Monday, 5=Friday etc.)

DATE_TO_DAY Returns day of the week for a particular date('Monday', 'Friday', 'Sat.')

atleast one helps u

Message was edited by:

sunil kumar

Read only

Former Member
0 Likes
972

Hi..

data: w_dt like sy-datum.

w_dt = p_date. **given date**

w_month = w_dt+4(2).

w_year = w_dt+2(2).

case w_month.

when '01'.

w_mon = 'Jan'.

when '02'.

w_mon = 'Feb'.

when '03'.

w_mon = 'Mar'.

when '04'.

w_mon = 'Apr'.

when '05'.

w_mon = 'May'.

when '06'.

w_mon = 'Jun'.

when '07'.

w_mon = 'Jul'.

when '08'.

w_mon = 'Aug'.

when '09'.

w_mon = 'Sep'.

when '10'.

w_mon = 'Oct'.

when '11'.

w_mon = 'Nov'.

when '12'.

w_mon = 'Dec'.

endcase.

write: w_mon,w_year.

Read only

Former Member
0 Likes
972

Hi,

<b>MONTH_NAMES_GET</b> It returns all the month and names in repective language.

Regards

Sudheer

Read only

Former Member
0 Likes
973

hi,

parameters p_date type sy-datum.

data:w_date type string,

w_month(10).

case p_date+4(2).

WHEN 1.

w_month = 'jan'.

WHEN 2.

w_month = 'Feb'.

WHEN 3.

w_month = 'March'.

WHEN 4.

w_month = 'April'.

WHEN 5.

w_month = 'May'.

WHEN 6.

w_month = 'June'.

WHEN 7.

w_month = 'July'.

WHEN 8.

w_month = 'Aug'.

WHEN 9.

w_month = 'Sept'.

WHEN 10.

w_month = 'Oct'.

WHEN 11.

w_month = 'Nov'.

WHEN 12.

w_month = 'Dec'.

endcase.

concatenate w_month p_date+2(2) into w_date.

write w_date.

regards,

ananth.

Message was edited by:

ananth

Read only

Former Member
0 Likes
972

Hi Sreeram,

Try this code . This is wrking perfectly.

REPORT ZDIN_1.

data: v_input1 type sy-datum,

v_input2 type sy-datum,

v_input3 type sy-datum,

v_input type sy-datum.

parameters: V2_INPUT type sy-datum.

move v2_input(4) to v_input1.

move v2_input+4(2) to v_input2.

move v2_input+6(2) to v_input3.

concatenate v_input3 v_input2 v_input1 into v_input.

DATA: V_CHAR(25).

data: date type sydatum.

DATA: MONTH_NAMES LIKE T247.

SELECT SINGLE * FROM T247

INTO MONTH_NAMES

WHERE SPRAS = SY-LANGU

AND MNR = V_INPUT+2(2).

CONCATENATE MONTH_NAMES-KTX V_INPUT+4(4)

INTO V_CHAR SEPARATED BY SPACE.

write: / V_CHAR.

Dont forget to rewrd for right ans.

Thanks,

Dinesh

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
972

Hi

It's Answered.