cancel
Showing results for 
Search instead for 
Did you mean: 

MessageTransformBean module parameter for header line in SFTP Receiver adapter

former_member55105
Participant
0 Kudos

Hello Experts


I have a requirement to generate a CSV file on an SFTP server for each IDOC triggered from ECC. One of the business requirements is to add the header(with the field names) in the CSV file. I used the module MessageTransformBean to achieve this; the CSV file is getting created fine but without the header.

I have used the parameter "addHeaderLine" to add the header in the CSV file in the module configuration but it doesn't work. Could you please check if I have missed any parameter for this functionality?

Regards

VJ

Accepted Solutions (0)

Answers (3)

Answers (3)

JaySchwendemann
Active Contributor
0 Kudos

For reference. I tried to make addHeaderLine / headerLine work with StructXML2Plain but to no avail. This was a particular pain in the neck because my initial xml structure was "one level too deep" for SimpleXML2Plain

<?xml version='1.0' encoding='UTF-8' ?>
<mt>
	<materials>
		<material>
			<number>1</number>
			<quantity>200.0</quantity>
			<unit>PCE</unit>
		</material>
		<material>
			<number>2</number>
			<quantity>100.0</quantity>
			<unit>PCE</unit>
		</material>
		<!-- more materials-->
	</materials>
</mt>

So I needed to get rid of the "materials" node and then use SimpleXML2Plain. I have not succeeded with StructXML2Plain, neither with xml.addHeaderLine or xml.material.addHeaderLine

JaySchwendemann
Active Contributor

Coming back to my own comment some years later 😄

Former Member
0 Kudos

Hello,

Cross check ur header line parameter, in addition to that i believe u don't need to use StructXML2Plain, SimpleXML2Plain parameters would suffice.

http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.htm


Thanks

Amit Srivastava

former_member55105
Participant
0 Kudos

Thanks Amit!! I aleady have tried using SimpleXML2Plain. But the issue with this option is that the data and the header are getting created in the same line. Looks like the endSeparator parameter is not having any impact. Do you think if I am missing any other parameter?

Former Member
0 Kudos

Hello,

You are right, it seems that simpleXML2Plain is creating header and data in the same line.

I would suggest you to use "StrictXML2Plain" parameters.

http://help.sap.com/saphelp_NW04/helpdata/en/44/748d595dab6fb5e10000000a155369/content.htm

For the below XML structure, strictXML2Plain parameters will be (i have tested it and it's working fine):

<MT>

<Record>

<Name>ABC</Name>

<Age>26</Age>

<Designation>Consultant</Designation>

</Record>

<Record>

<Name>ABC1</Name>

<Age>25</Age>

<Designation>Senior Consultant</Designation>

</Record>

</MT>

Thanks

Amit Srivastava

former_member55105
Participant
0 Kudos

Hi Amit,

Did you try it using an SFTP adapter? I tried this bean with the same parameters you listed, throws an error as below

"Message processing failed. Cause:
org.xml.sax.SAXParseException: Premature end of file.
"

Are you using only those 4 parameters that you showed in the snapshot?

Former Member
0 Kudos

Hello,

I don't have SFTP in my landscape so tested above parameters with File. But i don't see any reason why it should not work.

BTW, make sure the sequence of modules are properly maintained.

>>Are you using only those 4 parameters that you showed in the snapshot?

Yes, for the above mentioned XML structure, 4 parameters mentioned in the screenshot would suffice.

In addition to that, i have noticed that if u open text file created using MTB module (SimpleXML2Plain) with notepadd++ (or using some editor instead of notepad) u will find that header and data are coming in separate lines which eventually means that file is properly created.

Not sure, why file is not properly aligned in case of noteapd view, may be it's just a editor problem...

Thanks

Amit Srivastava

former_member55105
Participant
0 Kudos

Finally SimpleXML2Plain conversion type worked with parameter " xml.endSeparator = 'nl' ". Thanks Amit!!

former_member184720
Active Contributor
0 Kudos

try xml.addheaderline instead of xml.record.addHeaderline.

Can you also share the receiver strcuture/sample xml to validate the configuration..