新版的ERP已经支持二维码,但是未升级的ERP需要借助二维码API来生成二维码,一般网络上都是一段固定的代码,下面我就来说明SAP生成二维码的方法。若有不太明白的地方欢迎留言或邮件
[email protected]
最下端是SAP端的源码程序,此中运用了Smartforms,关于smartforms你可以参考https://blog.csdn.net/charmean/article/details/78135632介绍了smartforms的用法
CONCATENATE 'http://172.16.0.150/api.php?text=' qr_text INTO url.
CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = url
IMPORTING
client = http_client
EXCEPTIONS
argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc = 0.
http_client->send( ).
http_client->receive( ).
content = http_client->response->get_data( ).
http_client->close( ).
l_str_length = xstrlen( content ).
CALL FUNCTION 'RSFO_XSTRING_TO_MIME'
EXPORTING
c_xstring = content
i_length = l_str_length
TABLES
c_t_mime = mime.
ENDIF.
以上这段代码是SAP从API接口获得16进制数据,可以是文字和图片,图片是要先放入SE78然后才能显示
gi_name = 'ERWEIMA'. "name of the qrcode will be in se78 after one time running this program
gi_object = 'GRAPHICS'.
gi_id = 'BMAP'.
gi_btype = 'BMON'. "If u want black and white pass BMON
gi_resident = '二维码'.
gi_autoheight = 'X'.
gi_bmcomp = 'X'.
l_extension = 'BMP'.
"importing the image into se78 before displaying it in the smartform.
perform import_bitmap_bds using blob
gi_name
gi_object
gi_id
gi_btype
l_extension
' '
gi_resident
gi_autoheight
gi_bmcomp
changing l_docid
gi_resolution.
此代码是将数据放在SAP系统图片:注意SAP只支持BMP的图片格式,而一般网络API接口中的二维码图片的PNG格式会比较多,所以SAP中有专门的图片转换程序
FORM convert_image .
CREATE OBJECT i_igs_image_converter .
i_igs_image_converter->input = 'image/png'.
i_igs_image_converter->output = 'image/bmp'.
i_igs_image_converter->width = 200.
i_igs_image_converter->height = 200.
CALL METHOD i_igs_image_converter->set_image
EXPORTING
blob = mime
blob_size = l_content_length.
CALL METHOD i_igs_image_converter->execute
EXCEPTIONS
communication_error = 1
internal_error = 2
external_error = 3
OTHERS = 4.
IF sy-subrc = 0.
CALL METHOD i_igs_image_converter->get_image
IMPORTING
blob = blob
blob_size = blob_size
blob_type = blob_type.
ENDIF.
IF sy-subrc = 0.
PERFORM show_smart_form. "calling the smartform for qrcode display
ELSE.
WRITE:'convert failed! please wait a minute or cheack your Internet'.
ENDIF.
ENDFORM.
当然你也可以自己生成的png格式图片在API接口端进行转换,然后系统直接获取的是BMP的图片格式,这样就可以不用经过此程序进行图片格式的转换了。
REPORT ZPPT0021
.
************************************************************************
*&---------------------------------------------------------------------*
*& Report : ZPPT0021
*& Creat Date : 20170712
*& Author : wangcm
*& Reference resources : Internet
*& Purpose :
*& Suitable for inner label printing of Nanjing Dingzheng IMD.
*&---------------------------------------------------------------------*
************************************************************************
DATA
: usersettings
TYPE TDBOOL
.
DATA
: fname
TYPE RS38L_FNAM
.
DATA
: bds_description
like bapisignat
-prop_value
.
DATA
: qr_text
TYPE char200
.
DATA MAKTX
TYPE MAKTX
.
data
:maktx1
type maktx
.
DATA
: MATNR
TYPE MATNR
,
AUFNR
TYPE AUFNR
,
MANDT
TYPE MANDT
.
data
: E_AUFNR
type AUFNR
,
E_BUDAT
LIKE AFRU
-BUDAT
,
E_FENQIE
TYPE CHAR10
,
E_QUANTITY
TYPE CHAR10
,
liushui
(
12
)
TYPE
C
,
E_xuhao
(
6
)
TYPE
C
,
E_PCS
TYPE char10
.
data
: mdate
type sy
-datum
,
date
type char8
.
DATA
: ctrl_param
TYPE ssfctrlop
,
out_option1
TYPE ssfcompop
.
* BDS handling
constants
:
* c_bds_classname type sbdst_classname value 'DEVC_STXD_BITMAP',
c_bds_classname
TYPE bapibds01
-classname
value
'DEVC_STXD_BITMAP'
,
* c_bds_classtype type sbdst_classtype value 'OT', " others
c_bds_classtype
type bapibds01
-classtype
value
'OT'
,
" others
* c_bds_mimetype type bds_mimetp value 'application/octet-stream',
c_bds_mimetype
type bds_mimetp
value
'application/octet-stream'
,
* c_bds_original type sbdst_doc_var_tg value 'OR'.
c_bds_original
type bapibds01
-doc_var_tg
value
'OR'
.
TABLES ZIMD_WEIYIMA
.
DATA
:
BEGIN
OF WEIYIMA
OCCURS
0
.
INCLUDE
STRUCTURE ZIMD_WEIYIMA
.
DATA
END
OF WEIYIMA
.
* Graphic handling
constants
:
c_stdtext
like thead
-tdobject
value
'TEXT'
,
c_graphics
like thead
-tdobject
value
'GRAPHICS'
,
c_bmon
like thead
-tdid
value
'BMON'
,
c_bcol
like thead
-tdid
value
'BCOL'
.
DATA
: gi_filename
type rlgrap
-filename
,
gi_name
type stxbitmaps
-tdname
,
gi_object
type stxbitmaps
-tdobject
,
gi_id
type stxbitmaps
-tdid
,
gi_btype
type stxbitmaps
-tdbtype
,
gi_resident
type stxbitmaps
-resident
,
gi_autoheight
type stxbitmaps
-autoheight
,
gi_bmcomp
type stxbitmaps
-bmcomp
,
gi_resolution
type stxbitmaps
-resolution
,
l_extension
type rlgrap
-filename
,
l_docid
type stxbitmaps
-docid
.
"Picture Control
DATA
: picture_container
TYPE
REF
TO cl_gui_custom_container
,
picture_control
TYPE
REF
TO cl_gui_picture
.
DATA
: l_img_url
TYPE w3url
.
DATA
:l_img_subtype
TYPE w3param
-cont_type
.
DATA
: l_str_length
TYPE
i
.
DATA
: url
TYPE string
.
DATA
: l_content_length
TYPE
i
.
DATA
: mime
TYPE w3mimetabtype
.
DATA
: blob
TYPE w3mimetabtype
,
blob_size
TYPE w3param
-cont_len
,
blob_type
TYPE w3param
-cont_type
.
DATA
: i_igs_image_converter
TYPE
REF
TO cl_igs_image_converter
.
DATA
: content
TYPE xstring
.
DATA
: http_client
TYPE
REF
TO if_http_client
.
data
time
type sy
-uzeit
.
TYPES
:
BEGIN
OF ty_binary
,
binary_field
(
1000
)
TYPE
c
,
END
OF ty_binary
.
DATA
: hex_tab1
TYPE
TABLE
OF ty_binary
WITH
HEADER
LINE
.
DATA
: EXCEL_DATA
TYPE ALSMEX_TABLINE
OCCURS
20
WITH
HEADER
LINE
.
"表结构
SELECTION-SCREEN
:
BEGIN
OF
BLOCK INPUT3
WITH
FRAME
TITLE
TEXT
-
003
.
*PARAMETERS: P_WERKS LIKE T001W-WERKS MEMORY ID WRK OBLIGATORY.
PARAMETERS
:
EXCEL
TYPE
C
RADIOBUTTON
GROUP GP1
,
SCREEN
TYPE
C
RADIOBUTTON
GROUP GP1
.
SELECTION-SCREEN
:
END
OF
BLOCK INPUT3
.
SELECTION-SCREEN
:
BEGIN
OF
BLOCK INPUT4
WITH
FRAME
TITLE
TEXT
-
004
.
PARAMETERS
:
print
TYPE
C
RADIOBUTTON
GROUP GP2
,
times
(
1
)
type n
DEFAULT
2
,
scan
TYPE
C
RADIOBUTTON
GROUP GP2
.
SELECTION-SCREEN
:
END
OF
BLOCK INPUT4
.
SELECTION-SCREEN
:
BEGIN
OF
BLOCK INPUT1
WITH
FRAME
TITLE
TEXT
-
001
.
PARAMETERS
:P_FILE
LIKE RLGRAP
-FILENAME
MEMORY
ID F_DIR2 VISIBLE LENGTH
100
.
"OBLIGATORY.
SELECTION-SCREEN
:
END
OF
BLOCK INPUT1
.
SELECTION-SCREEN
:
BEGIN
OF
BLOCK INPUT2
WITH
FRAME
TITLE
TEXT
-
002
.
PARAMETERS
:NAME_NUM
TYPE AUFNR
.
PARAMETERS
:FENQIE
TYPE CHAR10
.
PARAMETERS
:QUANTITY
TYPE CHAR10
.
PARAMETERS
:S_BUDAT
type char8
.
PARAMETERS
:xuhao
(
6
)
type
c
.
PARAMETERS
:PCS
type char10
.
SELECTION-SCREEN
:
END
OF
BLOCK INPUT2
.
AT
SELECTION-SCREEN
ON
VALUE-REQUEST
FOR P_FILE
.
PERFORM SELECT_FILE
.
"选择需要上载的文件
START-OF-SELECTION
.
PERFORM PRINT_PTION
.
PERFORM input_information
.
*&---------------------------------------------------------------------*
*& Form DOWNLOAD_QRCODE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM search_MANDT
.
SELECT MATNR
FROM afPO
INTO MATNR
WHERE AFPO
~AUFNR
= E_AUFNR
.
ENDSELECT
.
ENDFORM
.
FORM PRINT_PTION
.
IF
scan
=
'X'
.
ctrl_param
-preview
=
'X'
.
out_option1
-tddest
=
'LP01'
.
" in your case it is LOCL
ctrl_param
-no_dialog
=
'X'
.
ELSE
.
ctrl_param
-NO_DIALOG
=
'X'
.
out_option1
-TDNEWID
=
'X'
.
"New Spool
out_option1
-TDIMMED
=
'X'
.
out_option1
-TDDELETE
=
'X'
.
"Delete Spool After Print
out_option1
-TDFINAL
=
'X'
.
out_option1
-TDIEXIT
=
'X'
.
"Exit after printing in print preview
out_option1
-TDDEST
=
'ZSAP'
.
usersettings
=
''
.
ENDIF
.
ENDFORM
.
FORM input_information
.
if
SCREEN
=
'X'
.
E_AUFNR
= NAME_NUM
.
E_BUDAT
= S_BUDAT
.
E_FENQIE
= FENQIE
.
E_QUANTITY
= QUANTITY
.
E_xuhao
= xuhao
.
E_PCS
= PCS
.
if E_AUFNR
=
''
.
MESSAGE i192
(YB
)
WITH
'请维护基本数据!'
.
exit
.
else
.
PERFORM search_MANDT
.
PERFORM SearchMAKTX
.
PERFORM download_qrcode
.
PERFORM convert_image
.
endif
.
ELSE
.
if P_FILE
=
''
.
MESSAGE i192
(YB
)
WITH
'请维护基本数据!'
.
exit
.
else
.
PERFORM GET_EXCEL_DATA
.
"处理excel中上载的数据
PERFORM PROCESS_EXCEL
.
endif
.
ENDIF
.
ENDFORM
.
FORM GET_EXCEL_DATA
.
CALL
FUNCTION
'ALSM_EXCEL_TO_INTERNAL_TABLE'
*导入EXCEL数据到内表
EXPORTING
FILENAME
= P_FILE
I_BEGIN_COL
=
'2'
I_BEGIN_ROW
=
'2'
I_END_COL
=
'8'
I_END_ROW
=
'9999'
TABLES
INTERN
= EXCEL_DATA
.
SORT EXCEL_DATA
BY ROW COL
.
ENDFORM
.
FORM PROCESS_EXCEL
.
CLEAR
: E_AUFNR
,
E_BUDAT
,
E_FENQIE
,
E_QUANTITY
,
E_xuhao
,
liushui
.
LOOP
AT EXCEL_DATA
.
CASE EXCEL_DATA
-COL
.
WHEN
1
.
E_AUFNR
= EXCEL_DATA
-
VALUE
.
WHEN
2
.
E_FENQIE
= EXCEL_DATA
-
VALUE
.
WHEN
3
.
E_QUANTITY
= EXCEL_DATA
-
VALUE
.
WHEN
4
.
E_BUDAT
= EXCEL_DATA
-
VALUE
.
WHEN
5
.
E_xuhao
= EXCEL_DATA
-
VALUE
.
when
6
.
E_PCS
= EXCEL_DATA
-
VALUE
.
ENDCASE
.
* AT END OF ROW."每行结束就执行bapi更新
AT
END
OF ROW
.
PERFORM add_zero_aufnr
CHANGING E_AUFNR E_AUFNR
.
PERFORM search_MANDT
.
PERFORM SearchMAKTX
.
WAIT
UP
TO
'1' SECONDS
.
PERFORM download_qrcode
.
PERFORM convert_image
.
ENDAT
.
*PERFORM OUT_MESSAGE."输出信息
CLEAR
:EXCEL_DATA
.
ENDLOOP
.
ENDFORM
.
" PROCESS_EXCEL
FORM add_zero_aufnr
CHANGING a b
.
CALL
FUNCTION
'CONVERSION_EXIT_ALPHA_INPUT'
"去除大订单号的前导0
EXPORTING
input
= a
IMPORTING
output
= b
.
ENDFORM
.
FORM SELECT_FILE
.
CALL
FUNCTION
'WS_FILENAME_GET'
EXPORTING
MASK
=
',Excel Files,*.xls,All Files,*.*.'
(
101
)
TITLE
=
'选择文件'
(
100
)
IMPORTING
FILENAME
= P_FILE
EXCEPTIONS
INV_WINSYS
=
1
NO_BATCH
=
2
SELECTION_CANCEL
=
3
SELECTION_ERROR
=
4
OTHERS
=
5
.
IF SY
-SUBRC <>
0
AND SY
-SUBRC <>
3
.
MESSAGE E100
(ZDEV
)
WITH
'选择文件出错!'
(
007
)
.
ENDIF
.
ENDFORM
.
FORM download_qrcode
.
* qr_text = '123456789ABCDEF'.
PERFORM Creat_liushui
.
PERFORM del_zero_aufnr
CHANGING E_AUFNR AUFNR
.
maktx1
= maktx
.
REPLACE
ALL
OCCURRENCES
OF
'+'
IN MAKTX1
WITH
'%2B'
.
CONCATENATE AUFNR
',"' MAKTX1
'" ,' E_BUDAT
',' E_FENQIE
',' E_QUANTITY
',' E_PCS
',PASS,PASS,PASS,N00' liushui
INTO qr_text
.
CONCATENATE
'http://172.16.0.150/api.php?text=' qr_text
INTO url
.
CALL
METHOD cl_http_client
=>create_by_url
EXPORTING
url
= url
IMPORTING
client
= http_client
EXCEPTIONS
argument_not_found
=
1
plugin_not_active
=
2
internal_error
=
3
OTHERS
=
4
.
IF sy
-subrc
=
0
.
http_client
->send
(
)
.
http_client
->
receive
(
)
.
content
= http_client
->response
->get_data
(
)
.
http_client
->
close
(
)
.
l_str_length
=
xstrlen
( content
)
.
CALL
FUNCTION
'RSFO_XSTRING_TO_MIME'
EXPORTING
c_xstring
= content
i_length
= l_str_length
TABLES
c_t_mime
= mime
.
ENDIF
.
ENDFORM
.
" DOWNLOAD_QRCODE
*&---------------------------------------------------------------------*
*& Form CONVERT_IMAGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM del_zero_aufnr
CHANGING a b
.
CALL
FUNCTION
'CONVERSION_EXIT_ALPHA_OUTPUT'
"去除大订单号的前导0
EXPORTING
input
= a
IMPORTING
output
= b
.
ENDFORM
.
FORM convert_image
.
CREATE OBJECT i_igs_image_converter
.
i_igs_image_converter
->
input
=
'image/png'
.
i_igs_image_converter
->
output
=
'image/bmp'
.
i_igs_image_converter
->width
=
200
.
i_igs_image_converter
->height
=
200
.
CALL
METHOD i_igs_image_converter
->set_image
EXPORTING
blob
= mime
blob_size
= l_content_length
.
CALL
METHOD i_igs_image_converter
->execute
EXCEPTIONS
communication_error
=
1
internal_error
=
2
external_error
=
3
OTHERS
=
4
.
IF sy
-subrc
=
0
.
CALL
METHOD i_igs_image_converter
->get_image
IMPORTING
blob
= blob
blob_size
= blob_size
blob_type
= blob_type
.
ENDIF
.
IF sy
-subrc
=
0
.
PERFORM show_smart_form
.
"calling the smartform for qrcode display
ELSE
.
WRITE
:
'convert failed! please wait a minute or cheack your Internet'
.
ENDIF
.
ENDFORM
.
" CONVERT_IMAGE
FORM Creat_liushui
.
clear liushui
.
time
= sy
-uzeit
.
mdate
= sy
-datum
.
date
= mdate
.
date
= date+2
(
6
)
.
CONCATENATE
date
time
INTO liushui
.
ENDFORM
.
FORM Cunchu_liushui
.
weiyima
-aufnr
= E_AUFNR
.
weiyima
-xuhao
= E_xuhao
.
weiyima
-liushui
= liushui
.
INSERT
INTO ZIMD_WEIYIMA VALUES weiyima
.
CLEAR weiyima
.
endform
.
FORM show_smart_form
.
gi_name
=
'ERWEIMA'
.
"name of the qrcode will be in se78 after one time running this program
gi_object
=
'GRAPHICS'
.
gi_id
=
'BMAP'
.
gi_btype
=
'BMON'
.
"If u want black and white pass BMON
gi_resident
=
'二维码'
.
gi_autoheight
=
'X'
.
gi_bmcomp
=
'X'
.
l_extension
=
'BMP'
.
"importing the image into se78 before displaying it in the smartform.
perform import_bitmap_bds
using blob
gi_name
gi_object
gi_id
gi_btype
l_extension
' '
gi_resident
gi_autoheight
gi_bmcomp
changing l_docid
gi_resolution
.
IF sy
-subrc
=
0
.
" PERFORM Cunchu_liushui.
CALL
FUNCTION
'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname
=
'ZBARCODE_IMD_IN'
IMPORTING
fm_name
= fname
.
DO
times
TIMES
.
CALL
FUNCTION fname
EXPORTING
CONTROL_PARAMETERS
= ctrl_param
OUTPUT_OPTIONS
= out_option1
USER_SETTINGS
= usersettings
AUFNR
= E_AUFNR
FENQIE
= E_FENQIE
DATA
= E_BUDAT
QUANTITY
= E_QUANTITY
MAKTX
= MAKTX
LIUSHUI
= LIUSHUI
PCS
= E_PCS
.
ENDDO
.
CLEAR liushui
.
ELSE
.
WRITE
:
'import_bitmap_bds failed'
.
ENDIF
.
ENDFORM
.
" SHOW_SMART_FORM
*&---------------------------------------------------------------------*
*& Form IMPORT_BITMAP_BDS (Copied from standard program and modified it as per the requirement)
*&---------------------------------------------------------------------*
form import_bitmap_bds
using p_blob
type w3mimetabtype
p_name
type stxbitmaps
-tdname
p_object
type stxbitmaps
-tdobject
p_id
type stxbitmaps
-tdid
p_btype
type stxbitmaps
-tdbtype
p_format
type
c
p_title
like bds_description
p_resident
type stxbitmaps
-resident
p_autoheight
type stxbitmaps
-autoheight
p_bmcomp
type stxbitmaps
-bmcomp
changing p_docid
type stxbitmaps
-docid
p_resolution
type stxbitmaps
-resolution
.
*data: l_object_key type sbdst_object_key.
data
: l_object_key
type bapibds01
-objkey
.
data
: l_tab
type ddobjname
.
data
:
begin
of l_bitmap
occurs
0
,
l
(
64
)
type
x
,
end
of l_bitmap
.
data
: l_filename
type string
,
l_bytecount
type
i
,
l_bds_bytecount
type
i
.
data
: l_color
(
1
)
type
c
,
l_width_tw
type stxbitmaps
-widthtw
,
l_height_tw
type stxbitmaps
-heighttw
,
l_width_pix
type stxbitmaps
-widthpix
,
l_height_pix
type stxbitmaps
-heightpix
.
data
: l_bds_object
type
ref
to cl_bds_document_set
,
l_bds_content
type sbdst_content
,
l_bds_components
type sbdst_components
,
wa_bds_components
type
line
of sbdst_components
,
l_bds_signature
type sbdst_signature
,
wa_bds_signature
type
line
of sbdst_signature
,
l_bds_properties
type sbdst_properties
,
wa_bds_properties
type
line
of sbdst_properties
.
data wa_stxbitmaps
type stxbitmaps
.
* Enqueue
perform enqueue_graphic
using p_object
p_name
p_id
p_btype
.
* Bitmap conversion
call
function
'SAPSCRIPT_CONVERT_BITMAP_BDS'
exporting
color
=
'X'
format
= p_format
resident
= p_resident
bitmap_bytecount
= l_bytecount
compress_bitmap
= p_bmcomp
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
= l_bds_bytecount
tables
bitmap_file
= p_blob
bitmap_file_bds
= l_bds_content
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
.
if sy
-subrc <>
0
.
perform dequeue_graphic
using p_object
p_name
p_id
p_btype
.
message
id sy
-msgid
type sy
-msgty
number sy
-msgno
with sy
-msgv1 sy
-msgv2 sy
-msgv3 sy
-msgv4
raising conversion_failed
.
endif
.
* Save bitmap in BDS
create object l_bds_object
.
wa_bds_components
-doc_count
=
'1'
.
wa_bds_components
-comp_count
=
'1'
.
wa_bds_components
-mimetype
= c_bds_mimetype
.
wa_bds_components
-comp_size
= l_bds_bytecount
.
append wa_bds_components
to l_bds_components
.
if p_docid
is
initial
.
" graphic is new
wa_bds_signature
-doc_count
=
'1'
.
append wa_bds_signature
to l_bds_signature
.
call
method l_bds_object
->create_with_table
exporting
classname
= c_bds_classname
classtype
= c_bds_classtype
components
= l_bds_components
content
= l_bds_content
changing
signature
= l_bds_signature
object_key
= l_object_key
exceptions
others
=
1
.
if sy
-subrc <>
0
.
perform dequeue_graphic
using p_object
p_name
p_id
p_btype
.
* message e285 with p_name 'BDS'.
endif
.
read
table l_bds_signature
index
1
into wa_bds_signature
transporting doc_id
.
if sy
-subrc
=
0
.
p_docid
= wa_bds_signature
-doc_id
.
else
.
perform dequeue_graphic
using p_object
p_name
p_id
p_btype
.
* message e285 with p_name 'BDS'.
endif
.
else
.
" graphic already exists
********* read object_key for faster access *****
clear l_object_key
.
select
single *
from stxbitmaps
into wa_stxbitmaps
where tdobject
= p_object
and tdid
= p_id
and tdname
= p_name
and tdbtype
= p_btype
.
select
single tabname
from bds_locl
into l_tab
where classname
= c_bds_classname
and classtype
= c_bds_classtype
.
if sy
-subrc
=
0
.
select
single object_key
from
(l_tab
)
into l_object_key
where loio_id
= wa_stxbitmaps
-docid+10
(
32
)
and classname
= c_bds_classname
and classtype
= c_bds_classtype
.
endif
.
******** read object_key end ********************
call
method l_bds_object
->update_with_table
exporting
classname
= c_bds_classname
classtype
= c_bds_classtype
object_key
= l_object_key
doc_id
= p_docid
doc_ver_no
=
'1'
doc_var_id
=
'1'
changing
components
= l_bds_components
content
= l_bds_content
exceptions
nothing_found
=
1
others
=
2
.
if sy
-subrc
=
1
.
" inconsistency STXBITMAPS - BDS; repeat check in
wa_bds_signature
-doc_count
=
'1'
.
append wa_bds_signature
to l_bds_signature
.
call
method l_bds_object
->create_with_table
exporting
classname
= c_bds_classname
classtype
= c_bds_classtype
components
= l_bds_components
content
= l_bds_content
changing
signature
= l_bds_signature
object_key
= l_object_key
exceptions
others
=
1
.
if sy
-subrc <>
0
.
perform dequeue_graphic
using p_object
p_name
p_id
p_btype
.
* message e285 with p_name 'BDS'.
endif
.
read
table l_bds_signature
index
1
into wa_bds_signature
transporting doc_id
.
if sy
-subrc
=
0
.
p_docid
= wa_bds_signature
-doc_id
.
else
.
perform dequeue_graphic
using p_object
p_name
p_id
p_btype
.
* message e285 with p_name 'BDS'.
endif
.
elseif sy
-subrc
=
2
.
perform dequeue_graphic
using p_object
p_name
p_id
p_btype
.
* message e285 with p_name 'BDS'.
endif
.
endif
.
* Save bitmap header in STXBITPMAPS
wa_stxbitmaps
-tdname
= p_name
.
wa_stxbitmaps
-tdobject
= p_object
.
wa_stxbitmaps
-tdid
= p_id
.
wa_stxbitmaps
-tdbtype
= p_btype
.
wa_stxbitmaps
-docid
= p_docid
.
wa_stxbitmaps
-widthpix
= l_width_pix
.
wa_stxbitmaps
-heightpix
= l_height_pix
.
wa_stxbitmaps
-widthtw
= l_width_tw
.
wa_stxbitmaps
-heighttw
= l_height_tw
.
wa_stxbitmaps
-resolution
= p_resolution
.
wa_stxbitmaps
-resident
= p_resident
.
wa_stxbitmaps
-autoheight
= p_autoheight
.
wa_stxbitmaps
-bmcomp
= p_bmcomp
.
insert
into stxbitmaps values wa_stxbitmaps
.
if sy
-subrc <>
0
.
update stxbitmaps
from wa_stxbitmaps
.
if sy
-subrc <>
0
.
* message e285 with p_name 'STXBITMAPS'.
endif
.
endif
.
* Set description in BDS attributes
wa_bds_properties
-prop_name
=
'DESCRIPTION'
.
wa_bds_properties
-prop_value
= p_title
.
append wa_bds_properties
to l_bds_properties
.
call
method l_bds_object
->change_properties
exporting
classname
= c_bds_classname
classtype
= c_bds_classtype
object_key
= l_object_key
doc_id
= p_docid
doc_ver_no
=
'1'
doc_var_id
=
'1'
changing
properties
= l_bds_properties
exceptions
others
=
1
.
perform dequeue_graphic
using p_object
p_name
p_id
p_btype
.
endform
.
*&---------------------------------------------------------------------*
*& Form ENQUEUE_GRAPHIC
*&---------------------------------------------------------------------*
* Enqueue of graphics stored in BDS
*----------------------------------------------------------------------*
form enqueue_graphic
using p_object
p_name
p_id
p_btype
.
call
function
'ENQUEUE_ESSGRABDS'
exporting
* MODE_STXBITMAPS = 'E'
tdobject
= p_object
tdname
= p_name
tdid
= p_id
tdbtype
= p_btype
* X_TDOBJECT = ' '
* X_TDNAME = ' '
* X_TDID = ' '
* X_TDBTYPE = ' '
* _SCOPE = '2'
* _WAIT = ' '
* _COLLECT = ' '
exceptions
foreign_lock
=
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
raising enqueue_failed
.
endif
.
endform
.
" ENQUEUE_GRAPHIC
*&---------------------------------------------------------------------*
*& Form DEQUEUE_GRAPHIC
*&---------------------------------------------------------------------*
* Dequeue of graphics stored in BDS
*----------------------------------------------------------------------*
form dequeue_graphic
using p_object
p_name
p_id
p_btype
.
call
function
'DEQUEUE_ESSGRABDS'
exporting
* MODE_STXBITMAPS = 'E'
* X_TDOBJECT = ' '
* X_TDNAME = ' '
* X_TDID = ' '
* X_TDBTYPE = ' '
* _SCOPE = '3'
* _SYNCHRON = ' '
* _COLLECT = ' '
tdobject
= p_object
tdname
= p_name
tdid
= p_id
tdbtype
= p_btype
.
endform
.
" DEQUEUE_GRAPHIC
FORM SearchMAKTX
.
SELECT MAKTX
FROM MAKT
INTO MAKTX
WHERE MAKT
~MATNR
= MATNR
.
ENDSELECT
.
ENDFORM
.