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

Problem with method SET_LONG_TEXT, class CL_SALV_COLUMN.

Former Member
0 Kudos
5,049

Hi All,

I am facing a weird problem with method SET_LONG_TEXT of class CL_SALV_COLUMN.

For displaying header of my ALV report, I have used this method 22 times and it is working fine for 20 columns

but it is not setting the value properly for two columns in ES language.

For these two columns the ALV takes data elements translataion and displays in header.

In debugger, I checked the values being passed to this Method and found it be correct,

the one that I wanted to display.

At the same time it is working fine all 22 columns in EN language.

Some one tackled the similar siltuation, please reply.

Thanking You All.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
2,885
9 REPLIES 9
Read only

Former Member
0 Kudos
2,885

are ;you sure you have the column fieldname exactly correct in what you are supplying to the method to get the column name?  For example, look at demo program SALV_TEST_TABLE_COLUMNS.... where you will see:

   try.

       lr_column ?= lr_columns->get_column( 'HYPERLINK' ).    <++++++ this text has to exactly match your fieldname in upper case.  If not nothing will change.

       lr_column->set_long_text( 'HYPERLINK' ).

     catch cx_salv_not_found.                            "#EC NO_HANDLER

   endtry.

If there is an error because you did not supply the exact fieldname in your column retrieval, the actual column title will remain unchanged.... and since you're probably using try....endtry. and not looking to see if an exception was caught...you might not see that your fieldname is not correct and that the long text therefore remained unchanged.

Read only

0 Kudos
2,885

Hi David,

Thanks for the help, but I have already checked these things, there is no such problem.

I have checked the internal tables inside class as well but could not find any thinng suspicious.

Thanks for the help.

Read only

former_member194152
Contributor
0 Kudos
2,885

Ankit,

Are 21,22 column refering standard data element or custom data element?

Have you checked proper traslation maintained from EN to ES in the translation, check in data element menu path GO to -> translation original language EN Target Language ES.

Thanks/Gagan

Read only

0 Kudos
2,885

Hi Gagan,

Yes Gagan, the variables are correctly set, I have checked the translatation in debugger as well.

I tried with set_short_text and SET_MEDIUM_TEXT , but nothing is working.

Thanks a lot.

Read only

Former Member
0 Kudos
2,886
Read only

0 Kudos
2,885

Thanks Nikita,

But its more cumbersome for me.

Any other idea, that colud may my code work...???

Well, thanks for the help.

Read only

Former Member
0 Kudos
2,885

Hi All,

My problem got solved.

 

It was taking the text with max length, among   Data Element’s Translation and Language translation, since the language translation was less in size so it was displaying   Data Element’s Translation.

I solved this problem by providing blank space.

Well, still its a workaround.

Probably it needs to be fixed by SAP.

Thanking You All for helping.

Read only

former_member800181
Discoverer
0 Kudos
2,885

this problem can be solved by using 'conv #' .

DATA: lo_column TYPE REF TO cl_salv_column.

eg . lo_column->set_long_text( conv # ( text-002 ) ).

Read only

Sandra_Rossi
Active Contributor
2,885

dineshkumar1302 You can see that it's a 2012 question, 7.40 didn't exist at that time, and moreover it doesn't answer the question, SET_LONG_TEXT is not sufficient. Also don't post a comment if it corresponds to an answer. Avoid answering old questions, because usually (and unfortunately), the same question has been asked and answered many times, even recently.