on 09-06-2016 7:50 PM
Hi Team,
I have requirement number IDOCs processed to single flat file using receiver FTP ....
In this case have configure the scenario and using FTP receiver communication channel wrote content conversion with "apend" option using dyanamic file name....
I am getting output every idoc is mergered and processed single flat file...
Using content conversion as below:
Getting output:
Below circle recorder are header information....each header under having data record...
Business requirement :Required output:
Request you please suggest how to how to ignore every header record from output generated file..
Thanks & Regards,
Naidu
Hi Varri!
Another option is to use "Run Operation System command before message processing" setting. You can use OS script to create new file with header line if it does not exist in target folder. And not to send header line in your message at all.
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What is the OS of your SAP PI system? Unix or Windows? If unix you need to write the shell script and for Windows you need to write a batch script.
And this script must be called from your File sender channel.
Please follow the below Wiki and help.sap for writing these scripts.
https://help.sap.com/saphelp_nw74/helpdata/en/44/556cb799c93677e10000000a114a6b/content.htm
SAP XI File Adapter OS Command Line Feature - Process Integration - SCN Wiki
Regards,
Nitin
Hi Varri!
I think that the better way in your case is using java UDF in your message mapping that checks if file exists on FTP server and adds header line in your message when result is negative.
You can use Apache Commons Net library for that:
void connect(String hostname,
int
port, String username, String password)
throws
SocketException, IOException {
ftpClient =
new
FTPClient();
ftpClient.connect(hostname, port);
returnCode = ftpClient.getReplyCode();
if
(!FTPReply.isPositiveCompletion(returnCode)) {
throw
new
IOException(
"Could not connect"
);
}
boolean
loggedIn = ftpClient.login(username, password);
if
(!loggedIn) {
throw
new
IOException(
"Could not login"
);
}
System.out.println(
"Connected and logged in."
);
}
boolean
checkFileExists(String filePath)
throws
IOException {
InputStream inputStream = ftpClient.retrieveFileStream(filePath);
returnCode = ftpClient.getReplyCode();
if
(inputStream ==
null
|| returnCode ==
550
) {
return
false
;
}
return
true
;
}
Regards, Evgeniy.
Hi Naidu,
Probably the easiest thing to do is to package the IDocs so that you send one message instead of many individual messages. If you package so the sender is one larger message then you will get only one header.
However, if you must continue to send separately then you handle it with two ICOs... the first one to merge the data into one file and the second to take the file and add the header to the final destination. The drawback to such and approach is that you would have to double dip on the FCC for the receiver and also add FCC for the second sender.
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ryan,
I am using dual stack PI 7.4 and already implemented package IDOC in SAP ECC but in our PI side i has received one one IDOC..
So finally i am near to requirement but header is repeated for every one...i populate first IDOC header and remaining IDOC data should be populated.
Thanks & Regards,
Naidu
Hi Naidu,
I'm not following based on your description - for example, if you have 50 IDocs that need to go out how many messages are you seeing in your monitoring? If you are getting 50 messages which is what I would expect based on what you have described then you are not getting packaging such that the IDocs are grouped as one message.
Regards,
Ryan Crosby
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.