Skip to Content
author's profile photo Former Member
Former Member

Custom container not clearing in module pool screen.

Dear Experts,

I have created a custom controllers MAT1,MAT2,MAT3.... in custom screen.

based on the material group selected the custom control (pitures) will be filled.

when I press material group1 , all the materials(pictures) of material group one are filling correctly in custom control .

problem is when I press material gruop2 it is showing material group1 only.

Its not clearing the custom control.

Can any one help me how to achieve this.

for your reference attached code

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

LOOP AT it_mat INTO wa_mat.
CLEAR l_txt.
CASE sy-tabix.
WHEN 1.
READ TABLE it_mat_img INTO wa_mat_img WITH KEY matnr = wa_mat-matnr.

* SCREEN 9010.

CREATE OBJECT container_mat1
EXPORTING
container_name = 'MAT1'.

CREATE OBJECT picture_control_mat1 EXPORTING parent = container_mat1.

REFRESH:event_tab.

event-eventid = cl_gui_picture=>eventid_control_click.
APPEND event TO event_tab.
CALL METHOD picture_control_mat1->set_registered_events
EXPORTING
events = event_tab.

CREATE OBJECT event_receiver_mat1.
SET HANDLER event_receiver_mat1->event_handler_control_click
FOR picture_control_mat1.

CALL METHOD picture_control_mat1->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_fit_center.

CALL METHOD picture_control_mat1->set_3d_border
EXPORTING
border = 1.
l_txt = wa_mat-matnr.
CALL METHOD picture_control_mat1->set_tooltip
EXPORTING
text = l_txt. "'Test'.

CLEAR :graphic_size,l_graphic_conv,l_graphic_xstr,graphic_url.
REFRESH :graphic_table[].

CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = 'GRAPHICS'
p_name = wa_mat_img-zimage "'ZRETAIL_LOGO' "wa_gp-zimage ""IMAGE NAME - Image name from SE78
p_id = 'BMAP'
* p_btype = 'BMON' "(BMON = black&white, BCOL = colour)
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.

CALL METHOD picture_control_mat1->load_picture_from_url
EXPORTING
* url = url.
url = graphic_url.

CALL METHOD picture_control_mat1->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_fit.
"am
CALL METHOD cl_gui_cfw=>flush
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2.

" am end

WHEN 2 .
BREAK-POINT.
READ TABLE it_mat_img INTO wa_mat_img WITH KEY matnr = wa_mat-matnr.
CREATE OBJECT container_mat2
EXPORTING
container_name = 'MAT2'.

CREATE OBJECT picture_control_mat2 EXPORTING parent = container_mat2.

REFRESH:event_tab.

event-eventid = cl_gui_picture=>eventid_control_click.
APPEND event TO event_tab.
CALL METHOD picture_control_mat2->set_registered_events
EXPORTING
events = event_tab.

CREATE OBJECT event_receiver_mat2.
SET HANDLER event_receiver_mat2->event_handler_control_click
FOR picture_control_mat2.

CALL METHOD picture_control_mat2->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_fit_center.

CALL METHOD picture_control_mat2->set_3d_border
EXPORTING
border = 1.
l_txt = wa_mat-matnr.
CALL METHOD picture_control_mat2->set_tooltip
EXPORTING
text = l_txt. "'Test'.

CLEAR :graphic_size,l_graphic_conv,l_graphic_xstr,graphic_url.
REFRESH :graphic_table[].

CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
EXPORTING
p_object = 'GRAPHICS'
p_name = wa_mat_img-zimage ""IMAGE NAME - Image name from SE78
p_id = 'BMAP'
* p_btype = 'BMON' "(BMON = black&white, BCOL = colour)
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.

CALL METHOD picture_control_mat2->load_picture_from_url
EXPORTING
* url = url.
url = graphic_url.

CALL METHOD picture_control_mat2->set_display_mode
EXPORTING
display_mode = cl_gui_picture=>display_mode_fit.

WHEN 3 .
WHEN OTHERS.
ENDCASE.

ENDLOOP.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Aug 10, 2016 at 10:51 AM

    I think it's the classic issue that you don't call the method FREE, so you always see the first control overriding the subsequent controls later instantiated.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.