2008 May 06 5:37 AM
Hi All,
I have an internal table with a field 'fdate'.The date comes in this field in the format 'Apr292008'.
Now I want this date to be converted into '04292008' format.
Is There any means to do this.
Or is there any function module to do so??
Kindly suggest.
Thank You.
Hi All,
I have an internal table with a field 'fdate'.The date comes in this field in the format 'Apr292008'.
Now I want this date to be converted into '04292008' format.
Is There any means to do this.
Or is there any function module to do so??
Kindly suggest.
Thank You.
2008 May 06 5:43 AM
Hi Rohan,
Try this FM
CONVERT_DATE_TO_EXTERNAL
Converts date from system storage format to users specified display format .
Reward if helpfull :):)
2008 May 06 5:44 AM
Hi,
You write one case statements for each month & modify with respective month number.
Like as follows.
DATA : DATE(9).
DATA : VAR(3).
DATA : VAR1(2) TYPE N.
DATE : 'Apr292008'.
VAR = DATE+(3).
CASE VAR.
WHEN 'JAN.
VAR1 = '01'.
.......
.........
ENDCASE.
AND CONCATENATE THE MONTH NUMBER WITH YOUR DATE
IT WILL WORK.
regards,
Madan.
2008 May 06 5:47 AM
The Simplest way is to go with the below logic.
" fdate will contain date in MMMDDYYYY format
l_date = fdate+0(3).
case l_date.
when 'Jan': l_mon = '01'.
when 'Feb': l_mon = '02'.
when 'Mar': l_mon = '03'.
when 'Apr': l_mon = '04'.
when 'May': l_mon = '05'.
when 'Jun': l_mon = '06'.
when 'Jul': l_mon = '07'.
when 'Aug': l_mon = '08'.
when 'Sep': l_mon = '09'.
when 'Oct': l_mon = '10'.
when 'Nov': l_mon = '11'.
when 'Dec': l_mon = '12'.
endcase.
concatenate l_mon fdate+3 into l_fdate.
" l_fdate will contain the date in MMDDYYYY format.
Hope this helps.
Thanks,
Balaji
2008 May 06 5:50 AM
HI,
use the code in internal table like below.
TABLES:t015m.
DATA:dat(15) VALUE 'Apr292008'.
DATA:mon(2).
SELECT * FROM t015m WHERE spras = 'E'.
TRANSLATE dat(3) to upper case.
TRANSLATE t015m-monam(3) to upper case.
IF t015m-monam(3) = dat(3).
mon = t015m-monum.
exit.
ENDIF.
ENDSELECT.
CONCATENATE mon dat+3 INTO dat.
write:/ dat.
rgds,
bharat.
2008 May 06 5:51 AM
Hi,
Use these function modules
CONVERT_DATE_BY_PERIOD_INPUT
CONVERT_DATE_BY_PERIOD_OUTPUT
It will usefull try once.
First use convert_date_input
After use convert_date_by_period_output.
it wil get output in your format from apr292008 to 04.29.2008.
*reward points
Edited by: jeevitha on May 6, 2008 10:22 AM
2008 May 06 5:57 AM
Try this sample code:
DATA: str(9) VALUE 'Apr292008'.
DATA: mon1(3).
DATA: mon(2).
WRITE: /1 str.
translate str+0(3) TO UPPER CASE.
mon1 = str+0(3).
SELECT SINGLE mnr FROM t247 INTO mon WHERE ktx EQ mon1 AND spras EQ sy-langu.
REPLACE FIRST OCCURRENCE OF mon1 IN str WITH mon.
WRITE: /1 str.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |