09-08-2008 6:48 PM
Hello All,
I have a BDS download functionality where i am using cl_bds_document_set->get_with_table, but this fails for text/HTML BDS documents.
Where am i going wrong?
It normally raises ERROR_KPRO exception. Any idea what causes this.
I also tried DP_GET_STREAM_FROM_URL, which give me the content when executed in the foreground, but fails in the background mode
I would really appreciate any kind of help on this.
Thanks and Regards,
Mona
09-08-2008 10:00 PM
Although I don't know for sure, my guess is that this functionality requires GUI, which is available only in foreground. You may not use GUI functionality in a background job.
09-10-2008 9:18 AM
Hi Jelena,
Thanks for your reply.
Is there no method for BDS documents bu which we could do this then. Is it sth to be raised to SAP then.
Thanks and Regards,
Mona
09-10-2008 12:13 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