07-05-2007 8:52 AM
Hi All,
I'm having a project where i should display the corresponding picture.
These are questions that i'm going to ask :
1. How can i store the image to SAP Server ? Could you direct me step by step please ..
2. How can i load the picture from the program ? Could it also be directed step by step ..
Many thanks all.
Still need your guidance a lot.
Kindly Regards,
Niel.
07-05-2007 8:55 AM
Hi Niel
U need:
- to save your image in TIF or BMP format;
- to load it in SAP by trx SE78;
- to use the statament BITMAP in your sapscript to print it:
/: BITMAP <IMAGE NAME> OBJECT GRAPHICS ID BMAP TYPE BCOL
Max
07-05-2007 8:55 AM
Hi Niel
U need:
- to save your image in TIF or BMP format;
- to load it in SAP by trx SE78;
- to use the statament BITMAP in your sapscript to print it:
/: BITMAP <IMAGE NAME> OBJECT GRAPHICS ID BMAP TYPE BCOL
Max
07-05-2007 8:56 AM
Hi,
For Uploading image in to SAP.
1. Go to txn. SMW0 select Binary data for WebRFC applications. Load your gif image here.
2.Maintain table SSM_CUST via SM30. Change the field START_IMAGE to the name of the object you created in SMW0.
I want to put the document in the logon screen so the users have info. to which client they should logon.
Check out OSS note #205487.
Please do the following steps to put the picture in the right side of the SAP Easy Access Menu Screen.
To put your company logo in the right-hand side of the initial
screen:
Put your picture in the database with the transaction SMW0
"Binary data" options, e.g. in ".GIF" format.
Put a record with the picture name in the key "START_IMAGE" of
the table SSM_CUST in the View maintenance transaction SM30.
You can adjust the picture to the window size automatically or
center it in the right-hand side of the initial screen
("RESIZE_IMAGE" "YES" or "NO" in the table SSM_CUST).
You can deactivate the picture globally so that noone sees it
with "HIDE_START_IMAGE" "YES" in the table SSM_CUST.
User-specific picture display settings are then ignored.
Cheers,
Simha.
Reward all the helpful answers...
07-05-2007 8:56 AM
Niel,
1.We will upload the logo using SE78.
2.RSTXLDMC-Using this program you can upload the logo.
K.Kiran.
07-05-2007 8:59 AM
Hi,
This needs to be done using the control frmaeworks classes.
here is a code snippet.
&----
*& Include ZAK_ADVERTISING_DEPT_PIC
&----
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: on_hotspot_click
FOR EVENT hotspot_click
OF cl_gui_alv_grid
IMPORTING e_row_id,
on_close
FOR EVENT close
OF cl_gui_dialogbox_container
IMPORTING sender,
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING e_row.
ENDCLASS. "lcl_event_handler DEFINITION
----
CLASS lcl_event_handler IMPLEMENTAITON
----
Implementation for displaying the picture
----
CLASS lcl_event_handler IMPLEMENTATION.
METHOD on_hotspot_click.
DATA: ls_advdept TYPE gs_advdept.
DATA: l_impath TYPE MGWPICTUREPATH. "zak_image.
READ TABLE gt_advdept INTO ls_advdept INDEX e_row_id-index.
CONCATENATE gs_mgwpicture-path ls_advdept-imname INTO l_impath.
CREATE OBJECT go_dialogbox_container
EXPORTING
width = 500
height = 200
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
event_already_registered = 6
error_regist_event = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
SET HANDLER lcl_event_handler=>on_close FOR go_dialogbox_container.
CREATE OBJECT go_picture
EXPORTING
parent = go_dialogbox_container
EXCEPTIONS
error = 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.
CALL METHOD go_picture->load_picture_from_url
EXPORTING
url = l_impath
EXCEPTIONS
error = 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.
ENDMETHOD. "on_hotspot_click
METHOD on_close.
CALL METHOD go_picture->free.
CALL METHOD sender->free.
FREE go_picture.
FREE go_dialogbox_container.
ENDMETHOD. "on_close
METHOD handle_double_click.
DATA :l_pos_row TYPE int4,
ls_advdept TYPE gs_advdept,
l_tdname TYPE thead-tdname.
CONSTANTS: c_tdid TYPE thead-tdid VALUE 'ST',
c_tdobject TYPE thead-tdobject VALUE 'TEXT',
c_tdprefix(7) TYPE c VALUE 'ZAK_PBB',
c_talker_tt(02) VALUE 'TT'. " Talker Text
l_pos_row = e_row-index.
READ TABLE gt_advdept INTO ls_advdept INDEX l_pos_row.
CLEAR l_tdname.
l_tdname(7) = c_tdprefix.
l_tdname+7(10) = ls_advdept-aktnr. "l_aktnr
l_tdname+17(18) = ls_advdept-matnr. "l_matnr.
l_tdname+35(3) = ls_advdept-mebme. "l_mebme.
l_tdname+38(18) = ls_advdept-filgr. "l_filgr.
l_tdname+56(02) = c_talker_tt.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = c_tdid
language = sy-langu
name = l_tdname
object = c_tdobject
TABLES
lines = gt_langt_format
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL SCREEN 200 STARTING AT 10 5.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_handler IMPLEMENTAITON
check the link below too...
please reward points
regards,
raksha
07-05-2007 9:12 AM
Thanks for all ..
But the point expected is not that .. ( i'm sorry if i didn't explain clearly ). The point that i need is the picture that it is loaded in custom control component (original report program).
My Questions are (based on my corresponding explanation.. above) :
1. How can i store the picture to server ?
2. How can i load the picture,stored in server (point 1), to custom control component?
Could you direct me step by step ??
Many thanks all.
Kind regards,
Niel.
i'm going to award the points as my gratitude to you all.
07-05-2007 9:23 AM
Hi Niel
I'm very sorry you're right.
U need to use the trx OAER in order to load a picture, here insert PICTURES as class and OT as type class and press F8.
Now you can load your picture as new document, then run trx DWDM, here you can find demo program explaining as to manage a picture.
Max
07-05-2007 9:47 AM
Thx Max.
I have already stored the picture through that t-code with object ID is zDufan.
I have made the program, but it still can't load the picture. If you don't mind to correct it.
For your information this is the code :
-
Start code.
data picture_control_1 type ref to cl_gui_picture.
data container_1 type ref to cl_gui_custom_container.
IF PICTURE_CONTROL_1 IS INITIAL.
Create controls
create object container_1
exporting container_name = 'PICTURE_CONTROL_1'.
CREATE OBJECT PICTURE_CONTROL_1 exporting parent = container_1.
DATA:
rslt TYPE i,
URL2 TYPE CNDP_URL.
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
OBJID = 'zDufan'
LIFETIME = cndp_lifetime_transaction
IMPORTING
URL = url2
EXCEPTIONS
OTHERS = 1.
CALL METHOD PICTURE_CONTROL_1->LOAD_PICTURE_FROM_URL
exporting URL = url2.
endif.
-
End code.
i still need your guidance Max.
p/s kindly advice me or correct the attached code above.
Best regards,
Niel.
07-05-2007 10:59 AM
Hi Niel
I've given a look and I think if it's use a code like your it should load the image using trx SMW0
Max
07-05-2007 11:03 AM
Tx a lot Max ..
But could you help me how to upload picture using tcode : smw0 step by step? And could i upload picture whose type is .bmp, .jpeg ??
Still need your help Max.
Many-many tks Max.
Kind regards,
Niel.
07-05-2007 11:10 AM
Niel,
Say thanks to Pavan Praveen who helped me with this sometime back.
To create a logo u have to remember one thing is u have to upload that logo through OAER or SE78
for uploading logo in OAER
Enter class name as PICTURES
Class type as OT
Object key the name of ur logo want to upload
then press F8 or execute
Then it will automatically creates a folder for ur LOGO and upload ur logo in that folder
After that In the left side bottom of the page u can c the following options
1)Detail
2)Document Info
3)Keywords
4)Create
goto Detail in which u can find the Object Id
which u have to paste in the function module of this program
Check this program1
&----
*& Report ZREPORT_LOGO *
*& *
&----
*& *
*& *
&----
REPORT ZREPORT_LOGO.
DATA:
docking TYPE REF TO cl_gui_docking_container,
picture_control_1 TYPE REF TO cl_gui_picture,
url(256) TYPE c .
DATA : sum(4) , num1(4) , num2(4).
PARAMETERS: p_dummy(4) DEFAULT '4' .
PARAMETERS: p_dummy1(4) DEFAULT '5' .
AT SELECTION-SCREEN OUTPUT.
PERFORM show_pic.
START-OF-SELECTION.
num1 = p_dummy.
num2 = p_dummy1.
sum = num1 + num2.
WRITE : / sum.
&----
*& Form show_pic
&----
FORM show_pic.
DATA: repid LIKE sy-repid.
repid = sy-repid.
CREATE OBJECT picture_control_1 EXPORTING parent = docking.
CHECK sy-subrc = 0.
CALL METHOD picture_control_1->set_3d_border
EXPORTING
border = 5.
CALL METHOD picture_control_1->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_stretch.
CALL METHOD picture_control_1->set_position
EXPORTING
height = 100
left = 500
top = 10
width = 300.
CALL METHOD picture_control_1->load_picture_from_url
EXPORTING
url = 'c:/pic.bmp'.
IF sy-subrc NE 0.
ENDIF.
ENDFORM. "show_pic
*************************************************
Check this program 2
program zsap_picture_demo.
set screen 200.
TYPE-POOLS cndp.
************************************************************************
CLASS c_event_receiver
DEFINITION
************************************************************************
class c_event_receiver definition.
The class is used to test the events raised by the cl_gui_picture
class
public section.
methods event_handler_picture_dblclick
for event picture_dblclick of cl_gui_picture
importing mouse_pos_x mouse_pos_y sender.
methods event_handler_context_menu
for event context_menu of cl_gui_picture
importing sender.
methods event_handler_context_menu_sel
for event context_menu_selected of cl_gui_picture
importing fcode sender.
endclass.
************************************************************************
DATA
************************************************************************
data function like sy-ucomm. " OK-Code field in screen 200
data url type cndp_url. " URL-field in screen 200
data url2 type cndp_url. " URL-field in screen 200
data picture_control_1 type ref to cl_gui_picture.
data picture_control_2 type ref to cl_gui_picture.
data container_1 type ref to cl_gui_custom_container.
data container_2 type ref to cl_gui_custom_container.
data event_receiver type ref to c_event_receiver.
data event_tab type cntl_simple_events.
data event_tab_line type cntl_simple_event.
data return type i.
************************************************************************
PBO
before_output
************************************************************************
module before_output output.
set pf-status 'MAIN0001'.
IF PICTURE_CONTROL_1 IS INITIAL.
Create controls
create object container_1
exporting container_name = 'PICTURE_CONTROL_1'.
create object container_2
exporting container_name = 'PICTURE_CONTROL_2'.
CREATE OBJECT PICTURE_CONTROL_1 exporting parent = container_1.
CREATE OBJECT PICTURE_CONTROL_2 exporting parent = container_2.
Register the events
EVENT_TAB_LINE-EVENTID = CL_GUI_PICTURE=>EVENTID_PICTURE_DBLCLICK.
append EVENT_TAB_LINE to EVENT_TAB.
EVENT_TAB_LINE-EVENTID = CL_GUI_PICTURE=>EVENTID_CONTEXT_MENU.
append EVENT_TAB_LINE to EVENT_TAB.
EVENT_TAB_LINE-EVENTID = CL_GUI_PICTURE=>EVENTID_CONTEXT_MENU_SELECTED.
append EVENT_TAB_LINE to EVENT_TAB.
CALL METHOD PICTURE_CONTROL_1->SET_REGISTERED_EVENTS
exporting
EVENTS = event_tab.
CALL METHOD PICTURE_CONTROL_2->SET_REGISTERED_EVENTS
exporting
EVENTS = event_tab.
Create the event_receiver object and set the handlers for the events
of the picture controls
create object event_receiver.
set handler event_receiver->event_handler_picture_dblclick
FOR PICTURE_CONTROL_1.
set handler event_receiver->event_handler_context_menu
FOR PICTURE_CONTROL_1.
set handler event_receiver->event_handler_context_menu_sel
FOR PICTURE_CONTROL_1.
set handler event_receiver->event_handler_picture_dblclick
FOR PICTURE_CONTROL_2.
set handler event_receiver->event_handler_context_menu
FOR PICTURE_CONTROL_2.
set handler event_receiver->event_handler_context_menu_sel
FOR PICTURE_CONTROL_2.
Set the display mode to 'normal' (0)
CALL METHOD PICTURE_CONTROL_1->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL.
CALL METHOD PICTURE_CONTROL_2->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL.
Set 3D Border
CALL METHOD PICTURE_CONTROL_1->SET_3D_BORDER
exporting border = 1.
CALL METHOD PICTURE_CONTROL_2->SET_3D_BORDER
exporting border = 1.
new async implementation since 4.6C
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
OBJID = 'HTMLCNTL_TESTHTM2_SAP_AG'
LIFETIME = cndp_lifetime_transaction
IMPORTING
URL = url
EXCEPTIONS
OTHERS = 1.
Load the picture by using the url generated by the data provider.
if sy-subrc = 0.
CALL METHOD PICTURE_CONTROL_1->LOAD_PICTURE_FROM_URL_ASYNC
exporting url = url.
endif.
CALL FUNCTION 'DP_PUBLISH_WWW_URL'
EXPORTING
OBJID = 'DEMOWORD97SAPLOGO'
LIFETIME = cndp_lifetime_transaction
IMPORTING
URL = url2
EXCEPTIONS
OTHERS = 1.
load image
if sy-subrc = 0.
CALL METHOD PICTURE_CONTROL_2->LOAD_PICTURE_FROM_URL_async
exporting url = url2.
endif.
endif.
endmodule.
************************************************************************
PAI
after_input
************************************************************************
module after_input input.
case function.
At the end of the program destroy the control
when 'BACK'.
CALL METHOD container_1->FREE.
CALL METHOD container_2->FREE.
leave to screen 0.
Change the display mode
when 'NORMAL'.
CALL METHOD PICTURE_CONTROL_1->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL.
CALL METHOD PICTURE_CONTROL_2->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL.
when 'STRETCH'.
CALL METHOD PICTURE_CONTROL_1->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_STRETCH.
CALL METHOD PICTURE_CONTROL_2->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_STRETCH.
when 'FIT'.
CALL METHOD PICTURE_CONTROL_1->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT.
CALL METHOD PICTURE_CONTROL_2->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT.
when 'NORMAL_CTR'.
CALL METHOD PICTURE_CONTROL_1->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL_CENTER.
CALL METHOD PICTURE_CONTROL_2->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL_CENTER.
when 'FIT_CTR'.
CALL METHOD PICTURE_CONTROL_1->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER.
CALL METHOD PICTURE_CONTROL_2->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER.
Clear the picture
when 'CLEAR'.
CALL METHOD PICTURE_CONTROL_1->CLEAR_PICTURE.
Load a new picture
when space.
CALL METHOD PICTURE_CONTROL_1->LOAD_PICTURE_FROM_URL
exporting url = url
importing result = return.
call method cl_gui_cfw=>flush.
if return = 0.
url = text-000.
endif.
endcase.
clear function.
endmodule.
************************************************************************
CLASS c_event_receiver
IMPLEMENTATION
************************************************************************
CLASS C_event_receiver implementation.
************************************************************************
CLASS c_event_receiver
METHOD event_handler_picture_dblclick
************************************************************************
METHOD EVENT_HANDLER_PICTURE_DBLCLICK.
for event picture_dblclick of c_picture_control
importing mouse_pos_x mouse_pos_y.
DATA pos_x(5) type c.
DATA pos_y(5) type c.
pos_x = mouse_pos_x.
pos_y = mouse_pos_y.
IF SENDER = PICTURE_CONTROL_1.
MESSAGE I000(0K) WITH
'DoubleClick' 'Upper Picture' POS_X POS_Y. "#EC NOTEXT
else.
MESSAGE I000(0K) WITH
'DoubleClick' 'Lower Picture' POS_X POS_Y. "#EC NOTEXT
endif.
endmethod.
************************************************************************
CLASS c_event_receiver
METHOD event_handler_context_menu
************************************************************************
METHOD EVENT_HANDLER_CONTEXT_MENU.
data menu type ref to cl_ctmenu.
create object menu.
call method menu->ADD_FUNCTION exporting
fcode = text-001
TEXT = TEXT-001.
call method menu->ADD_FUNCTION exporting
FCODE = TEXT-002
TEXT = TEXT-002.
call method menu->ADD_FUNCTION exporting
FCODE = TEXT-003
TEXT = TEXT-003.
call method menu->ADD_FUNCTION exporting
FCODE = TEXT-004
TEXT = TEXT-004.
call method menu->ADD_FUNCTION exporting
FCODE = TEXT-005
TEXT = TEXT-005.
CALL METHOD SENDER->DISPLAY_CONTEXT_MENU
EXPORTING CONTEXT_MENU = MENU.
endmethod.
************************************************************************
CLASS c_event_receiver
METHOD event_handler_context_menu_sel
************************************************************************
METHOD EVENT_HANDLER_CONTEXT_MENU_sel.
DATA DISPLAY_MODE TYPE I.
IF FCODE = TEXT-001.
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL.
ENDIF.
IF FCODE = TEXT-002.
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_STRETCH.
ENDIF.
IF FCODE = TEXT-003.
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT.
ENDIF.
IF FCODE = TEXT-004.
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL_CENTER.
ENDIF.
IF FCODE = TEXT-005.
DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER.
ENDIF.
CALL METHOD SENDER->SET_DISPLAY_MODE
EXPORTING DISPLAY_MODE = DISPLAY_MODE.
endmethod.
endclass.
Note: While creating this program I had observed the thing is it will accepts the logo which was having the URL so try to create a logo of URL but u can display the Standard SAP logo using this program
********************************************************
To upload the the logo image on the right hand side of the SAP screen.
Transaction codeSMW0
X - Binary data for WebRFC application
Hit Enter
Click Execute
Click Settings -> Maintain MIME types
Click the Create button
Fill in :- TYPE : image/gif EXTENSION : .GIF
Click Save
Click Back to the Binary data for WebRFC
Click Create
Fill in :- Obj. name : ZXXXX.GIF Description : Company Logo
Click Import and specify the filename where your GIF file is located.File type is BIN. Finish press the Transfer button.
If successful, your logo will be shown in the Binary data for WebRFC.
Transaction codeSM30 - Table/View - SSM_CUST
Click Maintain
Click New Entries
Name Value to be set
START_IMAGE ZXXXX.GIF
RESIZE_IMAGE NO
Logoff and Login again
Check this link
01-29-2010 9:20 AM
dear,
how to print this or can we take it to smartforms
regards,
hasan