on 08-17-2010 10:43 PM
Java Gurus,
I am getting below mentioned errors in my UDF code.
Need your help to resolve these.
Source code has syntax error: D:/usr/sap/XIQ/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5bbd39b0aa4411df8d68005056a47072/source/com/sap/xi/tf/_MM_RSPD_INFILE_RSPD_OUTFILE_.java:226: illegal start of expression public static void main(String[] args) throws Exception{/!_$ClNRep_/_MM_RSPD_INFILE_RSPD_OUTFILE_ st = new /!_$ClNRep_/_MM_RSPD_INFILE_RSPD_OUTFILE_(); st.testExecute(); } ^ D:/usr/sap/XIQ/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5bbd39b0aa4411df8d68005056a47072/source/com/sap/xi/tf/_MM_RSPD_INFILE_RSPD_OUTFILE_.java:227: ';' expected } ^ D:/usr/sap/XIQ/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map5bbd39b0aa4411df8d68005056a47072/source/com/sap/xi/tf/_MM_RSPD_INFILE_RSPD_OUTFILE_.java:228: '}' expected ^ 3 errors
//write your code here
/*
contract type is Export (EWT) then: Contract is NOT split
1st quarter 01 set import to 03 (MAR).
2nd quarter 02 set import to 05 (MAY).
3rd quarter 03 set import to 07 (JUL).
4th quarter 04 set import to 10 (OCT)
contract type is Export (DWT) then: Contract is split according to the following rules:
Our white sugar contracts are sold for delivery periods:
Jan/Mar split contract 50% assing to 01 (JAN), 50% assignto 03 (MAR)
Apr/Jun not split assign to 05 (MAY)
Jul/Sep split contract 50% assing to 07 (JUL), 50% assign to 09 (SEP)
Oct/Dec not split assign to (NOV)
The domestic #16 terminal months are:
Jan
Mar
May
Jul
Sep
Nov
*/
final String EXP = "EXP";
final String DOM = "DOM";
final String EWT = "EWT";
final String DWT = "DWT";
final String JAN = "JAN";
final String MAR = "MAR";
final String MAY = "MAY";
final String JUL = "JUL";
final String SEP = "SET";
final String NOV = "NOV";
for(int i = 0 ; i < row.length ;i ++){
String x = row<i>;
String contractNo = x.substring(0,10); //1-10 SAP contract reference
String quantity = x.substring(10,25); //11-25 Quantity
String price = x.substring(25,40); //26-40 Price
String delperiod = x.substring(40,46); //41-46 Delivery period e.g. YYYYMM
String condate = x.substring(46,54); //47-54 Contract date e.g. YYMMDD
String shipwts = x.substring(54,57); //55-57 Shipped weights e.g. DWT/EWT
String mtype = x.substring(57,58); //58 Market Type D/E
String cif = x.substring(58,73); //59-73 CIF price
String comtype = x.substring(73,77); //74-77 comtype e.g. ZRAW
String rejreason = x.substring(77,97); //78-97 Reject reason
String type = x.substring(97,98); //98 Type, A =create, B=amend, C= delete
String usrname = x.substring(98,110); //99-110 User Name
String impdate = x.substring(110,118); //111-118 Date, e.g. YYYYMMDD, imported as Quote date
String imptime = x.substring(118,124); //119-124 Time e.g. HHMMSS, imported as Quote time HH:MM
String vafrdate = x.substring(124,132); //124,132 Date, e.g. YYYYMMDD, valid from date
if ( shipwts.equals(EWT) ){
//set shipwts = EXP
shipwts = EXP;
//set terminal month
if ( delperiod.substring(4,6).equals("01") ) { delperiod = delperiod.substring(0,4)+"03";}
else{ if ( delperiod.substring(4,6).equals("02") ) { delperiod = delperiod.substring(0,4)+"05";}
else { if ( delperiod.substring(4,6).equals("03") ) { delperiod = delperiod.substring(0,4)+"07";}
else {if ( delperiod.substring(4,6).equals("04") ) { delperiod = delperiod.substring(0,4)+"10";}
else { delperiod = "999999";}
}
}
}
result.addValue( contractNo + quantity + price + delperiod + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
} else { if ( shipwts.equals(DWT) ) {
//set shipwts = DOM
shipwts = DOM;
//set terminal month
/*
Our white sugar contracts are sold for delivery periods:
Jan/Mar split contract 50% assing to 01 (JAN), 50% assignto 03 (MAR)
Apr/Jun not split assign to 05 (MAY)
Jul/Sep split contract 50% assing to 07 (JUL), 50% assign to 09 (SEP)
Oct/Dec not split assign to (NOV)*/
if ( delperiod.substring(4,6).equals("01") && vafrdate.substring(128,132).equals("0101") ) {
//split 50%
String tmpdecimal = quantity.substring(11,15);
String tmpint = quantity.substring(0,11).trim();
int f = Integer.valueOf(quantity.substring(0,11).trim()).intValue();
int tmpval1 = 0;
int tmpval2 = 0;
if ( f%2==0 ) { tmpval1 = f/2; tmpval2 = tmpval1;
} else { int tmpf = f -1; tmpval1 = tmpf/2; tmpval2 = tmpval1+1; }
String tmpqtystr1 = "";
String tmpqtystr2 = "";
if (tmpdecimal.equals(".000") ) {
tmpqtystr1 = Integer.toString(tmpval1)+tmpdecimal;
tmpqtystr2 = Integer.toString(tmpval2)+tmpdecimal;
} else { tmpqtystr1 = Integer.toString(tmpval1)+".000"; tmpqtystr2 = Integer.toString(tmpval2)+tmpdecimal; }
String pad = "";
int yy = 15-tmpqtystr1.length();
for(int y=1; y<=yy; y++){
pad = pad+" ";
} tmpqtystr1 = pad + tmpqtystr1;
pad = "";
int zz = 15-tmpqtystr2.length();
for(int z=1; z<=zz; z++){
pad = pad+" ";
} tmpqtystr2 = pad + tmpqtystr2;
result.addValue( contractNo + tmpqtystr1 + price + delperiod.substring(0,4)+"01" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
result.addValue( contractNo + tmpqtystr2 + price + delperiod.substring(0,4)+"03" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
} else {
if ( delperiod.substring(4,6).equals("01") && !vafrdate.substring(128,132).equals("0101") ) {
result.addValue( contractNo + quantity + price + delperiod.substring(0,4)+"03" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
} else {
if ( delperiod.substring(4,6).equals("03") && vafrdate.substring(128,132).equals("0601")) {
//split 50%
String tmpdecimal = quantity.substring(11,15);
String tmpint = quantity.substring(0,11).trim();
int f = Integer.valueOf(quantity.substring(0,11).trim()).intValue();
int tmpval1 = 0;
int tmpval2 = 0;
if ( f%2==0 ) { tmpval1 = f/2; tmpval2 = tmpval1;
} else { int tmpf = f -1; tmpval1 = tmpf/2; tmpval2 = tmpval1+1; }
String tmpqtystr1 = "";
String tmpqtystr2 = "";
if (tmpdecimal.equals(".000") ) {
tmpqtystr1 = Integer.toString(tmpval1)+tmpdecimal;
tmpqtystr2 = Integer.toString(tmpval2)+tmpdecimal;
} else { tmpqtystr1 = Integer.toString(tmpval1)+".000"; tmpqtystr2 = Integer.toString(tmpval2)+tmpdecimal; }
String padd = "";
int yyy = 15-tmpqtystr1.length();
for(int yy=1; yy<=yyy;yy++){
padd = padd+" ";
} tmpqtystr1 = padd + tmpqtystr1;
padd = "";
int zzz = 15-tmpqtystr2.length();
for(int zz=1; zz<=zzz; zz++){
padd = padd+" ";
} tmpqtystr2 = padd + tmpqtystr2;
result.addValue( contractNo + tmpqtystr1 + price + delperiod.substring(0,4)+"07" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
result.addValue( contractNo + tmpqtystr2 + price + delperiod.substring(0,4)+"09" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
} else {
if ( delperiod.substring(4,6).equals("03") && !vafrdate.substring(128,132).equals("0101") ) {
result.addValue( contractNo + quantity + price + delperiod.substring(0,4)+"09" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
} else {
if ( delperiod.substring(4,6).equals("02") ) {
result.addValue( contractNo + quantity + price + delperiod.substring(0,4)+"05" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
} else {
if ( delperiod.substring(4,6).equals("04") ) {
result.addValue( contractNo + quantity + price + delperiod.substring(0,4)+"11" + condate + shipwts + mtype + cif + comtype + rejreason + type + usrname +impdate + imptime );
}
}
}
}
}
}
/*
result.addValue(contractNo);
result.addValue(quantity);
result.addValue(price);
result.addValue(delperiod);
result.addValue(condate);
result.addValue(shipwts);
result.addValue(mtype);
result.addValue(cif);
result.addValue(comtype);
result.addValue(rejreason);
result.addValue(type);
result.addValue(usrname);
result.addValue(impdate);
result.addValue(imptime);
*/
//if (i == 1){result.addValue("Row 1.5");}
}
Dear Santhosh,
The posted information is not readable.
Can u please provide the UDF code..
Also provide the source and target structure..
So that some 1 here can try to understand ur req and surely provide the sol..
Babu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.