cancel
Showing results for 
Search instead for 
Did you mean: 

File to File using FTP :Empty soutce file

Former Member
0 Kudos

Hi,

I have a scenarion in which i need to process even the empty file also.

So whenever the file is empty i need to create a empty file in destination also.

So i have already set the Processing mode to -->Process empty files.

The file will be picked up successfilly even if it is a empty also but during runtime at mapping it will throw an error

<SAP:P1>No interface determination found for outbound interface urn://ISUToTallyman.financialDetails_OB: Error while determining root tag of XML: BOM / charset detection failed</SAP:P1>

Did any1 went through the same problem?If yes Please suggest how...

Thanks & Regards,

Babu

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Kudos

SOLVED

Former Member
0 Kudos

SOLVED

Former Member
0 Kudos

Hi,

I think this is because of mandatory fields in your mapping...You can use mapWith Default function wherever there is a mandatory field.

regards,

Ramya Shenoy

prasannakrishna_mynam
Contributor
0 Kudos

Hello,

- Bypassing the IR/ESR is the option to eliminate this error, since your source message dosn't have any payload, mapping will trigger the exception, as far i know the option we have is to bypass the IR/ESR and use the DUMMY interface in case of empty files.

Regards,

Prasanna

Former Member
0 Kudos

Hi ,

Use Constant or Map with Default

Constant will always give the value to the target filed .

MapwithDefault will map the default value once the source field doesn't have value

Regards,

Jude

prasannakrishna_mynam
Contributor
0 Kudos

Hi,

- Since you enable the option 'process enpty files' you can able to pick the empty files.

- In mapping if the source structure ( your root is of 0 occurence) is empty, then map the target field with constant value, as you need to do this in order to avoid the runtime exception in mapping and at receiver side use FCC as mentioned below.

For Eg:-   Root(0..1)
                        filed1..

Root.filedSeparater-'0'
Root.endSeparator-'0'.

- The other option to process empty files is to byprass the Designing/IR part and configure with DUMMY interface.

Regards,

Prasanna

Former Member
0 Kudos

Hi,

Is there any mandatory field in your mapping?

Regards,

Sumit Gupta

Former Member
0 Kudos

yup i have some mandatory elements... but the root element is 0..1 occurance.

The problem is not yet resolved.

Former Member
0 Kudos

Hi,

if you have madatory elements in the structure then

Either use InField1 --> mapwithDefault --> OutField1

OR pass some default value if in case the related field is blank. (empty data while reading from File)

Thanks

Swarup

Former Member
0 Kudos

Thanks for the reply...

May i know how to pass a default value while reading an empty file?

Former Member
0 Kudos

Hi,

As I already said, use mapWithDefault API or use the API Exist to check that the field is available or not and accordingly pass some constant (At least blank [ ]) which will create the field in XMl tag on receiver side.

Thanks

Swarup

Former Member
0 Kudos

Hi Swarup,

When the source file is empty,you will get an empty inputstream in mapping.

When the input stream in mapping is empty or null... then it will throw an exception called Premature end of file.

I tried with what you guys told but still the same error i am getting.

If the source is not empty (i.e. atleast a single blank in the source side) then the mapping works fine with mapWithDefaultValue..

but the source is not coming so..

Former Member
0 Kudos

Hi,

Ohh....ok, so your problem is with Outbound structure ....Can you tell us the outbound side structure with occuarance.

Also provide the input XMl string that you are getting over here.

Thanks

Swarup

Former Member
0 Kudos

*Hi swarup my source and target have same structure..

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

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">

<ns0:Message1>

<ns1:financialDetails xmlns:ns1="urn://ISUToTallyman"> (0..unbounded)

<Records> (0..unbounded)

<Header>(0..unbounded)

<BatchDate/>

<TotalRecords/>

<CreditAmount/>

<DebitAmount/>

</Header>

<Records1>(0..unbounded)

<PrimaryKey/>

<ContrAccntNumber/>

<ElectricContractReference/>

<GasContractReference/>

<PostingDate/>

<DocumentNumber/>

<DocumentType/>

<DocumentDesc/>

<DocumentAmnt/>

<MainTransaction/>

<SubTransaction/>

<DocumentDueDate/>

<ClearingDocumentNumber/>

<ClearingReason/>

<ClearingAmnt/>

<ClearingDate/>

</Records1>

</Records>

</ns1:financialDetails>

</ns0:Message1>

</ns0:Messages>

I think when the source is empty(no contents at all then)the mapping will throw the error definetly..

Edited by: hlbabu123 on Aug 24, 2009 11:23 AM

Edited by: hlbabu123 on Aug 24, 2009 11:23 AM

