‎2010 Feb 05 6:00 PM
I am writing a program using cl_salv_table=>factory and display() to display my data. From the initial list of records, lines can be selected by checking a checkbox and then the user can press 'Delete' to delete the selected records from a table.
I have this code in an Event method. In the Event method, I use the Refresh(), Factory(), and Display() methods to write the records that were deleted back to the screen.
I would like to add a line of text saying, for example, "The following records were deleted" and then display the records but the display method seems to overwrite anything written with a Write statement.
I am currently writing my message as Header text but I was wondering if there was another / better way. Below is the code snippet I use to write the new list to the screen.
Thanks in advance for any help.
Kind regards,
Chris Mowl
o_salvtable->refresh( ).
TRY.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = o_salvtable
CHANGING
t_table = o_zvc->i_vckun.
CATCH cx_salv_msg. "#EC NO_HANDLER
MESSAGE 'ALV display not possible' TYPE 'I' DISPLAY LIKE 'E'.
ENDTRY.
DATA: lr_header TYPE REF TO cl_salv_form_header_info.
CREATE OBJECT lr_header
EXPORTING
text = text-005.
o_salvtable->set_top_of_list( lr_header ).
o_salvtable->display( ).
‎2010 Feb 05 9:16 PM
What if you added a column to your output table and in your SALV controls marked that column as a checkbox. Then, instead of writing a message, turn on the check box to mark the row, perhaps with the heading "To Be Deleted"?
Just a suggestion...
Whatever you do with write:/ will show up when the user exits the ALV display (or at least it does for me) since the report output is triggered by expllicit or implicit end of selection event.
‎2010 Feb 05 9:54 PM
You can add create two ALVs. One for your Main table and the second ALV for the deleted records. Whenever, DELETE event happens, append deleted records in the Delete ALV and Refresh the ALV. You can use the Splitter container to Split your container into two. There are some methods in the Splitter Container, which can help you to hide/show the Second ALV (show only when there are delete entries).
Regards,
Naimesh Patel
‎2010 Feb 08 9:10 PM
Thank you both for your responses. The header solution was acceptable to the user.
‎2010 Feb 08 9:26 PM
Moderator message - You can also assign po1nts to helpful answers. This encourages people to help you in the future.
Rob