Useful Tips

How do you show subtotal in ALV report?


How do you show subtotal in ALV report?


  1. Create an internal table of type LVC_T_FCAT and mark the option do_sum as ‘X’
  2. Create an internal table of type LVC_T_SORT and mark the option subtot as ‘X’
  3. Pass these internal tables to the method SET_TABLE_FOR_FIRST_DISPLAY.

How do you sum in ALV report?

To sum subtotal, first in FM ‘REUSE_ALV_GIRD_DISPLAY’ or ‘REUSE_ALV_LIST_DISPLAY’, a parameter ‘it_sort’ is used to sort the outputlist. In the structure slis_sortinfo_alv, a field ‘subtot’ is used for this function. When you define sort table, you should point out the fieldname, and give value ‘X’ to ‘subtot’.

How do I display subtotal text in ALV grid?

Display subtotal text in ALV grid

  1. Steps: – Declare the fields twice in the table structure on which subtotal needs to be calculated.
  2. Code:
  3. Selection screen:
  4. Output:

How do I display subtotal and total in smartform?

To get subtotals on each page in smartforms

  1. STEP1. If the requirement is to get subtotal on each page, we can use calculation tab of smartforms which is present on table line as shown in the figure below.
  2. STEP2.
  3. STEP3.
  4. As shown in the figure you can set time in four ways.
  5. STEP4.

How do you display total and subtotal in ALV?

Display Subtotal and Total in ABAP ALV Grid

  1. Build field catalog and set the field DO_SUM of field catalog to ‘X’ for the field for which you want calculate the totals.
  2. Pass field catalog to function module ‘REUSE_ALV_GRID_DISPLAY’.

How do you collapse subtotals in SAP?

To expand or collapse the lines included in a single subtotal, click the expand or collapse icon next to the field being subtotaled. To expand or collapse all subtotals, click the expand/collapse icon in the lower lefthand corner of the total line.

How do you sort ALV in ABAP?


  1. Inorder to SORT the table data,you have to create an internal table of type LVC_T_SORT. LVC_T_SORT is a table type whic has a line type LVC_S_SORT.
  2. You need to create a work area of type LVC_S_SORT.
  3. Populate the internal table using this work area and pass it to the method.

How does Smartforms calculate grand total?

To display the grand total, include a table line into the footer and include a text node into this table line. In the text node, include R_BUSINESS-PRICE and R_BUSINESS-CURRENCY . You can specify whether to display the total at the end of each page (as subtotal) or as a grand total at the end of the table.

How do you add a total in Smartforms?

Go to Form > Global Settings > Global Definitions screen. Click on Global Data tab. Create the following global variables in the Global Data table as follows. ABAP developers will realize that I used a custom type GTY_N10 in the Global Data declarations type.

How do you total in Smartforms?

SAP Smartforms Tutorial – Table Calculations using Sum Total

  2. TYPES : BEGIN OF gty_N10, N10(10) TYPE N, END OF gty_N10.
  3. * Remove preceeding zeros. SHIFT GV_CATEGORYSUBTOTAL-N10 LEFT DELETING LEADING ‘0’.

Why we use type pools Slis?

It is a data dictionary object which contains all the reusable user-defined types. Example for a type group is SLIS , which contains all the user-defined types for developing ALV reports. TYPE-POOLS is a keyword which is used to assign the type-group to a ALV report .

How to display Subtotal and total in ALV?

*Pass data and field catalog to ALV function module to display ALV list CALL FUNCTION ‘REUSE_ALV_GRID_DISPLAY’ EXPORTING it_fieldcat = it_fieldcat TABLES t_outtab = it_sbook EXCEPTIONS program_error = 1 OTHERS = 2. To calculate subtotal in ALV, build sort catalog and set the field SUBTOT of sort catalog to ‘X’. TYPE-POOLS: slis.

How to calculate field totals in ALV grid?

Build field catalog and set the field DO_SUM of field catalog to ‘X’ for the field for which you want calculate the totals. Pass field catalog to function module ‘REUSE_ALV_GRID_DISPLAY’.

Why do I get 3 total lines in ALV?

But anyways, when you have three different currencies you will of cours get three totals. This is handeled by ALV because of your assignment of the value field to the currency field. If you get only 1 total line, then something is wrong.

What does it mean when report has 3 subtotals?

But she also wants Final Total will not be displayed, as it contains total from different currencies. It means she only wants subtotal of different currencies as final total. Like if report has 3 different currencies, then report will have 3 sub-totals as final totals. Please help me. Deepak. Help to improve this question by adding a comment.