cancel
Showing results for 
Search instead for 
Did you mean: 

user defined function in java for message mapping

Former Member
0 Kudos

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";

Accepted Solutions (1)

Accepted Solutions (1)

former_member187339
Active Contributor
0 Kudos

Hi Senthil,

Check these things :

1) Whether you have permission to create a file in that directory.

2) try giving this

10.10.0.55
sapmnt
trans
edixiin
err.txt

3) Also check for permissions.

Hope this will help you.

Regards

Suraj

Former Member
0 Kudos

Hi Suraj

I tried by changing to

10.10.0.55
sapmnt
trans
edixiin
err.txt, file is written and it is working fine.

Thanks

Senthil

Answers (0)