on 08-30-2010 2:27 PM
Hi All,
In an Idoc to file scenario we want to have counter option at the end of the file.we are using NFS so that we wil not face any problem of counter reset on a j2ee restart
But when the counter turns 999999 it has to be reset to 0000001
So we are trying to dynamically create a file name using the counter and check whether it has reached 999999 then resetting back . I had written a code for the same but it is throwing an error while mapping and activating.
UDF CODE is below
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION) ;
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName") ;
String FileName = conf.get(key) ;
int inc = 1 ;
String temp = FileName.substring(10,6);
String temp1 = FileName.substring(0,10);
Integer seqNo = Integer.parseInt(temp) ;
if(seqNo == 0 || seqNo == 999999) {
seqNo = new Integer(inc) ;
}
else {
int num = seqNo.intValue() + inc ;
seqNo = new Integer(num) ;
}
container.setParameter("seqNo", seqNo);
String File_Name = temp1 + Integer.toString(seqNo);
conf.put(key, File_Name);
return File_Name;
}
ERROR it is throwing
'class' or 'interface' expected public String Decimal$(String Sample,Container container){ ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpath_resolver/Map76d12330b43811df8c1500e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_TRGT_.java:127: 'class' or 'interface' expected }
So can anyone please advice.
Instead of this-
Integer seqNo = Integer.parseInt(temp) ;
use this -
int seqNo = Integer.parseInt(temp) ;
It's a problem with type mis-match.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
remove the last }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Stefan,
I removed the last }
But stil it is throwing the below error:
Activation of the change list canceled Check result for Message Mapping MM_Sample_to_Trgt | : Starting compilation Source code has syntax error: /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpath_resolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:98: FileName is already defined in File$(java.lang.String,com.sap.aii.mappingtool.tf3.rt.Container) String FileName = conf.get(key) ; ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:102: incompatible types found : int required: java.lang.Integer Integer seqNo = Integer.parseInt(temp) ; ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:103: operator == cannot be applied to java.lang.Integer,int if(seqNo == 0 || seqNo == 999999) { ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:103: operator == cannot be applied to java.lang.Integer,int if(seqNo == 0 || seqNo == 999999) { ^ /usr/sap/PJD/DVEBMGS58/j2ee/cluster/server0/./temp/classpathresolver/Map8e67b780b44111dfbc4100e000a6fabc/source/com/sap/xi/tf/_MM_Sample_to_Trgt .java:111: cannot resolve symbol symbol : method toString (java.lang.Integer) location: class java.lang.Integer String FileName = temp1 + Integer.toString(seqNo);
Edited by: mallavarapu soundarya on Aug 30, 2010 4:44 PM
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.