on 01-06-2008 11:22 PM
Hi There,
we need to pass a file(mostly xml) using file upload feature in Webdynpro and then need to pass the file in R/3 system using RFC. What should be importing parameters for RFC and how should i implement the fileUploadUi in this case.
I have already seen example of how to add this in a table input form.
Any pointers will be great help.
Regards,
Sudhir
Closing old messages, not relevant now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sudhir:
I have a similar kind of requirement, have been searching for this solution for quite awhile...
Could someone help us out...
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The RFC will have the input parameters as File Content, File Name, File Type and Content Type, Which accepts the byte content of the file from webdynpro (IWDResource). The RFC then combines the file contents, converts to the original format and form the attachement in SAP System.
Regards,
Krishnaveni.
Hi Krishnaveni:
Thanks for the input.
I guess we map the file name and pass the file type, the file content should be taken by the GUI_UPLOAD FM or similar type of FM right???
Correct me if iam wrong, please provide more information (If you can document what you have done, please email to sapk0708@gmail.com).
Iam able to pass the file name to the FM, but receive the following dump:
" Termination occurred in the ABAP program "SAPLCNDP" - in "DP_CONTROL_ASSIGN_TABLE". The main program was
"SAPMSSY1 ". In the source code you have the termination point in line 1 of the (Include) program "LCNDPU10".
Thanks and Regards.
Use this code to convert the file content to bytes in WDJ:
-
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 byte10 * 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.
-
Use this code in your R/3 function module to convert the data.
-
*" VALUE(XCONTENT) TYPE XSTRING OPTIONAL
OUTSTRING TYPE STRING,
CONV TYPE REF TO CL_ABAP_CONV_IN_CE.
Convert data passed from WD Application.
CONV = CL_ABAP_CONV_IN_CE=>CREATE( INPUT = XCONTENT ).
CONV->READ( IMPORTING DATA = OUTSTRING ).
SPLIT OUTSTRING AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE IT_DATA.
DELETE ADJACENT DUPLICATES FROM IT_DATA.
-
Let me know if you run into issues, please award points accordingly.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.