cancel
Showing results for 
Search instead for 
Did you mean: 

Truncate time stamp in date using SLT

Former Member
0 Kudos

hello Experts,

i am getting time stamp from my db dd/mm/yyyy hh/mm/ss AM or PM

Before loading the data to hana using slt i would like to truncate the date from source to

dd/mm/yyyy

could any one please how to go abt this.

Thanks & Regards,

Kishore

Accepted Solutions (1)

Accepted Solutions (1)

former_member252769
Active Participant
0 Kudos

Hi Kishore,

This is possible.

Please use the transformation settings for this.

Regards

BJ

former_member252769
Active Participant
0 Kudos

Hi Kishore,

Here's how u can do it via transformation settings:

- Go to tcode- LTRS.

- Add Rule for table you are replication.

- Select "field-related" type rule and select field.

- Mention the field in import parameter.

- In line of code - mention your code.

For ex. if you want to use only first 5 char from VPSTA field of MARA

Import parameter: VPSTA.

Code: Data x type char50. x = I_VPSTA_1. E_VPSTA = x+0(5).

Hope helps.

Regards

BJ

Former Member
0 Kudos

Hello BJ,

I was able to create the formula in LTRS, dropped data from table and reloaded

but still it is not getting truncated,

Data x type char50. x = I_ADT_INS_DTTM. E_ADT_INS_DTTM = x+0(10).


Thanks & Regards,

Kishore

former_member252769
Active Participant
0 Kudos

Hi Kishore,

I got it, use this.

- Modify the data type of field in "Rule assignment" for table, change it to "CHAR 10".

- Put import parameter: <field>

- Line of code: CONVERT TIME STAMP I_<field>_1 TIME ZONE '<timezone>' INTO DATE E_<field>.

for example: CONVERT TIME STAMP I_TIMESTAMP_1 TIME ZONE 'UTC' INTO DATE E_TIMESTAMP.

It will resolve your issue, let me know.

Cheers

BJ

former_member252769
Active Participant
0 Kudos

Hi Kishore

By any chance you have tested the solution?

Regards

BJ

Former Member
0 Kudos

Hi BJ,

Sorry for late reply, was sick and on leave, yes i did try the solution,

the code that u gave is not working, and its length is more than the length allowed

in ltrs tcode.

Thanks & Regards,

Kishore

former_member252769
Active Participant
0 Kudos

Hi Kishore,

I have simulated this in my system and its working.

The line code is of 72 char long, probably the field name is long in your case.

Regards

Former Member
0 Kudos

Hi BJ,

Is there any possible way to create alias for my table name in LTRS, i checked

we dont have any option to edit field name,

my code will be as follows.

CONVERT TIME STAMP I_ADT_INS_DTTM_1 TIME ZONE 'UTC+04:00' INTO DATE E_ADT_INS_DTTM

Thanks & Regards,

Kishore

Former Member
0 Kudos

Hi BJ,

I am trying a work around using program, which i found in below link

The problem i am facing it the data is getting populated with all 00000000

The program is given below, what am i doing wrong.

*&---------------------------------------------------------------------*

*&  Include           ZGT_TRUNCATE_DTTM

*&---------------------------------------------------------------------*

*Extract date and place it in DATS field

data: H_DTTM type dats.

CONCATENATE

<WA_S_ADT_INS_DTTM_CTRDTLS_O>-ADT_INS_DTTM(4)

<WA_S_ADT_INS_DTTM_CTRDTLS_O>-ADT_INS_DTTM+7(2)

<WA_S_ADT_INS_DTTM_CTRDTLS_O>-ADT_INS_DTTM+10(2)

INTO H_DTTM.

WA_R_ADT_INS_DTTM_CTRDTLS_O-INS_DTTM = H_DTTM.

*End of include

Thanks & Regards,

Kishore

former_member252769
Active Participant
0 Kudos

Hi Kishore,

Try to insert record in field symbol.

<WA_R_ADT_INS_DTTM_CTRDTLS_O>-INS_DTTM = H_DTTM.


Regards

Former Member
0 Kudos

Hello BJ,

yes it is already present in the code, but in the post i missed it,

and its still not working.

Thanks & Regards,

Kishore

Former Member
0 Kudos

Hello BJ,

I have  small doubt in which event should i make the code run, may be that

is causing error,

according to the post which i shared it BOR(Begin of rule.), but in new Version there is before of record,

Thanks & Regards,

Kishore

Former Member
0 Kudos

Hi BJ,

it got resolved thank you very much,

Thanks & Regards,

Kishore

Former Member
0 Kudos

Hello BJ,

I have a bigger problem now, i have 4 date fields in each table,

1 created date

2 updated date.

3 2nd updated date.

4 3rd updated date.

1). I have to edit all the fields in begin of record event and insert them in hana.(it doesnt allow to have two begin of record events in LTRS)

2). The second issue is for all the tables in my system, these fields are common, so all the 160 tables need this code to be implemented. that implies 160 programs or (160*4 which is not possible as begin of record is possible only once.)

is there any way i can make this dymanic for all tables in one program.

Thanks & Regards,

Kishore

Answers (0)