cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Receiver File Location based on Source EDIFACT File content without mapping in SAP PI7.1

Former Member
0 Kudos

Hi,

I have a File to File scenario without Integration Repository object. My source is EDIFACT EDI File with same filename for both IFTMBF and DESDAV file in same source location.

So I had to check the content in the EDIFACT EDI File if  text "IFTMBF" present then to Location1 and if "DESDAV" present then to Location2. Could you advice how we achieve this?

I already tried in Java Mapping but the file is failing at RD step itself with the below error as it is not allowing RAW EDI File as an input.

"Error when determining the receiver: Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed Error while determining root tag of XML: BOM / charset detection failed Error while parsing an XML stream: 'BOM / charset detection failed'."

Appreciate your immediate response

Thanks,

Senthil.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184720
Active Contributor
0 Kudos

Hi Senthil - I don't think you can do that with standard receiver determination when the file name is same.

The only option i see here is to go with enhanced receiver determination for which you again need the mapping in ESR.

May be you can request your external party to have different file name.

Former Member
0 Kudos

Hi Hareesh,

Customer is not ready to change the filename and also I tried with enhanced receiver determination using Java Mapping but PI7.1 is not taking the EDIFACT EDI File. Got the error as below

"Error when determining the receiver: Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed Problem while determining receivers using interface mapping: Error while determining root tag of XML: BOM / charset detection failed Error while determining root tag of XML: BOM / charset detection failed Error while parsing an XML stream: 'BOM / charset detection failed'."


May I know any other option?


Thanks,

Senthil.

Harish
Active Contributor
0 Kudos

Hi Senthil,

did you try with Xpath query in RD?

you will have qualifier for different EDI message in Data element 0065 (you need to check the length).

Data element  0065 IFTMBF

Data element  0065 DESDAV

you can use xpath operations contains, substring to compare the value and route to specific location.

Regards,

Harish

Former Member
0 Kudos

Hi Harish,

For this I guess the EDIFACT needs to converted to XML (Internal mapping E2X should exits at adapter level) but unfortunately I am using normal File sender adapter. Let me if I am wrong.

Thanks,

Senthil.

Harish
Active Contributor
0 Kudos

Hi Senthil,

If you use E2X with standard B2B functionality then you do not required xpath query in RD. I am suggesting to pick the EDI file as flat file with your current configuration and use the xpath query to distinguish the DESADV and IFTMBF files. you will have this values in first line (UNH) at specific length. use the xpath function to retrieve the value from file and compare in RD.

Hope this is help.

Harish

Former Member
0 Kudos

Hi Harish,

I am missing something are you saying to use Standard RD with rule as below

/List/Message/Payload/List/M_IFTMBF/S_UNH/C_S009/D_0065 = IFTMBF assign to BC1

/List/Message/Payload/List/M_IFTMBF/S_UNH/C_S009/D_0065 = DESDAV assign to BC2

I tried and got the below error in SXMB_MONI

Problem extracting values from the Payload: Check line 2 column 1 of the XML document

Here is the sample of my EDIFACT EDI file until UNH segment

for IFTMBF

UNA:+.? 'UNB+UNOC:2+XXX:ZZZ+003708183569+131218:1004+XXX000000120'UNH+17299000+IFTMBF:D:99B:UN:2.0'

for DESDAV

UNA:+.? 'UNB+UNOC:2+003710410900:1+003708183569+131218:1633+XXX000000174'UNH+TI513016131+DESADV:D:97B:UN:EXWL12'

Could you help to provide further details?

Thanks,

Senthil.

Harish
Active Contributor
0 Kudos

Hi Senthi,

My bad, you can use xpath query.

You can only use xpath query if read the flat file and convert to xml (simple xml in recordset). I would suggest to try simple2XML conversion in sender adapter, read in one node and apply the xpath function in RD. and you can also convert that simple XML to flat in receiver adapter. so if you do not want to use any ESR content, then i can see this is the only simple option.

But if you already started with Java map, then you can also go with Java map to determine the receiver. Please provide your java code if you need any input for that.

Regards,

Harish

Former Member
0 Kudos

Hi Harish,

NP! I was trying to follow below link (just instead of filename I am trying for directory)

Dynamic file name for pass-through scenario - Process Integration - SCN Wiki

File had been successfully processed and even success message in SXMB_MONI and I also could see path details in DynamicConfiguration as

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

- <!--

 Response 

--> 

- <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1"
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="directory">\\APPSRV2\ftproot\test\in\iftmbf</SAP:Record>
<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">0020</SAP:Record>

</SAP:DynamicConfiguration>


But error received in Receiver Communication channel monitoring as


Delivering the message to the application using connection File_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'Directory' was configured as mandatory element, but was not supplied in the XI Message header.


Could you advice where I went wrong? Let me know if you need my Javacode (it is almost the same as per the link given just changed the below code

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");

conf.put(key, "\\"+"\\"+"APPSRV2"+"\\"+"ftproot"+"\\"+"\\"+"test"+"\\"+"in"+"\\"+"iftmbf");

Thanks,

Senthil.

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Harish,

Please correct me if I'm wrong, but I think EDI is too 'deep' to be converted correctly using fcc or the standard transformation modules. The next best way would be to build a custom adapter module to convert the EDI input into XML, since he already ruled out using a B2B adapter.

Just my two cents

Regards,

Mark

Harish
Active Contributor
0 Kudos

Hi Mark,

Thanks for your comment, i do not want to suggest to convert E2X conversion in FTP adapter (which is not possible with standard features). I want to suggest to read the EDI in recordset (whole line in one field with occurence n), we have end seperator in EDI which can be use as new line seperator.

And when we have EDI in one field, we can apply xpath function in RD to differentiat different EDI.

Please let me know if this is not possible.

Regards,

Harish

Harish
Active Contributor
0 Kudos

Hi Senthil,

I don't see any issue in the code. Please check the below link

Target file name using Dynamic Configuration | SCN

regards,

Harish

markangelo_dihiansan
Active Contributor
0 Kudos

Your approach is very interesting and highly creative! It might be possible.

Regards,

Mark

anupam_ghosh2
Active Contributor
0 Kudos

Hi Harish,

                  when you try this approach the content of the file should be free of invalid XML characters. There is high probability that parser gives an exception.

Regards

Anupam

anupam_ghosh2
Active Contributor
0 Kudos

Hi Senthil,

                    Could you please post the complete code.

Regards

Anupam

Former Member
0 Kudos

Hi Harish,

It worked! I just changed from "directory" to "Directory" and now let me work to meet the customer requirement to identify 4 different directory based on payload in the same code.

Thanks,

Senthil.