Application Development 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: 

Problem with CL_SALV_TABLE

Former Member
0 Kudos

Dear Experts,

While implementing class CL_SALV_TABLE we have encountered two problems. They are as follows:

1. We need a personlized text for Total, and Subtotals instead of some grey box shown at the time of aggregation and subtotal.

2. When we transfer the ALV output to spool using print function, the list generated in the spool has the column headings as short text maintained under field labels of a data element. We wanted the spool output to have the column headings as medium text.

Have gone through various posts in SDN, just want to understand whether is this the limitation on CL_SALV_TABLE class, if not kindly let us know the way to achieve it.

Regards,

Shashikanth. D

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

Regarding #2 you can set the output length of the columns using SET_OUTPUT_LENGTH of the class CL_SALV_COLUMN_TABLE(make sure you turn off the column optimized flag using the SET_OPTIMIZED method of CL_SALV_COLUMN_TABLE).

Also did you set the medium text using SET_MEDIUM_TEXT method?

BR,

Suhas

PS: Regarding #1 lemme check & revert back

7 REPLIES 7

SuhaSaha
Advisor
Advisor
0 Kudos

Hello,

Regarding #2 you can set the output length of the columns using SET_OUTPUT_LENGTH of the class CL_SALV_COLUMN_TABLE(make sure you turn off the column optimized flag using the SET_OPTIMIZED method of CL_SALV_COLUMN_TABLE).

Also did you set the medium text using SET_MEDIUM_TEXT method?

BR,

Suhas

PS: Regarding #1 lemme check & revert back

Former Member
0 Kudos

Hi Suhas,

Thanks for the response.

Yeah We did the same thing ie.,

1. Optimise value as false,

2. We did set the output length to the desired length.

3. Called the method set_medium_text, to give the custom text.

The thing is whatever settings i make they are appearing online ie., on ALV grid, but when we take the print of this output, by default all the fields short description is getting copied as column headings in the spool request.

Regards,

Shashikanth. D

0 Kudos

Hello,

Did you check the program SALV_BCALV_TEST_PRINT_EVENTS ?

Anyway regarding the text for the Total & Sub-totals i don't think you can change the texts

BR,

Suhas

Former Member
0 Kudos

Hi Suhas,

Yeah the below mentioned program we checked it.

Even this program when it creates a spool list output for the ALV it uses the short description and prints the list.

Regards,

Shashikanth. D

naimesh_patel
Active Contributor
0 Kudos

You can try to set all the columns as Optimized.


*...Get all the Columns
    DATA: lo_cols TYPE REF TO cl_salv_columns.
    lo_cols = o_alv->get_columns( ).

*   set the Column optimization
    lo_cols->set_optimize( 'X' ).  "<<

Regards,,

Naimesh Patel

Former Member
0 Kudos

Regarding your #1 question, if the total and subtotal texts are really important to you (or your client), then you should use CL_GUI_ALV_GRID instead of CL_SALV_TABLE. Using CL_GUI_ALV_GRID class will allow you to modify the total and sub-total text. All the totals and subtotals are in an internal table, and you can get to them using method GET_SUBTOTALS.

0 Kudos

Hi all,

Thanks for your replies.

I have tried all the options but none of them worked.

I found a way to meet the requirement.

For the second one, to get different text at spool output, i replaced my data elements of my final internal table to plain data types like c, char20 data elements etc. Then i used methods to set the text for these fields. This works and prints different field label in spool request. Unfortunately with data elements it does not work.

For the first issue, i did code manually to add sub total and grand total rows where it is required along with the color.

Henceforth the thread is closed and Thanks for the time spend on this thread.

Regards,

Shashikanth