Hi, while executing report in the 1st screen double click one record based on that record related records will be displayed on 2nd screen ok and come back to 1st screen double click on another record data remains of 1st selected records screen was not cleared on 2nd screen. but i cleared 2nd internal table and fieldcatlog and get same
Hi, I have the same interactive OOPS ALV. When clicking on one MKPF record, corresponding MSEG entries are being fetched and shown in output in second screen. But, when i come back to 1st screen again and double click on different MKPF record, the system navigated to second screen with same output of which is shown before. And I tried with refreshing the internal tables before fetching, the issue persist still. Can you help?
It sounds like the issue might be related to how the data is being stored and refreshed between the screens. When dealing with interactive ALV reports in SAP ABAP using OOPS (Object-Oriented Programming), it's crucial to ensure that the data is properly cleared and refreshed between screen transitions. Here are a few steps you can take to resolve this issue: 1. **Clear and Refresh Data**: Make sure that the internal tables and ALV grid are cleared and refreshed each time you return to the first screen. This can be done in the event handler for the back button. 2. **Event Handling**: Check the event handling methods for the double-click event and the back button to ensure that the data refresh logic is correctly implemented. 3. **Instance Management**: Ensure that the ALV grid instance is properly managed. If the same instance is being reused without clearing the previous data, it might lead to the issue you're experiencing. Here is a basic example of how you can manage data clearing and refreshing in an interactive ALV report: ```abap DATA: lt_mkpf TYPE TABLE OF mkpf, lt_mseg TYPE TABLE OF mseg, lo_alv TYPE REF TO cl_gui_alv_grid. " Event handler for the double-click event FORM handle_double_click USING e_row e_column. DATA: ls_mkpf TYPE mkpf. " Fetch the selected MKPF record READ TABLE lt_mkpf INDEX e_row INTO ls_mkpf. IF sy-subrc = 0. " Clear the previous MSEG data CLEAR lt_mseg. REFRESH lt_mseg. " Fetch the corresponding MSEG entries SELECT * FROM mseg INTO TABLE lt_mseg WHERE mblnr = ls_mkpf-mblnr. " Display the MSEG entries in the second screen CALL SCREEN 200. ENDIF. ENDFORM. " Event handler for the back button FORM handle_back_button. " Clear the ALV grid CALL METHOD lo_alv->clear_table. lo_alv->refresh_table_display( ). " Return to the first screen CALL SCREEN 100. ENDFORM. ``` In this example, when a double-click event occurs on an MKPF record, the corresponding MSEG entries are fetched and displayed in the second screen. The internal table `lt_mseg` is cleared before fetching new data to ensure old data is not displayed again. Similarly, when the back button is pressed, the ALV grid is cleared and refreshed. Ensure that similar logic is implemented in your code to handle data refresh properly. If you are still facing issues, you may want to debug and verify the sequence of events and data handling in your code.
great work
Thank you very much sir 🙏
Most Welcome Rishi
Thank you so much, sir.
Hi, while executing report in the 1st screen double click one record based on that record related records will be displayed on 2nd screen ok and come back to 1st screen double click on another record data remains of 1st selected records screen was not cleared on 2nd screen. but i cleared 2nd internal table and fieldcatlog and get same
You need to build field catalogues for Second screen below first screen field catalogues, Instead of inside the form.
Hi, I have the same interactive OOPS ALV. When clicking on one MKPF record, corresponding MSEG entries are being fetched and shown in output in second screen. But, when i come back to 1st screen again and double click on different MKPF record, the system navigated to second screen with same output of which is shown before. And I tried with refreshing the internal tables before fetching, the issue persist still. Can you help?
It sounds like the issue might be related to how the data is being stored and refreshed between the screens. When dealing with interactive ALV reports in SAP ABAP using OOPS (Object-Oriented Programming), it's crucial to ensure that the data is properly cleared and refreshed between screen transitions.
Here are a few steps you can take to resolve this issue:
1. **Clear and Refresh Data**: Make sure that the internal tables and ALV grid are cleared and refreshed each time you return to the first screen. This can be done in the event handler for the back button.
2. **Event Handling**: Check the event handling methods for the double-click event and the back button to ensure that the data refresh logic is correctly implemented.
3. **Instance Management**: Ensure that the ALV grid instance is properly managed. If the same instance is being reused without clearing the previous data, it might lead to the issue you're experiencing.
Here is a basic example of how you can manage data clearing and refreshing in an interactive ALV report:
```abap
DATA: lt_mkpf TYPE TABLE OF mkpf,
lt_mseg TYPE TABLE OF mseg,
lo_alv TYPE REF TO cl_gui_alv_grid.
" Event handler for the double-click event
FORM handle_double_click USING e_row e_column.
DATA: ls_mkpf TYPE mkpf.
" Fetch the selected MKPF record
READ TABLE lt_mkpf INDEX e_row INTO ls_mkpf.
IF sy-subrc = 0.
" Clear the previous MSEG data
CLEAR lt_mseg.
REFRESH lt_mseg.
" Fetch the corresponding MSEG entries
SELECT * FROM mseg INTO TABLE lt_mseg WHERE mblnr = ls_mkpf-mblnr.
" Display the MSEG entries in the second screen
CALL SCREEN 200.
ENDIF.
ENDFORM.
" Event handler for the back button
FORM handle_back_button.
" Clear the ALV grid
CALL METHOD lo_alv->clear_table.
lo_alv->refresh_table_display( ).
" Return to the first screen
CALL SCREEN 100.
ENDFORM.
```
In this example, when a double-click event occurs on an MKPF record, the corresponding MSEG entries are fetched and displayed in the second screen. The internal table `lt_mseg` is cleared before fetching new data to ensure old data is not displayed again. Similarly, when the back button is pressed, the ALV grid is cleared and refreshed.
Ensure that similar logic is implemented in your code to handle data refresh properly. If you are still facing issues, you may want to debug and verify the sequence of events and data handling in your code.
do we have this source code ?
Please check here , abapeducation.blogspot.com/