Tuesday, January 26, 2021

Delete Suppress

 Sometimes we get SUPPRESS entries which causes wrong results in the mapping.


Below UDF can be used to remove those entries:


for(int i=0; i<a.length; i++)

{

if(!a[i].equals(ResultList.SUPPRESS))

result.addValue(a[i]);

}









 
















------------------------------------------------AMOR FATI----------------------------------------------


Senderport + Idoc number in Filename

 Requirement is to place the file with the below naming convention:


"senderport" + ORDERS + "IDoc Number" + .eof


ex. PRDORDERS_1192934631.EOF


Here, the sender port is   SAPPRD


To achieve this:


Use a UDF 








Use FORMATNUMBER function to remove the leading zeroes.




















UDF Code:


String name = null;

name =  a + "ORDERS_" + b + ".EOF";


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


if(conf!=null)

{

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

conf.put(filename, name);

}


return a;

 


--------------------------------------------------AMOR FATI---------------------------------------------------









File to Mail (with static Filename)

This can be useful for requirements when the user/business wants the payload file during testing or for other purposes.

No ESR Objects involved.

In ID,

Create File/NFS/SFTP sender channel:

Enable ASMA

















RECEIVER MAIL CHANNEL:




























OUTPUT MAIL:












This will work for Text files or XML files at Sender side.
For pdf's,  change content type to application/pdf  and filename =   sample.pdf
For CSV files, FCC has to be used at the sender side along with the above module.
For SFTP sender, Messagetransform bean module can be used for FCC as well as configuring the content type & disposition.

Content-Disposition response header is a header indicating if the content is expected to be displayed inline in the browser, that is, as a Web page or as part of a Web page, or as an attachment, that is downloaded and saved locally.


The Content-Type entity header is used to indicate the media type of the resource. In responses, a Content-Type header tells the client what the content type of the returned content actually is. ... In requests, (such as POST or PUT ), the client tells the server what type of data is actually sent.





--------------------------------------------------AMOR FATI -----------------------------------------------