on 09-17-2014 9:37 AM
Hi,
Greetings!
I have an requirement like iDoc to File and the output file name should be ABCDYYMMDDXX (e.g ABCD14091701) in PI 7.1
where,
Default = ABCD
YY = year
MM = month
DD = date
XX = sequence no. on the same day; e.g. first batch on same day = 01, second batch on the dame day = 02
I tried checking many blogs but its not meeting this requirement.
Kindly please help me out in completing this interface.
Regards,
Vinoth
Hi,
You can set filename in UDF using DynamicConfiguration class.
For below requirement, you can use NRO(part of B2B add-on).
vinoth g wrote:
XX = sequence no. on the same day; e.g. first batch on same day = 01, second batch on the dame day = 02
You can set XX from NRO counter
Please check the following guide:
Note: B2B Add-on SP1.0 is available from PI 711 SP08 onwards. Refere Note: 1695522
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you please check below 2 links
http://wiki.scn.sap.com/wiki/display/XI/More+with+the+File+Adapter
Thanks,
Sreenivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vinoth,
Have you checked this blog? Dynamic file name and directory in Receiver File Adapter - summary of possibilities - Process Integr...
Also, is there a value that is coming in your Idoc that specifies the batch no?
Regards,
Anand Patil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anand,
Thanks for your reply..
I have checked this link.. no value is coming from the iDoc that specifies batch number
This count has to be happen when the output file is generated.. i have used default value and time stamp as of now. its working fine but file count is not happening..
Please help.
Regards,
Vinoth
Hi Vinoth,
Looking at the options. Even having the standard counter wouldn't help in your scenario.
I would suggest this:
Create a UDF:
List the files from the target directory with " ABCDYYMMDD* " using I/O Library. Add 1 to the result and concatenate to the filename i.e. ABCDYYMMDD(result) using dynamic configuration.
Hope it helps!
Best Regards,
Anand Patil
Hi Anand,
i have tried with below code, but getting error.
Kindly please check the above code is correct and will it meet this requiremet.
And also, from the idoc no value is specifying the batch number.. in this case what will be source field to map with the root node of the target.
Please give your valuable inputs.
Regards,
Vinoth
Hi Vinoth,
Below is the code. Use it in-conjunction with your dynamic config code.
String inputFile = "D:\\Receiver"; //This is your target receiver folder
String dateStr = DateFormat.getDateInstance().format(new Date());
dateStr = dateStr.substring(0, 2)+ dateStr.substring(3, 5)+ dateStr.substring(8,10);
final String fileNamePattern = "DEFAULT"+dateStr;
File file = new File(inputFile);
File[] listFiles = file.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if(name.contains(fileNamePattern))
return true;
return false;
}
});
//System.out.println("Number of files in the directory "+inputFile+" : Next Counter"+ (listFiles.length+1));
int counter = listFiles.length+1;
String fileName = "";
if(counter < 10)
fileName = fileNamePattern+0+counter;
else
fileName = fileNamePattern+counter;
System.out.println("Name of the file will be:"+fileName);
}
Hope it helps!
Best Regards,
Anand Patil
Hi,
you can do this by a simple UDF..which you can find in many blogs...
for XX - Batch code, you need to add a reference in idoc..so you can check this reference to populate a field in PI...then use the UDF to concatenate...
Thanks,
Ashok
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.