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

REUSE_ALV_COmmentary_write change Alignment

Uli_42
Participant
0 Likes
746

Hello,

i would like to change the Default alignment of some Header_lines

using REUSE_ALV_HIERSEQ_LIST_DISPLAY.

I don't see that it is possible to do this with REUSE_ALV_COmmentary_write.

So, is it possible to get and manipulate the instance of the cl_salv_layout_grid used by the Function Module?

Or any other Ideas ( without doing all the Programming class based)

Thanx for all advices,

Uli

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
618

Hi Ulrich,

Actually as long as u are using the classical ALV lists, then (as far as I have experienced) you dont need to display the header information using the FM REUSE_ALV_COMMENTARY_WRITE. As long as you have attached a subroutine against TOP_OF_PAGE/TOP_OF_LIST event and passed the table to IT_EVENTS, you should be able to display header details with WRITE statements and hence the formatting options like position and color etc. should also work.

Have to tried this out?

Regards,

Aditya

A snippet of code (i think the below option should work with hirarchial ALV list also since both have the same fundamentals) :

TYPE-POOLS: slis.

DATA : it_fieldcat TYPE slis_t_fieldcat_alv,

it_events TYPE slis_t_event,

w_events TYPE slis_alv_event,

it_681z TYPE STANDARD TABLE OF t681z.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = 'ZT_XAD_TEST_PROGRAM'

i_structure_name = 'T681Z'

CHANGING

ct_fieldcat = it_fieldcat[]

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

ELSE.

SELECT * FROM t681z INTO TABLE it_681z

WHERE kappl EQ 'V4'.

IF sy-subrc EQ 0.

CLEAR : w_events, it_events[].

w_events-form = 'FM_TOP_OF_LIST'.

w_events-name = 'TOP_OF_LIST'.

APPEND w_events TO it_events.

w_events-name = 'TOP_OF_PAGE'.

APPEND w_events TO it_events.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = 'ZT_XAD_TEST_PROGRAM'

it_fieldcat = it_fieldcat[]

it_events = it_events[]

TABLES

t_outtab = it_681z.

ENDIF.

ENDIF.

&----


*& Form fm_top_of_list

&----


  • text

----


FORM fm_top_of_list.

<b>Here you can do the formatting allowed with WRITE statements</b>

WRITE:/20 ' header test'.

ENDFORM. "fm_top_of_list

Message was edited by:

Aditya Laud

Message was edited by:

Aditya Laud

Hello,

i would like to change the Default alignment of some Header_lines

using REUSE_ALV_HIERSEQ_LIST_DISPLAY.

I don't see that it is possible to do this with REUSE_ALV_COmmentary_write.

So, is it possible to get and manipulate the instance of the cl_salv_layout_grid used by the Function Module?

Or any other Ideas ( without doing all the Programming class based)

Thanx for all advices,

Uli

2 REPLIES 2
Read only

Former Member
0 Likes
619

Hi Ulrich,

Actually as long as u are using the classical ALV lists, then (as far as I have experienced) you dont need to display the header information using the FM REUSE_ALV_COMMENTARY_WRITE. As long as you have attached a subroutine against TOP_OF_PAGE/TOP_OF_LIST event and passed the table to IT_EVENTS, you should be able to display header details with WRITE statements and hence the formatting options like position and color etc. should also work.

Have to tried this out?

Regards,

Aditya

A snippet of code (i think the below option should work with hirarchial ALV list also since both have the same fundamentals) :

TYPE-POOLS: slis.

DATA : it_fieldcat TYPE slis_t_fieldcat_alv,

it_events TYPE slis_t_event,

w_events TYPE slis_alv_event,

it_681z TYPE STANDARD TABLE OF t681z.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

i_program_name = 'ZT_XAD_TEST_PROGRAM'

i_structure_name = 'T681Z'

CHANGING

ct_fieldcat = it_fieldcat[]

EXCEPTIONS

inconsistent_interface = 1

program_error = 2

OTHERS = 3.

IF sy-subrc <> 0.

ELSE.

SELECT * FROM t681z INTO TABLE it_681z

WHERE kappl EQ 'V4'.

IF sy-subrc EQ 0.

CLEAR : w_events, it_events[].

w_events-form = 'FM_TOP_OF_LIST'.

w_events-name = 'TOP_OF_LIST'.

APPEND w_events TO it_events.

w_events-name = 'TOP_OF_PAGE'.

APPEND w_events TO it_events.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

i_callback_program = 'ZT_XAD_TEST_PROGRAM'

it_fieldcat = it_fieldcat[]

it_events = it_events[]

TABLES

t_outtab = it_681z.

ENDIF.

ENDIF.

&----


*& Form fm_top_of_list

&----


  • text

----


FORM fm_top_of_list.

<b>Here you can do the formatting allowed with WRITE statements</b>

WRITE:/20 ' header test'.

ENDFORM. "fm_top_of_list

Message was edited by:

Aditya Laud

Message was edited by:

Aditya Laud

Read only

0 Likes
618

Hy Aditya,

thank you, it made me try this approach again.

i tried this before without seeing any output.

I think i did put the output to far to the right, relying on the value of REUSE_ALV_LIST_WIDTH_GET what's not possible, because i chnage the ouptut-Size of the columns in the layout.

Bye,

Uli