Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

PICTURE ON A MODULE POOL SCREEN

Former Member
0 Likes
2,025

Hi All.

I have an issue in module pool program.

I designed a screen with number 100.

on this screen they want to put some picture...like some logo.

Is it possible to put the picture on this screen 0100.

Please can any body ,help me to solve this issue.

Thanks in advance,

Regards,

Eswar.

Hi All.

I have an issue in module pool program.

I designed a screen with number 100.

on this screen they want to put some picture...like some logo.

Is it possible to put the picture on this screen 0100.

Please can any body ,help me to solve this issue.

Thanks in advance,

Regards,

Eswar.

6 REPLIES 6
Read only

andreas_mann3
Active Contributor
0 Likes
1,348

hi,

compare demo report SAP_PICTURE_DEMO

and se38 - reuse library

regards Andreas

Read only

Former Member
0 Likes
1,348

Hi,

Look at the demp Programs in SAP

DEMO_PICTURE_CONTROL

RSDEMO_PICTURE_CONTROL

SAP_PICTURE_DEMO

SAP_PICTURE_DEMO_DRAG_DROP

SAP_PICTURE_DEMO_ICON

Regards

Sudheer

Read only

Former Member
0 Likes
1,348

Hello,

You can use picture control to attach a picture to your screen.The sample code is below:

The custom container in the screen layout is named as 'CONTAINER'.

REPORT SAMPLE.

DATA: picture type ref to cl_gui_picture,

cont type ref to cl_gui_custom_container.

DATA: I_EVENTS TYPE CNTL_SIMPLE_EVENTS,

WA_EVENTS TYPE CNTL_SIMPLE_EVENT,

OK_CODE TYPE SY-UCOMM,

p_url type cndp_url.

Class click definition.

PUBLIC SECTION.

METHODS: click_handle for event picture_click of cl_gui_picture

importing MOUSE_POS_X MOUSE_POS_Y.

endclass.

DATA: click_variable type ref to click.

class click implementation.

method click_handle.

DATA: X_POS(5),Y_POS(5).

X_POS = MOUSE_POS_X.

Y_POS = MOUSE_POS_Y.

MESSAGE I000(OK) WITH 'Picture Click' X_POS Y_POS.

endmethod.

endclass.

START-OF-SELECTION.

call screen 100.

&----


*& Module STATUS_0100 OUTPUT

&----


  • text

----


MODULE STATUS_0100 OUTPUT.

SET PF-STATUS 'GUI'.

  • SET TITLEBAR 'xxx'.

if cont is initial.

CREATE OBJECT CONT

EXPORTING

CONTAINER_NAME = 'CONTAINER'.

CREATE OBJECT PICTURE

EXPORTING

  • LIFETIME =

  • SHELLSTYLE =

PARENT = cont

  • NAME =

  • 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.

wa_events-EVENTID = picture->EVENTID_PICTURE_CLICK.

wa_events-APPL_EVENT = 'X'.

append wa_events to i_events.

CALL METHOD PICTURE->SET_REGISTERED_EVENTS

EXPORTING

EVENTS = i_events.

create object click_variable.

set handler click_variable->click_handle for picture.

CALL METHOD PICTURE->SET_3D_BORDER

EXPORTING

BORDER = 1.

CALL FUNCTION 'DP_PUBLISH_WWW_URL'

EXPORTING

OBJID = 'HTMLCNTL_TESTHTM2_SAP_AG'

LIFETIME = cndp_lifetime_transaction

IMPORTING

URL = p_url

.

IF SY-SUBRC = 0.

CALL METHOD PICTURE->LOAD_PICTURE_FROM_URL_ASYNC

EXPORTING

URL = p_url.

ENDIF.

endif.

ENDMODULE. " STATUS_0100 OUTPUT

&----


*& Module USER_COMMAND_0100 INPUT

&----


  • text

----


MODULE USER_COMMAND_0100 INPUT.

CASE OK_CODE.

WHEN 'BACK'.

LEAVE PROGRAM.

WHEN 'NORMAL'.

CALL METHOD PICTURE->SET_DISPLAY_MODE

EXPORTING

DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL.

WHEN 'FIT'.

CALL METHOD PICTURE->SET_DISPLAY_MODE

EXPORTING

DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT.

WHEN 'NORMAL_C'.

CALL METHOD PICTURE->SET_DISPLAY_MODE

EXPORTING

DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_NORMAL_CENTER.

WHEN 'FIT_C'.

CALL METHOD PICTURE->SET_DISPLAY_MODE

EXPORTING

DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER.

WHEN 'STRETCH'.

CALL METHOD PICTURE->SET_DISPLAY_MODE

EXPORTING

DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_STRETCH.

