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

Former Member
0 Likes
561

Hi Abapers,

Im doing one Alv where i want my columns of final output is to be displayed as fieldname and its french conversion below field name... how can i create 2 level columns..

for eg:

Material no plant

French code French code

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
532

Hi,

u can have multiple lines in a header.Use list display with events(top-of-page).

Hi Abapers,

Im doing one Alv where i want my columns of final output is to be displayed as fieldname and its french conversion below field name... how can i create 2 level columns..

for eg:

Material no plant

French code French code

4 REPLIES 4
Read only

Former Member
0 Likes
532

Hi,

I believe it is not possible to have two lines in the header..

Thanks,

Naren

Read only

Former Member
0 Likes
533

Hi,

u can have multiple lines in a header.Use list display with events(top-of-page).

Read only

0 Likes
532

Hi swathi,

can you please gimme some sample code...

Read only

0 Likes
532

Pls go thru this.

REPORT ZTEST line-count 30 message-id zz line-size 50 .

type-pools: slis.

data: x_fieldcat type slis_fieldcat_alv,

it_fieldcat type slis_t_fieldcat_alv,

l_layout type slis_layout_alv,

x_events type slis_alv_event,

it_events type slis_t_event.

data: begin of itab occurs 0,

vbeln like vbak-vbeln,

posnr like vbap-posnr,

male type i,

female type i,

end of itab.

data: jtab like mara occurs 0 with header line.

select vbeln

posnr

from vbap

up to 10 rows

into table itab.

select * from mara

up to 10 rows

into table jtab.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'

EXPORTING

I_CALLBACK_PROGRAM = sy-repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • IT_EXCLUDING = IT_EXCLUDING

.

x_fieldcat-fieldname = 'VBELN'.

x_fieldcat-seltext_l = 'VBELN'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 1.

append x_fieldcat to it_fieldcat.

clear x_fieldcat.

x_fieldcat-fieldname = 'POSNR'.

x_fieldcat-seltext_l = 'POSNR'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 2.

append x_fieldcat to it_fieldcat.

clear x_fieldcat.

x_fieldcat-fieldname = 'MALE'.

x_fieldcat-seltext_l = 'MALE'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 3.

append x_fieldcat to it_fieldcat.

clear x_fieldcat.

x_fieldcat-fieldname = 'FEMALE'.

x_fieldcat-seltext_l = 'FEMALE'.

x_fieldcat-tabname = 'ITAB'.

x_fieldcat-col_pos = 3.

append x_fieldcat to it_fieldcat.

clear x_fieldcat.

x_events-name = slis_ev_top_of_page.

x_events-form = 'TOP_OF_PAGE'.

append x_events to it_events.

clear x_events .

l_layout-no_colhead = 'X'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = l_layout

IT_FIELDCAT = IT_FIELDCAT

I_TABNAME = 'ITAB'

IT_EVENTS = it_events

  • IT_SORT = IT_SORT

  • I_TEXT = ' '

TABLES

T_OUTTAB = ITAB

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • MAXIMUM_OF_APPENDS_REACHED = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

clear: IT_FIELDCAT,IT_FIELDCAT[].

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'

EXPORTING

I_PROGRAM_NAME = sy-repid

  • I_INTERNAL_TABNAME = 'ITAB'

I_STRUCTURE_NAME = 'MARA'

  • I_CLIENT_NEVER_DISPLAY = 'X'

  • I_INCLNAME = I_INCLNAME

  • I_BYPASSING_BUFFER = I_BYPASSING_BUFFER

  • I_BUFFER_ACTIVE = I_BUFFER_ACTIVE

CHANGING

CT_FIELDCAT = IT_FIELDCAT

  • EXCEPTIONS

  • INCONSISTENT_INTERFACE = 1

  • PROGRAM_ERROR = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

clear: it_events[].

x_events-name = slis_ev_top_of_page.

x_events-form = 'TOP_OF_PAGE2'.

append x_events to it_events.

clear x_events .

l_layout-no_colhead = 'X'.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'

EXPORTING

IS_LAYOUT = l_layout

IT_FIELDCAT = IT_FIELDCAT

I_TABNAME = 'JTAB'

IT_EVENTS = it_events

  • IT_SORT = IT_SORT

  • I_TEXT = ' '

TABLES

T_OUTTAB = JTAB

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • MAXIMUM_OF_APPENDS_REACHED = 2

  • OTHERS = 3

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'

  • EXPORTING

  • I_INTERFACE_CHECK = ' '

  • IS_PRINT = IS_PRINT

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER

  • ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER

  • EXCEPTIONS

  • PROGRAM_ERROR = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

form top_of_page2.

write: / 'SANTOSGKK'.

endform.

form top_of_page.

*-To display the headers for main list

format color col_heading.

write: / sy-uline(45).

write: / sy-vline,

(8) ' ' ,

sy-vline,

(8) ' ' ,

sy-vline,

(19) 'GENDER'(015) centered,

sy-vline.

write: / sy-vline,

(8) 'VBELN'(013) ,

sy-vline,

(8) 'POSNR'(014) ,

sy-vline,

(8) 'MALE'(016) ,

sy-vline,

(8) 'FMALE'(017) ,

sy-vline.

format color off.

endform.

Hope it helps.