cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping exception

Bhargavakrishna
Active Contributor
0 Kudos

Hi Experts,

im facing issue in message mapping. i was unable to see the source message structure, under test tab, in message mapping.

When im trying to execute, it is showing the below error.

12:39:36 Start of test 

Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 10] in class com.sap.aii.mappingtool.flib7.TextFunctions method substring[, 0, 10, com.sap.aii.mappingtool.tf7.rt.Context@4e4caa50]
com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 10] in class com.sap.aii.mappingtool.flib7.TextFunctions method substring[, 0, 10, com.sap.aii.mappingtool.tf7.rt.Context@4e4caa50]
at com.sap.aii.mappingtool.tf7.rt.MethodImplementedIteratorHelper.executeMethod(MethodImplementedIteratorHelper.java:188)
at com.sap.aii.mappingtool.tf7.rt.FunctionWrapper.calculateCurrentValue(FunctionWrapper.java:106)
at com.sap.aii.mappingtool.tf7.rt.AbstractFunctionWrapper.cacheValue(AbstractFunctionWrapper.java:31)
at com.sap.aii.mappingtool.tf7.rt.AbstractFunctionWrapper.gotoNextContext(AbstractFunctionWrapper.java:41)
at com.sap.aii.mappingtool.tf7.AMappingProgram.processNode(AMappingProgram.java:318)
at com.sap.aii.mappingtool.tf7.AMappingProgram.processNode(AMappingProgram.java:412)
at com.sap.aii.mappingtool.tf7.AMappingProgram.start(AMappingProgram.java:514)
at com.sap.aii.mappingtool.tf7.Transformer.start(Transformer.java:138)
at com.sap.aii.mappingtool.tf7.AMappingProgram.transform(AMappingProgram.java:645)
at com.sap.aii.ibrep.server.mapping.exec.ExecuteXiMappingCommand.transformInternal(ExecuteXiMappingCommand.java:198)
at com.sap.aii.ibrep.server.mapping.exec.ExecuteXiMappingCommand.execute(ExecuteXiMappingCommand.java:95)
at com.sap.aii.ib.server.mapping.exec.CommandManager.execute(CommandManager.java:43)
at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:40)
at com.sap.aii.ibrep.server.mapping.MapServiceBean.execute(MapServiceBean.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:47)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:50)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:37)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_MethodRetry.invoke(Interceptors_MethodRetry.java:46)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:191)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:23)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:25)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:17)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:138)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at $Proxy1270.execute(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:240)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:462)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:69)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:72)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:43)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:999)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:59)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:55)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:328)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.aii.mappingtool.tf7.rt.MethodImplementedIteratorHelper.executeMethod(MethodImplementedIteratorHelper.java:177)
... 53 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 10
at java.lang.String.substring(String.java:1976)
at com.sap.aii.mappingtool.flib7.TextFunctions.substring(TextFunctions.java:180)
... 58 more
Root Cause:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.aii.mappingtool.tf7.rt.MethodImplementedIteratorHelper.executeMethod(MethodImplementedIteratorHelper.java:177)
at com.sap.aii.mappingtool.tf7.rt.FunctionWrapper.calculateCurrentValue(FunctionWrapper.java:106)
at com.sap.aii.mappingtool.tf7.rt.AbstractFunctionWrapper.cacheValue(AbstractFunctionWrapper.java:31)
at com.sap.aii.mappingtool.tf7.rt.AbstractFunctionWrapper.gotoNextContext(AbstractFunctionWrapper.java:41)
at com.sap.aii.mappingtool.tf7.AMappingProgram.processNode(AMappingProgram.java:318)
at com.sap.aii.mappingtool.tf7.AMappingProgram.processNode(AMappingProgram.java:412)
at com.sap.aii.mappingtool.tf7.AMappingProgram.start(AMappingProgram.java:514)
at com.sap.aii.mappingtool.tf7.Transformer.start(Transformer.java:138)
at com.sap.aii.mappingtool.tf7.AMappingProgram.transform(AMappingProgram.java:645)
at com.sap.aii.ibrep.server.mapping.exec.ExecuteXiMappingCommand.transformInternal(ExecuteXiMappingCommand.java:198)
at com.sap.aii.ibrep.server.mapping.exec.ExecuteXiMappingCommand.execute(ExecuteXiMappingCommand.java:95)
at com.sap.aii.ib.server.mapping.exec.CommandManager.execute(CommandManager.java:43)
at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:40)
at com.sap.aii.ibrep.server.mapping.MapServiceBean.execute(MapServiceBean.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:47)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:50)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:37)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_MethodRetry.invoke(Interceptors_MethodRetry.java:46)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:191)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:23)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:25)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:17)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:138)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at $Proxy1270.execute(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:240)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:462)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:69)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:72)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:43)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:999)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:59)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:55)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:328)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 10
at java.lang.String.substring(String.java:1976)
at com.sap.aii.mappingtool.flib7.TextFunctions.substring(TextFunctions.java:180)
... 58 more
Root Cause:
java.lang.StringIndexOutOfBoundsException: String index out of range: 10
at java.lang.String.substring(String.java:1976)
at com.sap.aii.mappingtool.flib7.TextFunctions.substring(TextFunctions.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.aii.mappingtool.tf7.rt.MethodImplementedIteratorHelper.executeMethod(MethodImplementedIteratorHelper.java:177)
at com.sap.aii.mappingtool.tf7.rt.FunctionWrapper.calculateCurrentValue(FunctionWrapper.java:106)
at com.sap.aii.mappingtool.tf7.rt.AbstractFunctionWrapper.cacheValue(AbstractFunctionWrapper.java:31)
at com.sap.aii.mappingtool.tf7.rt.AbstractFunctionWrapper.gotoNextContext(AbstractFunctionWrapper.java:41)
at com.sap.aii.mappingtool.tf7.AMappingProgram.processNode(AMappingProgram.java:318)
at com.sap.aii.mappingtool.tf7.AMappingProgram.processNode(AMappingProgram.java:412)
at com.sap.aii.mappingtool.tf7.AMappingProgram.start(AMappingProgram.java:514)
at com.sap.aii.mappingtool.tf7.Transformer.start(Transformer.java:138)
at com.sap.aii.mappingtool.tf7.AMappingProgram.transform(AMappingProgram.java:645)
at com.sap.aii.ibrep.server.mapping.exec.ExecuteXiMappingCommand.transformInternal(ExecuteXiMappingCommand.java:198)
at com.sap.aii.ibrep.server.mapping.exec.ExecuteXiMappingCommand.execute(ExecuteXiMappingCommand.java:95)
at com.sap.aii.ib.server.mapping.exec.CommandManager.execute(CommandManager.java:43)
at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:40)
at com.sap.aii.ibrep.server.mapping.MapServiceBean.execute(MapServiceBean.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.engine.services.ejb3.runtime.impl.RequestInvocationContext.proceedFinal(RequestInvocationContext.java:47)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:166)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatesTransition.invoke(Interceptors_StatesTransition.java:19)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Resource.invoke(Interceptors_Resource.java:50)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.doWorkWithAttribute(Interceptors_Transaction.java:37)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_Transaction.invoke(Interceptors_Transaction.java:21)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_MethodRetry.invoke(Interceptors_MethodRetry.java:46)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:191)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_StatelessInstanceGetter.invoke(Interceptors_StatelessInstanceGetter.java:23)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_SecurityCheck.invoke(Interceptors_SecurityCheck.java:25)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.Interceptors_ExceptionTracer.invoke(Interceptors_ExceptionTracer.java:17)
at com.sap.engine.services.ejb3.runtime.impl.AbstractInvocationContext.proceed(AbstractInvocationContext.java:179)
at com.sap.engine.services.ejb3.runtime.impl.DefaultInvocationChainsManager.startChain(DefaultInvocationChainsManager.java:138)
at com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler.invoke(DefaultEJBProxyInvocationHandler.java:164)
at $Proxy1270.execute(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sap.engine.services.rmi_p4.P4DynamicSkeleton.dispatch(P4DynamicSkeleton.java:240)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:462)
at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:69)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:72)
at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:43)
at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:999)
at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:59)
at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:55)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:328)
Runtime exception when processing target-field mapping /ns0:MT_Time_Receiver_01/Date; root message: Exception:[java.lang.StringIndexOutOfBoundsException: String index out of range: 10] in class com.sap.aii.mappingtool.flib7.TextFunctions method substring[, 0, 10, com.sap.aii.mappingtool.tf7.rt.Context@4e4caa50]

