cancel
Showing results for 
Search instead for 
Did you mean: 

How to create empty text file on target system for empty source text file

Former Member
0 Kudos

Hi All,

I have an issue in handling empty file in the Text (FCC) to Text (FCC) file scenario. Interface picks text file and delivers on target system as text file. I have used FCC in both sender and receiver CCs.

Interface is working fine if the source file is not empty. If the source text file is empty (zero Bytes), interface has to delivery an empty text file on target system. I have setup empty file handling options correctly on both CCs.

But when I tried with an empty file I am getting the error message 'Parsing an empty source. Root element expected!'.

Could you please suggest me what I need to do to create an empty text file on target system from empty source text file?

Thanks in Advance....

Regards

Sreeni

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

I have used conditional interface based on source file size. To Get the Source file Size use the adapter specific seting and checked the file name, file size check boxs.

In case of empty file, i have skipped the mapping .

Thanks

sreeni

madanmohan_agrawal
Contributor
0 Kudos

Hello again

Another way is below.

If you really want to process them then assign them a different name and in PI just pass them through ID (and no IR..no Mapping)

Regards,

Madan Agrawal

madanmohan_agrawal
Contributor
0 Kudos

Hi Sreeni,

Do not use any message mapping rather use JAVA mapping or XSLT Mapping.

Regards,

Madan Agrawal

Shabarish_Nair
Active Contributor
0 Kudos

>

> Hi All,

>

> I have an issue in handling empty file in the Text (FCC) to Text (FCC) file scenario. Interface picks text file and delivers on target system as text file. I have used FCC in both sender and receiver CCs.

> Interface is working fine if the source file is not empty. If the source text file is empty (zero Bytes), interface has to delivery an empty text file on target system. I have setup empty file handling options correctly on both CCs.

>

> But when I tried with an empty file I am getting the error message 'Parsing an empty source. Root element expected!'.

>

> Could you please suggest me what I need to do to create an empty text file on target system from empty source text file?

>

> Thanks in Advance....

>

> Regards

> Sreeni

the problem is that when there is an empty file there is no XML for parsing available. Hence in case you are using a mapping it will fail.

What ideally you should do is to have a module that will check if the file is empty and if so write out an XML as you want with no values in the content/fields.

Or the next choice would be to have a java mapping to handle this requirement. I guess that on an empty file the java mapping will go to an exception which you can handle to write out your logic/processing

Former Member
0 Kudos

Hi Vijay,

Thanks you, i understand what you suggested me. I have no experience in developing and using the modules.

Could you please expline me how to write a custom module and also provide me if you have any material or example senario. So that i will develope a module for checking the empty file and generating the XML file as you mentioned.

Thanks & Regards

Sreeni

Former Member
0 Kudos

Hi

To create a adapter module you can refer to the following link..

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e21106cc-0c01-0010-db95-dbfc0ffd...

before starting you must install NWDS.

Thanks

Rinku Gangwani

VijayKonam
Active Contributor
0 Kudos

Write a UDF to at the root of the target message type for checking null. If it is null create an empty node. You Receiver CC would create an empty file for the empty root.

VJ

Former Member
0 Kudos

Vijay,

Below is the example message mapping structure similar to my senario mapping , Please let me for what node do i need to write UDF and also provide me sample code for checking the node is null and create the node for target messge. I have checked, i don't know its not worked. That's why i am asking you.

Tree Occurence Type

MT_MOD_FL 1..1 DT_MOD_FL

EMPLOYEE 0..Unbounded

ID 1..1 String

NAME 0..1 String

DESIGNATION 0..1 String

Message structure is same for both source and target. If this UDF solution works, my job is easy to fix all 10 interfaces.

Thanks & Regards

Sreeni