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

Write a text message when using Display method in class CL_SALV_TABLE

chris_mowl
Active Participant
0 Likes
2,581

Hello,

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( ).
     

4 REPLIES 4
Read only

Former Member
0 Likes
1,794

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.

Read only

naimesh_patel
Active Contributor
0 Likes
1,794

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

Read only

chris_mowl
Active Participant
0 Likes
1,794

Thank you both for your responses. The header solution was acceptable to the user.

Read only

0 Likes
1,794

Moderator message - You can also assign po1nts to helpful answers. This encourages people to help you in the future.

Rob