Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Refresh custom control to show another image | Module pool programming

$
0
0

Hi experts, I'm facing this issue :

 

1 - Via a screen, the user enter the name of a logo which was previously added via SE78

2 - On a custom control the logo should be displayed.

 

It works only when I save and run again the program...

 

I want to refresh the custom container within the PBO to be able to display the changed logo.

 

For displaying images I'm using this Form  (the variables are in blue) :

 

 

FORM show_image CHANGING   lv_cont_name

   lv_pic_nameTYPE tdobname.

 

 

*    data: l_object      like p_object,

*        l_name        like p_name.

   DATA: w_lines TYPE i.

   TYPES pict_line(256) TYPE c.

   DATA :

   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.

   DATA: graphic_url(255).

   DATA: BEGIN OF graphic_table OCCURS 0,

           line(255) TYPE x,

         END OF graphic_table.

   DATA: l_graphic_conv TYPE i.

   DATA: l_graphic_offs TYPE i.

   DATA: graphic_size TYPE i.

   DATA: l_graphic_xstr TYPE xstring.

 

   CALL METHOD cl_gui_cfw=>flush.

   CREATE OBJECT:

   container EXPORTING container_name = lv_cont_name,

   picture EXPORTING parent = container.

   CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp

     EXPORTING

       p_object       = 'GRAPHICS'

       p_name         = lv_pic_name

       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.

   CALL FUNCTION 'DP_CREATE_URL'

     EXPORTING

       type     = 'IMAGE'

       subtype  = 'X-UNKNOWN'

       size     = graphic_size

       lifetime = 'T'

     TABLES

       data     = graphic_table

     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.

ENDFORM.                    "Show_Image


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>