12:39:36 End of test    

Please help me on this.

Accepted Solutions (0)

Answers (8)

Answers (8)

Bhargavakrishna
Active Contributor
0 Kudos

thank u all

Bhargavakrishna
Active Contributor
0 Kudos

This message was moderated.

former_member184789
Active Contributor
0 Kudos

Hi,

I would too suggest you to catch the issue if the source field are empty or have lesser length as in case your mapping will give exception. Before the substring function, you need to apply condition that if length(Standard Mapping function) is greater than say 10, then substing (0,10) to the target

, else map blank constant value to target..This you will be able to do with the standard mapping functions..

Bhargavakrishna
Active Contributor
0 Kudos

Dear all,

i have tested With the payload. i closed the ESR and checked but it is not showing the fields under test tab, to give the inputs to test, whether mapping is working or not? The length of the field is coming more than 11. you can see the same in the below payload.please have a look

     

The payload is showing the correct data. but in mapping, it is showing the empty tags. my requirement is to separate the date and time at the target side. from the field at source side. I.e

Source field : EventDate contains the date and time, like shown in the above payload. i want to split that column into date and time columns at the target side. for that i have used sub-string function to read the first 10 characters from the field and 12 to 17 for time function as i required only the HH:MM.

some one please give a resolution for this.

Former Member
0 Kudos

