Skip to Content
0
Former Member
May 16, 2007 at 01:33 PM

alv footer

65 Views

i want to to display something at the footer of alv report. how can i do it.. Here is my code:

REPORT zsearch_zvtip LINE-SIZE 423 NO STANDARD PAGE HEADING.

TABLES: zfleet,zpermit.

DATA: BEGIN OF itab_zvtip OCCURS 0,

fleetno LIKE zfleet-fleetno,

intdate1 LIKE zfleet-intdate1,

dname LIKE zfleet-dname,

dsname LIKE zfleet-dsname,

pnum LIKE zfleet-pnum,

zadd1 LIKE zfleet-zadd1,

zadd2 LIKE zfleet-zadd2,

zadd3 LIKE zfleet-zadd3,

name LIKE zfleet-name,

oadd1 LIKE zfleet-oadd1,

oadd2 LIKE zfleet-oadd2,

oadd3 LIKE zfleet-oadd3,

persornaleffect2 LIKE zfleet-persornaleffect2,

iportxt LIKE zfleet-iportxt,

intdate LIKE zfleet-intdate,

zmake LIKE zfleet-zmake,

body LIKE zfleet-body,

chassis_num LIKE zfleet-chassis_num,

license_num LIKE zfleet-license_num,

engine_snr LIKE zfleet-engine_snr,

vtip_officer LIKE zfleet-vtip_officer,

aport LIKE zpermit-aport,

adate LIKE zpermit-adate,

aofc1 LIKE zpermit-aofc1,

END OF itab_zvtip.

TYPE-POOLS:slis.

DATA: BEGIN OF itab1 OCCURS 0,

fleetno LIKE zfleet-fleetno,

intdate1 LIKE zfleet-intdate1,

dname LIKE zfleet-dname,

dsname LIKE zfleet-dsname,

pnum LIKE zfleet-pnum,

zadd1 LIKE zfleet-zadd1,

zadd2 LIKE zfleet-zadd2,

zadd3 LIKE zfleet-zadd3,

name LIKE zfleet-name,

oadd1 LIKE zfleet-oadd1,

oadd2 LIKE zfleet-oadd2,

oadd3 LIKE zfleet-oadd3,

persornaleffect2 LIKE zfleet-persornaleffect2,

iportxt LIKE zfleet-iportxt,

intdate LIKE zfleet-intdate,

zmake LIKE zfleet-zmake,

body LIKE zfleet-body,

chassis_num LIKE zfleet-chassis_num,

license_num LIKE zfleet-license_num,

engine_snr LIKE zfleet-engine_snr,

vtip_officer LIKE zfleet-vtip_officer,

aport LIKE zpermit-aport,

adate LIKE zpermit-adate,

aofc1 LIKE zpermit-aofc1,

END OF itab1.

TYPES: BEGIN OF ty_it_final,

fleetno LIKE zfleet-fleetno,

intdate1 LIKE zfleet-intdate1,

dname LIKE zfleet-dname,

dsname LIKE zfleet-dsname,

pnum LIKE zfleet-pnum,

zadd1 LIKE zfleet-zadd1,

zadd2 LIKE zfleet-zadd2,

zadd3 LIKE zfleet-zadd3,

name LIKE zfleet-name,

oadd1 LIKE zfleet-oadd1,

oadd2 LIKE zfleet-oadd2,

oadd3 LIKE zfleet-oadd3,

persornaleffect2 LIKE zfleet-persornaleffect2,

iportxt LIKE zfleet-iportxt,

intdate LIKE zfleet-intdate,

zmake LIKE zfleet-zmake,

body LIKE zfleet-body,

chassis_num LIKE zfleet-chassis_num,

license_num LIKE zfleet-license_num,

engine_snr LIKE zfleet-engine_snr,

vtip_officer LIKE zfleet-vtip_officer,

aport LIKE zpermit-aport,

adate LIKE zpermit-adate,

aofc1 LIKE zpermit-aofc1,

END OF ty_it_final.

DATA:it_final TYPE TABLE OF ty_it_final WITH HEADER LINE.

DATA:x_fcat TYPE slis_fieldcat_alv,

t_fcat TYPE slis_t_fieldcat_alv.

DATA:

gt_events TYPE slis_t_event,

gt_list_top_of_page TYPE slis_t_listheader,

g_status_set TYPE slis_formname VALUE 'PF_STATUS_SET',

g_user_command TYPE slis_formname VALUE 'USER_COMMAND',

g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE',

g_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST',

g_end_of_list TYPE slis_formname VALUE 'END_OF_LIST'.

DATA : itab_events TYPE slis_t_event WITH HEADER LINE,

it_output LIKE vbak OCCURS 0 WITH HEADER LINE.

DATA:gs_layout TYPE slis_layout_alv,

g_exit_caused_by_caller,

gs_exit_caused_by_user TYPE slis_exit_by_user,

