Skip to Content
avatar image
Former Member

Image in Screen Painter

How can i place an in image in the screen painter?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 18, 2008 at 09:22 AM

    Check the Programs..

    DD_ADD_PICTURE

    SAP_PICTURE_DEMO

    RSDEMO_PICTURE_CONTROL

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 10:09 AM

    first of all uplod picture with transaction

    'SMW0'.

    Then in screen

    Create Custom Contain Area

    Use this code for sample

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

    if init is initial.

    CREATE OBJECT CONTAINER

    EXPORTING

    CONTAINER_NAME = 'CC area name'.

    CREATE OBJECT PICTURE

    EXPORTING

    PARENT = CONTAINER.

    DATA QUERY_TABLE LIKE W3QUERY OCCURS 1 WITH HEADER LINE.

    DATA HTML_TABLE LIKE W3HTML OCCURS 1.

    DATA RETURN_CODE LIKE W3PARAM-RET_CODE.

    DATA CONTENT_TYPE LIKE W3PARAM-CONT_TYPE.

    DATA CONTENT_LENGTH LIKE W3PARAM-CONT_LEN.

    DATA PIC_DATA LIKE W3MIME OCCURS 0.

    DATA PIC_SIZE TYPE I.

    REFRESH QUERY_TABLE.

    QUERY_TABLE-NAME = '_OBJECT_ID'.

    • query_table-value = 'ENJOYSAP_LOGO'.

    APPEND QUERY_TABLE.

    CALL FUNCTION 'WWW_GET_MIME_OBJECT'

    TABLES

    QUERY_STRING = QUERY_TABLE

    HTML = HTML_TABLE

    MIME = PIC_DATA

    CHANGING

    RETURN_CODE = RETURN_CODE

    CONTENT_TYPE = CONTENT_TYPE

    CONTENT_LENGTH = CONTENT_LENGTH

    EXCEPTIONS

    INVALID_TABLE = 1

    PARAMETER_NOT_FOUND = 2

    OTHERS = 3.

    IF SY-SUBRC 0.

    PIC_SIZE = CONTENT_LENGTH.

    ENDIF.

    CALL FUNCTION 'DP_CREATE_URL'

    EXPORTING

    TYPE = 'image'

    SUBTYPE = CNDP_SAP_TAB_UNKNOWN

    SIZE = PIC_SIZE

    LIFETIME = CNDP_LIFETIME_TRANSACTION

    TABLES

    DATA = PIC_DATA

    CHANGING

    URL = URL.

    CALL METHOD PICTURE->LOAD_PICTURE_FROM_URL

    EXPORTING

    URL = URL.

    INIT = 'X'.

    CALL METHOD CL_GUI_CFW=>FLUSH

    EXCEPTIONS

    CNTL_SYSTEM_ERROR = 1

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

    ENDIF.

    regards,

    Alpesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 18, 2008 at 11:31 AM

    Hi, first checkout whether your picture is present in your server or not.

    i am pasteing a code where i have taken sap enjoy pictur which is present default.

    Please see that your custom container name when u create for picture in screen painter will be PICTURE_CONTAINER1.

    Copy paste this code....

    In TOP declarations....

    TYPES pict_line(256) TYPE c.

    *

    DATA :init,

    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.

    in PBO

    MODULE STATUS_0100 OUTPUT.

    SET PF-STATUS 'ZTECH'.

    • SET TITLEBAR 'SELECT'.

    IF init is initial.

    init = 'X'.

    CREATE OBJECT:

    container EXPORTING container_name = 'PICTURE_CONTAINER1',

    picture EXPORTING parent = container.

    ENDIF.

    IMPORT pict_tab = pict_tab FROM DATABASE abtree(pi) ID 'ENJOY'.

    CALL FUNCTION 'DP_CREATE_URL'

    EXPORTING

    type = 'IMAGE'

    subtype = 'GIF'

    TABLES

    data = pict_tab

    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_0100 OUTPUT

    Hope this helps.

    Thks

    Add comment
    10|10000 characters needed characters exceeded