
Use this method to display a document that is stored in an internal table in your ABAP program. To retrieve a document from the Business Document Service as an internal table, use the method get_with_table of class cl_bds_document_set .
You are strongly recommended to use the Business Document Service in conjunction with this method. Although it is possible to use it with standalone documents that you store yourself in the database, you then have to make sure that the parameters are correctly filled. If you use the BDS, the parameter values are provided automatically by the get_with_table method.
CALL METHOD document_viewer->view_document_from_table
EXPORTING show_inplace = show_inplace
type = type
subtype = subtype
size = size
CHANGING document_table = document_table
EXCEPTIONS dp_invalid_parameter = 1
dp_error_general = 2
cntl_error = 3
not_initalized = 4
invalid_parameter = 5.
|
Parameter and Type |
Optional |
Description |
|
show_inplace TYPE C |
Indicates whether the document should be displayed in the SAP GUI window or a separate browser. Possible values:
|
|
|
type TYPE C |
The MIME type of the document. Note
See “Filling the Parameters Correctly” below. |
|
|
subtype TYPE C |
The MIME subtype of the document. Note
See “Filling the Parameters Correctly” below. |
|
|
size TYPE I |
The size of the document in bytes. Note
See “Filling the Parameters Correctly” below. |
|
|
document_table TYPE STANDARD TABLE |
The internal table containing the document |
Filling the Parameters Correctly
You can retrieve the type, subtype, size and document_table parameters for this method from the EXPORTING parameters of the get_with_table method of cl_bds_document_set . However, the mapping between the parameters is not one-to-one. get_with_table returns the following relevant parameters:
|
Parameter and Type |
Meaning |
|
content TYPE SBDST_CONTENT |
The internal table containing the document content. This can be passed directly to the document_table parameter of view_document_from_table . |
|
components TYPE SBDST_COMPONENTS |
A components table containing various administrative information about the document, including the MIME type and the size. |
Retrieving the MIME Type and Subtype
After you have called the get_with_table method of cl_bds_document_set , the MIME type and subtype of the document are contained in the field components-mimetype in the form <type>/<subtype> . To separate them, use the statement SPLIT ... AT '/' INTO field1 field2.
Retrieving the File Size
The size of the document is contained in the field components-comp_size . You can pass this value directly to the size parameter of view_document_from_table .