‎2009 Jan 20 6:53 AM
Hi,
i want convert date in following format.
December / 2009
how i convert this?
Thanks in advance?
Regard.
Sam.
Use meaningful subject and Search before posting
Edited by: Vijay Babu Dudla on Jan 20, 2009 2:03 AM
‎2009 Jan 20 7:06 AM
Hi
REPORT YJAN13_SS_DATE.
data: year(4) type c,
month(10) type c,
date(2) type c.
CALL SELECTION-SCREEN 100.
SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE T001.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE T002.
PARAMETERS p_date LIKE SY-DATUM DEFAULT SY-DATUM . " Select the date
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN END OF SCREEN 100.
INITIALIZATION.
T001 = 'DATE DISPLAY'.
T002 = 'DATE'.
START-OF-SELECTION.
year = p_date(4).
month = p_date+4(2). " Obtain the date, month and year
date = p_date+6(2).
case month. " Convert month to text
when '01'.
month = 'January'.
when '02'.
month = 'February'.
when '03'.
month = 'March'.
when '04'.
month = 'April'.
when '05'.
month = 'May'.
when '06'.
month = 'June'.
when '07'.
month = 'July'.
when '08'.
month = 'August'.
when '09'.
month = 'September'.
when '10'.
month = 'October'.
when '11'.
month = 'November'.
when '12'.
month = 'December'.
endcase.
write:/ date , '/' ,month , '/' ,year. "Write in desired format
You can also try Write with EDIT MASK options.
Also there is a function module:
CONVERT_DATE_TO_EXTERNAL that converts date from system storage format to user specified display format.
Hope this helps
Regards,
Jayanthi.K
‎2009 Jan 20 6:55 AM
‎2009 Jan 20 6:58 AM
Hi Sam,
If the date entered is like this: 20/01/2009, you need to read the Month and Year in to two seperate variables and then you need to concatenate the variables in to one.
E.g., lv_date = 20/01/2009.
lv_year = lv_date+6(4).
lv_month = lv_date+3(2).
Use FM: IDWT_READ_MONTH_TEXT to convert lv_month into characters.
then,
lv_new_date = concatenate lv_month lv_year separeted by '/'.Best Regards,
Ram.
‎2009 Jan 20 7:04 AM
use FM
DAY_ATTRIBUTES_GET
from the table day_attributes - get the value of DAY_STRING
and concatenate the same with year...
‎2009 Jan 20 7:06 AM
Hi
REPORT YJAN13_SS_DATE.
data: year(4) type c,
month(10) type c,
date(2) type c.
CALL SELECTION-SCREEN 100.
SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE T001.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE T002.
PARAMETERS p_date LIKE SY-DATUM DEFAULT SY-DATUM . " Select the date
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN END OF SCREEN 100.
INITIALIZATION.
T001 = 'DATE DISPLAY'.
T002 = 'DATE'.
START-OF-SELECTION.
year = p_date(4).
month = p_date+4(2). " Obtain the date, month and year
date = p_date+6(2).
case month. " Convert month to text
when '01'.
month = 'January'.
when '02'.
month = 'February'.
when '03'.
month = 'March'.
when '04'.
month = 'April'.
when '05'.
month = 'May'.
when '06'.
month = 'June'.
when '07'.
month = 'July'.
when '08'.
month = 'August'.
when '09'.
month = 'September'.
when '10'.
month = 'October'.
when '11'.
month = 'November'.
when '12'.
month = 'December'.
endcase.
write:/ date , '/' ,month , '/' ,year. "Write in desired format
You can also try Write with EDIT MASK options.
Also there is a function module:
CONVERT_DATE_TO_EXTERNAL that converts date from system storage format to user specified display format.
Hope this helps
Regards,
Jayanthi.K
‎2009 Jan 20 7:08 AM
Hi,
Check this one
If u give Date as 20090101
It'll give u 01JAN2009
CONVERSION_EXIT_IDATE_OUTPUT
‎2009 Jan 20 7:23 AM
Hi Sam,
Use the following code for your requirement:
DATA: w_date TYPE sy-datum,
w_month(2) TYPE c,
w_year(4) TYPE c,
w_date1(17) TYPE c,
w_mnthname(10) TYPE c.
INITIALIZATION.
w_date = sy-datum.
w_month = w_date+4(2).
w_year = w_date+0(4).
START-OF-SELECTION.
SELECT SINGLE monam FROM t015m INTO w_mnthname WHERE monum = w_month AND spras = sy-langu.
CONCATENATE w_mnthname '/' w_year INTO w_date1 SEPARATED BY space.
WRITE:/ w_date.
WRITE:/ w_date1.
w_date1 is the date format that you want as output.
Hope this will help.
Regards,
Nitin.
‎2009 Jan 20 7:38 AM
Hi,
DATA: ZTEMP(9).
data zmmm(12)
data zyyyy(4)
data zfinal (20)
CLEAR: ZTEMP, ZDD, ZMMM, ZYYYY.
CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
EXPORTING
INPUT = inpute_DATE
IMPORTING
OUTPUT = ZTEMP.
ZMMM = ZTEMP+0(3).
ZYYYY = ZTEMP+5(4).
concatenate zmmm '/' zyyyy into zfinal separated by space.
regards,
Dhan
‎2009 Jan 20 8:38 AM
hi
check this code
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETER : mydate LIKE sy-datum.
SELECTION-SCREEN END OF BLOCK B1.
data: year(4) type c,
month(2) type c,
date(2) type c,
new(5) type c.
year = mydate(4).
.
month = mydate+4(2).
date = mydate+6(2).
case month.
when '01'.
new = 'jan'.
when '02'.
new = ' feb'.
when '03'.
new = ' mar'.
when 4.
new = ' apr'.
when 5.
new = ' may'.
when 6.
new = ' june'.
when 7.
new = ' july'.
when 8.
new = ' aug'.
when 9.
new = ' sep'.
when 10.
new = ' oct'.
when 11.
new = ' nov'.
when 12.
new = ' dec'.
endcase
.
start-of-selection.
write : date , new, year.
regards
rajye
pls close the thread if its resolved
thank you
Edited by: Rajeshwari P on Jan 20, 2009 9:39 AM
‎2009 Jan 20 9:08 AM
Hi Sam,
Hope this helps you.
Split the date into month and year. For eg u want t0 convert 01/29/2009 to the December/2009 format then split first take month into a variable.
month = date+4(2).
year = date+7(4).
Now get the month description from the T247 table.
select ltx into month_des from t247 where mnr = month.
concatenate monthdesc year into l_date separated by '/'.
Regards
Madhu
‎2009 Jan 20 9:55 AM
HI,
This code will fulfill your requirement.
data: date like SY-DATUM,
dis_date type string,
month(10) type c.
date = SY-DATUM.
CASE date+4(2).
WHEN '01'.
month = 'January'.
WHEN '02'.
month = 'February'.
WHEN '03'.
month = 'March'.
WHEN '04'.
month = 'April'.
WHEN '05'.
month = 'May'.
WHEN '06'.
month = 'June'.
WHEN '07'.
month = 'July'.
WHEN '08'.
month = 'August'.
WHEN '09'.
month = 'September'.
WHEN '10'.
month = 'October'.
WHEN '11'.
month = 'November'.
WHEN '12'.
month = 'December'.
endcase.
concatenate month '/' date+4(2) into dis_date IN CHARACTER MODE.
condense dis_date.
write: dis_date.