03-18-2011 4:51 AM
Hi All,
Iwant my ALV header text to be aligned and displayed in the following form :
Title-abcdfghj
Subtitle : abdcesr...
.For this I am appending space in the ALV header text WA_HEADER-INFO.
Then I am using the function module REUSE_ALV_COMMENTARY_WRITE to write the header.
My internal table for the IT_LIST_COMMENTARY shows that it has accepted the spacesI havev appended.
But when I display the heade, my output is coming like this:
Title-abcdfghj
Subtitle : abdcesr...
How can I maek sure that the header lines are formatted as I want ?
Please help when you have the time.
Regards,
Inesha
Edited by: Thomas Zloch on Mar 18, 2011 9:08 AM - priority reduced by moderator
03-18-2011 5:57 AM
Hi,
When you add spaces into the ALV header Title it will accept the spaces and it won't affected when you see the output.
But In ALV goto Print preiview then the spaces will come there. You can see the Changes there.
Thanks,
Venkat.
Edited by: Venkatesh Kolluru on Mar 18, 2011 6:57 AM
03-18-2011 5:57 AM
Hi,
When you add spaces into the ALV header Title it will accept the spaces and it won't affected when you see the output.
But In ALV goto Print preiview then the spaces will come there. You can see the Changes there.
Thanks,
Venkat.
Edited by: Venkatesh Kolluru on Mar 18, 2011 6:57 AM
03-18-2011 6:12 AM
Hi Venkatesh,
Your answer gives me some hope.
However, I want the spacing in the output itself. My client insisits on it.
Is there any other function module I may use to create these settings ?
Thanks in advance .
Inesha
03-18-2011 6:39 AM
Hi inesha,
If you use add_gap method it will display in alv itself. But when you are going to print it won't print.Because it is HTML Based.
you can do one thing .
Use both the methods in OO ALV
For your user satisfaction in display method use the add_gap method and in Print method you can concatenate the spaces .
Then in both the ways it will remains the same.
Same problem i faced.Through this solution i get back.
Thanks,
Venkat.
03-18-2011 6:22 AM
Hi Inesha,
For displaying ALV header with more flexibility you can prefer going for OOPs ALV display. Because in OOPs ALV display we have more control over the top of page container. We can handle this situation easily in OOPs ALV.
In OOPs ALV there is a method to add newline and gap between words,
Example code:
CALL METHOD lv_top_of_page->add_gap
EXPORTING
width = 10.
If you add this code between two words, space of width 10 will be added between two words. If you are comfortable and prefer to go with OOPs ALV I will guide you.
Thanks,
Sri Hari Anand Kumar
03-18-2011 6:29 AM
Hi,
This should generally work with no issues. However, as you are saying your internal table is having the header with correct spaces, please check the below.
1. The code for the header is in the TOP-OF-PAGE event.
2. Check the sample program in http://www.sap-img.com/abap/sample-alv-heading-in-alv.htm.
Thanks,
Guru
03-18-2011 6:33 AM
Hi,
Try this.
Give "Title-abcdfghj " as " Title- 'a' 'b' 'c'........" to then while display in output
concatenate all those values to " final output structure or internaltable" seperated by space.
Regards,
Renuka S.
03-18-2011 7:12 AM
Hi,
you can use below method to add text in ALV header.
Go To menu --> Text Element --> Text symbols : using this path you can make Text-001 text element.
For subtitle also you can do same thing. again u call add_text method.
CALL METHOD lo_document->add_text
EXPORTING
text = text-001
sap_fontsize = '2'
sap_emphasis = 'STRONG'. " this paratmeter is optional.
If you need space between character then store in one variable lv_string which is "CONCATE" using "SEPERATED BY SPACE" or use "ADD_GAP" method and call lv_string instead of text-001.
Regards,
Kunjan