09-23-2008 3:50 PM
hii all,
In my alv grid i want to add the cost of materials vendor wise, which should appear as sub total at the end of records of a particular vendor(internal table sorted by vendor).the sum of the material should appear as a sub total.help me in this regards.
with regards,
sandeep akella.
09-23-2008 4:00 PM
Populate the sort table based on vendor , do you have any material count in your display, if so use DO_SUM option.
for the material count use DO_SUM in the fieldcatalog , and for Sort
SORT-FIELDNAME = 'LIFNR'.
sort-up = 'X'.
sort-subtot = 'X'.
append sort to it_sort.
09-23-2008 4:00 PM
Populate the sort table based on vendor , do you have any material count in your display, if so use DO_SUM option.
for the material count use DO_SUM in the fieldcatalog , and for Sort
SORT-FIELDNAME = 'LIFNR'.
sort-up = 'X'.
sort-subtot = 'X'.
append sort to it_sort.
09-23-2008 4:04 PM
hello ,
I didnt excatly get you can you be more detail.I am doing the avl grid using oops.
thanks and regards,
sandeep akella.
Edited by: sandeep akella on Sep 23, 2008 5:05 PM
09-23-2008 4:11 PM
show your internal table defintion. it may be OOALV or Normal ALV the approach is same.
09-23-2008 4:18 PM
hello,
my internal table is of this type
TYPES : BEGIN OF TY_FINAL,
SCNUM TYPE YQPL_SCRREP_M-SCNUM, "Scrap report number
LIFNUM TYPE YQPL_NOTIFADDL-LIFNUM, "Vendor no.
NAME1 TYPE LFA1-NAME1, "Vendor name
IRNUM TYPE YQPL_INSREP_M-IRNUM, "Inspection report No.
MATNR TYPE YQPL_NOTIFADDL-MATNR, "Material no.
MAKTX TYPE MAKT-MAKTX, "Part name
WERKS TYPE YQPL_INSREP_M-WERKS, "Plant
QMNUM TYPE YQPL_NOTIFADDL-QMNUM, "Notification no.
QMDAT TYPE VIQMEL-QMDAT, "Notification date
LTRMN TYPE VIQMEL-LTRMN, "Required end
FEGRP TYPE QMFE-FEGRP, "Defect code grp
ZQREP TYPE YQPL_INSREP_D-ZQREP, "Responsible section(YQPL_NOTIFADDL-ZQREP)
SCPRC TYPE YQPL_SCRREP_M-SCPRC, "Scrap reason code
WOLIQ TYPE YQPL_SCRREP_M-WOLIQ, "Way of liquidation
MGEIN TYPE YQPL_NOTIFADDL-MGEIN, "Unit of Measure
ZSCRQTY TYPE YQPL_NOTIFADDL-ZSCRQTY, "Scrap qty
UNITPR TYPE EKPO-NETPR, "NET PRICE
SCRCOST TYPE EKPO-NETPR, "Scrap cost
STATS TYPE YQPL_INSREP_M-STATS, "Status
APUSR TYPE YQPL_INSREP_M-APUSR, "Action taken by(APUSR/RJUSR - Based on the status)
APDAT TYPE YQPL_INSREP_M-APDAT, "Date & Time(APDAT\APTIM , RJDAT\RJTIM - Based on the status)
APTXT TYPE YQPL_INSREP_M-APTXT, "Status comment(APTXT/RJTXT - Based on the status)
TOT_COST TYPE EKPO-NETPR, "Total Costs
CONS_COST TYPE EKPO-NETPR, "Consolidated Costs
END OF TY_FINAL.
i want the field tot_cost as the subtotal cost for each vendor
cons_cost is the total cost of all materails.
with regards,
sandeep akella.
09-23-2008 4:25 PM
in the fieldcatalog population for the TOTAL_COST field enable the option DO_SUM.
fieldcat-fieldname = 'TOT_COST'.
fieldcat-do_sum = 'X'.
....
..
append fieldcat to it_fieldcat.
if you want the same to cons_cost then check the same.
and For subtotals.
You have to do this..
sort-fieldname = 'LIFNUM'.
sort-up = 'X'.
sort-subtot = 'X'.
append sort to it_sort.
pass this it_sort to the it_sort option of the Set table display method.