g_repid LIKE sy-repid.

DATA: gs_variant LIKE disvariant,

g_save.

DEFINE build_fieldcat.

clear x_fcat.

x_fcat-tabname = 'IT_FINAL'.

x_fcat-fieldname = &1.

x_fcat-seltext_l = &2.

x_fcat-col_pos = &3.

x_fcat-outputlen = &4.

append x_fcat to t_fcat.

END-OF-DEFINITION.

INITIALIZATION.

g_repid = sy-repid.

PERFORM layout_init USING gs_layout.

PERFORM eventtab_build USING gt_events[].

gs_variant-report = g_repid.

g_save = 'A'.

START-OF-SELECTION.

SELECTION-SCREEN BEGIN OF BLOCK bli WITH FRAME TITLE text-bli.

SELECT-OPTIONS: fleetno FOR zfleet-fleetno,

intdate1 FOR zfleet-intdate1,

dname FOR zfleet-dname,

dsname FOR zfleet-dsname,

pnum FOR zfleet-pnum,

name FOR zfleet-name,

port FOR zfleet-persornaleffect2,

  • iportxt FOR zfleet-iportxt,

intdate FOR zfleet-intdate,

aport FOR zpermit-aport,

adate FOR zpermit-adate,

chassis FOR zfleet-chassis_num,

license FOR zfleet-license_num,

engsnr FOR zfleet-engine_snr.

SELECTION-SCREEN END OF BLOCK bli.

SELECT p~fleetno

p~intdate1

p~dname

p~dsname

p~pnum

p~zadd1

p~zadd2

p~zadd3

p~name

p~oadd1

p~oadd2

p~oadd3

p~persornaleffect2

p~iportxt

p~intdate

p~zmake

p~body

p~chassis_num

p~license_num

p~engine_snr

p~vtip_officer

b~aport

b~adate

b~aofc1

INTO CORRESPONDING FIELDS OF TABLE itab_zvtip

FROM zfleet AS p

INNER JOIN zpermit AS b ON pfleetno = bfleetno

WHERE p~intdate1 IN intdate1

AND p~dname IN dname

AND p~dsname IN dsname

AND p~pnum IN pnum

AND p~name IN name

AND p~persornaleffect2 IN port

  • AND p~iportxt IN iportxt

AND p~intdate IN intdate

AND p~chassis_num IN chassis

AND p~license_num IN license

AND p~engine_snr IN engsnr

AND b~aport in aport

AND b~adate IN adate.

IF sy-subrc NE 0.

WRITE / 'No Information found for the corresponding selection criteria!' COLOR COL_NEGATIVE.

ELSE.

APPEND itab_zvtip.

LOOP AT itab_zvtip WHERE fleetno NE 0.

it_final-fleetno = itab_zvtip-fleetno.

it_final-intdate1 = itab_zvtip-intdate1.

it_final-dname = itab_zvtip-dname.

it_final-dsname = itab_zvtip-dsname.

it_final-pnum = itab_zvtip-pnum.

it_final-zadd1 = itab_zvtip-zadd1.

it_final-zadd2 = itab_zvtip-zadd2.

it_final-zadd3 = itab_zvtip-zadd3.

it_final-name = itab_zvtip-name.

it_final-oadd1 = itab_zvtip-oadd1.

it_final-oadd2 = itab_zvtip-oadd2.

it_final-oadd3 = itab_zvtip-oadd3.

it_final-persornaleffect2 = itab_zvtip-persornaleffect2.

it_final-iportxt = itab_zvtip-iportxt.

it_final-intdate = itab_zvtip-intdate.

it_final-zmake = itab_zvtip-zmake.

it_final-body = itab_zvtip-body.

it_final-chassis_num = itab_zvtip-chassis_num.

it_final-license_num = itab_zvtip-license_num.

it_final-engine_snr = itab_zvtip-engine_snr.

it_final-vtip_officer = itab_zvtip-vtip_officer.

it_final-aport = itab_zvtip-aport.

it_final-adate = itab_zvtip-adate.

it_final-aofc1 = itab_zvtip-aofc1.

APPEND it_final.

HIDE: itab_zvtip-fleetno.

ENDLOOP.

ENDIF.

build_fieldcat:

'FLEETNO' 'Document No.' '1' '12',

'INTDATE1' 'Doc Date' '2' '10',

'DNAME' 'Drivers Firstname' '3' '18',

'DSNAME' 'Drivers Surname' '4' '18',

'PNUM' 'Passport Number' '5' '18',

'ZADD1' 'Street' '6' '20',

'ZADD2' 'Area' '7' '16',

'ZADD3' 'City' '8' '16',

'NAME' 'Owners Name' '9' '25',

'OADD1' 'Owners Street' '10' '20',

'OADD2' 'Owners Area' '11' '20',

'OADD3' 'Owners City' '12' '20',

