on 12-10-2007 8:59 PM
I'm sorry I've used different tutorials on this site but I just can't get to UPLOAD a file to the R/3...
Could anyone explain an plain and simple way to do it ?
I'm using a RFC BAPI, with a string or a binary type but neither will accept connection with the 'Resource' context attribute...
Please help me on that
Hi Philippe,
U can follow these steps:
Apart from the resource context attribute create a context attribute of type binary.
get the data from resource & convert it to binary & pass that to RFC. U can use this code for conversion
byte fileData[] = null;
try{
InputStream fileIs = wdContext.currentAttachCVElement().getFileData().read(false);
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
int length;
byte[] part = new byte[10 * 1024];
while ((length = fileIs.read(part)) != -1) {
bOut.write(part, 0, length);
}
fileIs.close();
fileData = bOut.toByteArray();
bOut.close();
} catch (Exception e) {
wdComponentAPI.getMessageManager().reportSuccess(e.toString());
}
Here getFileData reffers to the attribute of type resource. rest of the code u can use directly.
regards
Sumit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yeah
thanks a lot it worked
you've got your points !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Philippe:
I tried the same code and it worked like a charm.
Iam converting the xstring format to string format in the corresponding RFC.
My question is if the file has mutilple records (input file) how are you handling???
Do we have any standard RFC which would split the String format and append to internal table???
Please advice.
Thanks!
thanks
i'm trying his
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.