Code: Alles auswählen.
DATA: l_filename TYPE string,
lv_bytecount TYPE i,
lt_bitmap TYPE sbdst_content.
CLEAR: lv_bytecount, p_bds_bytecount.
REFRESH: pt_content, lt_bitmap.
PERFORM get_filename CHANGING l_filename.
IF l_filename IS INITIAL.
MESSAGE 'Keine Datei ausgewählt. Der Vorgang wird abgebrochen "' TYPE 'S'.
RETURN.
ENDIF.
*BILD WIRD HOCHGELADEN
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = lv_bytecount
TABLES
data_tab = lt_bitmap
EXCEPTIONS
file_open_error = 2
file_read_error = 3
no_batch = 1
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
DATA: l_color(1) TYPE c VALUE 'X',
l_width_tw TYPE stxbitmaps-widthtw,
l_height_tw TYPE stxbitmaps-heighttw,
l_width_pix TYPE stxbitmaps-widthpix,
l_height_pix TYPE stxbitmaps-heightpix,
l_bds_object TYPE REF TO cl_bds_document_set,
p_resolution TYPE stxbitmaps-resolution.
p_resolution = gv_resolution.
*Umwandeln des Bildmaterials mittels FuBa SAPSCRIPT_CONVERT_BITMAP_BDS in das Format für den Ausdruck
CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP_BDS'
EXPORTING
color = l_color
format = 'BMP'
bitmap_bytecount = lv_bytecount
IMPORTING
width_tw = l_width_tw
height_tw = l_height_tw
width_pix = l_width_pix
height_pix = l_height_pix
dpi = p_resolution
bds_bytecount = p_bds_bytecount
TABLES
bitmap_file = lt_bitmap"-- Binario en BMP
bitmap_file_bds = pt_content "-- BMP en BDS
EXCEPTIONS
format_not_supported = 1
no_bmp_file = 2
bmperr_invalid_format = 3
bmperr_no_colortable = 4
bmperr_unsup_compression = 5
bmperr_corrupt_rle_data = 6
OTHERS = 7.
Code: Alles auswählen.
*
*======================================================================
* DATA DECLARATIONS
*
*======================================================================
DATA: lv_rc TYPE sy-subrc,
lt_file TYPE filetable,
ls_file LIKE LINE OF lt_file,
lv_bytecount TYPE i,
l_color(1) TYPE c VALUE 'X',
l_width_tw TYPE stxbitmaps-widthtw,
l_height_tw TYPE stxbitmaps-heighttw,
l_width_pix TYPE stxbitmaps-widthpix,
l_height_pix TYPE stxbitmaps-heightpix,
l_bds_object TYPE REF TO cl_bds_document_set,
p_resolution TYPE stxbitmaps-resolution,
l_filename TYPE string,
lt_bitmap TYPE sbdst_content,
p_bds_bytecount TYPE i,
pt_content TYPE sbdst_content,
ls_bus_obj TYPE sibflporb.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Wählen sie ein bmp-File aus!'
default_extension = '*.bmp'
file_filter = '*.bmp'
multiselection = abap_false
CHANGING
file_table = lt_file
rc = lv_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
READ TABLE lt_file INDEX 1 INTO ls_file.
l_filename = ls_file-filename.
*BILD WIRD HOCHGELADEN
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = lv_bytecount
TABLES
data_tab = lt_bitmap
EXCEPTIONS
file_open_error = 2
file_read_error = 3
no_batch = 1
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
*Umwandeln des Bildmaterials mittels FuBa SAPSCRIPT_CONVERT_BITMAP_BDS in das Format für den Ausdruck
CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP_BDS'
EXPORTING
color = l_color
format = 'BMP'
bitmap_bytecount = lv_bytecount
IMPORTING
width_tw = l_width_tw
height_tw = l_height_tw
width_pix = l_width_pix
height_pix = l_height_pix
dpi = p_resolution
bds_bytecount = p_bds_bytecount
TABLES
bitmap_file = lt_bitmap"-- Binario en BMP
bitmap_file_bds = pt_content "-- BMP en BDS
EXCEPTIONS
format_not_supported = 1
no_bmp_file = 2
bmperr_invalid_format = 3
bmperr_no_colortable = 4
bmperr_unsup_compression = 5
bmperr_corrupt_rle_data = 6
OTHERS = 7.
BREAK-POINT.
Code: Alles auswählen.
cl_bds_document_set=>create_with_table(
EXPORTING
* logical_system =
classname =
classtype =
* client =
components =
content = pt_content
CHANGING
* object_key =
signature =
EXCEPTIONS
internal_error = 1
error_kpro = 2
parameter_error = 3
not_authorized = 4
not_allowed = 5
nothing_found = 6
OTHERS = 7 ).
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Da steht alles was du für den Upload brauchst genau drinnen.a-dead-trousers hat geschrieben:Den genauen Ablauf findest du in der Form-Routine IMPORT_BITMAP_BDS in der Funktionsgruppe STXBITMAPS. (Das ist im Grunde die SE78)
Hi Wolfgang,wreichelt hat geschrieben:Hallo,
hier ein Beispiel für den aufruf des FB:
http://blog.csdn.net/abap01/article/details/1753225
Ist ja auch ein Beispiel wie die Grafik dann gelesen wird.
Gruß
Wolfgang