cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Date format conversion issue in BW

Former Member
0 Likes
2,351

Hi Experts,

I have 2 custom date fields for which I'm getting the values from oracle database through DB Connect in MM/DD/YYYY format (e.g values 10/20/2007 and 3/5/2007). But I want to convert this date format into SAP BW internal format (YYYYMMDD). I've defined the above 2 date fields in BW with a data type DATS (8 digits length) and wrote a code in the TRs as below. Both these fields are defined as a character with a length of 10 in the oracle system.

data zresult(10) type C.

data : lv_day(2) type c,

lv_month(2) type c,

lv_year(4) type c.

zresult = tran_structure-spring_norm_date.

lv_day = zresult+3(2).

lv_month = zresult+0(2).

lv_year = zresult+6(4).

CONCATENATE lv_year lv_month lv_day into result.

But still the data load is getting failed due to wrong date format and error in the routine. It says the value for the characteristic 0DATE doesn't have 8 spaces. Is there anything wrong with the routine?

Could someone please share some inputs on this.

Thanks,

Krish

View Entire Topic
Former Member
0 Likes

data zresult(10) type c.

data : lv_day(2) type c,

lv_month(2) type c,

lv_year(4) type c.

zresult = tran_structure-spring_norm_date.

lv_day = zresult+3(2).

lv_month = zresult+0(2).

lv_year = zresult+6(4).

result(8)

CONCATENATE lv_year lv_month lv_day into result.

Include this logic and see if it works.

If it doesn't try declaring result as type sy-datum

Edited by: BG on Apr 25, 2008 10:44 AM