Former Member
0 Kudos

i am getting the error

14:52:27 Start of test

Premature end of file. com.sap.aii.utilxi.misc.api.BaseRuntimeException: Premature end of file. at com.sap.aii.mappingtool.tf7.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:253) at com.sap.aii.mappingtool.tf7.rt.xparser.XParser.run(XParser.java:79) Caused by: org.xml.sax.SAXParseException: Premature end of file. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:230) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242) at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) at com.sap.aii.mappingtool.tf7.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:251) ... 1 more Root Cause: org.xml.sax.SAXParseException: Premature end of file. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:230) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242) at javax.xml.parsers.SAXParser.parse(SAXParser.java:375) at com.sap.aii.mappingtool.tf7.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:251) at com.sap.aii.mappingtool.tf7.rt.xparser.XParser.run(XParser.java:79) Premature end of file.

14:52:27 End of test

Former Member
0 Kudos

Hi,

Here in case of empty file the existing mapping will not work. You need to verify according to the condition in Receiver determination (something like Root != ' ') if this is true then divart it to receiver system and the related interface determination will get call.

Else process the file with bypass to mapping.

Create another Business Component and follow the steps mentioned in the blog

/people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository

Thanks

Swarup

Former Member
0 Kudos

Hi,

check this link it will help you http://help.sap.com/saphelp_nw70ehp1/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm

this helps in handling the empty files with 0 bytes.

Thanx

Sampath

Former Member
0 Kudos

HI

You need to remove some of the ns tag like

this <ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">..

this </ns0:Message1>

this </ns0:Messages>

and this <ns0:Message1>

so you have to put your file as below filled data and tags only then upload as below . try with this

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

<ns0:financialDetails xmlns:ns0="urn://ISUToTallyman"> (0..unbounded)

<Records> (0..unbounded)

<Header>(0..unbounded)

<BatchDate/>

<TotalRecords/>

<CreditAmount/>

<DebitAmount/>

</Header>

<Records1>(0..unbounded)

<PrimaryKey/>

<ContrAccntNumber/>

<ElectricContractReference/>

<GasContractReference/>

<PostingDate/>

<DocumentNumber/>

<DocumentType/>

<DocumentDesc/>

<DocumentAmnt/>

<MainTransaction/>

<SubTransaction/>

<DocumentDueDate/>

<ClearingDocumentNumber/>

<ClearingReason/>

<ClearingAmnt/>

<ClearingDate/>

</Records1>

</Records>

</ns0:financialDetails>

Regards,

Sumit Gupta

Former Member
0 Kudos

Hi all

The Problem is when the source file is empty then the mapping will throw,

Unable to execute. Source document is empty

So i think there should be atleast some content in the source even some blank atleast.. If not it will throw the exception..

Is there some way in which we can insert some payload for the source externally if it is blank....

I tried with all options mentioned above still i couldn't fix it...

former_member183908
Active Contributor
0 Kudos

Hu babu,

-->Refer the below link

-->Even though if the file does not contain any data if you have IR in your configuration(Message Mapping) you will get the error.

-->Better option is to bypass the IR.

Thanks

prasannakrishna_mynam
Contributor
0 Kudos

Hello,

Is there some way in which we can insert some payload for the source externally if it is blank....

I have two options that might resolve this issue along with the one i mentioned in my previouse post

1)using the module PayloadSwapBean, to replace the payload in source file at sender CC

http://help.sap.com/saphelp_nw04/helpdata/en/2e/bf37423cf7ab04e10000000a1550b0/content.htm

/people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step

2) Using custom adapter module and configure it at sender CC. In module check the payload size or content and replece it with the default payload, in case the payload id empty.

Regards,

Prasanna

former_member194786
Active Contributor
0 Kudos

Hi,

Why dont you try this:

Let the sender channel create an empty file. Now in the interface determination check for the condition: (SourceFileSize = 0). If this is the case, you do not select any mapping, else you select the mapping that you need.

Hope it helps.

Thanks and Regards,

Sanjeev Shekhar Singh.

Former Member
0 Kudos

Thanks guys,

The problem is solved... I have awarded the points.

So the solution for the empty source file handling is

-->In interface Determination set SourceFileSize=0,in context object's parameters.

-->If above condition satisfies map it to a dummy interface.

Former Member
0 Kudos

Hi,

You had provided the FCC parameters and when empty file will be processed, the FCC conversion will not get any value to under XMl tags. And missing XML tags will create the exception.

In mapping handle the absence of field (XMl field tags) with api mapWithDefault and then try.

thanks

Swarup

Edited by: Swarup Sawant on Aug 24, 2009 8:07 AM