on 11-22-2010 5:19 AM
Hi Friends,
I want to upload PDF file from my System and get it stored in content server Using WEB DYNPRO APPLICATION. I tried using it by calling the FM but its not uploading the file in the server.
Can i know the steps involved in uploading the file. I also created a custom Function Module and called this FM in WEB DYNPRO.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(DOCUMENTDATA) LIKE BAPI_DOC_DRAW2 STRUCTURE
*" BAPI_DOC_DRAW2
*" VALUE(BIN_CONTENT) TYPE XSTRING
*" EXPORTING
*" VALUE(DOCUMENTTYPE) LIKE BAPI_DOC_AUX-DOCTYPE
*" VALUE(DOCUMENTNUMBER) LIKE BAPI_DOC_AUX-DOCNUMBER
*" VALUE(DOCUMENTPART) LIKE BAPI_DOC_AUX-DOCPART
*" VALUE(DOCUMENTVERSION) LIKE BAPI_DOC_AUX-DOCVERSION
*" VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
*" TABLES
*" CHARACTERISTICVALUES STRUCTURE BAPI_CHARACTERISTIC_VALUES
*" OPTIONAL
*" CLASSALLOCATIONS STRUCTURE BAPI_CLASS_ALLOCATION OPTIONAL
*" DOCUMENTDESCRIPTIONS STRUCTURE BAPI_DOC_DRAT OPTIONAL
*" OBJECTLINKS STRUCTURE BAPI_DOC_DRAD OPTIONAL
*" DOCUMENTSTRUCTURE STRUCTURE BAPI_DOC_STRUCTURE OPTIONAL
*" DOCUMENTFILES STRUCTURE BAPI_DOC_FILES2 OPTIONAL
*" LONGTEXTS STRUCTURE BAPI_DOC_TEXT OPTIONAL
*" COMPONENTS STRUCTURE BAPI_DOC_COMP OPTIONAL
*"----------------------------------------------------------------------
*..... Document data
data: ls_doc like bapi_doc_files2.
**..... Bapi return structure
data: ls_return like bapiret2.
**.... Originals that are checked in at the same time
data: lt_files like bapi_doc_files2 occurs 0 with header line.
data: tstampl like tzonref-tstampl, tstampl_c(21) type c,
file_name type localfile, msg(80) type c.
constants path_name type localfile value '/tmp/'.
constants log type localfile value '/tmp/logFO.txt'.
* --------------------------------------------------------------------- *
*Create document
* ---------------------------------------------------------------------
describe table documentfiles lines sy-tfill.
if sy-tfill > 0.
clear ls_doc.
clear lt_files.
loop at documentfiles into ls_doc from 1 to 1.
open dataset log for output in text mode encoding default.
transfer ls_doc-wsapplication to log.
transfer ls_doc-description to log.
get time stamp field tstampl.
unpack tstampl to tstampl_c.
clear file_name.
concatenate path_name '/' sy-repid '_' 'ATT' tstampl_c '.' ls_doc-wsapplication into file_name.
condense file_name no-gaps.
transfer file_name to log.
open dataset file_name for output in binary mode message msg.
if sy-subrc = 0.
message a899(zz) with file_name msg 'SY-SUBRC:' sy-subrc.
endif.
transfer bin_content to file_name.
close dataset file_name.
transfer 'move data to lt_files' to log.
move:documentdata-documenttype to lt_files-documenttype,
documentdata-documentpart to lt_files-documentpart,
documentdata-documentversion to lt_files-documentversion,
ls_doc-description to lt_files-description,
'1' to lt_files-originaltype,
'Z_TEST_SAP' to lt_files-storagecategory,
ls_doc-wsapplication to lt_files-wsapplication,
file_name to lt_files-docfile,
'X' to lt_files-checkedin.
translate lt_files-wsapplication to upper case.
append lt_files.
** CLEAR ls_return.
transfer 'call BAPI_DOCUMENT_CREATE2' to log.
call function 'BAPI_DOCUMENT_CREATE2'
exporting
documentdata = documentdata
pf_http_dest = 'SAPHTTPA'
importing
documentnumber = documentnumber
documenttype = documenttype
documentversion = documentversion
documentpart = documentpart
return = return
tables
objectlinks = objectlinks
documentfiles = lt_files
exceptions
others = 1.
close dataset log.
endloop.
endif.
endfunction.
But i am getting short Dump stating File /tmp/logFO.txt is not open.
Can anyone help me with this issue..
Regards,
Santosh
Hi,
Please share the solution . I am also facing the same problem .
Omm
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
please help me with this issue as it is gettin very critical..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.