Powered By

Free XML Skins for Blogger

Powered by Blogger

Thursday, February 12, 2009

what is abap REUSE_ALV_GRID_DISPLAY Functions Example

I am using "REUSE_ALV_GRID_DISPLAY" to display Report in ALV.
I have to show System Date and Time at the end of Report so I caught Event "END_OF_PAGE" in IT_EVENTS and modified IT_EVENTS field FORM with "F100_TOP_OF_PAGE", but I am not able to see the Date and Time in the END OF PAGE

I wrote follwoing ocde so please suggest me necessary changes

*&---------------------------------------------------------------------*
*& Form f100-end_of_page
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*

FORM f100-end_of_page.
clear: wa_listheader, it_end_listheader, it_end_listheader[].
concatenate 'Date' sy-datum into w_date separated by space.

wa_listheader-key = ''.
wa_listheader-typ = 'S'.
wa_listheader-info = 'Date'.

append wa_listheader to it_end_listheader.

clear: wa_listheader.

concatenate 'Time' sy-uzeit into w_date separated by space.

wa_listheader-key = ''.
wa_listheader-typ = 'S'.
wa_listheader-info = 'Time'.

append wa_listheader to it_end_listheader.

clear: wa_listheader.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_end_listheader[]
* I_LOGO =
* I_END_OF_LIST_GRID =
.

ENDFORM. " f100-end_of_page

-----------------------------------

In grid display there will be no end_of_page and no end_of_list.
You have show in top_of_page itself.
Otherwise use list display instead of grid.

Suresh Avutu

-----------------------------------

These steps have to be carried out...

DATA: gc_formname_top_of_page TYPE slis_formname
VALUE 'TOP_OF_PAGE'.
DATA: gc_formname_end_of_page TYPE slis_formname
VALUE 'END_OF_PAGE'.

DATA: gt_list_top_of_page TYPE slis_t_listheader.
DATA: gt_list_end_of_page TYPE slis_t_listheader.

------------------
PERFORM e03_eventtab_build USING gt_event[].
PERFORM e04_comment_build USING
gt_list_top_of_page[].
PERFORM e06_comment_build USING
gt_list_end_of_page[].
PERFORM list_alv_display.
-------------------------
FORM list_alv_display .

gt_event-name = slis_ev_top_of_list.
gt_event-form = 'TOP_OF_PAGE'.
APPEND gt_event.

gt_event-name = slis_ev_end_of_list.
gt_event-form = 'END_OF_PAGE'.
APPEND gt_event.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
i_bypassing_buffer = 'X'
i_buffer_active = ' '
i_callback_program = ....
---------------------------------------
FORM end_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = ''
it_list_commentary = gt_list_end_of_page
I_END_OF_LIST_GRID = 1.

ENDFORM. "END_OF_PAGE
------------------------------------------
FORM e06_comment_build
USING e06_lt_end_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
DATA: yl_uname(60).

< here u can concatenate system date and time to
yl_uname>

CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-info = yl_uname.
APPEND ls_line TO e06_lt_end_of_page.

endform. "e06_comment_build

Suman Tyagi



An Example:

REPORT ZALV_GRID.

TABLES :vbap.
type-pools : slis.
data i_events TYPE slis_t_event.
DATA : my_alv TYPE REF TO cl_gui_alv_grid.
TYPES : BEGIN OF itab,
vbeln LIKE vbap-vbeln,
arktx LIKE vbap-arktx,
END OF itab.
TYPES : itab1 TYPE TABLE OF itab.
DATA : display TYPE itab1.
DATA : fcat TYPE SLIS_T_FIELDCAT_ALV.
DATA : wa LIKE LINE OF FCAT.
DATA WA1 LIKE VBAP.
DATA: container TYPE REF TO cl_gui_custom_container.
data report_id like sy-repid.

SELECT-OPTIONS s_vbeln FOR vbap-vbeln.
report_id = sy-repid.

SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE display WHERE
vbeln IN s_vbeln.

wa-fieldname = 'VBELN'.
wa-tabname = 'VBAP'.
wa-key = 'X'.
WA-HOTSPOT = 'X'.
wa-text_fieldname = 'Doc no.'.
APPEND wa TO fcat.
CLEAR wa.
wa-fieldname = 'ARKTX'.
wa-tabname = 'VBAP'.
wa-text_fieldname = 'Item Text'.
APPEND wa TO fcat.

PERFORM f0650_build_event USING 'USER_COMMAND'
'F0750_USER_COMMAND'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY '
EXPORTING

I_CALLBACK_PROGRAM = report_id

IT_FIELDCAT = FCAT
IT_EVENTS = i_events
TABLES
t_outtab = DISPLAY
.

FORM f0650_build_event USING value(w_c_event_name)
value(w_c_event_form).

DATA: f0650_wa_event TYPE slis_alv_event.

CLEAR f0650_wa_event.
f0650_wa_event-name = w_c_event_name.
f0650_wa_event-form = w_c_event_form.
APPEND f0650_wa_event TO i_events.

ENDFORM.
FORM f0750_user_command USING w_ucomm TYPE sy-ucomm

w_selfield TYPE slis_selfield.

CASE w_ucomm.
WHEN '&IC1'.

READ TABLE DISPLAY INTO WA1 INDEX w_selfield-tabindex.
* MESSAGE E000 WITH
* ' You have no authorization to view the report'.
call transaction 'SE11'.

ENDCASE.
ENDFORM.

*** End of Program

No comments:

Archives