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: 

ALV Header text not getting aligned

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

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

0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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