Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How Calculate TOTALS,SUBTOTALS in ALV Reporting?

Answer Posted / gogo

1. You need 2 internal tables: FIELDCATALOG table and SORT table
DATA: gt_fieldcatalog TYPE lvc_t_fcat,
gt_fieldcatalog_sort TYPE lvc_t_sort,
lw_fcat TYPE lvc_s_fcat,
lw_fcat_sort TYPE lvc_s_sort.

2. Fill fieldcatalog table fields
lw_fcat-fieldname = 'YOUR FIELD NAME'.
* Subtotal for this field
lw_fcat-do_sum = 'X'.
APPEND lw_fcat TO gt_fieldcatalog.

3. Fill sort table fields
* Mark the fields that you want to make subtotals after
(e.g. VKORG KUNNR VBELN = keys ; NETWR = sum)
CASE 'YOUR FIELD NAME'.
WHEN 'VKORG' OR 'KUNNR'.
lw_fcat_sort-fieldname = u_fieldname.
lw_fcat_sort-up = 'X'.
lw_fcat_sort-subtot = 'X'.
APPEND lw_fcat_sort TO gt_fieldcatalog_sort.
WHEN OTHERS.
ENDCASE.

Risult
VKORG | KUNNR | VBELN |NETWR
1 a 001 10
1 a 002 20
1 a 003 30
----------------------------
subtotal 1 a 60
----------------------------
1 b 001 5
----------------------------
subtotal 1 b 5
----------------------------

Hope it helps!

Is This Answer Correct ?    25 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

The extract statements in field groups can be used before or after processing the sort statements. State true or false. : abap modularization

982


Did you create any joins?

937


What are field groups?

961


What application areas are you comfortable in?

1298


What are logical databases? What are the advantages of logical databases?

885


What are the different methods of passing data?

1125


Explain about workbench request and customization requests?

1021


Explain how to create any functions?

1053


What is netweaver???what is the relationship with ABAP?

2112


What kind of deliverables you have on a day to day basis?

1355


PROGRAM TO CREATE INQUIRY IN SD USING BAPI 'BAPI_INQUIRY_CREATEFROMDATA'

4184


Explain the call transaction method? : abap bdc

1048


What are the types of search helps? : sap abap data dictionary

1033


what is difference between set screen and call screen ?

980


How does the interface between the dynpro and the abap/4 modules take place?

971