Hi,

I can see only one record is coming. If so then why you not manually put the data in mapping editor.

Also for retieving you need to use - substring(0,10)

If you need only HH:MM then you should use - substring(12,17)

Check if any date coming less than this string lenght, it will throw error

Regards,

Ashish

former_member184789
Active Contributor
0 Kudos

Hi,

Did you notice one thing, the payload in ESR is different from the one in SXMB_MONI. In ESR you are not having resultset & row. Based on your structure, the input should be like:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_Time_Sender_01 xmlns:ns0="URL://TimeRecordingSystem_01">

<empCode>93797</empCode>

<EventID>616</EventID>

<EventDate>2013-03-25 08:53:12.0</EventDate>

</ns0:MT_Time_Sender_01

Do one thing, for the three source fields i.e empCode,EventID & EventDate, give the three values i.e 97937,616 & 2013-03-25 08:53:12.0 respectively in mapping test tab & take the XML from there with the above structure; then you send this XML from the sender.

Former Member
0 Kudos

Hi,

Adarsh is correct that there is a mismatch in the structure defined & the value coming as source XML payload.

Check the issue why there is mismatch with the expected input xml data.

Regards,

Ashish

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Bhargavm

When you are playing with substring function then you have to build stable mapping logic.

1)Make sure that event Data legnth always <=17 ,if lenght less than 17 then you need to check length first then use If else block.

2)If time is optional then make sure that Event data lenght always <=12 and use mapping logic

EventData---->Substring(12,0)----->time.

Thank you,

Raj

Bhargavakrishna
Active Contributor
0 Kudos

It is not taking any inputs. it is throwing the same error. is there any other way to do the mapping with the required format.

i need the time and date should be saved in separate fields at the target side.

Former Member
0 Kudos

Hi Bharghav,

You can directly use dateTransform function to map date and time from Event date field with out using substring function. Check the length before passing the value.

Pass input date time format and in output format mention only the desired date or time for the corresponding field.

Thanks,

Pranav

Former Member
0 Kudos

Hi ,

Follow the below instead of complicating the things.

1)Check with sender system folks what are the possibilities of date format that you can expect .

2)For example if they say date you can expect in first ten characters and rest is optional ,then follow the below approach.

i/p-substringfn(0,10)-->date.

i/p------------------------------>replacestringfn()-->trim-->output

i/p-substringfn(0,10)---/

constant("")--------------/

Regards

Venkat

Former Member
0 Kudos

Hi,

To make your code robust,

Check the below condition before applying substring fn.

Lengthfn(text) >10 .If yes ,then go for substring

Regards

Venkat

former_member184789
Active Contributor
0 Kudos

Hi,

As the error says the substring(0,10) function has failed for field /ns0:MT_Time_Receiver_01/Date. You have used substring either in a UDF or the standard mapping functions for substring. Apply the condition before the substring that if the length is equal or greater than 11, then it has to substring the given value. Since you are doing a substring of a value for fetching the first 11 characters, it has failed because it got a value which has less than 11 characters. Check the input which came for this target field.

Bhargavakrishna
Active Contributor
0 Kudos

Adarsh, thanks for your reply.. i have verified the input, it is more than 11 characters. help me on this.

you can find my issue details, below.

Former Member
0 Kudos

Close your mapping object and open again.

Go to Test tab, you should be able to see the payload. Insert values and test.

Once you get the above mentioned error go to the mapping and check the values in the queues for the fields where you have used substring function, you will find the catch there.

Former Member
0 Kudos

Hi,

Check you mapping & check where you applied subsgring function.

Check for the input & check if its length is coming less than 10 chars

Regards,
Ashish

Former Member
0 Kudos

HI,

>>i was unable to see the source message structure, under test tab, in message mapping

save/reject the changes in mapping -->close and open it once you  can see the payload in test tab.

>>[java.lang.StringIndexOutOfBoundsException: String index out of range: 10] in class com.sap.aii.mappingtool.flib7.TextFunctions method substring[, 0, 10,

log clearly says input values given exceeded than expected check the input payload where you are using some logic on input string array values.

Regards

Venkat

Bhargavakrishna
Active Contributor
0 Kudos

Hi venkat , i have checked the values and the payload. it is showing the blank values. you can see the same in the below, post.