2023 Sep 30 12:56 PM
Hello, I do use CL_GUI_HTML_VIEWER->SHOW_URL to display a PDF in an SAP gui dynpro. Find the ABAP code part below. The dynpro is showing logistics invoice data where the PDF is part of the screen. This works as expected. However, when the connection to SAP application server is slow or for PDF holding a lot of data then the dynpro will not be displayed until the complete PDF is loaded into the SAP gui.
Is it possible to display the dynpro data immediately and PDF the moment it is fully loaded into the SAP gui ? Comparable to what web browsers do.
METHOD DOCUMENT.
DATA:
ls_document_data TYPE sofolenti1,
lt_data TYPE solix_tab,
lv_url TYPE url.
* Read document
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = CONV so_entryid( is_link-instid_b )
IMPORTING
document_data = ls_document_data
TABLES
contents_hex = lt_data
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
CHECK syst-subrc EQ 0.
* Update viewer document
go_viewer->load_data(
EXPORTING
url = ls_document_data-obj_descr
type = 'application'
subtype = ls_document_data-obj_type
IMPORTING
assigned_url = lv_url
CHANGING
data_table = lt_data
EXCEPTIONS
dp_invalid_parameter = 1
dp_error_general = 2
cntl_error = 3
html_syntax_notcorrect = 4
OTHERS = 5 ).
CHECK syst-subrc EQ 0.
* Show viewer
go_viewer->show_url(
EXPORTING
url = lv_url
EXCEPTIONS
cntl_error = 1
cnht_error_not_allowed = 2
cnht_error_parameter = 3
dp_error_general = 4
OTHERS = 5 ).
CHECK syst-subrc EQ 0.
ENDMETHOD.
2023 Sep 30 3:11 PM
I would create a Z ICF service to return the PDF and display it via SHOW_URL. It would load asynchronously. There are more details in the forum about ICF services (e.g. Creating a GOS attachment with SAPUI5 | SAP Blogs). In case your PDF is a GOS attachment, I don't know a standard ICF service for that.