on 04-07-2015 4:24 AM
hello all,
I have an oracle based source system and i have created DB Connect datasources for that in SAP BW.
I have a time field which is coming in 24hour format and i would want to convert that into 12 hour format.
issues faced -- when time in source is 12:08:19 AM, in BW it is converted into 240819 which is not plausible.
please suggest how to correct this error? is there a functional module for the same?
Thanks!
Tanu
Looks like it is the opposite here: the incoming data is in 12 hr format (i.e. with AM/PM) and BW requires it to be in 24-hr.
If the incoming data comes exactly in the format "12:08:19 AM", then in the DataSource, model it as a 11-char field, not as a Date field.
Map it to your date field in the transformation and use the below code in the field routine to convert.
DATA: ls_input type c length 11, hh type n length 2, mm type n length 2, ss type n length 2 .
ls_input = source_fields-<<the input field name>>.
hh = ls_input(2).
mm = ls_input+3(2).
ss = ls_input+6(2).
if hh = 12.
hh = 00.
endif.
if ls_input+9(2) = 'PM'.
hh = hh + 12.
endif.
concatenate hh mm ss into RESULT.
Regards,
Suhas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hello Suhas,
thanks for your reply...
May be i did not write the question correct...:(
1. in the non sap views, i get data in 24hour format
2. hence, in the db connect datasources in sap bw, i get data in 24hour format
so in this case, when the data is 12:08:19 AM, i get it as 240819 in the views/datasource
So, need to change it to 12 hour format in SAP BW to correct this error.
So if you get "240819" in the datasource itself, then in the transformation routine write this:
DATA: ls_input type c length 11, hh type n length 2, mmss type n length 6.
ls_input = source_fields-<<the input field name>>.
hh = ls_input(2).
mmss = ls_input+2(4).
if hh = 24.
hh = 00.
endif.
concatenate hh mmss into RESULT.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.