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
613

Hi guru,

How to display titles in ALV Programme?

Hi guru,

How to display titles in ALV Programme?

6 REPLIES 6
Read only

Former Member
0 Likes
576

In the PBO of the Screen.

Defne the title

using the statement SET TITLEBAR 'TITLE'.

If you are using OO ABAP for the ALV

check out the following method in CL_GUI_ALVGRID

SET_TITLE_SIZE

SET_TITLE_STYLE

SET_TITLE_TEXT

SET_GRIDTITLE - this is title only for the ALV GRID

Read only

Former Member
0 Likes
576

Hi ramakrishna,

You could either use the I_GRID_TITLE of the REUSE_ALV* FMs. Otherwise you could create a ALV header and add/display your title using the FM REUSE_ALV_COMMENTARY_WRITE

Regards

Wenceslaus

Read only

Former Member
0 Likes
576

HI,

in

MODULE status_0100 OUTPUT.

SET PF-STATUS 'STANDARD'.

SET TITLEBAR <b>'TITLE'. Double click</b> here and give the Tiltle u want

Reward points if this Helps.

Manish

Read only

Former Member
0 Likes
576

&----


*& Report ZGILL_ALV *

*& *

&----


*& *

*& *

&----


REPORT ZGILL_ALV message-id rp .

type-pools slis.

tables: zgill_main,zgill_details.

data begin of itab occurs 0.

include structure zgill_main.

data salary like zgill_details-salary.

data end of itab.

data : WA_SORT TYPE SLIS_SORTINFO_ALV,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

IT_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV.

PARAMETERS: p_list radiobutton group A1,

P_GRID RADIOBUTTON GROUP A1.

SELECT-OPTIONS: S_PERNR FOR ZGILL_MAIN-PERNR.

start-of-selection.

perform fill_itab.

perform fill_fieldcat. " Manuallly Preparing Fiedl Catalog

perform display_alv.

&----


*& Form fill_itab

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fill_itab .

select apernr aname aorg adob b~salary INTO CORRESPONDING FIELDS OF TABLE itab

from zgill_main as a join zgill_details as b on apernr = bpernr

WHERE A~PERNR IN S_PERNR.

endform. " fill_itab

&----


*& Form display_alv

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_alv .

data repid like sy-repid.

REPID = SY-REPID.

WA_LAYOUT-ZEBRA = 'X'.

WA_LAYOUT-WINDOW_TITLEBAR = 'GRID DISPLAY'.

WA_LAYOUT-SUBTOTALS_TEXT = 'SUBTOTAL'.

WA_LAYOUT-TOTALS_TEXT = 'TOTAL'.

IF P_GRID = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = repid

IT_FIELDCAT = IT_FIELDTAB

IT_SORT = IT_SORT

IS_LAYOUT = WA_LAYOUT

TABLES

t_outtab = itab[]

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

.

IF sy-subrc <> 0.

message e016 with 'Error in Display'.

ENDIF.

ELSEIF P_LIST = 'X'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = repid

IT_FIELDCAT = IT_FIELDTAB

IT_SORT = IT_SORT

IS_LAYOUT = WA_LAYOUT

TABLES

t_outtab = itab[]

EXCEPTIONS

PROGRAM_ERROR = 1

OTHERS = 2.

IF sy-subrc <> 0.

message e016 with 'Error in Display'.

ENDIF.

ENDIF.

endform. " display_alv

&----


*& Form fill_fieldcat

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fill_fieldcat .

CLEAR WA_FIELDCAT .

WA_FIELDCAT-TABNAME = 'ITAB'.

WA_FIELDCAT-FIELDNAME = 'PERNR'.

WA_FIELDCAT-SELTEXT_L = 'EMP NUMBER'.

  • WA_FIELDCAT-ddictxt = 'l'.

WA_FIELDCAT-COL_POS = 2.

WA_FIELDCAT-OUTPUTLEN = 10.

