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 Block List

Former Member
0 Kudos

Hi,

I have a Block List in which the data is getting printed properly,

At the end of the report standard heading and the column headings are printed again .

please let me know why is it getting printed again.

regards,

sudha

2 REPLIES 2

Former Member
0 Kudos

Can u paste the code,

I guess it displaying properly but the problem may be that the last internal table does not contain any data , thatswhy its displaying just the headings

0 Kudos

hi chandrasekhar,

there is no problem with the data the internal table has the data.

please see the code.

************************************************************************

  • E N D - O F - S E L E C T I O N

************************************************************************

end-of-selection.

if v_error = 'X'.

write:/ v_message.

else.

  • Production report

if p_prod <> space.

perform disp_prod.

endif.

if p_rev <> space.

perform disp_rev.

endif.

if p_gp <> space.

perform disp_gp.

endif.

form disp_prod.

clear : v_report.

v_report = c_1.

  • Sort

perform sort_data using c_tab1.

  • Build catalog

perform build_catalog .

  • Modify catalog

perform modify_catalog.

  • Change layout

perform modify_layout changing v_layout.

  • Build event

perform events.

sort t_prod by udate utime username.

  • Initialize alv block list

if v_start = space.

perform alv_init.

endif.

  • Append Production report

perform append_data .

*----


  • Sort ALV report data

*----


form sort_data using p_tab type any.

refresh t_sort.

v_sort-spos = c_1.

v_sort-fieldname = c_unit.

v_sort-tabname = p_tab.

v_sort-up = c_x.

v_sort-group = '*'.

append v_sort to t_sort.

clear v_sort.

v_sort-spos = c_2.

v_sort-fieldname = c_username. "Username

v_sort-tabname = p_tab.

v_sort-up = c_x.

v_sort-group = '*'.

append v_sort to t_sort.

clear v_sort.

v_sort-spos = c_3.

v_sort-fieldname = c_udate. "Date

v_sort-tabname = p_tab.

v_sort-up = c_x.

append v_sort to t_sort.

v_sort-spos = c_4.

v_sort-fieldname = c_utime. "Time

v_sort-tabname = p_tab.

v_sort-up = c_x.

append v_sort to t_sort.

endform.

*----


  • Build catalog for current

*----


form build_catalog .

case v_report.

  • For Production Report

when c_1.

refresh : t_fldcat1.

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = v_repid

i_internal_tabname = c_tab1

i_inclname = v_inclname

changing

ct_fieldcat = t_fldcat1

exceptions

  • inconsistent_interface = 1

  • program_error = 2

  • OTHERS = 3.

others = 0.

if sy-subrc <> 0.

endif.

*----


  • Modify catalog

*----


form modify_catalog.

clear v_fieldcat.

case v_report.

when c_1.

  • Field catalog for PRoduction report

loop at t_fldcat1 into v_fieldcat.

v_tabix = sy-tabix.

  • Unit.

if v_fieldcat-fieldname = c_unit.

v_fieldcat-col_pos = 0.

v_fieldcat-outputlen = 10.

v_fieldcat-seltext_l = 'UNIT'.

v_fieldcat-seltext_m = 'UNIT'.

v_fieldcat-seltext_s = 'UNIT'.

v_fieldcat-reptext_ddic = 'UNIT'.

  • Date

elseif v_fieldcat-fieldname = c_udate.

v_fieldcat-key = ' '.

v_fieldcat-col_pos = 1.

v_fieldcat-outputlen = 10.

v_fieldcat-seltext_l = 'DATE'(s17).

v_fieldcat-seltext_m = 'DATE'(s17).

v_fieldcat-seltext_s = 'DATE'(s17).

v_fieldcat-reptext_ddic = 'DATE'(s17).

  • Time

elseif v_fieldcat-fieldname = c_utime.

v_fieldcat-key = ' '.

v_fieldcat-col_pos = 2.

v_fieldcat-outputlen = 10.

v_fieldcat-seltext_l = 'TIME'(s18).

v_fieldcat-seltext_m = 'TIME'(s18).

v_fieldcat-seltext_s = 'TIME'(s18).

v_fieldcat-reptext_ddic = 'TIME'(s18).

  • Username

