‎2008 Jan 07 9:01 AM
Hi All,
I am trying the read the attached file from delivery document and i want to download that in desktop.
So i am using the function module 'SO_DOCUMENT_READ_API1' and the data's are populate in Object content and Content_hex tables.
Using the Gui_download i am passing the object content table. But the document which was downloaded stored in some other format.. How to do this..? can anyone have sample code for this.
problem - File is downloaded to my desktop. but it stores in different format...
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
DOCUMENT_ID = V_DOC1
FILTER = FILTER
IMPORTING
DOCUMENT_DATA = DOCUMENT_DATA
TABLES
OBJECT_HEADER = OBJECT_HEADER
OBJECT_CONTENT = OBJECT_CONTENT
OBJECT_PARA =
OBJECT_PARB =
ATTACHMENT_LIST =
RECEIVER_LIST =
CONTENTS_HEX = CONTENTS_HEX
EXCEPTIONS
DOCUMENT_ID_NOT_EXIST = 1
OPERATION_NO_AUTHORIZATION = 2
X_ERROR = 3
OTHERS = 4
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Documents and Settings\i041492\Desktop\TEST.txt'
FILETYPE = 'DAT'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = OBJECT_CONTENT[]
‎2008 Jan 07 9:11 AM
hi,
may be try like this it is helpful to u.
FILETYPE = 'DBF'
instead of DAT
‎2008 Jan 07 9:22 AM
Hi Arpit,
Thanks for your reply. But still i am facing the same problem.
Any other way to solve this?
Regards
Vinoth
‎2008 Jan 07 9:27 AM
Hi,
Try changing DAT to ASC or TXT in the below line
FILETYPE = 'DAT'
Regards,
Satish
‎2010 Aug 16 1:37 PM
hi
Can you try the following :
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = l_doc_id
IMPORTING
DOCUMENT_DATA = DOCUMENT_DATA
TABLES
object_header = object_header
object_content = object_content
CONTENTS_HEX = CONTENTS_HEX.
then
IF CONTENTS_HEX IS NOT INITIAL.
DESCRIBE TABLE CONTENTS_HEX LINES lin.
input_length = lin * sy-tleng .
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = input_length
IMPORTING
BUFFER = FILE_CONTENT
TABLES
binary_tab = CONTENTS_HEX.
Then you will send the FILE_CONTENT to a PDF output format. Did the same using Webdynpro and it worked.
eg:
get element via lead selection
lo_el_context = wd_context->get_element( ).
get single attribute
lo_el_context->set_attribute(
EXPORTING
name = `PDF`
value = FILE_CONTENT ).
I hope it helps.