Skip to Content
0
Former Member
Aug 04, 2005 at 07:17 AM

user defined function in java for message mapping

11 Views

I wrote the following user defined function in java for message mapping and mapped vendor with this. The aim of this function is to write a error file at defined path when i send empty Vendor value from File to RFC-Function module BAPI_PO_CREATE. The "err.txt" error file is not written when i execute in TEST but the value "ERROR" is returned to destination Vendor Field.

public String validation(String a, Container container) {

//write your code here

if (a.equals("")) {

try {

String source = "Vendor cannot be empty";

char buffer[] = new char[source.length()];

source.getChars(0, source.length(), buffer, 0);

for (int i = 0; i < buffer.length; i +=2)

{

f0.write(buffer<i>);

}

f0.close();

FileWriter f1 = new FileWriter("/10.10.0.55/sapmnt/trans/edixiin/err.txt");

f1.write(buffer);

f1.close();

}

catch (IOException e) {}

}

}

return "ERROR";