on 01-23-2018 3:49 PM
Hi all,
Users want to add special characters to their members. For example convert 120000050130 to 1_20000.501.30 The logic is after every first digit or character, insert "_", then after the next 5 digits, insert ".", after the next 3 digits/characters, insert another "."
Regards
Jordan
First you need to convert %eternal% to string:
js: %external%.toString
Then
js:
%external%.toString().slice(0,1)+"_"+%external%.toString().slice(1,6)+"."+%external%.toString().slice(7,10)+"."+%external%".toString().slice(10)
You can test it here:
<script>
alert("120000050130".toString().slice(0,1)+"_"+"120000050130".toString().slice(1,6)+"."+"120000050130".toString().slice(7,10)+"."+"120000050130".toString().slice(10))
</script>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim,
I appreciate your help. The script is working when i test it online but on the conversion it is not writing any records. The transformation and conversion files are as below:
Whilst giving the following error;
Java scription JS: %EXTERNAL%.toString().slice(0,1)+"_"+%EXTERNAL evaluation errorRegards
Jordan
I am restricting to only a few master records I know are in that format. The log file as below:
/CPMB/MODIFY completed in 0 seconds /CPMB/BW_IOBJ_MASTER_SOURCE completed in 0 seconds /CPMB/BW_IOBJ_TEXT_SOURCE completed in 1 seconds /CPMB/MERGE_IOBJ_MD_DATA completed in 0 seconds /CPMB/IOBJ_SOURCE_MD_CONVERT completed in 0 seconds /CPMB/SPLIT_IOBJ_MD_TXT_DATA completed in 0 seconds /CPMB/BPC_MASTER_DATA_TARGET completed in 0 seconds /CPMB/BPC_TXT_DATA_TARGET completed in 0 seconds /CPMB/CLEAR completed in 0 seconds [Selection] -------------------------------------------------------------- INFOOBJECT = 0WBS_ELEMT SELECTION = <?xml version="1.0" encoding="utf-16"?><Selections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Selection Type="Attribute"><Attribute><ID>0WBS_ELEMT</ID><Operator>1</Operator><LowValue>A304506BAHA61</LowValue><HighValue /></Attribute><Attribute><ID>0WBS_ELEMT</ID><Operator>1</Operator><LowValue>A304506BZAA03</LowValue><HighValue /></Attribute><Attribute><ID>0WBS_ELEMT</ID><Operator>1</Operator><LowValue>A304506BZAA11</LowValue><HighValue /></Attribute></Selection><Selection Type="Hierarchy" ImportText="1" /><Selection Type="Language" TextType="2"><Language>E</Language></Selection><Selection Type="AttributeList"><Attribute>0WBS_ELEMT</Attribute><Attribute>0APPR_YEAR</Attribute><Attribute>0BUS_AREA</Attribute><Attribute>0CH_ON</Attribute><Attribute>0COMP_CODE</Attribute><Attribute>0COSTCENTER</Attribute><Attribute>0CO_AREA</Attribute><Attribute>0CPR_GUID</Attribute><Attribute>0CPR_PSGUID</Attribute><Attribute>0CREATEDON</Attribute><Attribute>0CRM_MKTELM</Attribute><Attribute>0FIELDKEY</Attribute><Attribute>0IM_CORPOR</Attribute><Attribute>0IM_SIZE</Attribute><Attribute>0INV_REASON</Attribute><Attribute>0LOGSYS</Attribute><Attribute>0OBJ_CURR</Attribute><Attribute>0PLANT</Attribute><Attribute>0PRIORITY</Attribute><Attribute>0PROFIT_CTR</Attribute><Attribute>0PROG_DEF_S</Attribute><Attribute>0PROG_POS</Attribute><Attribute>0PROJECT</Attribute><Attribute>0PS_APPLNO</Attribute><Attribute>0PS_LEVEL</Attribute><Attribute>0PS_PRJTYPE</Attribute><Attribute>0PS_RESPNO</Attribute><Attribute>0PS_USR1</Attribute><Attribute>0PS_USR10</Attribute><Attribute>0PS_USR11</Attribute><Attribute>0PS_USR12</Attribute><Attribute>0PS_USR2</Attribute><Attribute>0PS_USR3</Attribute><Attribute>0PS_USR4</Attribute><Attribute>0PS_USR5</Attribute><Attribute>0PS_USR5UNT</Attribute><Attribute>0PS_USR6</Attribute><Attribute>0PS_USR6UNT</Attribute><Attribute>0PS_USR7</Attribute><Attribute>0PS_USR7CUR</Attribute><Attribute>0PS_USR8</Attribute><Attribute>0PS_USR8CUR</Attribute><Attribute>0PS_USR9</Attribute><Attribute>0PS_XSTAT</Attribute><Attribute>0REQU_CCTR</Attribute><Attribute>0RESP_CCTR</Attribute><Attribute>0SCOPE</Attribute><Attribute>0SOURSYSTEM</Attribute><Attribute>0STATUSSYS0</Attribute><Attribute>0WBS_ELM_EX</Attribute><Attribute>ZBASSQ</Attribute><Attribute>ZGENMAN</Attribute><Attribute>ZGOVPLAN</Attribute><Attribute>ZLINEMAN</Attribute><Attribute>ZMEASOBJ</Attribute><Attribute>ZNEWEXPR</Attribute><Attribute>ZPIDPREF</Attribute><Attribute>ZPROCMAN</Attribute><Attribute>ZPROJCHAM</Attribute><Attribute>ZPROVPLAN</Attribute><Attribute>ZSCOAGUID</Attribute><Attribute>ZSECTPLAN</Attribute></Selection><KeyDate>20180124</KeyDate><Relation><Value Right="Hierarchy" Left="Attribute">1</Value></Relation></Selections> WRITEMODE = 2 FORMAT = Yes TRANSFORMATION = \ROOT\WEBFOLDERS\MSUNDUZI\BUDGET\DATAMANAGER\TRANSFORMATIONFILES\PROJECT_ATTR.xls DIMNAME = PROJECT CLEAR_ALL = No [Message] -------------------------------------------------------------- Task name MASTER DATA SOURCE: Record count: 3 Task name TEXT SOURCE: Record count: 3 Task name CONVERT: No 1 Round: Java scription JS: %EXTERNAL%.toString().slice(0,1)+"_"+%EXTERNAL evaluation error Java scription JS: %EXTERNAL%.toString().slice(0,1)+"_"+%EXTERNAL evaluation error Java scription JS: %EXTERNAL%.toString().slice(0,1)+"_"+%EXTERNAL evaluation error Reject count: 3 Record count: 3 Skip count: 0 Accept count: 0 Task name MASTER DATA TARGET: Submit count: 0 Task name TXT DATA TARGET: Submit count: 0 model: BUDGET. Package status: WARNING
If you open ANY JavaScript tutorial you will find function:
substring(start [, end])
or
substr(start [, length])
or
slice(start [, end])
And you can test your code on any JavaScript test page!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry, but you didn't accepted my answer in previous question!
https://answers.sap.com/questions/404916/invalid-special-characters-in-transformation-and-c.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any online JavaScript tutorial will help!
Or do you want me to do your job for free?
Uhm...I think he wants the second option, Vadim. You have been FAR more patient than I would be. haha
Hello,
Please review KBA 1448836 for permitted characters. This KBA covers valid characters for all areas of BPC, anything outside it or stated as invalid will not be supported.
Best Regards,
Leila Lappin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
15 | |
4 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.