‎2011 Nov 27 7:56 AM
Hi to all.
I am new in abap programming.
I would like to ask what could be the reason in my program for not printing the image. I do not know where's my mistake is, please help. Thanks..
I got this program from internet and it's pretty displaying the image ( I uploaded the image in SE78), then I created the program below and run it, but when I happened to click the print button, it wasn't giving me anything or no action at all.
REPORT ZPICTURE04.
START-OF-SELECTION.
SET PF-STATUS 'ADJTEMP'.
CALL SCREEN 9000.
module status_9000 output.
SET PF-STATUS 'ADJTEMP'.
data: w_lines type i.
types pict_line(256) type c.
data : ok_code type c,
exit type c.
data :
container type ref to cl_gui_custom_container,
editor type ref to cl_gui_textedit,
picture type ref to cl_gui_picture,
pict_tab type table of pict_line,
url(255) type c.
data: graphic_url(255). data: begin of graphic_table occurs 0,
line(255) type x,
end of graphic_table.
data: l_graphic_conv type i.
data: l_graphic_offs type i.
data: graphic_size type i.
data: l_graphic_xstr type xstring.
call method cl_gui_cfw=>flush. create object:
container exporting container_name = 'PICTURE_CONTAINER',
picture exporting parent = container.
call method cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
exporting
p_object = 'GRAPHICS'
p_name = 'XLPE'
p_id = 'BMAP'
p_btype = 'BCOL'
receiving
p_bmp = l_graphic_xstr
.
graphic_size = xstrlen( l_graphic_xstr ).
l_graphic_conv = graphic_size.
l_graphic_offs = 0.
while l_graphic_conv > 255.
graphic_table-line = l_graphic_xstr+l_graphic_offs(255).
append graphic_table.
l_graphic_offs = l_graphic_offs + 255.
l_graphic_conv = l_graphic_conv - 255.
endwhile.
graphic_table-line = l_graphic_xstr+l_graphic_offs(l_graphic_conv).
append graphic_table.
call function 'DP_CREATE_URL'
exporting
type = 'IMAGE'
subtype = 'X-UNKNOWN'
size = graphic_size
lifetime = 'T'
tables
data = graphic_table
changing
url = url.
call method picture->load_picture_from_url
exporting
url = url.
call method picture->set_display_mode
exporting
display_mode = picture->display_mode_fit_center.
case sy-ucomm.
when 'EXIT'.
leave program.
WHEN '%PRI'.
NEW-PAGE PRINT ON
DESTINATION 'LP01'
IMMEDIATELY 'X'
KEEP IN SPOOL 'X'
NO DIALOG.
NEW-PAGE PRINT OFF.
endcase.
endmodule. " STATUS_9000 OUTPUT
my pf-status " SET PF-STATUS 'ADJTEMP", I set it from the / menu / extras / adjust template then List status.
Is there anything I missed for not printing it? Thanks a lot to all.
Edited by: chard_vill on Nov 27, 2011 8:59 AM
‎2011 Nov 27 8:30 AM
‎2011 Nov 27 8:30 AM
‎2011 Nov 27 1:16 PM
Hi Venkat, Thanks a lot for the very helpful reply.
I can't seem follow the contents in the link and lost it somewhere, may be I am missing something being a beginner?
I actually have that program for displaying the image, uploaded from the transaction SMW0 (Binary data for WebRFC applications.). I successfully uploaded the images (format .gif and jpeg), and it was also successful displaying on the screen container.
The problem now is also similar, print button seems not functioning, I guess I am missing something I don't know.
Your help is really appreciated, thanks a lot!
here is my executable program.
REPORT ZPICTURE02.
TYPE-POOLS: cndp.
DATA: ok_code TYPE syucomm,
container TYPE REF TO cl_gui_custom_container,
picture TYPE REF TO cl_gui_picture,
url TYPE cndp_url,
print_parameters TYPE pri_params,
valid_flag TYPE c LENGTH 1..
User can input which object name they uploaded from SMW0.
PARAMETERS: p_objid TYPE w3objid OBLIGATORY.
Here query the table and throw error message if the object is not found.
AT SELECTION-SCREEN.
SELECT COUNT(*) FROM wwwparams
WHERE objid = p_objid.
IF sy-subrc <> 0.
MESSAGE e001(00) WITH 'MIME Object not found'.
ENDIF.
START-OF-SELECTION.
Enabled the function keys from template
SET PF-STATUS 'S0100'.
IF container is INITIAL.
CREATE OBJECT container
EXPORTING
container_name = 'CONT'
repid = 'ZPICTURE02'
dynnr = '0100'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE i001(00) WITH 'Error while creating container'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF picture is INITIAL.
CREATE OBJECT picture
EXPORTING
parent = container
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE i001(00) WITH 'Error while displaying pictures'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
IF picture IS NOT INITIAL.
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
objid = p_objid
lifetime = cndp_lifetime_transaction
IMPORTING
url = url
EXCEPTIONS
OTHERS = 1.
IF sy-subrc = 0.
CALL METHOD picture->load_picture_from_url_async
EXPORTING
url = url.
CALL METHOD picture->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_fit.
ELSE.
MESSAGE i001(00) WITH 'Error while loading picture222'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDIF.
call SCREEN 0100.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'S0100'.
SET TITLEBAR 'XXX'.
ENDMODULE.
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'BACK'.
SET SCREEN 00.
LEAVE SCREEN.
when 'EXIT'.
LEAVE PROGRAM.
WHEN 'PRINT'.
NEW-PAGE PRINT ON
DESTINATION 'LP01'
IMMEDIATELY 'X'
KEEP IN SPOOL 'X'
NO DIALOG.
NEW-PAGE PRINT OFF.
WHEN 'PRNLOG'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
IMPORTING
out_parameters = print_parameters
valid = valid_flag
EXCEPTIONS
invalid_print_params = 2
OTHERS = 4.
NEW-PAGE PRINT ON PARAMETERS print_parameters
NO DIALOG.
NEW-PAGE PRINT OFF.
ENDCASE.
ENDMODULE.
In my own opinion, the function code "%PRN" and "PRINT" seems not functioning, is there anything I missed?
Thanks a lot.
‎2011 Nov 28 8:12 AM
Hello Dear guru's out there!
In addition to my question, I would like to point out that there's no problem in displaying images both in the transaction SE78 and SMW0. But the only problem is, the printing.
After displaying the images, i'd like to click the print button and print the contents of my screen, and there goes the problem not printing, is there any way to print it?
Thanks!