elseif v_fieldcat-fieldname = c_username.

v_fieldcat-key = ' '.

v_fieldcat-col_pos = 3.

v_fieldcat-outputlen = 12.

v_fieldcat-seltext_l = 'USER ID'(s19).

v_fieldcat-seltext_m = 'USER ID'(s19).

v_fieldcat-seltext_s = 'USER ID'(s19).

v_fieldcat-reptext_ddic = 'USER ID'(s19).

  • Delivery netwrok #

elseif v_fieldcat-fieldname = c_dn_no.

v_fieldcat-key = ' '.

v_fieldcat-col_pos = 4.

v_fieldcat-outputlen = 20.

v_fieldcat-seltext_l = 'DN #'(s20).

v_fieldcat-seltext_m = 'DN #'(s20).

v_fieldcat-seltext_s = 'DN #'(s20).

v_fieldcat-reptext_ddic = 'DN #'(s20).

  • Transaction code

  • ELSEIF v_fieldcat-fieldname = c_tcode.

elseif v_fieldcat-fieldname = c_tcodx. "shorter version

v_fieldcat-key = ' '.

v_fieldcat-col_pos = 5.

v_fieldcat-outputlen = 16.

v_fieldcat-seltext_l = 'TRANSACTION CODE'(s21).

v_fieldcat-seltext_m = 'TRANSACTION CODE'(s21).

v_fieldcat-seltext_s = 'TRANSACTION CODE'(s21).

v_fieldcat-reptext_ddic = 'TRANSACTION CODE'(s21).

  • Field name - medium

elseif v_fieldcat-fieldname = c_scrtext_m.

v_fieldcat-key = ' '.

v_fieldcat-col_pos = 6.

v_fieldcat-outputlen = 20.

v_fieldcat-seltext_l = 'FIELD NAME'(s22).

v_fieldcat-seltext_m = 'FIELD NAME'(s22).

v_fieldcat-seltext_s = 'FIELD NAME'(s22).

v_fieldcat-reptext_ddic = 'FIELD NAME'(s22).

  • Value old

elseif v_fieldcat-fieldname = c_old.

v_fieldcat-key = ' '.

v_fieldcat-col_pos = 7.

v_fieldcat-outputlen = 40.

v_fieldcat-seltext_l = 'OLD VALUE'(s23).

v_fieldcat-seltext_m = 'OLD VALUE'(s23).

v_fieldcat-seltext_s = 'OLD VALUE'(s23).

v_fieldcat-reptext_ddic = 'OLD VALUE'(s23).

  • value new

elseif v_fieldcat-fieldname = c_new.

v_fieldcat-key = ' '.

v_fieldcat-col_pos = 8.

v_fieldcat-outputlen = 40.

v_fieldcat-seltext_l = 'NEW VALUE'(s24).

v_fieldcat-seltext_m = 'NEW VALUE'(s24).

v_fieldcat-seltext_s = 'NEW VALUE'(s24).

v_fieldcat-reptext_ddic = 'NEW VALUE'(s24).

endif.

modify t_fldcat1 from v_fieldcat index v_tabix.

clear v_fieldcat.

endloop.

form events.

data :l_events type slis_alv_event. " Structure for ALV Event

case v_report.

  • Top of page event for Production report

when c_1.

refresh t_events1.

l_events-name = slis_ev_top_of_page.

l_events-form = c_top_of_page_1.

append l_events to t_events1.

clear l_events.

form events.

data :l_events type slis_alv_event. " Structure for ALV Event

case v_report.

  • Top of page event for Production report

when c_1.

refresh t_events1.

l_events-name = slis_ev_top_of_page.

l_events-form = c_top_of_page_1.

append l_events to t_events1.

clear l_events.

form events.

data :l_events type slis_alv_event. " Structure for ALV Event

case v_report.

  • Top of page event for Production report

when c_1.

refresh t_events1.

l_events-name = slis_ev_top_of_page.

l_events-form = c_top_of_page_1.

append l_events to t_events1.

clear l_events.

  • Initialize alv block list

if v_start = space.

perform alv_init.

endif.

  • Append Production report

perform append_data .

*Print AVL list

if v_start = c_x.

perform print_alv.

endif.

endif.

regards,

sudha