on 05-26-2016 9:20 AM
Hi Experts,
I am working on file scenario below the pattern of file I need to generate with the details. How can we know the file is checksum or not. Uniquecode has to be generate with date milliseconds with random number.
File pattern is QPS.COMPANYCODE.CY/CN.CURRENCYCODE.UNIQUECODE
Ex: QPS.0111.CN.USD.0911242847812
QPS is identifying the file
0111 is company code
CY/CN if the file is checksum then CY or CN
USD is currency code
UniqueCode have to generate using DDHHMMSSNNNRR (DD - Day, HH - Hour, MM- Minute, SS-Second, NNN - Milisecond, RR - Random Number)
Any help would be appreciated.
Regards,
Mohammad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
Thanks very much for your help its really great.I am having target structure like
Header
-- Customer
---Customer name
---customerAge
Details
--- CompanyAcount
----EmployeeSalary
----EmployeeAge
Where can i add the field to get the file name.I am bit confused pls help i will mark this as answer if i get the field information.
Regards,
Mohammad
Hi Praveen,
I converted the java code in ESR but getting function is not declared properly and some 5-6 error. I am poor in writing java code.pls can you help how to write the code in ESR.
Starting i have written the same public static as below.
public static void main(string[] args) throws StreamTransformationException{
Regards,
Mohammad
Hi Mohammad,
Use below UDF.
public String setFileName(String companyCode, String currencyCode, String checkSum, Container container)
throws StreamTransformationException {
StringBuilder sb = new StringBuilder("QPS.");
sb.append(companyCode).append(".");
sb.append(checkSum).append(".");
sb.append(currencyCode).append(".");
sb.append(new SimpleDateFormat("ddhhMMssSSS").format(new Date()));
sb.append(new Random().nextInt(100));
Map<String, Object> mapParameters = container.getInputHeader().getAll();
DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
if (conf != null)
conf.put(KEY_FILENAME, sb.toString());
return sb.toString();
}
Regards,
Praveen.
Hi Mohammad,
Regards,
Praveen.
Hi Mohammad,
Your initial post you want to generate unique code like below.
File pattern is QPS.COMPANYCODE.CY/CN.CURRENCYCODE.UNIQUECODE
Ex: QPS.0111.CN.USD.0911242847812
UniqueCode have to generate using DDHHMMSSNNNRR (DD - Day, HH - Hour, MM- Minute, SS-Second, NNN - Milisecond, RR - Random Number)
And i have written the UDF only for that, where did you get the extra time stamp??
Regards,
Praveen.
Hi Praveen,
Thanks very much for the reply.
WHen I added the UDF for the field (variable) the file name is creating with timestamp and miliseconds.
Like am getting the filename QPS.0111.CN.USD.20160615-090417-247.1509061716158
Bold letters am getting extra timestamp.
please how to avoid it when am triggering a file it is coming.
Regards,
Mohammad
Hi Praveen,
Thanks very much for your help.
Now the filename is coming correct but the business is changed client requested to remove the random numbers in the file. As am using RFClookup counter value in the file. Now the client need the value to be replaced instead of random number. As of now I removed the random number code in the UDF.
Now how can I add the counter value please help.
SIPC062016100054 Value should come at the end of file instead of random number, please help its urgent.
Regards,
Mohammad
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
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.