cancel
Showing results for 
Search instead for 
Did you mean: 

MAPPING ERROR

sapjmm
Participant
0 Kudos

WE are getting mapping error due to the field bukars mapped with userdefind function to bukars field

error i got in queue process at mapping of the userdefind funtion we used as setfilename.

Runtime Exception when executing application mapping

program com/sap/xi/tf/_MI_Treasury_Deals_OB_To_FTR_COUNTERCONFIRM

_FTR_COUNTERCONFIRM01_; Details: com.sap.aii.mappingtool.tf7.

MessageMappingException; Runtime exception when processing

target-field mapping /FTR_COUNTERCONFIRM01/IDOC/E1FTR_COUNTERCONFIRM/TRANSACTION;

root message: Exception:[java.lang.StringIndexOutOfBoundsException:

String index out of range: -1] in class

public String setFileName(String variablePart, Container container) throws

{

StreamTransformationException{

String filename = new String("");

DynamicConfiguration conf1 = (DynamicConfiguration)

container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");

filename = "SAGE_" + variablePart + ".txt";

conf1.put(key1,filename);

return variablePart;

The scenario is having sender as proxy and the receiver as file and the sender side when the empty file is coming the mapping got failed here due to empty payload . i know it to be fixed either in mapping or proxy of writing code for ignoreing empty files . pls let me know any idea.

can Please guide me this how to resolve the mapping error.

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Check the UDF return value whether not null and if that's true map to the target field.

Answers (5)

Answers (5)

praveen_sutra
Active Contributor
0 Kudos

hi Murali,

If my understanding is right you just want mapping to run even if field is blank.

I have not done this in past but i am sure if you put your entire code under try catch block and dont do anything in catch block that will let you execute the mapping without error and at the same time file will also not generate.

something like this:

try{

                                        tring filename = new String("");

                                        DynamicConfiguration conf1 = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

                                        DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/File","FileName");

                                        filename = "SAGE_" + variablePart + ".txt";

                                        conf1.put(key1,filename);

                                        return variablePart;

                              }

                              catch(Exception e){ }

thanks and regards,

Praveen T

sapjmm
Participant
0 Kudos

Thanks Praveen

anupam_ghosh2
Active Contributor
0 Kudos

Hi Murali,

                    The UDF should not give an exception just because the part "variable" is blank. The reason being if the "variable" part is blank you should get following output

filename = "SAGE_" + variablePart + ".txt";

if variable="" then output should be something like this filename = "SAGE_.txt"; Thus there should not be any string out of bound exception. If we look at the error it says

"

Runtime exception when processing

target-field mapping /FTR_COUNTERCONFIRM01/IDOC/E1FTR_COUNTERCONFIRM/TRANSACTION; "  but in your case you wrote the UDF is mapped to "bukars" field. The error indicates the name of the target field as "TRANSACTION". Please check the minimum occurrence  of the source field being mapped to  /FTR_COUNTERCONFIRM01/IDOC/E1FTR_COUNTERCONFIRM/TRANSACTION; " field in target. In case min occurrence is zero you need to add a mapwithdefault standard node function in the mapping so that there is always an input from the source be it blank file or not.

Regards

Anupam

sapjmm
Participant
0 Kudos

I am new to this Code part. Please can u give me the some solution Idea with sample code of change where with code help.

ambrish_mishra
Active Contributor
0 Kudos

Hi Murali,

Hope you have checked my earlier post.

Here is what you need to do, in case you want to create an empty file.Code remains the same.

In case, you do not want to create an empty file, you need to check in proxy code if the internal table is not null, then trigger proxy else simply output to an ALV that no valid records for the interface run. You can work with the ABAPers for this.

Hope it answers your question.

Ambrish

anupam_ghosh2
Active Contributor
0 Kudos

Hi Murali,

                As I pointed out earlier, this (code posted by you) is not the code which is throwing exception. Please try identify the UDF which is mapped to the target field /FTR_COUNTERCONFIRM01/IDOC/E1FTR_COUNTERCONFIRM/TRANSACTION. There you might need changes.

Regards

Anupam

sapjmm
Participant
0 Kudos

Thanks Ambrish

Pranil1
Participant
0 Kudos

Hi Murali,

As mentioned by Baskar, please revisit and check your UDF.

Also check if you are using substring anywhere.

Try checking the string's length before calling substring.
If it is long enough, call the substring, otherwise leave it as it is.

Regards,

Pranil.

ambrish_mishra
Active Contributor
0 Kudos

Hi,

This is because the value of field variablePart is not coming from the source and in that case the mapping is bound to fail since the file name is dynamic.

Proxy code should be changed not to send any data to PI in case there are no valid records to be sent to the third party.

In case you want to send empty file, just use maWithDefault function after BUKRS field and pass NULL to the UDF in case empty payload comes from ECC. this should generate a file with name SAGE_NULL.txt.

Hope it answers your question.

Ambrish