10-17-2008 5:08 AM
Hi All,
In TCURR table GDATU (Date As of Which the Exchange Rate Is Effective) field is in inverted date format. I want to convert it to normal date format and use it in an BI end routine.
Can you please check the code below and let me know if there are any errors.
TABLES: TCURR.
DATA: tcurr_tab TYPE TABLE OF tcurr.
FIELD-SYMBOLS
<tcurr_wa> TYPE tcurr.
SELECT gdatu FROM tcurr INTO TABLE tcurr_tab.
SORT tcurr_tab BY gdatu.
LOOP AT tcurr_tab ASSIGNING <tcurr_wa>.
CONVERT INVERTED-DATE <tcurr_wa>-gdatu
INTO DATE <tcurr_wa>-gdatu.
ENDLOOP.
Thanks,
Sri Arun Prian
10-17-2008 5:28 AM
one more correction
REPORT ZTEST.
TABLES: TCURR.
DATA: tcurr_tab TYPE TABLE OF tcurr.
data: date_normal type sy-datum.
FIELD-SYMBOLS
<tcurr_wa> TYPE tcurr.
SELECT gdatu FROM tcurr INTO corresponding fields of
TABLE tcurr_tab.
SORT tcurr_tab BY gdatu.
LOOP AT tcurr_tab ASSIGNING <tcurr_wa>.
break-point.
CONVERT INVERTED-DATE <tcurr_wa>-gdatu
INTO DATE date_normal. "you need to move that to normal date field
write:/ date_normal. "you need to take a normal date field
ENDLOOP.
10-17-2008 5:17 AM
10-17-2008 5:20 AM
Hi,
Use FM CONVERT_DATE_TO_EXTERNAL as follows,
Data : date_out(10) type c,
date_in type d.
date_in = '20081017'.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = date_in
IMPORTING
DATE_EXTERNAL = date_out
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2.
Remember that you cannot store external format back to your date variable as it is 10 characters long while date is only 8 characters long.
Regards
Karthik D
10-17-2008 5:25 AM
as i told you yesterday, the statement is obsolete. just keep in mind. apart from that there is a correction to your code.
SELECT gdatu FROM tcurr
INTO corresponding fields of "add this
TABLE tcurr_tab.
10-17-2008 5:28 AM
one more correction
REPORT ZTEST.
TABLES: TCURR.
DATA: tcurr_tab TYPE TABLE OF tcurr.
data: date_normal type sy-datum.
FIELD-SYMBOLS
<tcurr_wa> TYPE tcurr.
SELECT gdatu FROM tcurr INTO corresponding fields of
TABLE tcurr_tab.
SORT tcurr_tab BY gdatu.
LOOP AT tcurr_tab ASSIGNING <tcurr_wa>.
break-point.
CONVERT INVERTED-DATE <tcurr_wa>-gdatu
INTO DATE date_normal. "you need to move that to normal date field
write:/ date_normal. "you need to take a normal date field
ENDLOOP.
10-17-2008 6:13 AM