WHEN 'CLEAR'.

CALL METHOD PICTURE->CLEAR_PICTURE.

WHEN SPACE.

CALL METHOD PICTURE->LOAD_PICTURE_FROM_URL

EXPORTING

URL = P_URL.

  • IMPORTING

  • RESULT = RETURN.

CALL METHOD CL_GUI_CFW=>FLUSH.

endcase.

endmodule.

Also check demo program:RSDEMO_PICTURE_CONTROL

<b>TO GET DIFFERENT PICTURES</b>:

(The following is <b>Judith Jessie Selvi's</b> reply for a similar query.Unfortunately I'm not able to track the URL of that thread).

Refer this link

1... create a logo using paint shop and save it as tifffile then using RSTXLDMC (is a program name) used to upload logo

2.....create a logo using paint shop and save it as bmpfile then using SE78 you can do this.

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCIIMAGE/BCCIIMAGE.pdf

http://www.sap-img.com/human/linking-employee-photos-using-sap-archive-link.htm

Transaction OAOR,

- OAOR (Business Document Navigator)

Give Class Name - PICTURES Class Type - OT..... then Execute

It will show you the list, then select ENJOYSAP_LOGO.

On that list, you will find one control with a "create" tab.

Click std. doc types.

Select SCREEN and double-click.

It will push FILE selection screen.

Select your company logo (.gif) and press OK.

It will ask for a description- for instance: "company logo".

It will let you know your doc has been stored successfully.

You can find your logo under ENJOYSAP_LOGO->Screen->company logo.

Just run your ALV program, you should find your company logo in place of the EnjoySAP logo.

Regards,

Beejal

**Reward if this helps

Read only

Former Member
0 Likes
1,348

HI,

Check the following link:

http://www.sapdevelopment.co.uk/graphics/add_image.htm

It contains the sample code to solve your problem.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
1,348

Hi Venkat,

Check out the following sample program which will take the picture from presentation server and the same will be displayed in a picture control on the screen.

In this report , I have a selection-screen which will take the path of the file as input. After F8, the same pic will be displayed in a screen. On the screen, u need to create a custom control with name 'PICTURE_CONTROL_1' [in this example].

PROGRAM ypicture.

TYPE-POOLS : cndp.

selection-screen begin of block b1.

parameters : path type rlgrap-filename.

selection-screen end of block b1.

SET SCREEN 200.

************************************************************************

  • 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 container_1 TYPE REF TO cl_gui_custom_container.

DATA event_tab TYPE cntl_simple_events.

DATA event_tab_line TYPE cntl_simple_event.

DATA return TYPE i.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR path.

PERFORM f1000_file_select.

************************************************************************

  • 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 picture_control_1 EXPORTING parent = container_1.

  • new async implementation since 4.6C

CALL FUNCTION 'DP_PUBLISH_WWW_URL'

EXPORTING

OBJID = 'ZSATYA.GIF'

LIFETIME = cndp_lifetime_transaction

IMPORTING

URL = url

EXCEPTIONS

OTHERS = 1.

concatenate 'file://' path into url.

CALL METHOD PICTURE_CONTROL_1->LOAD_PICTURE_FROM_URL

exporting url = url.

ENDIF.

ENDMODULE. "before_output OUTPUT

************************************************************************

  • 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.

LEAVE TO SCREEN 0.

  • 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. "after_input INPUT

&----


*& Form f1000_file_select

&----


  • text

----


FORM f1000_file_select .

DATA: li_file_table TYPE filetable,

wa_file_table TYPE file_table,

lws_rc TYPE i,

lws_user_action TYPE i.

DATA : lc_title TYPE string.

CONSTANTS :lc_ext TYPE string VALUE '.',

lc_directory TYPE string VALUE 'C:\'.

CLEAR: path.

REFRESH: li_file_table.

lc_title = text-049.

*-- Class to select the file.

CALL METHOD cl_gui_frontend_services=>file_open_dialog

EXPORTING

window_title = lc_title

default_extension = lc_ext

initial_directory = lc_directory

CHANGING

file_table = li_file_table

rc = lws_rc

user_action = lws_user_action

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

not_supported_by_gui = 3

OTHERS = 4.

IF sy-subrc NE 0.

MESSAGE e001(zdemet) WITH text-002.

ENDIF.

READ TABLE li_file_table INDEX 1 INTO wa_file_table.

IF sy-subrc = 0.

path = wa_file_table-filename.

ENDIF.

endform. " f1000_file_select

-SatyaPriya

Read only

Former Member
0 Likes
1,348

Hello Venkat,

Also check the demo program:

RSDEMO_PICTURE_CONTROL

Regards,

Beejal

**Reward if this helps