- The file size must be specified.
It is specified with the field COMP_SIZE of thestructure BAPIDOCCOMP. The file size is always given in bytes.Example
DATA:
objectid TYPE bapisrmdoc-guid,
documentclass TYPE bapisrmdoc-docclass,
wa_comp TYPE bapidoccomp,
lt_comp TYPE TABLE OF bapidoccomp,
wa_bin TYPE bapicontent255,
it_bin TYPE TABLE OF bapicontent255,
wa_ascii TYPE bapiascont255,
lt_ascii TYPE TABLE of bapiascont255.
...
* ASCII content
* Specifies in which order a component appears in the content table
* The field comp_count is not saved persistently in the backendrepository.
wa_comp-comp_count = 1.
wa_comp-comp_id = 'my.txt'.
wa_comp-mimetype = 'text/plain'. " Always lowercase
wa_comp-comp_size = filelen. "File size in bytes
wa_comp-binary_flag = ''.
* Numbering of a component in the document, saved persistently in thebackend repository
wa_comp-com_num = 1.
append wa_comp to lt_comp.
wa_ascii-line = 'This is my first text'.
append wa_ascii to lt_ascii.
CALL FUNCTION 'BAPI_SRM_DOC_CHECKIN_VIA_TAB'
EXPORTING
objectid = objectid
documentclass = documentclass
as_new_version = 'X' " Create new logical version
do_commit = 'X'
* IMPORTING
* return = return
TABLES
components = lt_comp
ascii_content = lt_ascii
.
* Binary content
wa_comp-comp_count = 1.
wa_comp-comp_id = 'my_ms.doc'.
wa_comp-mimetype = 'application/msword'. " Must be lowercase
wa_comp-comp_size = filelen. "File sizes in bytes
wa_comp-binary_flag = 'X'.
wa_comp-com_num = 1.
APPEND wa_comp TO lt_comp.
wa_bin-line = bin_line.
APPEND wa_bin TO lt_bin.
CALL FUNCTION 'BAPI_SRM_DOC_CHECKIN_VIA_TAB'
EXPORTING
objectid = objectid
documentclass = documentclass
as_new_version = 'X' " Create new logical version
do_commit = 'X'
* IMPORTING
* return = return
TABLES
components = lt_comp
bin_content = lt_bin
.
Description
Result of the BAPI call
Description
This field is set to 'X' if the content of a new document is beingchecked in for the first time. The document did not have aprevious physical version, and therefore no content.
Description
This parameter is optional.
If you set an "X", a new logical version is created and the content ischecked in for this new version.
If you set an empty space, the content of the current version isoverwritten.
Description
Storage location of the document (content model)
Description
Context for accessing documents. If the document is stored on a WebDAVserver, you must specify the RMS ID and SPS ID in the document context.
Description
'X': Execute commit work after the document has been checked in
'': no commit
Description
Internal ID of the document
Description
Table for document content in ASCII format
Description
Table for document content in binary format
Description
Table for describing the components of the document
comp_count: Specifies the order of the components in the specifiedcontent table. This field is not saved persistently in the back-endrepository.
comp_id: Name of the component
mimetype: MIME type
comp_size: File size of the component in bytes
binary_flag: 'X' - Component has binary format; ' ' - ASCII format
comp_num: Numbering of the component in the document. Savedpersistently in the back-end repository.
Value range
Suggestion:> When you check in a document, we recommend thatfor each componentyou give the fields comp_count and comp_num the same number.