‎2013 Jan 05 8:04 AM
Hi experts..
I have a container and am calling a image into it,
i have got the image displayed in the container.
Now my requirement is to trigger PAI when i click on the image,
can i have a function code for the image?
is it possible??
Thanks
Askar.
‎2013 Jan 07 7:06 AM
Create an handling method to manage the events click [double] on picture : CL_GUI_PICTURE=>PICTURE_CLICK [PICTURE_DBLCLICK] (*). In this method trigger the PAI with FM like SAPGUI_SET_FUNCTIONCODE or class cl_gui_cfw=>set_new_ok_code. But do you actually need to trigger PAI, couldn't you manage it in the method ?
Regards,
Raymond
PS: Check demo program DEMO_PICTURE_CONTROL.
‎2013 Jan 05 8:38 AM
Hi,
Please put a breakpoint in PAI and click on your image.
Check the value of SY_UCOMM.
This would be your required F Code.
Regrds,
Amit
‎2013 Jan 07 6:06 AM
Thank you for your reply, i tried..
but its no use...
clicking on image doesn't load the PAI.
any other ideas??
THANKS
Askar
‎2013 Jan 05 8:41 AM
You can refer to the sample SAP_PICTURE_DEMO.
You add cl_gui_picture=>EVENTID_CONTROL_CLICK to trigger PAI when you click on the image.
‎2013 Jan 07 6:14 AM
See the following link ...
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIIMAGE/BCCIIMAGE.pdf
In the PDF look for the topic SAP Picture Events..
A list of events for your requirement are there.
‎2013 Jan 07 7:00 AM
‎2013 Jan 07 7:09 AM
Hi Askar,
Just for your reference go through the initial screen of t-code ABAPDOCU,Here Image is attached ( which is available in the screen 600 of the program SAPMSABAPDEMOS_TREE ) & on click of the image it will give the Information about the Structure.Debugg and findout the way Image is used to trigger functions. Go through the PBO and PAI of the screen 600,hope that helps.
With regards,
‎2013 Jan 07 7:18 AM
Hi ,
Can you please check the events of the class which you are using .
Eg: if the class used is CL_GUI_ALV_GRID then the event BUTTON_CLICK can be checked.
Regards,
Amit
‎2013 Jan 07 8:59 AM
Hi...
i have imported picture first in BMP format in t-code SE-78,and this is my code.
CALL METHOD cl_gui_cfw=>flush.
CREATE OBJECT:
container EXPORTING container_name = 'DMS',
picture EXPORTING parent = container.
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = 'GRAPHICS'
p_name = 'DMS'
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.
‎2013 Jan 07 9:06 AM
As you said,i saw it in debugging mode,
i checks eventid.
could you please explain it a little more.
Thankyou
Askar
‎2013 Jan 07 9:25 AM
Hi Askar,
Your code is fine no problem.
Just try calling this like.
PAI
module image_click.
.
..
....
......
........
module image_click.
Perform < use CL_GUI_PICTURE event PICTURE_CLICK >
endmodule.
Please search for the code how to use CL_GUI_PICTURE event PICTURE_CLICK
Regards,
Amit
‎2013 Jan 07 1:02 PM
could you please send me the code?
i tried but am not able to fix it..
this is what i have done,
\IN PAI
----
-----
-------
fs_event-eventid = cl_picture->eventid_picture_click.
APPEND fs_event TO t_events.
CALL METHOD cl_picture->set_registered_events
EXPORTING
events = t_events
EXCEPTIONS
cntl_error = 1
OTHERS = 4.
when i click the image nothing is happening,
i switched on the debugger,nothing happens..
‎2013 Jan 07 7:06 AM
Create an handling method to manage the events click [double] on picture : CL_GUI_PICTURE=>PICTURE_CLICK [PICTURE_DBLCLICK] (*). In this method trigger the PAI with FM like SAPGUI_SET_FUNCTIONCODE or class cl_gui_cfw=>set_new_ok_code. But do you actually need to trigger PAI, couldn't you manage it in the method ?
Regards,
Raymond
PS: Check demo program DEMO_PICTURE_CONTROL.
‎2013 Jan 07 8:54 AM
Yea,Thanks a lot for your patient reply...
actually am a beginner, am not able to get through it.
Can you please explain more clearly???
Thanks
Askar
‎2013 Jan 07 9:15 AM
Check the sample at Display picture in a container and triggering event picture_click.
Regards,
Raymond
‎2013 Jan 08 6:25 AM
Thank you for you reply,
i got a little bit and tried my code,now it runs but none of the image's are loading.
The change i have made is this..
* CALL METHOD cl_gui_cfw=>flush.
* CREATE OBJECT:
* container EXPORTING container_name = 'DMS',
* picture EXPORTING parent = container.
I also want to know where in the program they have given CONTAINER for the picture,
i have given container in screen painter.
‎2013 Jan 08 6:58 AM
Hi Askar,
Please refer the
CREATE OBJECT cl_pic_container
EXPORTING
dynnr = '100'
side = cl_gui_docking_container=>dock_at_top
extension = 300.
CREATE OBJECT cl_picture
EXPORTING
parent = cl_pic_container.
In the above URL given by Raymond.
Regards,
Amit
‎2013 Jan 08 7:06 AM
Hi Askar,
Please refer the
CREATE OBJECT cl_pic_container
EXPORTING
dynnr = '100'
side = cl_gui_docking_container=>dock_at_top
extension = 300.
CREATE OBJECT cl_picture
EXPORTING
parent = cl_pic_container.
In the above URL given by Raymond.
Regards,
Amit
‎2013 Jan 08 9:03 AM
i tried the above code,the link raymond gave,but it just calls an empty screen.
please help..
*&---------------------------------------------------------------------*
*& Report ZPICTURE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zpicture.
CONSTANTS: cntl_true TYPE i VALUE 1,
cntl_false TYPE i VALUE 0.
DATA:
cl_pic_container TYPE REF TO cl_gui_docking_container,
container TYPE REF TO cl_gui_custom_container,
picture TYPE REF TO cl_gui_picture,
cl_picture TYPE REF TO cl_gui_picture,
* react TYPE REF TO lcl_event_handler,
t_events TYPE cntl_simple_events,
fs_event TYPE cntl_simple_event.
DATA: graphic_url(255) TYPE c,
graphic_refresh(1) TYPE c,
g_result TYPE i.
DATA: BEGIN OF graphic_tab OCCURS 0,
line(255) TYPE x,
END OF graphic_tab.
DATA: graphic_size TYPE i.
CALL SCREEN 100. " Create a screen and activate the PBO and PAI process
*----------------------------------------------------------------------*
* CLASS lcl_event_handler DEFINTION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS: click FOR EVENT picture_click OF cl_gui_picture
IMPORTING mouse_pos_x mouse_pos_y.
ENDCLASS. "lcl_event_handler DEFINTION
*----------------------------------------------------------------------*
* CLASS lcl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_event_handler IMPLEMENTATION.
METHOD click.
CALL SCREEN 200. " Create a screen 200 and activate the PBO and PAI Process
ENDMETHOD. "click
ENDCLASS. "lcl_event_handler IMPLEMENTATION
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'TEST'.
* SET TITLEBAR 'xxx'.
DATA: l_graphic_xstr TYPE xstring,
l_graphic_conv TYPE i,
l_graphic_offs TYPE i.
* CALL METHOD cl_gui_cfw=>flush.
* CREATE OBJECT:
* container EXPORTING container_name = 'DMS',
* picture EXPORTING parent = container.
CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = 'GRAPHICS'
p_name = 'DMS' "IMAGE NAME - Image name from SE78
p_id = 'BMAP'
p_btype = 'BCOL' "(BMON = black&white, BCOL = colour)
RECEIVING
p_bmp = l_graphic_xstr
EXCEPTIONS
not_found = 1
OTHERS = 2.
graphic_size = XSTRLEN( l_graphic_xstr ).
CHECK graphic_size > 0.
l_graphic_conv = graphic_size.
l_graphic_offs = 0.
WHILE l_graphic_conv > 255.
graphic_tab-line = l_graphic_xstr+l_graphic_offs(255).
APPEND graphic_tab.
l_graphic_offs = l_graphic_offs + 255.
l_graphic_conv = l_graphic_conv - 255.
ENDWHILE.
graphic_tab-line = l_graphic_xstr+l_graphic_offs(l_graphic_conv).
APPEND graphic_tab.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'image'
subtype = 'BMP' "cndp_sap_tab_unknown
size = graphic_size
lifetime = cndp_lifetime_transaction
TABLES
data = graphic_tab
CHANGING
url = graphic_url
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
EXIT.
ENDIF.
CREATE OBJECT cl_pic_container
EXPORTING
dynnr = '100'
side = cl_gui_docking_container=>dock_at_top
extension = 300.
CREATE OBJECT cl_picture
EXPORTING
parent = cl_pic_container.
BREAK-POINT.
CALL METHOD cl_picture->load_picture_from_url
EXPORTING
url = graphic_url
IMPORTING
RESULT = g_result.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
fs_event-eventid = cl_picture->eventid_picture_click.
APPEND fs_event TO t_events.
CALL METHOD cl_picture->set_registered_events
EXPORTING
events = t_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3
OTHERS = 4.
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=>click FOR cl_picture.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0200 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*&---------------------------------------------------------------------*
*& Module STATUS_0200 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0200 OUTPUT.
SET PF-STATUS 'AB'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0200 OUTPUT
‎2013 Jan 08 10:21 AM
Hi Askar,
Can you please check the method CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
in the debugger that whether your image is getting loadede or not.
Regards,
Amit
‎2013 Jan 08 11:33 AM
THANKS A LOT...
GOT IT...
HAD GIVEN A WRONG OBJECT.
I GOT MY OUTUT,
COULD YOU EXPLAIN IT LITTLE??
EVEN THOUGH I GOT WHAT I WANT,I AM NOT TOTALLY CLEAR,
COULD YOU EXPLAIN ME??
PLEASE?
What is the purpose of
1) CALL METHOD cl_gui_cfw=>flush.?
2) CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
3) CALL FUNCTION 'DP_CREATE_URL'
and also,
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.
THANKS
askar
‎2013 Jan 10 3:35 AM
Hi Askar,
Please refer the
What is the purpose of following URL
1) CALL METHOD cl_gui_cfw=>flush.?
http://scn.sap.com/thread/1724102
http://help.sap.com/saphelp_nw04/helpdata/en/06/3fa1879f2811d2bd68080009b4534c/content.htm
2) CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
Used for uploading graphics
3) CALL FUNCTION 'DP_CREATE_URL'
http://help.sap.com/saphelp_45b/helpdata/en/f1/b4a6c4df3911d18e080000e8a48612/content.htm
and also,
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.
Used for resizing according to the internal table graphic_table.
Regards,
Amit