This is a sample routine to write in the transformations for converting the date format from oracle date format to SAP date format while using 'DBCONNECT' source system.
******************************************************************************************************************************************************************
Note:
While creating the datasource , in the proposal tab change the format of the source field from " Date-DATS" to "Char" and the length of the field should be changed to 11 atleast. Otherwise you will get the data in PSA as "-0.EP.24-S" instead of "24-SEP-09" which leads you to wrong formats.
Here my source field is DOC_DATE. So, Just change the source field in the statement "P_DATE = SOURCE_FIELDS-DOC_DATE." as per your requirement.
******************************************************************************************************************************************************************
*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
DATA P_DATE(11) TYPE C.
DATA: M1(3) TYPE C,
D1(2) TYPE C,
Y1(2) TYPE C,
D2(11) TYPE C.
P_DATE = SOURCE_FIELDS-DOC_DATE.
if P_DATE NE ''.
D1 = P_DATE+0(2).
M1 = P_DATE+3(3).
Y1 = P_DATE+7(2).
IF M1 = 'JAN'.
M1 ='01'.
ELSEIF M1 = 'FEB'.
M1 = '02'.
ELSEIF M1 = 'MAR'.
M1 = '03'.
ELSEIF M1 = 'APR'.
M1 = '04'.
ELSEIF M1 = 'MAY'.
M1 = '05'.
ELSEIF M1 = 'JUN'.
M1 = '06'.
ELSEIF M1 = 'JUL'.
M1 = '07'.
ELSEIF M1 = 'AUG'.
M1 = '08'.
ELSEIF M1 = 'SEP'.
M1 = '09'.
ELSEIF M1 = 'OCT'.
M1 = '10'.
ELSEIF M1 = 'NOV'.
M1 = '11'.
ELSEIF M1 = 'DEC'.
M1 = '12'.
endif.
CONCATENATE '20' Y1 M1 D1 INTO P_DATE.
RESULT = P_DATE.
else.
RESULT = '00000000'.
endif.
*$*$ end of routine - insert your code only before this line *-*
******************************************************************************************************************************************************************
Note:
While creating the datasource , in the proposal tab change the format of the source field from " Date-DATS" to "Char" and the length of the field should be changed to 11 atleast. Otherwise you will get the data in PSA as "-0.EP.24-S" instead of "24-SEP-09" which leads you to wrong formats.
Here my source field is DOC_DATE. So, Just change the source field in the statement "P_DATE = SOURCE_FIELDS-DOC_DATE." as per your requirement.
******************************************************************************************************************************************************************
*$*$ begin of routine - insert your code only below this line *-*
... "insert your code here
DATA P_DATE(11) TYPE C.
DATA: M1(3) TYPE C,
D1(2) TYPE C,
Y1(2) TYPE C,
D2(11) TYPE C.
P_DATE = SOURCE_FIELDS-DOC_DATE.
if P_DATE NE ''.
D1 = P_DATE+0(2).
M1 = P_DATE+3(3).
Y1 = P_DATE+7(2).
IF M1 = 'JAN'.
M1 ='01'.
ELSEIF M1 = 'FEB'.
M1 = '02'.
ELSEIF M1 = 'MAR'.
M1 = '03'.
ELSEIF M1 = 'APR'.
M1 = '04'.
ELSEIF M1 = 'MAY'.
M1 = '05'.
ELSEIF M1 = 'JUN'.
M1 = '06'.
ELSEIF M1 = 'JUL'.
M1 = '07'.
ELSEIF M1 = 'AUG'.
M1 = '08'.
ELSEIF M1 = 'SEP'.
M1 = '09'.
ELSEIF M1 = 'OCT'.
M1 = '10'.
ELSEIF M1 = 'NOV'.
M1 = '11'.
ELSEIF M1 = 'DEC'.
M1 = '12'.
endif.
CONCATENATE '20' Y1 M1 D1 INTO P_DATE.
RESULT = P_DATE.
else.
RESULT = '00000000'.
endif.
*$*$ end of routine - insert your code only before this line *-*