Application Development 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: 

IMAGE DISPLAY IN MODULE POOL

Former Member
0 Kudos
1,951

Hi All,

I have imported an image in SAP thru tcode se78. Now i want to display the image in my module pool program in one of the screen. Can any body guide me wat needs to be done. I have so far created an object of type cl_gui_picture but that is not solving my purpose.

Any solutions?

Thanks & regards.

5 REPLIES 5

Former Member
0 Kudos
483

Hi

check this

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.

Refer the links -

See following link:

http://www.sap-img.com/basis/changing-the-sapgui-logo-on-the-right-hand-side.htm

See the link

http://www.sap-img.com/bc052.htm

<b>Reward points for useful Answers</b>

Regards

Anji

Former Member
0 Kudos
483

Hi,

goto abapdocu tcode.select ABAP User Dialogs ->Screens ->Complex Screen Elements ->GUI controls on screen .

check that program code and output.

You can display image on to the screens using dialog programming.

check demo programs

sapbc412_cond_dialogbox_1

sapbc412_cond_splitter_1

<b>Reward points if useful</b>

Regards

Ashu

abhijitzope
Active Participant
0 Kudos
483

Hi Anurita,

Some of images are store through TCode SMW0 . ('ENJOYSAP_LOGO' is stored there)

SMW0->binary data for webrfc application-> enter object name execute

you can also store the image here.

also check program RSDEMO_CUSTOM_CONTROL.

Hope it will help you !!!

Reagards,

Abhijit Zope

Message was edited by:

Abhijit Zope

Former Member
0 Kudos
483

Hi,

Yes you can display image on screen using cl_gui_picture, but before that you have to call this method get_bds_graphic_as_bmp of CL_SSF_XSF_UTILITIES class.

******Data Declarations For Insert Image on Screen.***********

CONSTANTS: cntl_true TYPE i VALUE 1,

cntl_false TYPE i VALUE 0.

DATA:

h_picture TYPE REF TO cl_gui_picture,

h_pic_container TYPE REF TO cl_gui_custom_container.

DATA: graphic_url(255),

graphic_refresh(1),

g_result LIKE cntl_true.

DATA: BEGIN OF graphic_table OCCURS 0,

line(255) TYPE x,

END OF graphic_table.

DATA: graphic_size TYPE i.

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

In MODULE STATUS_0100. of PBO write this code.

DATA: l_graphic_xstr TYPE xstring,

l_graphic_conv TYPE i,

l_graphic_offs TYPE i.

CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp

EXPORTING

p_object = 'GRAPHICS'

p_name = 'ENJOY' "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_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' "#EC NOTEXT

subtype = cndp_sap_tab_unknown " 'X-UNKNOWN'

size = graphic_size

lifetime = cndp_lifetime_transaction "'T'

TABLES

data = graphic_table

CHANGING

url = graphic_url

EXCEPTIONS

  • dp_invalid_parameter = 1

  • dp_error_put_table = 2

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

EXIT.

ENDIF.

CREATE OBJECT h_pic_container

EXPORTING container_name = 'CUST_CONTROL'.

CREATE OBJECT h_picture EXPORTING parent = h_pic_container.

CALL METHOD h_picture->load_picture_from_url

EXPORTING

url = graphic_url

IMPORTING

RESULT = g_result.

Reward points id useful.

Regards,

Saroj.

Former Member
0 Kudos
483

Insert image onto SAP screen

This is very simple to do, first create a dialog program with one screen (any number i.e. 0100) and create a custom control called 'CUST_CONTROL'. Now use the below sections of code to create a top include and a PBO module/process. And then finally create a transaction code for it. This version does not work for version 4.6 so click here for alternative code.

CONSTANTS: CNTL_TRUE  TYPE I VALUE 1,
      CNTL_FALSE type i value 0.
data:
   h_picture       type ref to cl_gui_picture,
   h_pic_container type ref to cl_gui_custom_container.
*   h_tree          type ref to cl_gui_list_tree,
*   h_docking       type ref to cl_gui_docking_container,
*   h_application   type ref to lcl_application.

data: graphic_url(255),
      graphic_refresh(1),
      g_result                     like cntl_true.

data: begin of graphic_table occurs 0,
        line(255) type x,
      end of graphic_table.

data: graphic_size type i.

*--------------------------------------------------------------------*
***INCLUDE ZDISPLAYIMAGEPBO .
*--------------------------------------------------------------------*
*&-------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&-------------------------------------------------------------------*
*       text
*--------------------------------------------------------------------*
module STATUS_0100 output.
data: l_graphic_xstr type xstring,
      l_graphic_conv type i,
      l_graphic_offs type i.

  CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
    EXPORTING
      p_object  = 'GRAPHICS'
      p_name    = 'ENJOY' "IMAGE NAME - Image name from SE78
      p_id      = 'BMAP'
      p_btype   = 'BMON'  "(BMON = black&white, BCOL = colour)
    RECEIVING
      p_bmp     = l_graphic_xstr
    EXCEPTIONS
      not_found = 1
      OTHERS    = 2.

*  IF sy-subrc = 1.
*    MESSAGE e287 WITH g_stxbitmaps-tdname.
*  ELSEIF sy-subrc <> 0.
*    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*    EXIT.
*  ENDIF.

  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_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'               "#EC NOTEXT
          subtype              = cndp_sap_tab_unknown " 'X-UNKNOWN'
          size                 = graphic_size
          lifetime             = cndp_lifetime_transaction  "'T'
       TABLES
          data                 = graphic_table
       CHANGING
          url                  = graphic_url
       EXCEPTIONS
*           dp_invalid_parameter = 1
*           dp_error_put_table   = 2
*           dp_error_general     = 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.
    EXIT.
  ENDIF.

   create object h_pic_container
          exporting container_name =  'CUST_CONTROL'.
   create object h_picture exporting parent = h_pic_container.

   call method h_picture->load_picture_from_url
        exporting url    = graphic_url
        importing result = g_result.

endmodule.                 " STATUS_0100  OUTPUT

reward points if it is usefull ...

Girish