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

ALV List display - header width adjust

Former Member
0 Likes
896

Hi,

I am using REUSE_ALV_LIST_DISPLAY for my ALV display.The width of the ALV varies for different inputs.

I have a header followed by sub heading.Subheading has been structured into boxes on top of the fields label using TOP OF PAGE.Is there a way to fix the right alignment of the subheading with the width of the ALV?

WRITE:/50 'heading'.

WRITE: 145 'subheading'.

WRITE: 169 SY-VLINE.

I want the value of sy-vline be adjusted as per the width of my ALV.

Please advice

Thanks.

1 ACCEPTED SOLUTION
Read only

david_lees
Product and Topic Expert
Product and Topic Expert
0 Likes
785

Hi,

You can dynamically position text using the write statement -

Example

This example outputs a text field text at different positions, with different output lengths.

DATA: text TYPE string VALUE '0123456789ABCDEF',

col TYPE i VALUE 25,

len TYPE i VALUE 5.

WRITE text.

WRITE /5(10) text.

WRITE AT col(len) text.

http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/db9e2335c111d1829f0000e829fbfe/frameset.htm

You would need to determine the width of your ALV before the TOP-OF-PAGE event is triggered and then pass the position value into the routine.

Kind regards, David

Hi,

I am using REUSE_ALV_LIST_DISPLAY for my ALV display.The width of the ALV varies for different inputs.

I have a header followed by sub heading.Subheading has been structured into boxes on top of the fields label using TOP OF PAGE.Is there a way to fix the right alignment of the subheading with the width of the ALV?

WRITE:/50 'heading'.

WRITE: 145 'subheading'.

WRITE: 169 SY-VLINE.

I want the value of sy-vline be adjusted as per the width of my ALV.

Please advice

Thanks.

4 REPLIES 4
Read only

david_lees
Product and Topic Expert
Product and Topic Expert
0 Likes
786

Hi,

You can dynamically position text using the write statement -

Example

This example outputs a text field text at different positions, with different output lengths.

DATA: text TYPE string VALUE '0123456789ABCDEF',

col TYPE i VALUE 25,

len TYPE i VALUE 5.

WRITE text.

WRITE /5(10) text.

WRITE AT col(len) text.

http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/db9e2335c111d1829f0000e829fbfe/frameset.htm

You would need to determine the width of your ALV before the TOP-OF-PAGE event is triggered and then pass the position value into the routine.

Kind regards, David

Read only

0 Likes
785

HI David,

Thanks for the prompt reply...I am sure your suggestion is just fine,but how will i determine the width of ALV before event top of page is triggered?

Thanks.

Read only

david_lees
Product and Topic Expert
Product and Topic Expert
0 Likes
785

Hi,

In the example you would need to determine the length manually and the position value would be in variable LEN.

I am not sure of your criteria for the width your ALV however it could be that you calculate the length of fields in your internal table before it is output and perhaps take the maximum value? You can use the in built method STRLEN for example to work out the length of a data object.

Regards, David

Read only

0 Likes
785

Thanks

Will confirm with client for the correct length option.