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 -- TOP OF PAGE

Former Member
0 Kudos

HI,

I am using the top_of_page form. I want to change the header info in each case. How can i do it.

Pls tell me

4 REPLIES 4

Former Member
0 Kudos

HI

FORM LAYOUT .

PERFORM FCAT USING 'ZEMPNO' 'ITAB' '' 'Emp.No.' 'ZEMPNO'

'ZEMP_MST' ''.

PERFORM FCAT USING 'ZEMPNAME' 'ITAB' '' 'Emp. Name' 'ZEMPNAME'

'ZEMP_MST' ''.

PERFORM FCAT USING 'ZDEPTCD' 'ITAB' '' 'Dept.Code' 'ZDEPTCD'

'ZEMP_MST' ''.

PERFORM FCAT USING 'ZDEPTNAME' 'ITAB' '' 'Dept.Name' 'ZDEPTNAME'

'ZDEPT_MST' ''.

PERFORM FCAT USING 'ZDESGCD' 'ITAB' '' 'Desg.Code' 'ZDESGCD'

'ZEMP_MST' ''.

PERFORM FCAT USING 'ZDESGNAME' 'ITAB' '' 'Desg.Name' 'ZDESGNAME'

'ZDESG_MST' ''.

  • PERFORM LSORT USING 'ZEMPNO' 'IDATA' ''.

  • PERFORM LSORT USING 'ZEMPNAME' 'IDATA' ''.

  • MOVE IT_SORT[] TO GT_SORT[].

REPID = SY-REPID.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = REPID

IT_FIELDCAT = F1

  • IT_SORT = GT_SORT

I_SAVE = 'X'

IT_EVENTS = GT_EVENTS[]

TABLES

T_OUTTAB = ITAB.

IF SY-SUBRC <> 0.

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

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

ENDIF.

ENDFORM. " LAYOUT

&----


*& Form FCAT

&----


FORM FCAT USING P_FIELD P_TABLE P_SUM P_TEXT P_RFIELD P_RTABLE P_DISP.

ADD 1 TO POS.

F2-COL_POS = POS.

F2-FIELDNAME = P_FIELD.

F2-TABNAME = P_TABLE.

F2-SELTEXT_L = P_TEXT.

F2-REF_FIELDNAME = P_RFIELD.

F2-REF_TABNAME = P_RTABLE.

F2-DO_SUM = P_SUM.

F2-NO_OUT = P_DISP.

APPEND F2 TO F1.

CLEAR F2.

ENDFORM. " FCAT

&----


*& Form LSORT

&----


*FORM LSORT USING P_FIELD P_TABLE P_UP.

  • ADD 1 TO L_POS.

  • IT_SORT-SPOS = L_POS.

  • IT_SORT-FIELDNAME = P_FIELD.

  • IT_SORT-TABNAME = P_TABLE.

  • IT_SORT-UP = P_UP.

  • APPEND IT_SORT.

*ENDFORM. " LSORT

*----


FORM F_BUILD_EVENTCAT .

CLEAR: GT_EVENTS. REFRESH: GT_EVENTS.

CLEAR: FS_EVENTCAT.

FS_EVENTCAT-NAME = 'TOP_OF_PAGE'.

FS_EVENTCAT-FORM = 'F_REPORT_HEADER_ALV'.

APPEND FS_EVENTCAT TO GT_EVENTS.

CLEAR: FS_EVENTCAT.

FS_EVENTCAT-NAME = 'END_OF_LIST'.

FS_EVENTCAT-FORM = 'F_WRITE_SUMMARY'.

APPEND FS_EVENTCAT TO GT_EVENTS.

ENDFORM. " F_BUILD_EVENTCAT

FORM F_REPORT_HEADER_ALV.

CALL FUNCTION 'Z_YHEAD_PRINT'

EXPORTING

TITLE1 = 'XYZ Limited'

TITLE2 = 'Employee Master'

TITLE3 = 'Created on '

COLOR = 'X'

.

ENDFORM.

regards

kishore

Former Member
0 Kudos

HI

or you can try like this

start-of-selection.

perform data_retrieval.

  • perform user_command.

perform build_fieldcatalog.

perform build_layout.

perform build_events.

perform build_print_params.

perform build_sortcat.

perform display_alv_report.

end-of-selection.

*TOP-OF-PAGE.

  • PERFORM top-of-page.

end-of-page.

*&----


*& Form build_fieldcatalog

*&----


  • text

*----


  • --> p1 text

  • <-- p2 text

*----


form build_fieldcatalog.

fieldcatalog-fieldname = 'EBELN'.

fieldcatalog-seltext_m = 'Purchase Order'.

fieldcatalog-col_pos = 0.

fieldcatalog-outputlen = 10.

fieldcatalog-emphasize = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'EBELP'.

fieldcatalog-seltext_m = 'PO Item'.

fieldcatalog-col_pos = 1.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'STATU'.

fieldcatalog-seltext_m = 'Status'.

fieldcatalog-col_pos = 2.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'AEDAT'.

fieldcatalog-seltext_m = 'Item change date'.

fieldcatalog-col_pos = 3.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MATNR'.

fieldcatalog-seltext_m = 'Material Number'.

fieldcatalog-col_pos = 4.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MENGE'.

fieldcatalog-seltext_m = 'PO quantity'.

fieldcatalog-col_pos = 5.

fieldcatalog-do_sum = 'X'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'MEINS'.

fieldcatalog-seltext_m = 'Order Unit'.

fieldcatalog-col_pos = 6.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'NETPR'.

fieldcatalog-seltext_m = 'Net Price'.

fieldcatalog-col_pos = 7.

fieldcatalog-outputlen = 15.

fieldcatalog-datatype = 'CURR'.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

fieldcatalog-fieldname = 'PEINH'.

fieldcatalog-seltext_m = 'Price Unit'.

fieldcatalog-col_pos = 8.

append fieldcatalog to fieldcatalog.

clear fieldcatalog.

endform. " build_fieldcatalog

if you want i can post the whole code

regards

kishore

0 Kudos

hi kishore,

Thanks a lot for your response.

My requirement was not the one you gave. I already have done those things which you gave as sample.

I just wanted to change the heading which is assigned in the top of page form. I declared a global variable and assigned value to it and solve my problem

Regrds

Priya

hymavathi_oruganti
Active Contributor
0 Kudos

case xxxx.

when 'abc'.

wa_header-typ = 'H'.

wa_header-info = 'abc'

APPEND wa_header TO heading.

when 'xyz'.

wa_header-typ = 'H'.

wa_header-info = 'xyz'

APPEND wa_header TO heading.

endcase.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

i_logo = 'ENJOYSAP_LOGO'

it_list_commentary = heading.

CLEAR heading.