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 Display requirement

Former Member
0 Kudos

Hi

In ALV presently I am getting layout as

Kunnr Amount

1000 10

1000 15

1000 05

30 <-- this is total.

Actually I should get it as

Kunnr Amount

1000 10

15

05

30 <-- This is total.

I can not use hirarchical ALV . Suggest me some way.....

4 REPLIES 4

Former Member
0 Kudos

Hi,

do like this

DATA: it_sortcat TYPE TABLE OF slis_sortinfo_alv,

wa_sort TYPE slis_sortinfo_alv.

wa_sort-spos = 1.

wa_sort-fieldname = 'KUNNR'.

APPEND wa_sort TO it_sortcat.

CLEAR wa_sort.

pass it_sortcat to ALV function module

Reward points if it helps,

Satish

Former Member
0 Kudos

Yes you can use it

Totals :

use fieldcatlog

s_fieldcatalog-do_sum = 'X'. -> which gives total

Sub totals :

DATA: s_layout TYPE slis_layout_alv.

s_layout-subtotals_text = 'SUBTOTAL TEXT'.

s_layout-key_hotspot = 'X'.

s_layout-expand_fieldname = 'EXPAND'.

former_member386202
Active Contributor
0 Kudos

Hi,

Sort internal table by KUNNR.

Ex.

&----


*& Form sub_display_data

&----


  • text

----


FORM sub_display_data .

*--To sort the output through material number

DATA : lwa_sort TYPE slis_sortinfo_alv.

DATA : lit_sort TYPE slis_t_sortinfo_alv.

*--Pass the values to the table

lwa_sort-fieldname = 'PERNR'. "Field name in o/p inttable

lwa_sort-tabname = 'it_final2'. "Output Internal table

lwa_sort-spos = '1'. "Sort sequence

lwa_sort-up = 'X'. "Sort in ascending order

lwa_sort-down = ' '. "Sort in descending order

lwa_sort-subtot = 'X'. "Subtotal

APPEND lwa_sort TO lit_sort.

*--Pass the values to the table

lwa_sort-fieldname = 'WORKDATE'. "Field name in o/p inttable

lwa_sort-tabname = 'it_final2'. "Output Internal table

lwa_sort-spos = '2'. "Sort sequence

lwa_sort-up = 'X'. "Sort in ascending order

lwa_sort-down = ' '. "Sort in descending order

lwa_sort-subtot = ' '. "Subtotal

APPEND lwa_sort TO lit_sort.

*--Pass the values to the table

lwa_sort-fieldname = 'WEKLY'. "Field name in o/p inttable

lwa_sort-tabname = 'it_final2'. "Output Internal table

lwa_sort-spos = '3'. "Sort sequence

lwa_sort-up = 'X'. "Sort in ascending order

lwa_sort-down = ' '. "Sort in descending order

lwa_sort-subtot = ' '. "Subtotal

APPEND lwa_sort TO lit_sort.

wa_layout-colwidth_optimize = 'X'.

IF NOT it_final2[] IS INITIAL.

*--Call the function module to display the ALV report

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

is_layout = wa_layout

i_callback_program = v_repid

it_fieldcat = it_fieldcat1[]

i_default = c_chk

i_save = c_save

it_sort = lit_sort

TABLES

t_outtab = it_final2

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.

ELSE.

*--Message No data found

MESSAGE i888 WITH text-017.

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " sub_display_data

Regards,

Prashant

Former Member
0 Kudos

Hi

I think there is some confusion with my question.

In the actual layout I don't want 1000 to get reapeated . But only

the amout valuese should be shown.

I mean that as for as the same KUNNR is there, it shouldn't be displayed and only

amount is shown along with total at the end.

KUNNR AMOUNT

10000 10

-


20

-


30

-


60 <-- this is total

20000 10

-


20

-


30 <-- this is total.