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

Custom container problem

Former Member
0 Likes
901

Hi all,

This is strange. I've a screen 100 with an alv grid displayed in the custom container. It is like the program BCALV_GRID_04 with the LEDs in the display. On the double click event of a line, another screen 200 is displayed with the same style, but fetching the line item details with LEDs. For the first time it works fine, but on going back to screen 100 again and then selecting another header line item, the container of 200 is not geting initialized and due to this the new contents are not displayed on the screen 200 correctly but the old contents still remain though i clear it.

Is there a way to initialize the container while leaving the screen?? I've tried Flush and refresh table display as below...

Any clues on where i went wrong?

code...

data: begin of gt_outtab1 occurs 0.

include structure ZPYT_ED_LINE.

data: light type c.

data: end of gt_outtab1.

PBO of screen 200.

-


if custom_container2 is initial.

PERFORM BUILD_LINE_DATA TABLES GT_LINE[].

create object custom_container2

exporting

container_name = cont_for_line

exceptions

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5.

if sy-subrc ne 0.

call function 'POPUP_TO_INFORM'

EXPORTING

titel = g_repid

txt2 = sy-subrc

txt1 = 'The control could not be created'(510).

endif.

  • create an instance of alv control

create object grid2

exporting i_parent = custom_container2.

clear: gs_layout2.

gs_layout2-grid_title = 'Records details'(101).

gs_layout2-CWIDTH_OPT = 'X'.

gs_layout2-excp_fname = g_lights_name2.

perform mask_columns tables gt_fieldcat.

call method grid2->set_table_for_first_display

exporting

is_layout = gs_layout2

changing it_fieldcatalog = gt_fieldcat[]

it_outtab = gt_line.

else.

call method grid2->refresh_table_display

exporting

i_soft_refresh = 'X'.

endif. "IF grid2 IS INITIAL.

call method cl_gui_control=>set_focus

EXPORTING

control = grid2.

call method grid2->refresh_table_display.

clear gt_outtab1[].

call method cl_gui_cfw=>flush.

if sy-subrc ne 0.

call function 'POPUP_TO_INFORM'

EXPORTING

titel = g_repid

txt2 = sy-subrc

txt1 = 'Error in FLush'(500).

endif.

1 REPLY 1
Read only

Former Member
0 Likes
712

Samuel,

Looks like its a silly mistake. You have a IF statement where you are checking for CUSTOM CONTAINER2 has been created or not. For the first time it goes in and creates the container and also gets the new data. However when you come for the next time the container already exists and the whole IF cond. will be bypassed because of which the new line item details are not fetched.

I would suggest that you put your PERFORM BUILD_LINE_DATA TABLES GT_LINE[], outside the IF statement and it should be working.

Regards,

Ravi

Note : Please reward points if the answers have been helpful.