cancel
Showing results for 
Search instead for 
Did you mean: 

How to write ABAP ROUTINE

Former Member
0 Kudos

Hi,

I have product id with the format 9624-6569-5856 in data source, How shold I write a routine to remove the Hyphen .

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

You can write this in the object level routine or the start routine in the transformations.

Try this.

DATA: string1 type string,

string2 type string.

string1 = '9624-6569-5856'.

REPLACE string1 WITH space INTO string2.

CONDENSE string2.

Finally string2 is your o/p.

Hope this helps.

thanks,

rahul

Former Member
0 Kudos

Try the following code .. modify it according to your source data type.

Data:

ZINPUT1 Type String,

ZINPUT2 Type String,

ZINPUT3 Type String,

ZINPUT4 Type String,

ZOUTPUT Type String.

ZINPUT1 = '9624-6569-5856'.

split zinput1 At '-' into ZINPUT2 ZINPUT3 ZINPUT4.

Concatenate ZINPUT2 ZINPUT3 ZINPUT4 into Zoutput.

write zoutput.

Regards,

Srivatsan.S