APPEND WA_FIELDCAT TO IT_FIELDTAB.

CLEAR WA_FIELDCAT .

  • when 'maktx'.

WA_FIELDCAT-TABNAME = 'ITAB'.

WA_FIELDCAT-FIELDNAME = 'NAME'.

WA_FIELDCAT-SELTEXT_L = 'EMP NAME'.

  • WA_FIELDCAT-ddictxt = 'l'.

WA_FIELDCAT-COL_POS = 3.

WA_FIELDCAT-OUTPUTLEN = 15.

APPEND WA_FIELDCAT TO IT_FIELDTAB.

CLEAR WA_FIELDCAT .

WA_FIELDCAT-TABNAME = 'ITAB'.

WA_FIELDCAT-FIELDNAME = 'ORG'.

WA_FIELDCAT-SELTEXT_L = 'ORG UNIT'.

WA_FIELDCAT-COL_POS = 4.

WA_FIELDCAT-OUTPUTLEN = 10.

APPEND WA_FIELDCAT TO IT_FIELDTAB.

CLEAR WA_FIELDCAT .

WA_FIELDCAT-TABNAME = 'ITAB'.

WA_FIELDCAT-FIELDNAME = 'DOB'.

WA_FIELDCAT-SELTEXT_L = 'BIRTH DATE'.

WA_FIELDCAT-COL_POS = 5.

WA_FIELDCAT-OUTPUTLEN = 12.

APPEND WA_FIELDCAT TO IT_FIELDTAB.

CLEAR WA_FIELDCAT .

WA_FIELDCAT-TABNAME = 'ITAB'.

WA_FIELDCAT-FIELDNAME = 'SALARY'.

WA_FIELDCAT-SELTEXT_L = 'SALARY'.

WA_FIELDCAT-COL_POS = 6.

WA_FIELDCAT-OUTPUTLEN = 25.

WA_FIELDCAT-do_sum = 'X'.

APPEND WA_FIELDCAT TO IT_FIELDTAB.

endform. " fill_fieldcat

try out this code..it will help..change the table names accordingly..

reward points if helpfull..

amit

Read only

Former Member
0 Likes
576

hi,

use the FM <b>REUSE_ALV_COMMENTARY_WRITE</b>

CLEAR GS_EVENT.

GS_EVENT-NAME = 'TOP_OF_PAGE'.

GS_EVENT-FORM = 'TOP_OF_PAGE'.

APPEND GS_EVENT TO IT_EVENTS.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = LV_REPID

IT_FIELDCAT = IT_FLDCAT

IT_EVENTS = IT_EVENTS

is_layout = s_layout

TABLES

T_OUTTAB = IT_INV

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_PAGE.

DATA : LS_VALUE TYPE SLIS_LISTHEADER ,

LT_VALUE TYPE SLIS_T_LISTHEADER.

clear ls_value.

LS_VALUE-TYP = 'H'.

LS_VALUE-INFO = 'Heading'.

APPEND LS_VALUE TO LT_VALUE .

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = LT_VALUE.

hope this helps,

do reward if it helps,

priya.

Read only

Former Member
0 Likes
576

What type of titles are you talking about?

If it is the column field headings then it is handled by the field catalog.

you need to use 'fieldname' attribute of slis_fieldcat_alv.

for example

DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV.

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'SEATSOCC'.

LS_FIELDCAT-NO_OUT = 'X'.

LS_FIELDCAT-SP_GROUP = 'A'.

LS_FIELDCAT-NO_SUM = 'X'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

*

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'SEATSMAX'.

LS_FIELDCAT-NO_OUT = 'X'.

LS_FIELDCAT-SP_GROUP = 'A'.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

*

CLEAR LS_FIELDCAT.

LS_FIELDCAT-FIELDNAME = 'CARRID'.

LS_FIELDCAT-OUTPUTLEN = 7.

APPEND LS_FIELDCAT TO E01_LT_FIELDCAT.

i hope this helps