Created by Jerry Wang, last modified on Oct 17, 2014
report ZJERRY_GET_DOC_CONTENT in BTD/003:
PARAMETERS: content TYPE /ipro/tdocmnt-content DEFAULT 'ZCR_KT' OBLIGATORY,
document TYPE /ipro/tdocmnt-docmnt_id OBLIGATORY.
DATA: lt_contents TYPE /ipro/tt_contents,
lo_content TYPE REF TO /ipro/if_content,
lo_doc_factory TYPE REF TO /ipro/if_docb_factory,
lo_document TYPE REF TO /ipro/if_document,
lv_content TYPE string,
lo_exception TYPE REF TO cx_root,
lv_error_text TYPE string.
lv_content = content.
CALL FUNCTION '/IPRO/CONTENT_FACTORY'
EXPORTING
piv_name = lv_content
IMPORTING
pet_contents = lt_contents.
READ TABLE lt_contents INTO lo_content INDEX 1.
CHECK lo_content IS BOUND.
lo_doc_factory = lo_content->get_docb_factory( ).
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = document
IMPORTING
output = document.
TRY.
lo_document ?= lo_doc_factory->open( piv_docmnt_id = document ).
CATCH cx_root INTO lo_exception.
lv_error_text = lo_exception->get_text( ).
WRITE: /,lv_error_text.
RETURN.
ENDTRY.
DATA: lo_data TYPE REF TO /ipro/if_docb_attribute.
lo_data = lo_document->get_document_data( ).
输入content ID和Document ID:
mo_element_counter is filled:
with all 8 entries:
Document header information包含下列这些属性:
document guid
content name
creation user name
document id
document language
document description
document style
...
The second step is to read other document information like variable assignment detail from DB table /IPRO/TDOCDATA:
please note the structure of /IPRO/TDOCDATA, the document detail information is stored in that table as a xml stream:
for example, in this part of xml it defines that the variable ZCR_PERSON contains five sub variables:
which reflects the hierarchy relationship defined in customizing:
besides the variable information there is also another part of xml which contains the element information:
The xml is serialized here:
the internal table is filled here: