on 09-24-2015 7:46 AM
Dear Experts,
My scenario is File-Proxy,the requirement is checking the Bank GL codes having range
from 14400000 to 14432000 and 22125000 to 221256000, with another variable called posting key.
if posting key=40,the last digit should replace with 1,
if posting key=50,the last digit should replace with 2,
if the GLs are out of this range then the GL should post as such(input GL and output GL are same).
Below is the code snippet
public String calculate1(String var1, int var2, Container container) throws StreamTransformationException{
int temp;
temp=Integer.parseInt(var1);
if(temp>14400000&&temp<14432000)
{
if(var2=40)
{
temp=temp+1;
}
else if(var2=50)
{
var1=var1+2;
}
}
else if(temp>22125000&&temp<221256000)
{
if(var2=40)
{
temp=temp+1;
}
else if(var2=50)
{
var1=var1+2;
}
}
return var1;
Also attaching my screenshot of message mapping.
when executed the message mapping the following error is showed
Source text of object Message Mapping: GeneralLedgerDetailTrans2_ | http://lntinfra.com/pi/sapgl/tcsbancs has syntax errors: |
Please guide on how to resolve this error.
Thanks &Regards,
Kalpana
Hello Kalpana,
for IF and else if conditions ,change to
if(var2==40)
and on which line your getting that String error?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello All,
Thanks for your reply.The issue is resolved once I added (var2==50).
Regards,
Kalpana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kalpana,
Pls try the below corrected udf and check the outcome.
Code snippet:
int temp;
temp=Integer.parseInt(var1);
if((temp>=14400000) && (temp<=14432000))
{
if(var2.equals("40"))
{
temp=temp+1;
}
else if(var2.equals("50"))
{
temp=temp+2;
}
}
else if((temp>=22125000) && (temp<=221256000))
{
if(var2.equals("40"))
{
temp=temp+1;
}
else if(var2.equals("50"))
{
temp=temp+2;
}
}
return String.valueOf(temp);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
import java.lang.string; DELETE THE IMPORT STATEMENT
USE THIS CORRECTED CODE
int temp;
temp=Integer.parseInt(var1);
if(temp>14400000&&temp<14432000)
{
if(var2==40)
{
temp=temp+1;
}
else if(var2==50)
{
var1=var1+2;
}
}
else if(temp>22125000&&temp<221256000)
{
if(var2==40)
{
temp=temp+1;
}
else if(var2==50)
{
var1=var1+2;
}
}
return var1;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Kalpana, please delete "import java.lang.string;" from the mapping, class String (capital S) is contained in java.lang package which is imported by default in any java class, no need to do that explicitly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
8 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.