Application Development and Automation 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: 
Read only

ALV - Total text

Former Member
0 Likes
543

hai

i done alv report with total and subtotal , but the text for the total and subtotal

which iam specified in layout are not displayed in a report.

plz help me..

hai

i done alv report with total and subtotal , but the text for the total and subtotal

which iam specified in layout are not displayed in a report.

plz help me..

4 REPLIES 4
Read only

Former Member
0 Likes
512

hi,

&----


*

*& Report Z_REPT_ALV_EX1 *

*& *

&----


*& *

*& *

&----


report ZALV_GEN line-count 36(5)

line-size 225

no standard page heading.

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

  • Report name: Puchase Order Report for ALV practice *

  • Program ID : Z_REPT_ALV_EX1_TG *

  • Author : ADCDEV ( T G Santosh ) *

  • Date : Sep 09, 2004 *

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

*..Type Definitions for ALV Report

type-pools slis.

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

  • Tables Declaration

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

tables : lfa1,

lfb1,

lfm1.

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

  • Data Declaration

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

data : v_lifnr like lfa1-lifnr,

v_bukrs like lfb1-bukrs,

v_ekorg like lfm1-ekorg,

v_ktokk like lfa1-ktokk,

v_repid like sy-repid.

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

  • Internal Tables

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

data : begin of it_details occurs 0,

lifnr like lfa1-lifnr,

bukrs like lfb1-bukrs,

ekorg like lfm1-ekorg,

ktokk like lfa1-ktokk,

name1 like lfa1-name1,

stras like lfa1-stras,

ragio like lfa1-regio,

pfach like lfa1-pfach,

pstl2 like lfa1-pstl2,

pstlz like lfa1-pstlz,

telf1 like lfa1-telf1,

end of it_details.

data: it_fieldcatalog type slis_t_fieldcat_alv,

it_fieldcatalog1 type slis_t_fieldcat_alv,

wa_fieldcatalog type slis_fieldcat_alv,

wa_layout type slis_layout_alv,

it_events type slis_t_event,

wa_events type slis_alv_event,

it_sort type slis_t_sortinfo_alv,

wa_sort type slis_sortinfo_alv occurs 0 with header line.

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

  • Initialization

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

v_repid = sy-repid.

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

  • Selecton Screen

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

selection-screen begin of block blk1 with frame title text-001.

select-options : s_lifnr for lfa1-lifnr,

s_bukrs for lfb1-bukrs,

s_ekorg for lfm1-ekorg,

s_ktokk for lfa1-ktokk.

selection-screen end of block blk1.

selection-screen begin of block blk2 with frame title text-002.

parameter : block radiobutton group g1,

grid radiobutton group g1.

selection-screen end of block blk2.

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

  • At Selecton Screen

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

select single lifnr

from lfa1

into v_lifnr

where lifnr in s_lifnr.

if sy-subrc <> 0.

message i101(zsantosh) with 'v_lifnr' .

  • write : 'not a valid number', v_lifnr.

else.

select single bukrs

from lfb1

into v_bukrs

where bukrs in s_bukrs.

if sy-subrc <> 0.

message i101(zsantosh) with 'Company Code'.

else.

select single ekorg

from lfm1

into v_ekorg

where ekorg in s_ekorg.

if sy-subrc <> 0.

message i101(zsantosh) with 'Purchasing Organisation'.

else.

select single ktokk

from lfa1

into v_ktokk

where ktokk in s_ktokk.

if sy-subrc <> 0.

message i101(zsantosh) with 'Vendor Group'.

endif.

endif.

endif.

endif.

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

  • Start of Selection

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

start-of-selection.

select a1~lifnr

b1~bukrs

m1~ekorg

a1~ktokk

a1~name1

a1~stras

a1~regio

a1~pfach

a1~pstl2

a1~pstlz

a1~telf1

into table it_details

from lfa1 as a1

join lfb1 as b1 on a1lifnr = b1lifnr

join lfm1 as m1 on a1lifnr = m1lifnr

where a1~lifnr in s_lifnr and

b1~bukrs in s_bukrs and

m1~ekorg in s_ekorg and

a1~ktokk in s_ktokk.

clear wa_sort.

wa_sort-spos = 1.

wa_sort-fieldname = 'LIFNR'.

wa_sort-tabname = 'IT_DETAILS'.

