Documente Academic
Documente Profesional
Documente Cultură
PERFORM load_picture.
LOOP AT iprofile.
“2. Now Read the image in JPG format by using below function module.
CALL FUNCTION ‘ALINK_RFC_TABLE_GET’
EXPORTING
im_docid = p_connect_info-arc_doc_id
im_crepid = p_connect_info-archiv_id
IMPORTING
ex_length = length
TABLES
ex_document = it_doc.
“3. Convert the image from JPG Format to Binary Format by using the below function
module.
crep_id = p_connect_info-archiv_id.
doc_id = p_connect_info-arc_doc_id.
phio_id = p_connect_info-object_id.
“4. create a folder in the presentation layer in one of the directory. By using below function
module.
CALL FUNCTION ‘TMP_GUI_CREATE_DIRECTORY’
EXPORTING
dirname = ‘C:\TEMP’
no_flush = ‘ ‘
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.
“5. download the image of the pernr into this folder by using below function module.
CALL FUNCTION ‘GUI_DOWNLOAD’
EXPORTING
filename = zfilename
filetype = ‘BIN’
TABLES
data_tab = it_bin
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
OTHERS = 22.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
* BREAK-POINT.
“6. Now upload the file which you have downloaded by using the function module.
CALL FUNCTION ‘GUI_UPLOAD’
EXPORTING
filename = zfilename
filetype = ‘BIN’
IMPORTING
filelength = l_content_length
TABLES
data_tab = mime
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
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.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
* BREAK-POINT.
IF sy-subrc = 0.
dpi = ‘100’.
CALL METHOD i_igs_image_converter->get_image
IMPORTING
blob = blob
blob_size = blob_size
blob_type = blob_type.
ENDIF.
* BREAK-POINT.
wa_stxbitmaps-tdname = iprofile-pernr.
wa_stxbitmaps-tdobject = ‘GRAPHICS’.
wa_stxbitmaps-tdid = ‘BMAP’.
wa_stxbitmaps-tdbtype = ‘BCOL’.
wa_stxbitmaps-docid = p_docid.
wa_stxbitmaps-widthpix = l_width_pix. “‘450’. “‘540’.”‘640’ .”l_width_pix.
wa_stxbitmaps-heightpix = l_height_pix. “‘400’. “‘480’. “l_height_pix.
wa_stxbitmaps-widthtw = l_width_tw. “‘11200’. “‘12288’.”l_width_tw.
wa_stxbitmaps-heighttw = l_height_tw. “‘8000’. “‘9216’.”l_height_tw.
wa_stxbitmaps-resolution = ‘100’.
INSERT INTO stxbitmaps VALUES wa_stxbitmaps.
“10. delete the file which is present on presentation layer by using below FM.
CALL METHOD cl_gui_frontend_services=>file_delete
EXPORTING
filename = zfilename
CHANGING
rc = rc
EXCEPTIONS
file_delete_failed = 1
cntl_error = 2
error_no_gui = 3
file_not_found = 4
access_denied = 5
unknown_error = 6
not_supported_by_gui = 7
wrong_parameter = 8
OTHERS = 9.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
“11. After all the employees delete the floder in the presentation layer which you have
created.
“Note: Give the name of the Picture when your are uploading into SE78 as Employee
Number so that for every employee we will get pictures individually in SE78 as name as
Employee Number.
“Now in order to print Employee Photo dynamically in smart forms. Generally we use
graphic window for displaying Logos, Photos etc.
“But here we have to print Employee Photo for particular employee. So in order to do this
code as shown below .This code we have to create program lines then we need to write below
code before graphic node.
* DATA: wa_stxbitmaps TYPE stxbitmaps.
* wa_stxbitmaps-tdname = itprofile-pernr.
* wa_stxbitmaps-tdobject = ‘GRAPHICS’.
* wa_stxbitmaps-tdid = ‘BMAP’.
* wa_stxbitmaps-tdbtype = ‘BCOL’.
*
* CALL FUNCTION ‘SSFCOMP_PRINT_GRAPHIC’
* EXPORTING
* bm_name = wa_stxbitmaps-tdname
* bm_object = wa_stxbitmaps-tdobject
* bm_id = wa_stxbitmaps-tdid
* bm_type = wa_stxbitmaps-tdbtype
* bm_dpi = ‘0100’
* EXCEPTIONS
* error = 1
* non_main_overflow = 2
* OTHERS = 3.
* IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
* ENDIF.
CLEAR: length,crep_id,doc_id,phio_id,l_content_length,
l_bds_signature,l_object_key,wa_bds_signature,
wa_bds_components,wa_stxbitmaps.
REFRESH: it_doc,it_bin,mime,blob,l_bds_content.
FREE i_igs_image_converter.
FREE l_bds_object.
ENDLOOP.
Like this:
Related
Send external email from within ABAP program The code below demonstrates how to send
an email to an external email address(test@sapdev.co.uk) *&---------------------------------------
------------------------------* *& Report ZSENDEMAIL *
*& * *&---------------------------------------------------
------------------* *& Example of sending external email via SAPCONNECT *
*& * *&---------------------------------------------------
------------------* REPORT zsendemail . PARAMETERS: psubject(40) type c
default 'Hello',…
Convert Spool request to PDF and send as e-mail The code below demonstrates how to
retrieve a spool request and email it as a PDF document. Please note for the below program to
process a spool request the program must be executed in background otherwise no spool
request will be…
Leave a Reply
727c11bcd9 /2016/03/29/abap-d guest
Search
Category
o ABAP HR (14)
o HR (3)
o php (2)
o Saham (3)
o SAP (81)
ABAP (79)
Coding (56)
File Processing (15)
OLE (5)
SCREEN (15)
Search Help / Listbox (3)
o Tips & Tricks (4)
o Vb.net (5)
Archives
o March 2016 (3)
o July 2015 (1)
o June 2015 (44)
o April 2007 (8)
o February 2007 (39)
Recent Comment
zdiodic on ABAP – BPJS Kesehatan Pr…
Dewi on ABAP – BPJS Kesehatan Pr…
Eslam on SAP – Send external emai…
Piroz Eslam on SAP – Sending mail with…
cio on SAP – Send external emai…
Blog Stats
o 83,560 hits
http://feedjit.com
Blog at WordPress.com.
Post to
Reblog Post 728370 https://diocio.wordp BUKU TEBALKU
Cancel
bae333c954 /2016/03/29/abap-d
o BUKU TEBALKU
o Customize
o Follow
o Sign up
o Log in
o Copy shortlink
o Report this content
o Manage subscriptions
o Collapse this bar
%d bloggers like this:
<img src="https://pixel.wp.com/b.gif?v=noscript"
style="height:0px;width:0px;overflow:hidden" alt="" />
REPORT THIS AD
A+ A-
Before running the code given below what should we do?
4. Done.
Note : In the program given below I have used a screen 9000. Please do create it
before running and also create acustom control in the screen layout and give the
name ‘PICTURECONTROL’ to it.
SOURCE CODE
*&------------------------------------------------------------
---------*
*& Report Z03_QRCODE_IMAGE
*&
*&------------------------------------------------------------
---------*
*&
*&
*&------------------------------------------------------------
---------*
REPORT z03_qrcode_image.
* BDS handling
constants:
c_bds_classname type sbdst_classname value
'DEVC_STXD_BITMAP',
c_bds_classtype type sbdst_classtype value 'OT', "
others
c_bds_mimetype type bds_mimetp value
'application/octet-stream',
c_bds_original type sbdst_doc_var_tg value 'OR'.
* 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'.
"Picture Control
DATA: picture_container TYPE REF TO cl_gui_custom_container,
picture_control TYPE REF TO cl_gui_picture.
START-OF-SELECTION.
PERFORM download_qrcode.
PERFORM convert_image.
*&------------------------------------------------------------
---------*
*& Form DOWNLOAD_QRCODE
*&------------------------------------------------------------
---------*
* text
*-------------------------------------------------------------
---------*
* --> p1 text
* <-- p2 text
*-------------------------------------------------------------
---------*
FORM download_qrcode .
CONCATENATE
'http://chart.apis.google.com/chart?chs=200x200&cht=qr&chld=|1
&chl=' qr_text '/chart.png' INTO url.
IF sy-subrc = 0.
http_client->send( ).
http_client->receive( ).
content = http_client->response->get_data( ).
http_client->close( ).
ENDIF.
*&------------------------------------------------------------
---------*
*& Form CONVERT_IMAGE
*&------------------------------------------------------------
---------*
* text
*-------------------------------------------------------------
---------*
* --> p1 text
* <-- p2 text
*-------------------------------------------------------------
---------*
FORM convert_image .
i_igs_image_converter->input = 'image/png'.
i_igs_image_converter->output = 'image/bmp'.
i_igs_image_converter->width = width.
i_igs_image_converter->height = height.
ENDIF.
IF sy-subrc = 0.
IF p_rad1 = 'X'.
ELSE.
ENDIF.
ENDIF.
*&------------------------------------------------------------
---------*
*& Module STATUS_9000 OUTPUT
*&------------------------------------------------------------
---------*
* text
*-------------------------------------------------------------
---------*
PERFORM call_screen.
*&------------------------------------------------------------
---------*
*& Form CALL_SCREEN
*&------------------------------------------------------------
---------*
* text
*-------------------------------------------------------------
---------*
* --> p1 text
* <-- p2 text
*-------------------------------------------------------------
---------*
FORM call_screen .
IF sy-subrc IS INITIAL.
CALL METHOD picture_control->load_picture_from_url
EXPORTING
url = l_img_url.
ENDIF.
*&------------------------------------------------------------
---------*
*& Module USER_COMMAND_9000 INPUT
*&------------------------------------------------------------
---------*
* text
*-------------------------------------------------------------
---------*
MODULE user_command_9000 INPUT.
IF sy-ucomm = 'BACK'.
LEAVE TO SCREEN 0.
ENDIF.
*&------------------------------------------------------------
---------*
*& Form SHOW_SMART_FORM
*&------------------------------------------------------------
---------*
* text
*-------------------------------------------------------------
---------*
* --> p1 text
* <-- p2 text
*-------------------------------------------------------------
---------*
FORM show_smart_form .
IF sy-subrc = 0.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
*&------------------------------------------------------------
---------*
*& 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.
* 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.
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.
wa_bds_signature-doc_count = '1'.
append wa_bds_signature to l_bds_signature.
if sy-subrc <> 0.
endif.
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.
if sy-subrc = 0.
endif.