09-09-2008 2:37 PM
Hello all,
Can anybody please advice me how to save a BDS HTML document to a local directory in background.
Appreciate any kind of help.
Thanks and Regards,
Mona
09-09-2008 2:38 PM
In background mode you can't save a file to Presentation server...instead you can save a file to application server in background mode...
09-09-2008 2:48 PM
Thats Ok. But is there any solution to saving an HTML BDS document to application server directory?
Thanks and Regards,
Mona
09-10-2008 12:12 PM
Well, I solved the problem and wanted to share with all who face this problem and dont have to debug the SAP standard module again and again to reach this point.
I used the following steps to save the BDS HTML/Text documents to local directory in background mode. Infact this solution works for all document types.
1) Get the Physical class and object id for the Business document, using GET_INFO method of CL_BDS_DOCUMENT_SET
e.g
CALL METHOD cl_bds_document_set=>get_info
EXPORTING
classname = 'BUS2091' "Class name e.g BUS2091 or your custom class
classtype = 'BO' "Class type
object_key = '1000003111' " object key
IMPORTING
extended_components = t_comp " extneded information for the Business dcument
EXCEPTIONS
nothing_found = 1
error_kpro = 2
internal_error = 3
parameter_error = 4
not_authorized = 5
not_allowed = 6
others = 7.
The extneded components table returns the Physical class (CLASS) and object id (OBJID) for all the documents stored under that class, classtype and object id.
2) Use function 'SDOK_PHIO_LOAD_CONTENT' to get the binary/ascii content for your file
e.g
call function 'SDOK_PHIO_LOAD_CONTENT'
exporting
object_id = v_phio_object " this is of type SDOKOBJECT and
" has the physical class and objid key
raw_mode = 'X'
tables
file_content_binary = i_content
exceptions
not_existing = 1
not_authorized = 2
no_content = 3
bad_storage_type = 4
others = 5.
In the above case, i have selected raw_mode and the binary content is returned in table I_CONTENT.
3) Step 3 - transfer content to dataset using OPEN DATASET, TRANSFER and CLOSE DATASET
And thats it