wa_sort-up = 'X'.

append wa_sort to it_sort.

clear wa_sort.

wa_sort-spos = 2.

wa_sort-fieldname = 'BUKRS'.

wa_sort-tabname = 'IT_DETAILS'.

wa_sort-up = 'X'.

append wa_sort to it_sort.

clear wa_sort.

wa_sort-spos = 3.

wa_sort-fieldname = 'EKORG'.

wa_sort-tabname = 'IT_DETAILS'.

wa_sort-up = 'X'.

append wa_sort to it_sort.

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

  • End of selection

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

end-of-selection.

perform fill_fieldcat.

loop at it_fieldcatalog into wa_fieldcatalog.

if wa_fieldcatalog-fieldname = 'RAGIO'.

wa_fieldcatalog-intlen = 2.

wa_fieldcatalog-ref_fieldname = ''.

wa_fieldcatalog-ref_tabname = ''.

wa_fieldcatalog-ddic_outputlen = 2.

endif.

wa_fieldcatalog-ref_fieldname = ''.

wa_fieldcatalog-ref_tabname = ''.

modify it_fieldcatalog from wa_fieldcatalog.

endloop.

perform fill_layout.

if block = 'X'.

perform list_block_display.

elseif grid = 'X'.

perform list_grid_display.

endif.

&----


*& Form FILL_FIELDCAT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fill_fieldcat .

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = v_repid

i_internal_tabname = 'IT_DETAILS'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = v_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

changing

ct_fieldcat = it_fieldcatalog

exceptions

inconsistent_interface = 1

program_error = 2

others = 3

.

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. " FILL_FIELDCAT

&----


*& Form FILL_LAYOUT

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form fill_layout .

wa_layout-zebra = 'X'.

wa_layout-totals_text = 'TOTAL'.

wa_layout-colwidth_optimize = 'X'.

endform. " FILL_LAYOUT

&----


*& Form list_block_display

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form list_block_display .

call function 'REUSE_ALV_BLOCK_LIST_INIT'

exporting

i_callback_program = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • IT_EXCLUDING =

.

call function 'REUSE_ALV_BLOCK_LIST_APPEND'

exporting

is_layout = wa_layout

it_fieldcat = it_fieldcatalog

i_tabname = 'IT_DETAILS'

it_events = it_events

it_sort = it_sort

  • I_TEXT = ' '

tables

t_outtab = it_details

exceptions

program_error = 1

maximum_of_appends_reached = 2

others = 3

.

if sy-subrc <> 0.

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

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

endif.

call function 'REUSE_ALV_BLOCK_LIST_DISPLAY'

  • EXPORTING

  • I_INTERFACE_CHECK = ' '

  • IS_PRINT =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

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. " list_block_display

&----


*& Form LIST_GRID_DISPLAY

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form list_grid_display .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = v_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

  • I_CALLBACK_USER_COMMAND = ' '

  • I_CALLBACK_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

  • I_CALLBACK_HTML_END_OF_LIST = ' '

i_structure_name = 'IT_DETAILS'

  • I_BACKGROUND_ID = ' '

i_grid_title = 'DETAILS IN GRID DISPLAY'

  • I_GRID_SETTINGS =

is_layout = wa_layout

it_fieldcat = it_fieldcatalog

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

it_sort = it_sort

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • IS_VARIANT =

  • IT_EVENTS =

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab = it_details

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. " LIST_GRID_DISPLAY

regards,

deepthi reddy

Read only

Former Member
0 Likes
512

hi,

s_layout-TOTALS_TEXT = 'TOTALS:'.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = LV_REPID

IT_FIELDCAT = IT_FLDCAT

IT_EVENTS = IT_EVENTS

is_layout = s_layout

TABLES

T_OUTTAB = IT_INV

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.

regards,

priya.

Read only

Former Member
0 Likes
512

Hi,

i did it like this and it works.

LAYOUT-TOTALS_TEXT = 'Endsumme'.

LAYOUT-SUBTOTALS_TEXT = 'Zwischensumme'.

Do you do the same?

Regards, Dieter

Read only

anversha_s
Active Contributor
0 Likes
512

hi,

in the field catlog..increase the size of outputlength of ur first column in fieldcatlog.

fieldcatalog-outputlen   = 15. "increase this length of the first column in field catlog

ur problem will be solved.

Regards

Anver