Code: Alles auswählen.
CALL FUNCTION 'HTTP2_GET'
EXPORTING
absolute_uri = lv_url
request_entity_body_length = 1024
* rfc_destination =
user = lv_user
password = lv_password
* blankstocrlf = 'X'
timeout = 20
no_logon = ' '
* wrap_lines = 'X'
IMPORTING
status_code = lv_status
status_text = lv_status_text
response_entity_body_length = lv_length
TABLES
** REQUEST_ENTITY_BODY =
response_entity_body = lt_response_body
response_headers = lt_response_head
Code: Alles auswählen.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = lv_length
* FIRST_LINE =
* LAST_LINE =
IMPORTING
buffer = lv_xstring
TABLES
binary_tab = lt_response_body
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*
* l_img_size = xstrlen( lv_xstring ).
** --- convert back
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_xstring
* APPEND_TO_TABLE = ' '
IMPORTING
output_length = lv_length
TABLES
binary_tab = lt_data.
Code: Alles auswählen.
CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CREA_TAB'
EXPORTING
logical_system = ls_bapibds01-log_system
classname = ls_bapibds01-classname
classtype = ls_bapibds01-classtype
client = sy-mandt
object_key = ls_bapibds01-objkey
binary_flag = 'X'
* IMPORTING
* OBJECT_KEY =
TABLES
signature = lt_signature
components = lt_components
content = lt_data
* ASCII_CONTENT =
EXCEPTIONS
nothing_found = 1
parameter_error = 2
not_allowed = 3
error_kpro = 4
internal_error = 5
not_authorized = 6
OTHERS = 7.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
dirrty
Code: Alles auswählen.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = lv_length
filename = lv_file
filetype = 'BIN'
* append = SPACE
* write_field_separator = SPACE
* header = '00'
* trunc_trailing_blanks = SPACE
write_lf = ' '
* col_select = SPACE
* col_select_mask = SPACE
* dat_mode = SPACE
* confirm_overwrite = SPACE
* no_auth_check = SPACE
* codepage = SPACE
* ignore_cerr = ABAP_TRUE
* replacement = '#'
* write_bom = SPACE
* trunc_trailing_blanks_eol = 'X'
* wk1_n_format = SPACE
* wk1_n_size = SPACE
* wk1_t_format = SPACE
* wk1_t_size = SPACE
* IMPORTING
* filelength =
changing
data_tab = lt_response_body[]
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
others = 24.