2008 Jul 14 11:27 AM
Hi,
I would like to insert a picture on screen how can I do that. Please help. Thatnx a lot for the help you are about to give me.
2008 Jul 14 11:37 AM
Hi,
try this,
Step 1: Upload picture into SAP using the transaction SE78. Test picture.
Create a custom screen section in the screen.'customcontainer'
Step 3: In the PBO module of the screen, attach the following code. Please note that the object name is u2018winnyu2019, please pass your own object name to the method:
&----
*& Module STATUS_9000 OUTPUT
&----
text
----
MODULE STATUS_9000 OUTPUT. DATA: W_LINES TYPE I.
TYPES PICT_LINE(256) 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 = 'WINNY'
P_ID = 'BMAP'
P_BTYPE = 'BCOL'
RECEIVING
P_BMP = L_GRAPHIC_XSTR
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 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. 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.ENDMODULE. " STATUS_9000 OUTPUT
2008 Jul 14 11:29 AM
2008 Jul 14 11:29 AM
2008 Jul 14 11:30 AM
Hi,
Refer below link:
http://www.sapdevelopment.co.uk/graphics/add_image.htm
Hope it would be helpfull for you.
Best Regards,
Sunil.
2008 Jul 14 11:35 AM
Hi,
insert a picture (logo) into report:
Main menu -> Insert -> Picture... ->
then click somewhere in the report and u get browser dialogue where u choose .bmp file.ot .tif file. After that a rectangle appears with a line by it's diagonal in my report but no picture at all.
If useful reward the points.
Thanks
Sridhar.
2008 Jul 14 11:36 AM
2008 Jul 14 11:37 AM
Hi,
try this,
Step 1: Upload picture into SAP using the transaction SE78. Test picture.
Create a custom screen section in the screen.'customcontainer'
Step 3: In the PBO module of the screen, attach the following code. Please note that the object name is u2018winnyu2019, please pass your own object name to the method:
&----
*& Module STATUS_9000 OUTPUT
&----
text
----
MODULE STATUS_9000 OUTPUT. DATA: W_LINES TYPE I.
TYPES PICT_LINE(256) 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 = 'WINNY'
P_ID = 'BMAP'
P_BTYPE = 'BCOL'
RECEIVING
P_BMP = L_GRAPHIC_XSTR
EXCEPTIONS
NOT_FOUND = 1
INTERNAL_ERROR = 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. 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.ENDMODULE. " STATUS_9000 OUTPUT
2008 Jul 14 11:50 AM