03-05-2009 10:14 AM
Hi Experts,
I want to display the below said in top-of-page (alv) as TITLE can include only 72 characters.
*FORM TITLE.
**
WRITE BUDAT-LOW DD/MM/YYYY TO DATE1.
WRITE BUDAT-HIGH DD/MM/YYYY TO DATE2.
**
CONCATENATE IT_FINAL-NAME1 'Reconcilliation Statement From'
DATE1 'TO' DATE2
INTO TITLE SEPARATED BY SPACE .
**
**
**
**ENDFORM. "TITLE
Please advice.
Karthik
03-05-2009 10:25 AM
Hi Karthik,
In ALV you will use the events and a Function module calle Resue_alv_commentry_write you can display the header on the top of the ALV.
You can check with the below code :
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
* I_GRID_TITLE = i_title_gts
IS_LAYOUT = wa_layout
IT_FIELDCAT = lt_fieldcat
IT_EVENTS = it_events
TABLES
T_OUTTAB = <dyn_table>
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.
ENDFORM. " DISPLAY
*&---------------------------------------------------------------------*
*& Form DESINLAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DESINLAYOUT .
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM. " DESINLAYOUT
*&---------------------------------------------------------------------*
*& Form GETEVENTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_EVENTS text
*----------------------------------------------------------------------*
FORM GETEVENTS USING P_IT_EVENTS type slis_t_event.
.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = p_it_events
EXCEPTIONS
LIST_TYPE_WRONG = 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.
READ TABLE P_IT_EVENTS INTO WA_EVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'TOP_OF_PAGE'.
MODIFY IT_EVENTS FROM WA_EVENTS TRANSPORTING FORM WHERE NAME = WA_EVENTS-NAME.
ENDFORM. " GETEVENTS
*&---------------------------------------------------------------------
*& Form top-of-page
*&---------------------------------------------------------------------
FORM TOP_OF_PAGE.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE'.
* WA_LISTHEADER-INFO = SY-DATUM. " - DG1K902198
WRITE SY-DATUM TO WA_LISTHEADER-INFO." + DG1K902198
APPEND WA_LISTHEADER TO IT_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'TIME'.
* WA_LISTHEADER-INFO = SY-UZEIT." - DG1K902198
WRITE SY-UZEIT TO WA_LISTHEADER-INFO. " +DG1K902198
APPEND WA_LISTHEADER TO IT_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'CLIENT'.
WA_LISTHEADER-INFO = SY-MANDT.
APPEND WA_LISTHEADER TO IT_LISTHEADER.
CLEAR WA_LISTHEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = IT_LISTHEADER. "it_listheader.
REFRESH IT_LISTHEADER. "it_listheader.
ENDFORM. "top-of-pa
This will work....Try with the above code with the changes that you wanted.
Regards,
Kittu
03-05-2009 10:20 AM
03-05-2009 10:21 AM
Hi,
For this you need to use events in ALV.. in FM you have parameter called event..
sample
-----
IT_EVENT-EVENTNAME = TOP_OF_PAGE.
IT_EVENT-FORMNAME = top.
call the ALV grid FM ..
FORM TOP.
---
---
ENDFORM.
03-05-2009 10:23 AM
03-05-2009 10:25 AM
Hi Karthik,
In ALV you will use the events and a Function module calle Resue_alv_commentry_write you can display the header on the top of the ALV.
You can check with the below code :
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DISPLAY .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
* I_GRID_TITLE = i_title_gts
IS_LAYOUT = wa_layout
IT_FIELDCAT = lt_fieldcat
IT_EVENTS = it_events
TABLES
T_OUTTAB = <dyn_table>
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.
ENDFORM. " DISPLAY
*&---------------------------------------------------------------------*
*& Form DESINLAYOUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM DESINLAYOUT .
WA_LAYOUT-ZEBRA = 'X'.
WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
ENDFORM. " DESINLAYOUT
*&---------------------------------------------------------------------*
*& Form GETEVENTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_IT_EVENTS text
*----------------------------------------------------------------------*
FORM GETEVENTS USING P_IT_EVENTS type slis_t_event.
.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = p_it_events
EXCEPTIONS
LIST_TYPE_WRONG = 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.
READ TABLE P_IT_EVENTS INTO WA_EVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'TOP_OF_PAGE'.
MODIFY IT_EVENTS FROM WA_EVENTS TRANSPORTING FORM WHERE NAME = WA_EVENTS-NAME.
ENDFORM. " GETEVENTS
*&---------------------------------------------------------------------
*& Form top-of-page
*&---------------------------------------------------------------------
FORM TOP_OF_PAGE.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'DATE'.
* WA_LISTHEADER-INFO = SY-DATUM. " - DG1K902198
WRITE SY-DATUM TO WA_LISTHEADER-INFO." + DG1K902198
APPEND WA_LISTHEADER TO IT_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'TIME'.
* WA_LISTHEADER-INFO = SY-UZEIT." - DG1K902198
WRITE SY-UZEIT TO WA_LISTHEADER-INFO. " +DG1K902198
APPEND WA_LISTHEADER TO IT_LISTHEADER.
WA_LISTHEADER-TYP = 'S'.
WA_LISTHEADER-KEY = 'CLIENT'.
WA_LISTHEADER-INFO = SY-MANDT.
APPEND WA_LISTHEADER TO IT_LISTHEADER.
CLEAR WA_LISTHEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = IT_LISTHEADER. "it_listheader.
REFRESH IT_LISTHEADER. "it_listheader.
ENDFORM. "top-of-pa
This will work....Try with the above code with the changes that you wanted.
Regards,
Kittu
03-05-2009 12:47 PM
Hi Kittu,
Thanks for your post, but its not working.
Now my out put is:
Subcontracting Vend
Reconcilliation Statement From 22.12.2006 T*
it should be:
Subcontracting Vendors
Reconcilliation Statement From 22.12.2006 TO 16.02.2009.
Please advice if there is any thing wrong with my coding.
FORM GETEVENTS USING GT_EVENTS TYPE SLIS_T_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = GT_EVENTS
* EXCEPTIONS
* LIST_TYPE_WRONG = 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.
READ TABLE GT_EVENTS INTO WA_EVENTS WITH KEY NAME = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'TOP_OF_PAGE'.
MODIFY EVENT FROM WA_EVENTS TRANSPORTING FORM WHERE NAME = WA_EVENTS-NAME.
ENDFORM. "GETEVENTS
FORM TOP_OF_PAGE.
DATA : LV_DATE(24) TYPE C.
WRITE BUDAT-LOW DD/MM/YYYY TO DATE1.
WRITE BUDAT-HIGH DD/MM/YYYY TO DATE2.
CONCATENATE DATE1 'TO' DATE2 INTO LV_DATE SEPARATED BY SPACE.
WA_TOP-TYP = 'S'.
WA_TOP-KEY = IT_FINAL-NAME1.
APPEND WA_TOP TO IT_TOP.
CLEAR WA_TOP.
WA_TOP-TYP = 'S'.
WA_TOP-KEY = 'Recon.Statement From'.
WA_TOP-INFO = LV_DATE.
APPEND WA_TOP TO IT_TOP.
CLEAR WA_TOP.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_TOP
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
.
ENDFORM. "TOP_OF_PAGE
Please advice.
Karthik
03-05-2009 12:55 PM
Hi Karthik,
As i see in your coding, you are passing "Subcontracting Vendors" in to KEY of the header structure.
WA_TOP-TYP = 'S'.
WA_TOP-KEY = IT_FINAL-NAME1.
APPEND WA_TOP TO IT_TOP.
CLEAR WA_TOP.
But, the Key can hold only a maximum of 20 Characters. So its better that you pass this text in "info"
Similarly, for the other details also, you need to take care of the maximum characters that it would accept.
types: begin of slis_listheader,
typ(1) type c, " H = Header, S = Selection, A = Action
key(20) type c,
info type slis_entry,
end of slis_listheader.
info accepts a maxmum of 60 Characters only.
Best Regards,
Ram.
03-05-2009 1:10 PM
Hi Ram,
Thank you !!
Can you please advice me on this as if mt vendor name is lengthy I am facing trouble.
Karthik
03-05-2009 1:42 PM
Karthik,
I guess the vendor name may not be lengthier than 60 characters. Hence you can pass it in the INFO field of the list header strucutre, instead of Key. In this way, you wil not face this issue.
Only draw back would be, it will not be displayed in BOLD letters
For bold, you can provide TYPE as "H".
Best Regards,
Ram.
Edited by: ram Kumar on Mar 5, 2009 7:13 PM
03-05-2009 1:52 PM
Hi,
Try with this.
DATA : LH TYPE SLIS_T_LISTHEADER,
LS TYPE SLIS_LISTHEADER .
I_CALLBACK_TOP_OF_PAGE = 'TOP'
FORM TOP.
DATA : L_DATE(10) TYPE C .
DATA : L_DATE1(20) TYPE C .
CLEAR LS.
LS-TYP = 'H'.
LS-INFO = 'STUDENT DETAILS'.
APPEND LS TO LH.
CLEAR LS.
LS-TYP = 'S'.
WRITE: SY-DATUM TO L_DATE USING EDIT MASK '__/__/____'.
CONCATENATE 'DATE :' L_DATE INTO L_DATE1 SEPARATED BY SPACE.
LS-INFO = L_DATE1.
APPEND LS TO LH.
CLEAR LS.
03-05-2009 10:28 AM
Hi,
Use the top_of_page this way to print as per your requirement:-
*FOR TOP OF THE PAGE
DATA : it_top TYPE slis_t_listheader,
wa_top TYPE slis_listheader.
*&---------------------------------------------------------------------*
* DISPLAY RECORDS IN ALV GRID
*&---------------------------------------------------------------------*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_top_of_page = 'TOP'
it_fieldcat = it_field
TABLES
t_outtab = it_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*&---------------------------------------------------------------------*
*& Form top
*&---------------------------------------------------------------------*
* TO WRITE THE HEADER
*----------------------------------------------------------------------*
FORM top.
DATA : lv_date(20) TYPE c.
WRITE BUDAT-LOW DD/MM/YYYY TO DATE1.
WRITE BUDAT-HIGH DD/MM/YYYY TO DATE2.
CONCATENATE DATE1 DATE2 INTO lv_date SEPARATED BY SPACE.
REFRESH it_top.
wa_top-typ = 'S'.
wa_top-key = IT_FINAL-NAME1.
wa_top-info = ' '.
APPEND wa_top TO it_top.
CLEAR wa_top.
wa_top-typ = 'S'.
wa_top-key = 'Reconcilliation Statement From'.
wa_top-info = lv_date.
APPEND wa_top TO it_top.
CLEAR wa_top.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_top.
ENDFORM. "top
Hope this helps you.
Regards,
Tarun
03-06-2009 8:36 AM
02-10-2011 7:38 AM
How do we link the text message 'TOP_OF_Page' in the form of a subroutine?
I have tried the TOP of page event program ... everything seems fine except that the form 'top_of_page' is not getting linked with the reuse_alv_events_get function as it is just a text value... please help me out.. early help would be appreciated.
03-05-2009 10:30 AM
i_callback_top_of_page = 'TOP_OF_PAGE'
of the FM 'REUSE_ALV_GRID_DISPLAY'
then
FORM top_of_page.
DATA: l_header TYPE slis_t_listheader,
l_wa TYPE slis_listheader.
l_wa-typ = 'S'.
WRITE BUDAT-LOW DD/MM/YYYY TO DATE1.
WRITE BUDAT-HIGH DD/MM/YYYY TO DATE2.
**
CONCATENATE IT_FINAL-NAME1 'Reconcilliation Statement From'
DATE1 'TO' DATE2
INTO TITLE SEPARATED BY SPACE .
write title to l_wa-info .
APPEND l_wa TO l_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = l_header
i_logo = 'SARBA_LOGO'.
I_END_OF_LIST_GRID =
I_ALV_FORM =
ENDFORM. "top_of_page
03-05-2009 10:33 AM
hi,
Total lenght should be less than equal to 72 char.
other wise it goes dump.
Regards
Md.MahaboobKhan
03-05-2009 10:35 AM
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
is_layout = gs_layout
it_fieldcat = i_fieldcat[]
it_events = i_event[]
it_sort = i_sort[]
i_save = 'A'
TABLES
t_outtab = i_final_1
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM top_of_page.
Write : /5 TITLE1.
ENDFORM.
FORM f_build_eventtab USING ps_event TYPE slis_t_event.
DATA: wa_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = ps_event.
READ TABLE ps_event WITH KEY name = slis_ev_top_of_page INTO wa_event.
IF sy-subrc EQ 0.
MOVE slis_ev_top_of_page TO wa_event-form.
APPEND wa_event TO ps_event.
ENDIF.
ENDFORM.
Regards,
Joan
03-05-2009 1:49 PM