on 12-03-2009 3:51 PM
Hi All,
I'm using WD4A to reproduce the [GOS|http://help.sap.com/saphelp_nw70/helpdata/EN/be/3fe63659241157e10000009b38f889/frameset.htm] file upload/download functionality from the TRIP transaction in the backend.
For a given PERNR and Trip#, I've been able to pull the list of files using cl_binary_relation=>read_links_of_binrels. From there, I can use SO_DOCUMENT_READ_API1 to pull the file's hex code, convert it to an XSTRING, and display it in an InteractiveForm component.
The problem I'm having is uploading new files in such a way that they will show up via the GOS. Currently I'm using:
SO_DOCUMENT_INSERT_API1
SO_OBJECT_INSERT
cl_binary_relation=>create_link
All of these functions run without error, but the file is not ending up in the GOS list.
The GOS uses SO_OBJECT_UPLOAD, but my understanding is that I can't use that in WD4A since I need to capture the file as an XSTRING via the FileUpload component.
Any suggestions would be appreciated.
Thanks.
Clarification: I'm only interested in working with PDF files.
Edited by: Scott Ehardt on Dec 3, 2009 11:20 AM
Solved. Needed a COMMIT WORK statement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Scott,
I, too, am using WD4A to upload files. I have written a custom Purchase Requisition ABAP Web Dynpro, and one requirement is to upload PDF's, Word Documents, Excel Sheets, etc., and associate them to the newly created PR via GOS.
So far, I've gotten my file to upload without any issues, and when I go to ME53N to view the newly created PR, I can see the attached PDF, via GOS.
Only problem is that when I go to view the PDF, I receive an error in Adobe Acrobat indicating that the PDF is corrupt.
I have written a custom Function Module to create the attachment. The FM takes in the PR Number and the file in XSTRING format (as you correcly pointed out, WD4A supports XSTRING for uploaded files).
In my custom Function Module, I convert XSTRING to a binary object via the following:
DATA: it_content LIKE STANDARD TABLE OF soli.
data: it_binary_content type solix_tab.
data: wa_binary_content like LINE OF it_binary_content.
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = ip_raw_file " this in an input parameter to the FM of XSTRING
tables
binary_tab = it_binary_content.
loop at it_binary_content into wa_binary_content.
wa_content-line = wa_binary_content-line.
APPEND wa_content TO it_content.
endloop.
I then call SO_OBJECT_INSERT, using it_content.
Anyhow, my question is this - Are you receiving file corruption errors/issues when you view the attached PDF?
Also, could you provide some tips and/or sample code for how you were able to attach files?
Thanks!
Hi Matthew,
I haven't run in to any errors since I figured out the conversion (no intermittent errors).
The data I feed to SO_DOCUMENT_INSERT_API1 is in hex form. It turns out that I only needed to use that and function BINARY_RELATION_CREATE (no need for SO_OBJECT_INSERT) Here's how I convert from the xstring:
DATA: wa_uploaddata TYPE XSTRING, "From fileupload component
wa_stringlength TYPE I VALUE 1,
wa_datastring TYPE STRING,
wa_xbuf(255) TYPE X,
wa_contents_hex TYPE SOLIX.
FIELD-SYMBOLS: <xbuf> TYPE ANY,
<contents_hex> TYPE ANY.
"Construct upload structure from xstring
WHILE wa_stringlength <> -1.
CLEAR: wa_xbuf, wa_contents_hex.
wa_stringlength = STRLEN( wa_datastring ).
IF wa_stringlength >= 510.
wa_xbuf = wa_datastring(510).
wa_datastring = wa_datastring+510.
ELSE.
wa_xbuf = wa_datastring.
wa_stringlength = -1. "end condition
ENDIF.
<contents_hex> = <xbuf>.
APPEND wa_contents_hex TO wt_contents_hex.
ENDWHILE.
Hi,
I am trying to display GOS documents in WDA. I am getting the list of documents but not able to open the document. I am also facing the same problem in conversion to XString.
I have tried using SCMS_BINARY_TO_XSTRING FM and also tried to write my own code:
Data: lt_objconthex TYPE STANDARD TABLE OF solix,
ls_objconthex type solix,
lv_objcontxstring TYPE xstring.
called 'SO_DOCUMENT_READ_API1' FM
loop at lt_objconthex into ls_objconthex.
concatenate lv_objcontxstring ls_objconthex-LINE into lv_objcontxstring in byte mode.
endloop.
But its not working for me. Please help me how to convert solix table to xstring.
Regards,
Vikram
Vikram Rawal, as I posted in the other thread a few moments ago you should not post new questions to existing forum threads particularly when the new question is only loosely related to the existing thread. Also you must not double post your questions into multiple threads. These are both violations of the rules of the forums on SDN.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.