Skip to content

/AWS1/IF_BDZ=>GETDOCUMENTCONTENT()

About GetDocumentContent

Retrieves the content of an ingested document from a knowledge base. Returns a pre-signed URL for secure document access.

Method Signature

METHODS /AWS1/IF_BDZ~GETDOCUMENTCONTENT
  IMPORTING
    !IV_KNOWLEDGEBASEID TYPE /AWS1/BDZKNOWLEDGEBASEID00 OPTIONAL
    !IV_DATASOURCEID TYPE /AWS1/BDZDATASOURCEID OPTIONAL
    !IV_DOCUMENTID TYPE /AWS1/BDZDOCUMENTID OPTIONAL
    !IV_OUTPUTFORMAT TYPE /AWS1/BDZDOCUMENTOUTPUTFORMAT OPTIONAL
    !IO_USERCONTEXT TYPE REF TO /AWS1/CL_BDZUSERCONTEXT OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_bdzgetdoccontentrsp
  RAISING
    /AWS1/CX_BDZACCESSDENIEDEX
    /AWS1/CX_BDZINTERNALSERVEREX
    /AWS1/CX_BDZRESOURCENOTFOUNDEX
    /AWS1/CX_BDZTHROTTLINGEX
    /AWS1/CX_BDZVALIDATIONEX
    /AWS1/CX_BDZCLIENTEXC
    /AWS1/CX_BDZSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_knowledgebaseid TYPE /AWS1/BDZKNOWLEDGEBASEID00 /AWS1/BDZKNOWLEDGEBASEID00

The unique identifier of the knowledge base that contains the document.

iv_datasourceid TYPE /AWS1/BDZDATASOURCEID /AWS1/BDZDATASOURCEID

The unique identifier of the data source that contains the document.

iv_documentid TYPE /AWS1/BDZDOCUMENTID /AWS1/BDZDOCUMENTID

The unique identifier of the document to retrieve content for.

Optional arguments:

iv_outputformat TYPE /AWS1/BDZDOCUMENTOUTPUTFORMAT /AWS1/BDZDOCUMENTOUTPUTFORMAT

The output format for the document content. RAW returns the original file. EXTRACTED returns parsed text as JSON. Defaults to RAW.

io_usercontext TYPE REF TO /AWS1/CL_BDZUSERCONTEXT /AWS1/CL_BDZUSERCONTEXT

Contains information about the user making the request. Use this to pass user identity information for access control filtering, so that retrieval results only include documents the user is authorized to access.

RETURNING

oo_output TYPE REF TO /aws1/cl_bdzgetdoccontentrsp /AWS1/CL_BDZGETDOCCONTENTRSP

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->getdocumentcontent(
  io_usercontext = new /aws1/cl_bdzusercontext( |string| )
  iv_datasourceid = |string|
  iv_documentid = |string|
  iv_knowledgebaseid = |string|
  iv_outputformat = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_string = lo_result->get_mimetype( ).
  lv_presignedurl = lo_result->get_presignedurl( ).
  lv_long = lo_result->get_documentcontentlength( ).
ENDIF.