cancel
Showing results for 
Search instead for 
Did you mean: 

Removal of commas when extracting Master Data to File

Former Member
0 Kudos

Hi,

I want to extract SAP BW master data to file but make sure commas are removed from any text. Otherwise the file which which has comma delimiters would be incorrect.

I am using "js: %external%.toString().replace(/,/g,"")" in the conversion file in EXTERNAL column. INTERNAL is set to "*",

I refer to the conversion file in the transformation file

"DESCRIPTION=EXCL_COMMAS.xls"

Doesnt seem to work.


Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

former_member186338
Active Contributor
0 Kudos

And the correct JavaScript syntax to remove comma's will be:

js: %external%.toString().replace( /\,/g, "")

You have to use "\," instead of ","

Vadim

Former Member
0 Kudos

Hi, the javascript command didnt seem to work?

The script is placed in INTERNAL, that correct? EXTERNAL is set to "*" Formula is empty in the conversion file

Cheers,

former_member186338
Active Contributor
0 Kudos

It works!

You have to do everything properly! Steps to reproduce:

Transformation file:

*OPTIONS

FORMAT = DELIMITED

HEADER = YES

DELIMITER = ,

AMOUNTDECIMALPOINT = .

SKIP = 0

SKIPIF =

VALIDATERECORDS=YES

CREDITPOSITIVE=YES

MAXREJECTCOUNT=

ROUNDAMOUNT=2

OUTPUTDELIMITER=,

SPECIFICMAPPING=YES

*MAPPING

ID=ID

EVDESCRIPTION=EVDESCRIPTION

*CONVERSION

EVDESCRIPTION=INACCT.XLS

Conversion file (INACCT.XLS):

EXTERNAL      INTERNAL                                                    FORMULA

*                        js:%external%.toString().replace( /\,/g, "")   

And result - no commas in EVDESCRIPTION

Vadim

Former Member
0 Kudos

Hi,

for some reason i am still not getting the desired result. For example, I have the columns ID, EVDESCRIPTION, ACCTYPTE.

The EVEDESCRIPTION has "Expenses, Admin,Office"

Then the file outputs - effectively missing ACCTYPE and viewing the :

1000,Expenses, Admin.

I know you mentioned using "TAB" as the delimeter. I think i had tried that but had problems. I will try again as this is correct way of doing what i am trying to do. Do i just change the DELIMITER = TAB and the OUTPUTDELIMITER=TAB too?

Is there a way i can use the delimiter ¦ (pipe)

Cheers

former_member186338
Active Contributor
0 Kudos

Hi Leo,

The sample I provide in my previous post was tested on the real system! Please, reproduce it with just 2 fields - ID and EVDESCRIPTION. Provide all screenshots! (transformation file, conversion file, export result...) If it's not working - then there is something wrong.

"Do i just change the DELIMITER = TAB and the OUTPUTDELIMITER=TAB too?" - the key is OUTPUTDELIMITER, you are exporting data!!!

Pipe: OUTPUTDELIMITER=|

Vadim

Former Member
0 Kudos

Hi,

not sure why the removal of commas didnt work for me. Went for the pipe delimeter and this resolved the issue.

thanks for your help as always!

Answers (1)

Answers (1)

former_member186338
Active Contributor
0 Kudos

Hi Leo,

Strange idea "Otherwise the file which which has comma delimiters would be incorrect." - use file with TAB delimiter

Vadim