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 with Multiple lines of Subtotal Text.

former_member184739
Contributor
0 Kudos

Hello Experts,

I am displaying ALV with Subtotal texts.

How to display 2 lines of Subtotal text in an ALV as shown below?

Thanks

Prabaharan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Prabaharan,

I really doubt if you can achieve this in simple ALV. May be you can use OOPs ALV and have a footer(container split) mentioning these details.

Regards,

DN.

12 REPLIES 12

s_nnoorie
Active Participant
0 Kudos

Hi,

Multiple sub-total are not possible in ALV. atmost try sub-total and Total

Former Member
0 Kudos

Hi Prabaharan,

I really doubt if you can achieve this in simple ALV. May be you can use OOPs ALV and have a footer(container split) mentioning these details.

Regards,

DN.

0 Kudos

HI Deepak,

Thanks for your idea. I will display using FM:"REUSE_ALV_GRID_DISPLAY" and display Total Accural and usage as a footer using event:"END_OF_PAGE".

Thanks

Prabaharan

0 Kudos

Hello All,

I want to display ALV in the format like as shown below.I tried debugging FBL1N and also searched SCN but no luck. Any help would be appreciated.

Example:FBL1N Transaction display's each Vendor and its details in a separate block.

Thanks

Prabaharan

0 Kudos

Hi Asokan,

The ALV you are looking at is a Classival ALV. This output is achieved using WRITE statments.You can achieve this output only by WRITE statements(which i would not suggest). You will have to change the layout and achieve a closer version of the same.

Regards,

DN.

former_member209119
Active Participant
0 Kudos

Hi,

This kind of functionality is not supported by ALV.

You can go to 'Block list display' in ALV, in which you can display 2 saperate tables as per your current requirement.

One for the main data and other for the Accrual and usage.

for block list display, there are 3 functiona modules which you need to use.

REUSE_ALV_BLOCK_LIST_INIT

REUSE_ALV_BLOCK_LIST_APPEND

REUSE_ALV_BLOCK-LIST_DISPLAY

0 Kudos

Hi Anamika,

Two separate tables using the approach you have suggested would change the display required.. But really thanks for your ideas.

Prabaharan

raymond_giuseppi
Active Contributor
0 Kudos

Not a standard function for ALV which generate one subtotal line, except for multiple currency codes or quantity units.

Either you could create two columns Accrual and Usage or you could "play" with unit/currency codes to get 2 subtotals lines and then use OO methods to update subtotals, but that would involve some effort (*).

Regards,

Raymond

(*) Look for method get_subtotals of class cl_gui_alv_grid.

Former Member
0 Kudos

Hi,

Check the below link:

http://scn.sap.com/thread/924966

Hope it serves useful to you.

Thanks

Akankshi

Former Member
0 Kudos

Hello. I think you need two additional columns with text "Accruals" and "Usage". And in alv format you can choose subtotal for this two columns.

As result you will have something like this

If hide technical columns, result is

gurunathkumar_dadamu
Active Contributor
0 Kudos

Hi prabaharan,

please use this code which in the link  http://wiki.sdn.sap.com/wiki/display/ABAP/ALV+Standard+Sum+Total+Or+Subtotal.

if any issue let me know.

Regards,

Gurunath

Former Member
0 Kudos

Hi prabhakaran,

In field catalog structure u have to create two more fields as usage and accrual.

In the function moduile fill i_sort table as

i_sort_line-subtot = 'X'.

i_sort_line-fieldname = 'hour'.

append i_sort_line to i_sort.

pass it to function module reuse_grid_display.

Sample Code:

TYPES : BEGIN OF type_s_sflight,

         carrid TYPE sflight-carrid,

         carrid1 TYPE sflight-carrid,

         connid TYPE sflight-connid,

         connid1 TYPE sflight-connid,

         fldate TYPE sflight-fldate,

         paymentsum TYPE sflight-paymentsum,

         END OF type_s_sflight.

DATA:

   i_sflight TYPE TABLE OF type_s_sflight,

   i_sflight_line TYPE type_s_sflight,

   i_layout TYPE slis_layout_alv,

   t_fcat TYPE slis_t_fieldcat_alv,

   w_fcat TYPE LINE OF slis_t_fieldcat_alv,

   t_sort TYPE slis_t_sortinfo_alv,

   wa_sort TYPE LINE OF slis_t_sortinfo_alv.

SELECT   carrid

          carrid

          connid

          connid

          fldate

          paymentsum

FROM sflight INTO TABLE i_sflight.

IF sy-subrc EQ 0.

   PERFORM display.

ENDIF.

FORM display .

   PERFORM fill_fcat.

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

       is_layout   = i_layout

       it_fieldcat = t_fcat

       it_sort     = t_sort

     TABLES

       t_outtab    = i_sflight.

ENDFORM.                    "display

FORM fill_fcat .

   w_fcat-col_pos = '1'.

   w_fcat-fieldname = 'CARRID'.

   w_fcat-outputlen = '20'.

   w_fcat-no_out = 'X'.

   w_fcat-emphasize = 'C1'.

   APPEND w_fcat TO t_fcat.

   CLEAR w_fcat.

   w_fcat-col_pos = '2'.

   w_fcat-fieldname = 'CONNID'.

   w_fcat-no_out = 'X'.

   w_fcat-outputlen = '20'.

   w_fcat-lzero = 'X'.

   w_fcat-emphasize = 'C1'.

   APPEND w_fcat TO t_fcat.

   CLEAR w_fcat.

   w_fcat-col_pos = '2'.

   w_fcat-fieldname = 'CONNID1'.

   w_fcat-outputlen = '20'.

   w_fcat-lzero = 'X'.

   w_fcat-emphasize = 'C1'.

   APPEND w_fcat TO t_fcat.

   CLEAR w_fcat.

   w_fcat-col_pos = '1'.

   w_fcat-fieldname = 'CARRID1'.

   w_fcat-outputlen = '20'.

   w_fcat-emphasize = 'C1'.

   APPEND w_fcat TO t_fcat.

   CLEAR w_fcat.

   w_fcat-col_pos = '3'.

   w_fcat-fieldname = 'FLDATE'.

   w_fcat-seltext_l = text-025.

   w_fcat-emphasize = 'C1'.

   APPEND w_fcat TO t_fcat.

   CLEAR w_fcat.

   w_fcat-col_pos = '4'.

   w_fcat-fieldname = 'PAYMENTSUM'.

   w_fcat-do_sum = 'X'.

   w_fcat-outputlen = '20'.

   APPEND w_fcat TO t_fcat.

   CLEAR w_fcat.

   wa_sort-spos = '1'.

   wa_sort-fieldname = 'CARRID'.

   wa_sort-up = 'X'.

   wa_sort-subtot = 'X'.

   APPEND wa_sort TO t_sort.

   wa_sort-spos = '2'.

   wa_sort-fieldname = 'CONNID'.

   wa_sort-up = 'X'.

   wa_sort-subtot = 'X'.

   APPEND wa_sort TO t_sort.

ENDFORM.                    " FILL_FCAT