'PERSORNALEFFECT2' 'Entry Port' '13' '20',

'IPORTXT' 'Intended Exit Port' '14' '20',

'INTDATE' 'Intended Exit Date ' '15' '10',

'ZMAKE' 'Vehicle Make' '16' '18',

'BODY' 'Vehicle Body' '17' '18',

'CHASSIS_NUM' 'Chassis Number' '18' '15',

'LICENSE_NUM' 'Registration No.' '19' '15',

'ENGINE_SNR' 'Engine Number' '20' '15',

'VTIP_OFFICER' 'Officer' '21' '20',

'APORT' 'Port Of Exit' '22' '20',

'ADATE' 'Date Of Exit' '23' '10',

'AOFC1' 'Acquittal Officer' '24' '20'.

*"List Header for Top-Of-Page

PERFORM comment_build USING gt_list_top_of_page[].

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_background_id = 'ALV_BACKGROUND'

i_buffer_active = 'X'

i_callback_program = g_repid

i_callback_user_command = 'FRM_ALV_USER_COMMAND'

it_fieldcat = t_fcat

is_layout = gs_layout

i_save = g_save

is_variant = gs_variant

it_events = gt_events[]

TABLES

t_outtab = it_final.

&----


*& Form EVENTTAB_BUILD

&----


  • text

----


  • -->P_GT_EVENTS[] text

----


FORM eventtab_build USING rt_events TYPE slis_t_event.

.

*"Registration of events to happen during list display

DATA: ls_event TYPE slis_alv_event.

*

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = rt_events.

READ TABLE rt_events WITH KEY name = slis_ev_top_of_page

INTO ls_event.

IF sy-subrc = 0.

MOVE g_top_of_page TO ls_event-form.

APPEND ls_event TO rt_events.

ENDIF.

ENDFORM. " EVENTTAB_BUILD

&----


*& Form TOP_OF_PAGE

&----


  • text

----


FORM top_of_page.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

i_logo = 'LOGO'

it_list_commentary = gt_list_top_of_page.

ENDFORM. "TOP_OF_PAGE

&----


*& Form COMMENT_BUILD

&----


  • text

----


  • -->P_GT_LIST_TOP_OF_PAGE[] text

----


FORM comment_build USING lt_top_of_page TYPE

slis_t_listheader.

DATA: dates(10).

DATA: ls_line TYPE slis_listheader.

CONCATENATE sy-datum6(2) sy-datum4(2) sy-datum(4)

INTO dates.

*

  • LIST HEADING LINE: TYPE H

CLEAR ls_line.

ls_line-typ = 'H'.

  • LS_LINE-KEY: NOT USED FOR THIS TYPE

ls_line-info = text-100.

APPEND ls_line TO lt_top_of_page.

  • STATUS LINE: TYPE S

CLEAR ls_line.

ls_line-typ = 'H'.

  • ls_line-key = text-101.

  • LS_LINE-INFO = TEXT-102.

ls_line-info = text-101.

  • ls_line-info = dates.

APPEND ls_line TO lt_top_of_page.

CLEAR ls_line.

ls_line-typ = 'S'.

ls_line-key = 'Printed As At'.

  • LS_LINE-INFO = TEXT-102.

  • ls_line-info = text-101.

ls_line-info = dates.

APPEND ls_line TO lt_top_of_page.

  • ls_line-key = text-103.

  • ls_line-info = text-104.

  • APPEND ls_line TO lt_top_of_page.

  • ACTION LINE: TYPE A

  • CLEAR ls_line.

  • ls_line-typ = 'A'.

    • LS_LINE-KEY: NOT USED FOR THIS TYPE

  • ls_line-info = text-105.

  • APPEND ls_line TO lt_top_of_page.

  • ENDFORM. " COMMENT_BUILD

    &----


    *& Form LAYOUT_INIT

    &----


    • text

    ----


    • -->P_GS_LAYOUT text

    ----


    FORM layout_init USING rs_layout TYPE slis_layout_alv.

    *"Build layout for list display

    rs_layout-detail_popup = 'X'.

    ENDFORM. " LAYOUT_INIT

    &----


    *& Form frm_alv_user_command

    &----


    • text

    ----


    • -->UCOMM text

    • -->SELFIELD text

    ----


    FORM frm_alv_user_command USING ucomm LIKE sy-ucomm

    selfield TYPE slis_selfield.

    CASE ucomm.

    WHEN '&IC1'.

    IF selfield-tabname = 'IT_FINAL'.

    IF selfield-fieldname = 'RBTNO'.

    READ TABLE it_final INDEX selfield-tabindex.

    IF sy-subrc = 0.

    SET PARAMETER ID 'AUN' FIELD it_final-fleetno.

    ENDIF.

    ENDIF.

    ENDIF.

    ENDCASE.

    ENDFORM. "frm_alv_user_command