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

ALV Grid - Display/change Problem

Former Member
0 Likes
1,680

Hi Guys,

I have a peculiar problem. I have developed a Module pool application containing two screens. In the first screen I have a input field and 2 buttons for display and change. When I enter the value and press Displaythe second screen is called which shows an ALV grid in the respective display mode. But If I come back and press change I could not get the change mode for the ALV grid still it remains in the Display mode. Again if rerun the transaction and press change it shows the ALV grid in change mode but if we press back and choose display then it is not getting changed still remains as such. In all at the first run what ever the mode is chosen it remains stationery. I am using OOALV and i have tried flushing the container, grid and also refreshing the ALV. But could not trace the problem. If you guys have worked or can put some inputs please reply back.

Jagath.

Hi Guys,

I have a peculiar problem. I have developed a Module pool application containing two screens. In the first screen I have a input field and 2 buttons for display and change. When I enter the value and press Displaythe second screen is called which shows an ALV grid in the respective display mode. But If I come back and press change I could not get the change mode for the ALV grid still it remains in the Display mode. Again if rerun the transaction and press change it shows the ALV grid in change mode but if we press back and choose display then it is not getting changed still remains as such. In all at the first run what ever the mode is chosen it remains stationery. I am using OOALV and i have tried flushing the container, grid and also refreshing the ALV. But could not trace the problem. If you guys have worked or can put some inputs please reply back.

Jagath.

9 REPLIES 9
Read only

Former Member
0 Likes
1,561

Hi,

On the BACK Button, what is the logic you have included.

It should be LEAVE TO SCREEN 0 or LEAVE LIST-PROCESSING.

Best regards,

Prashant

Read only

0 Likes
1,561

Have given as LEave to screen 0.

Read only

Former Member
0 Likes
1,561

Ya got your problem, some time back i had also got same kind of problem, i think i used the FM SET_TABLE_FOR_FIRST_DISPLAY twice, one for display purpose and one for change purpose, problem was solved or try using the FM in a subroutine by using a variable flag to track display or change.

Regards:-

<b>Santosh</b>

Read only

0 Likes
1,561

Hi,

Tried your resolution already... doesn't work. seems like it something to do with the refreshing screen container.

Read only

0 Likes
1,561

Why don't you post the code of the container here?

Read only

0 Likes
1,561

Please find the attached code...

from the first screen 100 i am assigning the flag w_display or w_change based on the okcode. in the second screen 200 PBO i have the following code:

MODULE status_0200 OUTPUT.

SET PF-STATUS 'STAT200'.

SET TITLEBAR 'TIT200'.

if w_display eq 'X'.

perform grid_display.

else.

perform grid_change.

endif.

ENDMODULE. " STATUS_0200 OUTPUT

Now in perform display I have the following code:

form grid_display .

  • Set the Fieldcatalog.

REFRESH t_fieldcat.

PERFORM get_field_catalog.

  • set the Layout.

CLEAR wa_layout.

wa_layout-cwidth_opt = 'X'.

  • wa_layout-stylefname = 'CELLTAB'.

  • set the Variant

w_variant-report = sy-repid.

  • Create the Instance for container

IF lcl_custom_disp IS INITIAL.

CREATE OBJECT lcl_custom_disp

EXPORTING

  • PARENT =

container_name = 'CONTAINER1'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • create the object for ALV grid

CREATE OBJECT lcl_grid_disp

EXPORTING

i_parent = lcl_custom_disp

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Create the object for events

CREATE OBJECT lcl_events.

SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_disp.

  • Display the ALV.

CALL METHOD lcl_grid_disp->set_table_for_first_display

EXPORTING

is_variant = w_variant

i_save = ' '

is_layout = wa_layout

CHANGING

it_outtab = t_final[]

it_fieldcatalog = t_fieldcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 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.

ENDIF.

ELSE.

  • Refresh the ALV grid

CALL METHOD lcl_grid_disp->refresh_table_display

  • EXPORTING

  • IS_STABLE =

  • I_SOFT_REFRESH =

EXCEPTIONS

finished = 1

OTHERS = 2.

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.

endform. " grid_display

In the perform change the same code is followed for different object with the fieldcatalog is changed to edit based on flag.

  • Set the Fieldcatalog.

REFRESH t_fieldcat.

PERFORM get_field_catalog.

  • set the Layout.

CLEAR wa_layout.

wa_layout-cwidth_opt = 'X'.

  • wa_layout-stylefname = 'CELLTAB'.

  • set the Variant

w_variant-report = sy-repid.

  • Create the Instance for container

IF lcl_custom_chng IS INITIAL.

CREATE OBJECT lcl_custom_chng

EXPORTING

  • PARENT =

container_name = 'CONTAINER1'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • create the object for ALV grid

CREATE OBJECT lcl_grid_chng

EXPORTING

i_parent = lcl_custom_chng

EXCEPTIONS

error_cntl_create = 1

error_cntl_init = 2

error_cntl_link = 3

error_dp_create = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Create the object for events

CREATE OBJECT lcl_events.

SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_chng.

SET HANDLER lcl_events->handle_data_changed FOR lcl_grid_chng.

SET HANDLER lcl_events->handle_data_changed_finished FOR lcl_grid_chng.

  • Display the ALV.

CALL METHOD lcl_grid_chng->set_table_for_first_display

EXPORTING

is_variant = w_variant

i_save = ' '

is_layout = wa_layout

CHANGING

it_outtab = t_final[]

it_fieldcatalog = t_fieldcat

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

too_many_lines = 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.

ENDIF.

ELSE.

  • Refresh the ALV grid

CALL METHOD lcl_grid_chng->refresh_table_display

  • EXPORTING

  • IS_STABLE =

  • I_SOFT_REFRESH =

EXCEPTIONS

finished = 1

OTHERS = 2.

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.

Please let me know if you require some more inputs?

Jagath

Read only

0 Likes
1,561

debug and check at the point

if w_display eq 'X'.

,

check the value of w_display

Read only

Former Member
0 Likes
1,561

Hi Jagath,

I had faced this problem in the development of module pool. You need to call this method that refreshs the display of ALV else the transaction will caontain old layout though the screen has got updated it will not show.

call method grid1->refresh_table_display. will solve your problem.

please reward points if this solves your problem.

regards,

Brijesh Patel

Read only

0 Likes
1,561

Hi all,

Indeed your suggestions are at level of incomplete query understamding, as if you could read my initial script where i have cleary told about my way of coding and development. Please probe that and let me know..

Jagath