Dynamic table sub total.
Quite new for Jdeveloper11g 1.1.4,
May I konw is there a solution for dynamic table sub total. eg, when i enter a row in a af:table, the sub total will also changed. any sample is welcomed, Thanks!
check example: 64.Recalc Sum of Salary at the View Object Level
in this link:
http://blogs.oracle.com/smuenchadf/examples/
Similar Messages
-
Requirement - I am writing a very large reports from Hyperion Performance Cost management.
Account is in Row. We are taking all level0 members in Row. In columns we are taking Entity,Cost Centers
Current Structure of the Report
41100 Entity1 Cost center1 20
41100 Entity1 Cost center2 30
41100 Entity1 Cost cenetr3 40
41200 Entity 10 Cost center1 200
41200 Entity 10 Cost center2 210
41200 Entity 10 Cost center3 200
Grand Total 1000 ( For Example)
User wants to dynamically add a sub total into the report when account (41200,41100) changes i.e. This is because , its a very large report of 100's of pages,
Future State
41100 Entity1 Cost center1 20
41100 Entity1 Cost center2 30
41100 Entity1 Cost cenetr3 40
sub total 1 --------------------------90 ( This line should be automatically inserted here)
41200 Entity 10 Cost center1 200
41200 Entity 10 Cost center2 210
41200 Entity 10 Cost center3 200
sub total (n) -------------------------610 ( This line should be automatically inserted here)
Grand Total 1000 ( For Example)Hello,
maybe re-consider this approach and say no to the users who request this. Try to think about other solutions.
Sometimes a "no" helps them more than doing what they ask.
You might export the whole in Excel. Then they can make their subtotals at every line.
Regards,
Philip. -
SUB Totals within a Dynamic Data Column
Has anyone ever calculated SUB Totals in a Layout with a Dynamic Data Column?
The TOTAL for all data is expressed on the Data Column tab of the Layout as C(1):C(1) - 0FISCPER / Posting Period is the Dynamic Characteristic. When the system actually displays the 12 columns of data for the Year, the formula for TOTAL is also adjusted - no problem here. But the user also wants SUB Totals, by Quarter, within the Year.
Any insight or suggections are appreciated !
Thanks,
LyleHello,
use variables Q1, ..., Q4 for the quarters and create
data colums as follows
1 Q1 dynamic = X
2 Total C(1)
3 Q2 dynamic = X
4 Total C(3)
5 Q3 dynamic = X
6 Total C(5)
7 Q4 dynamic = X
8 Total C(7)
9 Year Total C(2)C(4)C(6)+C(8)
Regards,
Gregor -
Hello,
I am creating an Adobe form for SD invoices.
I have a table which contains the list of invoice items. I want to calculate a sub total per page in the table footer.
For example :
PAGE 1
Item1 10,00 euros
Item2 10,00 euros
Item3 10,00 euros
Sub total : 30,00 euros
PAGE 2
Item4 10,00 euros
Item5 13,00 euros
Item6 22,00 euros
Item7 14,00 euros
Sub total : 59,00 euros
PAGE 3
Item8 23,00 euros
Item9 55,00 euros
Sub total : 78,00 euros
How can I calculate this ?
I have found this code on SDN but I don't know if it matches with my problem and I don't know how to use it ....Do you have an idea ?
var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var total = 0;
for (var i=0; i <= fields.length-1; i++) {
if (fields.item(i).name == "PRICE") {
total = total + fields.item(i).rawValue;
this.rawValue = total;
Edited by: Laure VERE on Jul 1, 2010 9:11 AMHi ,
Search for the function "sum" in formcalc in the "Adobe Livecycle Designer Help". That will solve your problem.
It is something like
var total = sum( TableName.RowName[*].FieldName[*])
Thanks,
Omkar Mirvankar. -
Sub Total value is empty in parent child hierarchy pivot table
Hi All,
I am using obiee 11.1.1.6.2 in Test environment. Is it a known issue/bug for 11.1.1.6.2 to show empty/blank values for sub total when using parent child hierarchy pivot table. The sub total for parent value is showing but sub total for child value is coming blank. However, in 11.1.1.5.0, we do not have any issue with this.
Is it a known bug in obiee 11.1.1.6.2?
Thanks,
SushilYes it is a known bug...
Thanks. -
I have a dynamic table that calculates the sum of all rows, no issue. I'm struggling with pulling out a subtotal though. I would like to have a check box in each row that flags those rows and gives the sum of their total. Any help would be greatly appreciated.
Here's something I threw together rq. The script is in the change event for the checkbox in the table. (Of course, you'll have to modify it to suit the names of your fields.)
var rows = xfa.resolveNodes("tblAmounts.Row1[*]");
var subtotal=0;
for (i=0; i<rows.length; i++) if (rows.item(i).cbAdd.rawValue == 1) subtotal = subtotal + rows.item(i).nfAmount.rawValue;
nfSubtotal.rawVlaue=subtotal; -
Dynamic TABLE parameter in Sub routine call
Hi,
Is it possible to have a dynamic TABLE parameter in a sub-routine call? The structure of the internal table will be different during different calls to the sub-routine.
I have a subroutine which has the FM "HR_INFOTYPE_OPERATION" to update the infotype data for an Applicant. Now i want to call this subroutine for every Infotype update. So every time the structure of the internal table to be passed will vary depending on Infotype ( eg P0002 for Infotype 0002, p0006 for infotype 0006).
Any pointers will be appreciated.
Thanks in advance.Hi Navin,
yes, why not.
just use a generic type parameter, i.e.
FORM process USING IT_00x type table IV_type typc.
It depend what yout FORM shall do. If you pass the types name, you can dynamically assign to a field-symbol of the respective type.
Regards,
Clemens -
Sum of Values from previous rows in a dynamic table
Hello,
I have a dynamic table has multiple rows (added dynamically via a button). One column in the table is a Quantity column. Another is a Total column. We do not want to keep a running total, but only wish to display a total when the rest of the cells in that row are emty and the previous row(s) has/have values in the Quantity column. The Total is the sum on the Quatnities up to a blank row. Below is a sample. How do I get teh value of the Quantities in the previous rows?
Quantity
Total
5
8
12
25
7
27
34
22
22
Another option might be to put the Total in the last row with data as opposed to the row below the data.
Any ideas?
Regards,
KarlThe script is written to achive your requirement (i.e. the second approach you have mentioned)
You can either contact me at [email protected] to get the sample form created.
Or the following is the XML Source of the form. Copy the entire content in XML source view of your form and see the result.
<?xml version="1.0" encoding="UTF-8"?>
<?xfa generator="AdobeLiveCycleDesignerES_V9.0.0.0.20091029.1.612548" APIVersion="3.1.9277.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/" timeStamp="2012-02-28T14:04:54Z" uuid="2c561cdf-3377-4e84-9a89-51e740bb2fea">
<template xmlns="http://www.xfa.org/schema/xfa-template/2.8/">
<?formServer defaultPDFRenderFormat acrobat9.0dynamic?>
<subform name="form1" layout="tb" locale="en_US" restoreState="auto">
<pageSet>
<pageArea name="Page1" id="Page1">
<contentArea x="0.25in" y="0.25in" w="197.3mm" h="284.3mm"/>
<medium stock="a4" short="210mm" long="297mm"/>
<?templateDesigner expand 1?></pageArea>
<?templateDesigner expand 1?></pageSet>
<subform w="197.3mm" layout="tb">
<subform name="Subform1" w="190.5mm" h="25.4mm">
<field name="Button1" y="15.875mm" x="60.325mm" w="28.575mm" h="6mm">
<ui>
<button highlight="inverted"/>
</ui>
<font typeface="Myriad Pro"/>
<caption>
<value>
<text>Add Row</text>
</value>
<para vAlign="middle" hAlign="center"/>
</caption>
<border hand="right">
<?templateDesigner StyleID apbx2?>
<edge stroke="raised"/>
<fill/>
</border>
<bind match="none"/>
<event activity="click" name="event__click">
<script contentType="application/x-javascript">
try
Subform2.Table1._Row1.addInstance(1);
//for(var i=0;i<Subform2.Table1._Row1.count;i++)
//xfa.resolveNode("Subform2.Table1.Row1["+i+"].Total").execEvent("exit");
}catch(e)
app.alert(e)
</script>
</event>
</field>
<?templateDesigner expand 1?></subform>
<subform name="Subform2" w="196.85mm">
<subform name="Table1" layout="table" columnWidths="55.916mm 44.47mm" x="38.1mm" y="12.7mm">
<border>
<edge/>
</border>
<subform layout="row" name="HeaderRow" id="HeaderRow_ID">
<assist role="TH"/>
<draw h="10mm" name="Cell1">
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<ui>
<textEdit/>
</ui>
<value>
<text>Quantity</text>
</value>
<font typeface="Myriad Pro"/>
<margin topInset="0.5mm" bottomInset="0.5mm" leftInset="0.5mm" rightInset="0.5mm"/>
<para vAlign="middle" hAlign="center"/>
</draw>
<draw h="10mm" name="Cell2">
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<ui>
<textEdit/>
</ui>
<value>
<text>Total</text>
</value>
<font typeface="Myriad Pro"/>
<margin topInset="0.5mm" bottomInset="0.5mm" leftInset="0.5mm" rightInset="0.5mm"/>
<para vAlign="middle" hAlign="center"/>
</draw>
<border>
<edge presence="hidden"/>
</border>
<occur max="-1"/>
<?templateDesigner expand 1?></subform>
<subform layout="row" name="Row1">
<assist role="TR"/>
<field name="Quantity" w="55.916mm" h="9.317mm">
<ui>
<numericEdit>
<border presence="hidden">
<?templateDesigner StyleID aped0?></border>
<margin/>
</numericEdit>
</ui
><
font typeface="Myriad Pro"/><
margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><
para vAlign="middle"/><
border><
edge/><
corner thickness="0.1778mm"/></
border></
field><
field name="Total" w="44.47mm" h="9.317mm" access="readOnly"><
ui><
numericEdit><
border presence="hidden">
<?templateDesigner StyleID aped0?>
</border><
margin/></
numericEdit></
ui><
font typeface="Myriad Pro"/><
margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/><para vAlign="middle"/>
<border>
<edge/>
<corner thickness="0.1778mm"/>
</border>
<calculate>
<script contentType="application/x-javascript">
try
var nextRow = xfa.resolveNode("Subform2.Table1.Row1["+(this.parent.instanceIndex+1)+"]"); // Next row of the table
if((nextRow==null || nextRow.Quantity.rawValue == null || nextRow.Quantity.rawValue=="") && Quantity.rawValue!=null) // If there is no more rows OR the next row don't contain any Quantity value
var subTotal = 0;
for(var j=this.parent.instanceIndex;j>=0;j--) // Loop until the previous row has empty value OR reach start of row Index (i.e. 0)
var prevObj = xfa.resolveNode("Subform2.Table1.Row1["+j+"].Quantity"); // locate the previous row's Quantity object
if(prevObj.rawValue == null || prevObj.rawValue=="")
break; // if blank value found, skip the loop
subTotal+= prevObj.rawValue;
this.rawValue = subTotal; // Update the Total value
}else
this.rawValue = null; // Clear the total value
}catch(e)
app.alert(e)
</script>
</calculate>
</field>
<border>
<edge presence="hidden"/>
</border>
<occur max="-1"/>
<?templateDesigner expand 1?></subform>
<keep intact="contentArea"/>
<?templateDesigner rowpattern first:1, next:1, firstcolor:f0f0f0, nextcolor:ffffff, apply:0?>
<overflow leader="HeaderRow"/>
<?templateDesigner expand 1?></subform>
<?templateDesigner expand 1?></subform>
<?templateDesigner expand 1?></subform>
<proto/>
<desc>
<text name="version">9.0.0.0.20091029.1.612548.606130</text>
</desc>
<?templateDesigner expand 1?></subform>
<?templateDesigner DefaultPreviewDynamic 1?>
<?templateDesigner DefaultRunAt client?>
<?templateDesigner Grid show:1, snap:1, units:0, color:ff8080, origin:(0,0), interval:(125000,125000)?>
<?templateDesigner FormTargetVersion 28?>
<?templateDesigner DefaultLanguage JavaScript?>
<?acrobat JavaScript strictScoping?>
<?templateDesigner Zoom 62?>
<?templateDesigner Rulers horizontal:1, vertical:1, guidelines:1, crosshairs:0?>
<?templateDesigner SaveTaggedPDF 1?>
<?templateDesigner SavePDFWithEmbeddedFonts 1?></template>
<config xmlns="http://www.xfa.org/schema/xci/2.8/">
<agent name="designer">
<!-- [0..n] -->
<destination>pdf</destination>
<pdf>
<!-- [0..n] -->
<fontInfo/>
</pdf>
</agent>
<present>
<!-- [0..n] -->
<pdf>
<!-- [0..n] -->
<fontInfo/>
<version>1.7</version>
<adobeExtensionLevel>3</adobeExtensionLevel>
</pdf>
<xdp>
<packets>*</packets>
</xdp>
</present>
</config>
<localeSet xmlns="http://www.xfa.org/schema/xfa-locale-set/2.7/">
<locale name="en_US" desc="English (United States)">
<calendarSymbols name="gregorian">
<monthNames>
<month>January</month>
<month>February</month>
<month>March</month>
<month>April</month>
<month>May</month>
<month>June</month>
<month>July</month>
<month>August</month>
<month>September</month>
<month>October</month>
<month>November</month>
<month>December</month>
</monthNames>
<monthNames abbr="1">
<month>Jan</month>
<month>Feb</month>
<month>Mar</month>
<month>Apr</month>
<month>May</month>
<month>Jun</month>
<month>Jul</month>
<month>Aug</month>
<month>Sep</month>
<month>Oct</month>
<month>Nov</month>
<month>Dec</month>
</monthNames>
<dayNames>
<day>Sunday</day>
<day>Monday</day>
<day>Tuesday</day>
<day>Wednesday</day>
<day>Thursday</day>
<day>Friday</day>
<day>Saturday</day>
</dayNames>
<dayNames abbr="1">
<day>Sun</day>
<day>Mon</day>
<day>Tue</day>
<day>Wed</day>
<day>Thu</day>
<day>Fri</day>
<day>Sat</day>
</dayNames>
<meridiemNames>
<meridiem>AM</meridiem>
<meridiem>PM</meridiem>
</meridiemNames>
<eraNames>
<era>BC</era>
<era>AD</era>
</eraNames>
</calendarSymbols>
<datePatterns>
<datePattern name="full">EEEE, MMMM D, YYYY</datePattern>
<datePattern name="long">MMMM D, YYYY</datePattern>
<datePattern name="med">MMM D, YYYY</datePattern>
<datePattern name="short">M/D/YY</datePattern>
</datePatterns>
<timePatterns>
<timePattern name="full">h:MM:SS A Z</timePattern>
<timePattern name="long">h:MM:SS A Z</timePattern>
<timePattern name="med">h:MM:SS A</timePattern>
<timePattern name="short">h:MM A</timePattern>
</timePatterns>
<dateTimeSymbols>GyMdkHmsSEDFwWahKzZ</dateTimeSymbols>
<numberPatterns>
<numberPattern name="numeric">z,zz9.zzz</numberPattern>
<numberPattern name="currency">$z,zz9.99|($z,zz9.99)</numberPattern>
<numberPattern name="percent">z,zz9%</numberPattern>
</numberPatterns>
<numberSymbols>
<numberSymbol name="decimal">.</numberSymbol>
<numberSymbol name="grouping">,</numberSymbol>
<numberSymbol name="percent">%</numberSymbol>
<numberSymbol name="minus">-</numberSymbol>
<numberSymbol name="zero">0</numberSymbol>
</numberSymbols>
<currencySymbols>
<currencySymbol name="symbol">$</currencySymbol>
<currencySymbol name="isoname">USD</currencySymbol>
<currencySymbol name="decimal">.</currencySymbol>
</currencySymbols>
<typefaces>
<typeface name="Myriad Pro"/>
<typeface name="Minion Pro"/>
<typeface name="Courier Std"/>
<typeface name="Adobe Pi Std"/>
<typeface name="Adobe Hebrew"/>
<typeface name="Adobe Arabic"/>
<typeface name="Adobe Thai"/>
<typeface name="Kozuka Gothic Pro-VI M"/>
<typeface name="Kozuka Mincho Pro-VI R"/>
<typeface name="Adobe Ming Std L"/>
<typeface name="Adobe Song Std L"/>
<typeface name="Adobe Myungjo Std M"/>
</typefaces>
</locale>
</localeSet>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.398682, 2009/08/10-13:00:47 ">
<
rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><
rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/" rdf:about=""><
xmp:MetadataDate>2012-02-28T14:04:54Z</xmp:MetadataDate><
xmp:CreatorTool>Adobe LiveCycle Designer ES 9.0</xmp:CreatorTool></
rdf:Description><
rdf:Description xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about=""><
pdf:Producer>Adobe LiveCycle Designer ES 9.0</pdf:Producer></
rdf:Description><
rdf:Description xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/" rdf:about=""><
xmpMM:DocumentID>uuid:2c561cdf-3377-4e84-9a89-51e740bb2fea</xmpMM:DocumentID></
rdf:Description><
rdf:Description xmlns:desc="http://ns.adobe.com/xfa/promoted-desc/" rdf:about=""><
desc:version rdf:parseType="Resource"><
rdf:value>9.0.0.0.20091029.1.612548.606130</rdf:value><
desc:ref>/template/subform[1]</desc:ref></
desc:version></
rdf:Description></
rdf:RDF></
x:xmpmeta></xdp:xdp> -
hi,
in alv i want sub total text for purchase order.
can you check my code . i am not getting.
TYPE-POOLS: slis.
TABLES: ekko,ekpo,eket.
TYPES: BEGIN OF ty_ekko,
lifnr TYPE elifn,
ebeln TYPE ebeln,
ebeln1 TYPE ebeln,
bsart TYPE esart,
ekorg TYPE ekorg,
ekgrp TYPE bkgrp,
ernam TYPE ernam,
END OF ty_ekko,
BEGIN OF ty_ekpo,
ebeln TYPE ebeln,
matnr TYPE matnr,
ebelp TYPE ebelp,
ebelp1 TYPE ebelp,
menge TYPE bstmg,
meins TYPE bstme,
netpr TYPE bprei,
werks TYPE ewerk,
END OF ty_ekpo,
BEGIN OF ty_eket,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
etenr TYPE eeten,
eindt TYPE eindt,
END OF ty_eket,
BEGIN OF ty_final,
slno TYPE sy-dbcnt,
lifnr TYPE elifn,
ebeln TYPE ebeln,
ebeln1 TYPE ebeln,
bsart TYPE esart,
ekorg TYPE ekorg,
ekgrp TYPE bkgrp,
ernam TYPE ernam,
matnr TYPE matnr,
ebelp TYPE ebelp,
ebelp1 TYPE ebelp,
menge TYPE bstmg,
meins TYPE bstme,
netpr TYPE bprei,
werks TYPE ewerk,
eindt TYPE eindt,
END OF ty_final.
DATA: it_ekko TYPE STANDARD TABLE OF ty_ekko,
it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
it_eket TYPE STANDARD TABLE OF ty_eket,
it_final TYPE STANDARD TABLE OF ty_final,
it_fieldcat TYPE slis_t_fieldcat_alv,
it_alv_top_of_page TYPE slis_t_listheader,
it_sort TYPE slis_t_sortinfo_alv,
it_event TYPE slis_t_event,
l_repid TYPE syrepid,
slno TYPE i VALUE 1.
DATA: wa_ekko TYPE ty_ekko,
wa_ekpo TYPE ty_ekpo,
wa_eket TYPE ty_eket,
wa_final TYPE ty_final,
wa_fieldcat TYPE slis_fieldcat_alv,
wa_alv_top_of_page TYPE slis_listheader,
wa_sort TYPE slis_sortinfo_alv,
wa_layout TYPE slis_layout_alv.
wa_event TYPE slis_alv_event.
CONSTANTS:
c_header TYPE char1
VALUE 'H', "Header in ALV
c_item TYPE char1
VALUE 'S'.
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_aedat FOR ekko-aedat.
SELECTION-SCREEN END OF BLOCK blk.
START-OF-SELECTION.
PERFORM validation.
PERFORM retrive_data.
PERFORM sub_build_header.
PERFORM sub_field_catalog.
PERFORM sub_populate_layout.
PERFORM sub_populate_sort.
PERFORM sub_get_event.
*END-OF-SELECTION.
Perform to display ALV report
PERFORM sub_alv_report_display.
*FORM validation .
SELECT SINGLE * FROM ekko WHERE aedat IN s_aedat .
IF sy-subrc <> 0.
MESSAGE e001(zram).
ENDIF.
*ENDFORM. " validation
FORM retrive_data .
SELECT lifnr
ebeln
ebeln
bsart
ekorg
ekgrp
ernam FROM ekko INTO TABLE it_ekko
INTO CORRESPONDING FIELDS OF TABLE it_ekko
WHERE aedat IN s_aedat .
IF it_ekko[] IS NOT INITIAL.
SELECT ebeln
ebelp
ebelp
matnr
menge
meins
netpr
werks FROM ekpo
INTO corresponding fields of TABLE it_ekpo
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln .
if sy-subrc = 0.
SELECT ebeln
ebelp
etenr
eindt
FROM eket INTO TABLE it_eket
FOR ALL ENTRIES IN it_ekpo
WHERE ebeln = it_ekpo-ebeln .
endif.
ENDIF.
ENDIF.
LOOP AT it_ekko INTO wa_ekko.
READ TABLE it_ekpo INTO wa_ekpo
WITH KEY ebeln = wa_ekko-ebeln.
READ TABLE it_eket INTO wa_eket
WITH KEY ebeln = wa_ekpo-ebeln.
wa_final-slno = slno.
wa_final-lifnr = wa_ekko-lifnr.
wa_final-ebeln = wa_ekko-ebeln.
wa_final-bsart = wa_ekko-bsart.
wa_final-ekgrp = wa_ekko-ekgrp.
wa_final-ekorg = wa_ekko-ekorg.
wa_final-ernam = wa_ekko-ernam.
wa_final-ebelp = wa_ekpo-ebelp.
wa_final-matnr = wa_ekpo-matnr.
wa_final-menge = wa_ekpo-menge.
wa_final-meins = wa_ekpo-meins.
wa_final-netpr = wa_ekpo-netpr.
wa_final-werks = wa_ekpo-werks.
wa_final-eindt = wa_eket-eindt.
slno = slno + 1.
APPEND wa_final TO it_final.
ENDLOOP.
ENDFORM. " retrive_data
FORM sub_build_header .
Local data declaration
DATA: l_system TYPE char10 , "System id
l_r_line TYPE slis_listheader, "Hold list header
l_date TYPE char10, "Date
l_time TYPE char10, "Time
l_success_records TYPE i, "No of success records
l_title(300) TYPE c. " Title
Title Display
l_r_line-typ = c_header. " header
l_title = 'Test report'(001).
l_r_line-info = l_title.
APPEND l_r_line TO it_alv_top_of_page.
CLEAR l_r_line.
Run date Display
CLEAR l_date.
l_r_line-typ = c_item. " Item
WRITE: sy-datum TO l_date MM/DD/YYYY.
l_r_line-key = 'Run Date :'(002).
l_r_line-info = l_date.
APPEND l_r_line TO it_alv_top_of_page.
CLEAR: l_r_line,
l_date.
ENDFORM. " sub_build_header
FORM sub_field_catalog .
REFRESH it_fieldcat.
wa_fieldcat-row_pos = '01'. " p_rowpos. "Row
wa_fieldcat-col_pos = '01'. "p_colpos. "Column
wa_fieldcat-fieldname = 'SLNO'. "p_fldnam. "Field Name
wa_fieldcat-tabname = 'IT_FINAL'. "p_tabnam. "Internal Table Name
wa_fieldcat-just = ' '. "p_justif. "Screen Justified
wa_fieldcat-seltext_l = 'SLNo'. "p_seltext. "Field Text
wa_fieldcat-do_sum = ' '.
wa_fieldcat-outputlen = '4' .
wa_fieldcat-no_out = ' '. "p_out. "No output
wa_fieldcat-tech = ' '. "p_tech. "Technical field
wa_fieldcat-qfieldname = ' '. "p_qfield. "Quantity unit
wa_fieldcat-qtabname = ' '. "p_qtab . "Quantity table
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = '01'. " p_rowpos. "Row
wa_fieldcat-col_pos = '02'. "p_colpos. "Column
wa_fieldcat-fieldname = 'LIFNR'. "p_fldnam. "Field Name
wa_fieldcat-tabname = 'IT_FINAL'. "p_tabnam. "Internal Table Name
wa_fieldcat-just = ' '. "p_justif. "Screen Justified
wa_fieldcat-seltext_l = 'Supplier Name'. "p_seltext. "Field Text
wa_fieldcat-do_sum = ' '.
wa_fieldcat-outputlen = '12' .
wa_fieldcat-no_out = ' '. "p_out. "No output
wa_fieldcat-tech = ' '. "p_tech. "Technical field
wa_fieldcat-qfieldname = ' '. "p_qfield. "Quantity unit
wa_fieldcat-qtabname = ' '. "p_qtab . "Quantity table
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = '01'. " p_rowpos. "Row
wa_fieldcat-col_pos = '03'. "p_colpos. "Column
wa_fieldcat-fieldname = 'EBELN'. "p_fldnam. "Field Name
wa_fieldcat-tabname = 'IT_FINAL'. "p_tabnam. "Internal Table Name
wa_fieldcat-just = ' '. "p_justif. "Screen Justified
wa_fieldcat-seltext_l = 'PO No'. "p_seltext. "Field Text
wa_fieldcat-do_sum = ' '.
wa_fieldcat-outputlen = '15' .
wa_fieldcat-no_out = ' '. "p_out. "No output
wa_fieldcat-tech = ' '. "p_tech. "Technical field
wa_fieldcat-qfieldname = ' '. "p_qfield. "Quantity unit
wa_fieldcat-qtabname = ' '. "p_qtab . "Quantity table
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-row_pos = '01'. " p_rowpos. "Row
wa_fieldcat-col_pos = '03'. "p_colpos. "Column
wa_fieldcat-fieldname = 'EBELN1'. "p_fldnam. "Field Name
wa_fieldcat-tabname = 'IT_FINAL'. "p_tabnam. "Internal Table Name
wa_fieldcat-just = ' '. "p_justif. "Screen Justified
wa_fieldcat-seltext_l = 'PO No'. "p_seltext. "Field Text
wa_fieldcat-do_sum = ' '.
wa_fieldcat-no_out = ' '. "p_out. "No output
wa_fieldcat-tech = 'X'. "p_tech. "Technical field
wa_fieldcat-qfieldname = ' '. "p_qfield. "Quantity unit
wa_fieldcat-qtabname = ' '. "p_qtab . "Quantity table
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. " sub_field_catalog
FORM sub_populate_layout .
CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'." Optimization of Col width
ENDFORM. " sub_populate_layout
FORM sub_populate_sort .
Sort on material
wa_sort-spos = '01' .
wa_sort-fieldname = 'EBELN'.
wa_sort-tabname = 'IT_FINAL'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
Sort on plant
wa_sort-spos = '02'.
wa_sort-fieldname = 'EBELP'.
wa_sort-tabname = 'IT_FINAL'.
wa_sort-up = 'X'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
ENDFORM. " sub_populate_sort
FORM sub_get_event .
CONSTANTS : c_formname_subtotal_text TYPE slis_formname VALUE
'SUBTOTAL_TEXT'.
data : wa_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = it_event
EXCEPTIONS
list_type_wrong = 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.
Subtotal
READ TABLE it_event INTO wa_event
WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 0.
MOVE c_formname_subtotal_text TO wa_event-form.
MODIFY it_event FROM wa_event INDEX sy-tabix.
ENDIF.
ENDFORM. " sub_get_event
FORM sub_alv_report_display .
l_repid = sy-repid .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = l_repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'SUB_ALV_TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_fieldcat
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = it_sort
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
IS_VARIANT =
IT_EVENTS = i_event
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final
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.
ENDFORM. " sub_alv_report_display
FORM sub_alv_top_of_page. "#EC CALLED
To write header for the ALV
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_alv_top_of_page.
ENDFORM. "alv_top_of_page
FORM subtotal_text CHANGING
p_total TYPE any
p_subtot_text TYPE slis_subtot_text.
Material level sub total
IF p_subtot_text-criteria = 'EBELN'.
p_subtot_text-display_text_for_subtotal
= 'The Nett price of PO No'(009).
ENDIF.
Plant level sub total
IF p_subtot_text-criteria = 'EBELP'.
p_subtot_text-display_text_for_subtotal = 'Total Purchase Order value placed'(010).
ENDIF.
ENDFORM. "subtotal_texthi ,
try the given below code ...
"*************INTERNAL TABLE FR SORTING***********************
DATA: it_sort TYPE slis_t_sortinfo_alv.
"******** WORK AREA FR FIELD CATALOG *************************
DATA: wa_sort TYPE slis_sortinfo_alv.
wa_sort-fieldname = 'EBELN'."field name
wa_sort-tabname = 'IT_TAB'."internal table name
wa_sort-up = 'X'.
wa_sort-subtot ='X'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_sort = it_sort
ENDFORM. "alv
hope this helps
Regards
RItesh J -
hi,
I have a report on ALV with sub totals for some fields, it is working fine but my requirement is whether i can get only the sub totals of that report.
regards,
PrabhuHI
refer this code.
REPORT ZALV.
TYPE-POOLS: SLIS.
DATA: G_REPID LIKE SY-REPID,
GS_PRINT TYPE SLIS_PRINT_ALV,
GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
GT_EVENTS TYPE SLIS_T_EVENT,
GT_SORT TYPE SLIS_T_SORTINFO_ALV,
GS_LAYOUT TYPE SLIS_LAYOUT_ALV,
GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT,
COL_POS TYPE I.
DATA: BEGIN OF ITAB,
FIELD1(5) TYPE C,
FIELD2(5) TYPE C,
FIELD3(5) TYPE P DECIMALS 2,
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB1.
DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
INCLUDE STRUCTURE ITAB.
DATA: END OF ITAB_FIELDCAT.
Print Parameters
PARAMETERS:
P_PRINT AS CHECKBOX DEFAULT ' ', "PRINT IMMEDIATE
P_NOSINF AS CHECKBOX DEFAULT 'X', "NO SELECTION INFO
P_NOCOVE AS CHECKBOX DEFAULT ' ', "NO COVER PAGE
P_NONEWP AS CHECKBOX DEFAULT ' ', "NO NEW PAGE
P_NOLINF AS CHECKBOX DEFAULT 'X', "NO PRINT LIST INFO
P_RESERV TYPE I. "NO OF FOOTER LINE
INITIALIZATION.
G_REPID = SY-REPID.
PERFORM PRINT_BUILD USING GS_PRINT. "Print PARAMETERS
START-OF-SELECTION.
TEST DATA
MOVE 'TEST1' TO ITAB1-FIELD1.
MOVE 'TEST1' TO ITAB1-FIELD2.
MOVE '10.00' TO ITAB1-FIELD3.
APPEND ITAB1.
MOVE 'TEST2' TO ITAB1-FIELD1.
MOVE 'TEST2' TO ITAB1-FIELD2.
MOVE '20.00' TO ITAB1-FIELD3.
APPEND ITAB1.
DO 50 TIMES.
APPEND ITAB1.
ENDDO.
END-OF-SELECTION.
PERFORM BUILD.
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
FORM BUILD.
DATA FIELD CATALOG
Explain Field Description to ALV
DATA: FIELDCAT_IN TYPE SLIS_FIELDCAT_ALV.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD1'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
*FIELDCAT_LN-NO_OUT = 'X'. "FIELD NOT DISPLAY, CHOOSE FROM LAYOUT
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'HEAD1'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD2'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-NO_OUT = 'X'.
FIELDCAT_LN-SELTEXT_L = 'HEAD2'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
CLEAR FIELDCAT_IN.
FIELDCAT_LN-FIELDNAME = 'FIELD3'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-REF_FIELDNAME = 'MENGE'. "<- REF FIELD IN THE DICTIONNARY
FIELDCAT_LN-REF_TABNAME = 'MSEG'. "<- REF TABLE IN THE DICTIONNARY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-DO_SUM = 'X'. "SUM UPON DISPLAY
APPEND FIELDCAT_LN TO GT_FIELDCAT.
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
ENDFORM.
FORM CALL_ALV.
ABAP List Viewer
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = G_REPID
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
I_STRUCTURE_NAME = 'ITAB1'
IS_LAYOUT = GS_LAYOUT
IT_FIELDCAT = GT_FIELDCAT[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT = GT_SORT[]
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS = GT_EVENTS[]
IT_EVENT_EXIT =
IS_PRINT = GS_PRINT
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
T_OUTTAB = ITAB1
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
ENDFORM.
HEADER FORM
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
*GC_FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
define END_OF_PAGE event
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_END_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = 'HEADER 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'S'.
GS_LINE-KEY = 'STATUS 1'.
GS_LINE-INFO = 'INFO 1'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
GS_LINE-KEY = 'STATUS 2'.
GS_LINE-INFO = 'INFO 2'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
CLEAR GS_LINE.
GS_LINE-TYP = 'A'.
GS_LINE-INFO = 'ACTION'.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
WRITE: SY-DATUM, 'Page No', SY-PAGNO LEFT-JUSTIFIED.
ENDFORM.
FORM END_OF_PAGE.
WRITE at (sy-linsz) sy-pagno CENTERED.
ENDFORM.
PRINT SETTINGS
FORM PRINT_BUILD USING LS_PRINT TYPE SLIS_PRINT_ALV.
LS_PRINT-PRINT = P_PRINT. "PRINT IMMEDIATE
LS_PRINT-NO_PRINT_SELINFOS = P_NOSINF. "NO SELECTION INFO
LS_PRINT-NO_COVERPAGE = P_NOCOVE. "NO COVER PAGE
LS_PRINT-NO_NEW_PAGE = P_NONEWP.
LS_PRINT-NO_PRINT_LISTINFOS = P_NOLINF. "NO PRINT LIST INFO
LS_PRINT-RESERVE_LINES = P_RESERV.
ENDFORM.
*END OF ZALV PROGRAM
Reward all helpfull answers.
Regards.
Jay -
Urgent: regarding sub total button in alv report
hi,
i had made dis report and it is is fine till now,but now i want add the sub total field in it ,by making double click on the field sub-total should be displayed in it.
here is d code as i had tried the sub - total but when i execute it is giving some diferrent result.
*& Report ZTET2
REPORT ZTET2.
TABLES: ISEG,MARA.
TYPE-POOLS : SLIS.
DATA : DATE1(15) TYPE C,
DATE2(15) TYPE C,
TITLE(65) TYPE C,
DT(25) TYPE C.
DATA : ITEVENT TYPE SLIS_T_EVENT.
DATA: lv_sort TYPE slis_sortinfo_alv,
t_sort type slis_t_sortinfo_alv.
DATA : repid LIKE sy-repid.
INTERNAL TABLE FOR INVENTORY STOCK *****************
DATA: BEGIN OF ITS1 OCCURS 0,
MATNR LIKE ISEG-MATNR,
ITEMID(6) TYPE C,
MEINS LIKE ISEG-MEINS,
MENGE LIKE ISEG-MENGE,
WRTZL LIKE ISEG-WRTZL,
BUCHM LIKE ISEG-BUCHM,
WRTBM LIKE ISEG-WRTBM,
WERKS LIKE ISEG-WERKS,
BUDAT LIKE ISEG-BUDAT,
ZLDAT LIKE ISEG-ZLDAT,
MTART LIKE MARA-MTART,
ITEMDESC LIKE MAKT-MAKTX,
DIFFQTY LIKE ISEG-BUCHM,
DIFFVALUE LIKE ISEG-WRTBM,
GRUND LIKE ISEG-GRUND,
GRTXT LIKE T157E-GRTXT,
BWART LIKE T157E-BWART,
REAS TYPE C LENGTH 15,
END OF ITS1.
data: t_heading type slis_t_listheader.
SELECTION-SCREEN BEGIN OF BLOCK PAR1 WITH FRAME TITLE TEXT-001.
*SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
*********PARAMETERS*********
PARAMETERS : PLANT LIKE ISEG-WERKS OBLIGATORY.
*********SELECTION SCREEN OPTIONS*********
SELECT-OPTIONS : R_DATE FOR ISEG-BUDAT OBLIGATORY NO-EXTENSION,
M_TYPE FOR MARA-MTART,
IT_M FOR MARA-MATNR.
*********DEFINING VARIABLES*********
SELECTION-SCREEN END OF BLOCK par1.
CONCATENATE R_DATE-LOW6(2) '.' R_DATE-LOW4(2) '.' R_DATE-LOW+0(4) INTO DATE1.
CONCATENATE R_DATE-HIGH6(2) '.' R_DATE-HIGH4(2) '.' R_DATE-HIGH+0(4) INTO DATE2.
TOP-OF-PAGE.
PERFORM PG_HEADER.
START-OF-SELECTION.
SELECT AMATNR AMEINS AMENGE AWRTZL ABUCHM AWRTBM AWERKS ABUDAT AZLDAT BMTART AGRUND CBWART
FROM ISEG AS A INNER JOIN MARA AS B ON BMATNR = AMATNR
INNER JOIN MSEG AS C ON AMBLNR = CMBLNR
INTO CORRESPONDING FIELDS OF TABLE ITS1 WHERE BMATNR = AMATNR AND BMEINS = AMEINS AND AWERKS = PLANT AND ABUDAT IN R_DATE AND BMTART IN M_TYPE AND BMATNR IN IT_M.
LOOP AT ITS1.
ITS1-ITEMID = ITS1-MATNR+12(6).
ITS1-DIFFQTY = ITS1-MENGE - ITS1-BUCHM.
ITS1-DIFFVALUE = ITS1-WRTZL - ITS1-WRTBM.
SELECT SINGLE MAKTX FROM MAKT INTO ITS1-ITEMDESC WHERE MATNR = ITS1-MATNR.
SELECT SINGLE GRTXT INTO ITS1-GRTXT FROM T157E WHERE GRUND = ITS1-GRUND AND SPRAS = 'E' AND BWART = ITS1-BWART.
MODIFY ITS1.
ENDLOOP.
PERFORM PRN_SMSTOCK_ALV.
WRITING DATA FROM D TABLES**********
FORM PG_HEADER.
WRITE : 'PHYSICAL INVENTORY AUDIT REPORT PLANT : ', PLANT.
ENDFORM.
*& Form PRN_SMSTOCK_ALV
text
--> p1 text
<-- p2 text
form PRN_SMSTOCK_ALV .
data: w_title type lvc_title,
w_repid type syrepid,
w_comm type slis_formname,
w_status type slis_formname,
x_layout type slis_layout_alv,
t_event type slis_t_event,
t_fieldcat type slis_t_fieldcat_alv,
t_subtot TYPE slis_t_sortinfo_alv,
subtot LIKE LINE OF t_subtot.
refresh t_fieldcat.
refresh t_event.
refresh t_sort.
clear x_layout.
clear w_title.
perform set_fieldcat2 using:
1 'MTART' 'MTART' 'MARA' '15' space 'MATERIAL TYPE' space space space space space space space space SPACE t_fieldcat 'L' 'L',
2 'ITEMID' 'ITEMID' 'MARA' '7' space 'ITEM ID' space space space space space space space space SPACE t_fieldcat 'R' 'C',
3 'ITEMDESC' 'MAKTX' 'MAKT' '25' space 'MATERIAL DESCRIPTION' space space space space space space space space SPACE t_fieldcat 'L' 'C',
4 'MEINS' 'MEINS' 'MARA' '5' space 'UOM' space space space space space space space space SPACE t_fieldcat 'C' 'C',
5 'MENGE' 'MENGE' 'ISEG' '13' space 'ORG.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
6 'WRTZL' 'WRTZL' 'ISEG' '13' space 'ORG.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
7 'BUCHM' 'BUCHM' 'ISEG' '13' space 'PHY.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
8 'WRTBM' 'WRTBM' 'ISEG' '13' space 'PHY.INV.VALUE' space space space space space space space space SPACE t_fieldcat 'R' 'C',
9 'DIFFQTY' 'MENGE' 'ISEG' '13' space 'DIFF.INV.QTY' space space space space space space space space SPACE t_fieldcat 'R' 'C',
10 'DIFFVALUE' 'WRTZL' 'ISEG' '13' space 'DIFF.INV.VALUE' space space space space space space space space SPACE t_fieldcat SPACE 'P',
11 'BUDAT' 'BUDAT' 'ISEG' '18' space 'CORRECTED DATE' space space space space space space space space SPACE t_fieldcat 'C' 'C',
12 'GRTXT' 'GRTXT' 'ISEG' '18' space 'REASON' space space space space space space space space SPACE t_fieldcat 'L' 'L',
13 'REAS' 'REAS' 'ISEG' '18' space 'AUTH.BY' space space space space space space space space SPACE t_fieldcat 'C' 'C'.
x_layout-zebra = 'X'.
perform set_top_page_heading using t_heading t_event.
perform set_events using t_event.
perform get_subtotals.
w_status = ''.
w_repid = sy-repid.
w_comm = 'USER_COMMAND'.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = w_repid
it_fieldcat = t_fieldcat
i_Callback_top_of_page = 'Top-of-page'
is_layout = x_layout
it_sort = t_sort
i_callback_pf_status_set = w_status
i_callback_user_command = w_comm
i_save = 'X'
it_events = t_event
i_grid_title = w_title
tables
t_outtab = ITS1
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.
ENDFORM.
FORM set_fieldcat2 USING
p_colpos p_fieldname p_ref_fieldname p_ref_tabname
p_outputlen p_noout
p_seltext_m p_seltext_l p_seltext_s p_reptext_ddic p_ddictxt
p_hotspot p_showasicon p_checkbox p_edit
p_dosum
p_subtot
t_fieldcat TYPE slis_t_fieldcat_alv
P_JUST
P_FTYPE.
DATA: wa_fieldcat TYPE slis_fieldcat_alv.
CLEAR wa_fieldcat.
General settings
wa_fieldcat-fieldname = p_fieldname.
wa_fieldcat-col_pos = p_colpos.
wa_fieldcat-no_out = p_noout.
wa_fieldcat-hotspot = p_hotspot.
wa_fieldcat-checkbox = p_checkbox.
wa_fieldcat-icon = p_showasicon.
wa_fieldcat-do_sum = p_dosum.
wa_fieldcat-t_subtot = p_subtot.
Set output length.
IF NOT p_outputlen IS INITIAL.
wa_fieldcat-outputlen = p_outputlen.
ENDIF.
Set text headers.
IF NOT p_seltext_m IS INITIAL.
wa_fieldcat-seltext_m = p_seltext_m.
ENDIF.
IF NOT p_seltext_l IS INITIAL.
wa_fieldcat-seltext_l = p_seltext_l.
ENDIF.
IF NOT p_seltext_s IS INITIAL.
wa_fieldcat-seltext_s = p_seltext_s.
ENDIF.
IF NOT p_reptext_ddic IS INITIAL.
wa_fieldcat-reptext_ddic = p_reptext_ddic.
ENDIF.
IF NOT p_ddictxt IS INITIAL.
wa_fieldcat-ddictxt = p_ddictxt.
ENDIF.
IF NOT P_JUST IS INITIAL.
WA_FIELDCAT-JUST = P_JUST.
ENDIF.
IF NOT p_edit IS INITIAL.
wa_fieldcat-Input = 'X'.
wa_fieldcat-edit = 'X'.
wa_fieldcat-do_sum = 'x'.
wa_fieldcat-p_subtot = 'x'.
ENDIF.
APPEND wa_fieldcat TO t_fieldcat.
ENDFORM. "set_fieldcat2
======================== Subroutines called by ALV ================
*& Form top_of_page
Called on top_of_page ALV event.
Prints the heading.
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_heading.
ENDFORM.
form set_top_page_heading using t_heading type slis_t_listheader
t_events type slis_t_event.
data: x_heading type slis_listheader,
x_event type line of slis_t_event.
Report title
clear t_heading[].
clear x_heading.
x_heading-typ = 'H'.
x_heading-info = 'PHYSICAL INVENTORY AUDIT REPORT'.
append x_heading to t_heading.
Plant Name
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'PLANT : '.
x_heading-info = PLANT.
append x_heading to t_heading.
IF DATE2 = '00.00.0000'.
CONCATENATE DATE1 'to' DATE1 INTO DT SEPARATED BY SPACE.
ELSE.
CONCATENATE DATE1 'to' DATE2 INTO DT SEPARATED BY SPACE.
ENDIF.
X_heading-TYP = 'S'.
X_heading-key = 'PERIOD :'.
X_heading-INFO = DT.
APPEND x_heading TO t_heading.
Control Date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL NO. :'.
x_heading-info = ' ASDFADDFAAS DATE : 11.04.2007'.
append x_heading to t_heading.
Control date
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'CONTROL DATE : '.
x_heading-info = ''.
append x_heading to t_heading.
Time of execution
clear x_heading.
x_heading-typ = 'S'.
x_heading-key = 'DATE : '.
write sy-DATUM to x_heading-info.
append x_heading to t_heading.
Top of page event
x_event-name = slis_ev_top_of_page.
x_event-form = 'TOP_OF_PAGE'.
append x_event to t_events.
endform.
FORM get_subtotals.
CLEAR lv_sort.
lv_sort-fieldname = 'MENGE'.
lv_sort-up = 'X'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
*lv_sort-fieldname = 'MENGE'.
*lv_sort-tabname = 'ITS1'.
*lv_sort-subtot = 'X'.
*APPEND lv_sort TO t_sort.
lv_sort-fieldname = 'WRTZL'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
lv_sort-fieldname = 'BUCHM'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
lv_sort-fieldname = 'WRTBM'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
lv_sort-fieldname = 'DIFFQTY'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
lv_sort-fieldname = 'DIFFVALUE'.
lv_sort-tabname = 'ITS1'.
lv_sort-subtot = 'X'.
APPEND lv_sort TO t_sort.
clear lv_sort.
ENDFORM.
form set_events using t_events type slis_t_event.
data: x_event type line of slis_t_event.
endform.
PLZ HELP ME and definately get rewarded.hi,
how did u declared ur internal table?
Declare a dummy field in your internal table to trigger subtotal text event.
TYPES: BEGIN OF ty_ekpo,
lifnr TYPE ekko-lifnr, "vendor number
ebeln TYPE ekko-ebeln, "purchase document number
ebelp TYPE ekpo-ebelp, "Item Number of Purchasing Document
matnr TYPE ekpo-matnr, "Material Number
bukrs TYPE ekpo-bukrs, "Company Code
werks TYPE ekpo-werks, "Plant
d, "Dummy field to fire the Subtotal text event
END OF ty_ekpo.
Prepare field catalog for that dummyfield also and set attributes like below
wa_fcat-col_pos = 7.
wa_fcat-fieldname = 'D'.
wa_fcat-tabname = 'IT_EKPO'.
wa_fcat-ref_fieldname = 'NETPR'.
wa_fcat-ref_tabname = 'EKPO'.
wa_fcat-no_out = 'X'.
APPEND wa_fcat TO it_fcat.
Fill sortinfo table as follows
wa_sort-spos = 1.
wa_sort-fieldname = 'LIFNR'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = 'X'.
wa_sort-group = 'UL'.
APPEND wa_sort TO it_sort.
CLEAR wa_sort.
wa_sort-spos = 2.
wa_sort-fieldname = 'D'.
wa_sort-tabname = 'IT_EKPO'.
wa_sort-up = 'X'.
wa_sort-group = 'UL'.
wa_sort-subtot = 'X'.
APPEND wa_sort TO it_sort.
fill the event table
wa_event-name = 'SUBTOTAL_TEXT'. "--> this event is used to trigger subtotal text
wa_event-form = 'SUBTOTAL'.
APPEND wa_event TO it_event.
*& Form subtotal
FORM subtotal USING i_listhead STRUCTURE wa_ekpo i_subtotal TYPE slis_subtot_text.
READ TABLE it_sort INTO wa_sort WITH KEY fieldname = 'D'.
IF sy-subrc = 0.
IF i_subtotal-criteria = 'D'.
i_subtotal-display_text_for_subtotal = 'Sub total'.
ENDIF.
ENDIF.
ENDFORM. "subtotal
Thanks & REgards -
Dear experts,
I am working on ALV report. I need to maintain Sub total text but its not working with the below code.
Can you please tell me whats wrong with this code.
FORM f_display_alv_output .
DATA: loc_repid TYPE sy-repid.
CLEAR: loc_repid.
loc_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = loc_repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* i_callback_top_of_page = 'F_ALV_TOP_OF_PAGE'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = fs_layout
it_fieldcat = itab_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = itab_sort
* IT_FILTER =
* IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
* IS_VARIANT =
it_events = itab_events
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab_output
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.
ENDFORM. " F_DISPLAY_ALV_OUTPUT
*& Form F_POPULATE_SORT
* text
* --> p1 text
* <-- p2 text
FORM f_populate_sort .
CLEAR: fs_sort.
REFRESH: itab_sort.
* Sort by Account Manager
fs_sort-spos = '01' .
fs_sort-fieldname = 'ACT_MANAGER'.
fs_sort-tabname = 'ITAB_OUTPUT'.
fs_sort-up = 'X'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO itab_sort .
CLEAR fs_sort.
* Sort by Sales Office
fs_sort-spos = '02' .
fs_sort-fieldname = 'VKBUR'.
fs_sort-tabname = 'ITAB_OUTPUT'.
fs_sort-up = 'X'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO itab_sort .
CLEAR fs_sort.
* Sort by Customer
fs_sort-spos = '03' .
fs_sort-fieldname = 'KUNNR'.
fs_sort-tabname = 'ITAB_OUTPUT'.
fs_sort-up = 'X'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO itab_sort .
CLEAR fs_sort.
* Sort by Material
fs_sort-spos = '04' .
fs_sort-fieldname = 'MATNR'.
fs_sort-tabname = 'ITAB_OUTPUT'.
fs_sort-up = 'X'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO itab_sort .
CLEAR fs_sort.
ENDFORM. " F_POPULATE_SORT
*& Form F_GET_EVENT
* Handle events for the list
* --> p1 text
* <-- p2 text
FORM f_get_event .
REFRESH: itab_events.
CLEAR: fs_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = itab_events
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.
CLEAR: fs_events.
READ TABLE itab_events INTO fs_events WITH KEY name = slis_ev_top_of_page.
IF sy-subrc EQ 0.
MOVE 'F_ALV_TOP_OF_PAGE' TO fs_events-form.
MODIFY itab_events FROM fs_events INDEX sy-tabix.
ENDIF.
CLEAR fs_events.
READ TABLE itab_events INTO fs_events WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 0.
MOVE wl_formname_subtotal_text TO fs_events-form.
MODIFY itab_events FROM fs_events INDEX sy-tabix.
ENDIF.
ENDFORM. " F_GET_EVENT
*& Form SUBTOTAL_TEXT_form
* text
FORM subtotal_text_form USING p_subtot_text TYPE slis_subtot_text.
IF p_subtot_text-criteria = 'ACT_MANAGER'.
p_subtot_text-display_text_for_subtotal = 'Account Manager Level Subtotal'(020).
ENDIF.
ENDFORM. "SUBTOTAL_TEXT
*& Form f_alv_top_of_page
* text
FORM f_alv_top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = itab_top_of_page.
ENDFORM. "F_ALV_TOP_OF_PAGE
Edited by: Rajesh Tummala on Apr 7, 2009 4:16 PMHere's the code below. Sub total text event is not working but top of page is working fine.
*& Form F_POPULATE_SORT
* text
* --> p1 text
* <-- p2 text
FORM f_populate_sort .
CLEAR: fs_sort.
REFRESH: itab_sort.
* Sort by Account Manager
fs_sort-spos = '01' .
fs_sort-fieldname = 'ACT_MANAGER'.
fs_sort-tabname = 'ITAB_OUTPUT'.
fs_sort-up = 'X'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO itab_sort .
CLEAR fs_sort.
* Sort by Sales Office
fs_sort-spos = '02' .
fs_sort-fieldname = 'VKBUR'.
fs_sort-tabname = 'ITAB_OUTPUT'.
fs_sort-up = 'X'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO itab_sort .
CLEAR fs_sort.
* Sort by Customer
fs_sort-spos = '03' .
fs_sort-fieldname = 'KUNNR'.
fs_sort-tabname = 'ITAB_OUTPUT'.
fs_sort-up = 'X'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO itab_sort .
CLEAR fs_sort.
* Sort by Material
fs_sort-spos = '04' .
fs_sort-fieldname = 'MATNR'.
fs_sort-tabname = 'ITAB_OUTPUT'.
fs_sort-up = 'X'.
fs_sort-subtot = 'X'.
APPEND fs_sort TO itab_sort .
CLEAR fs_sort.
ENDFORM. " F_POPULATE_SORT
*& Form F_GET_EVENT
* Handle events for the list
* --> p1 text
* <-- p2 text
FORM f_get_event .
REFRESH: itab_events.
CLEAR: fs_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 4
IMPORTING
et_events = itab_events
EXCEPTIONS
list_type_wrong = 0
OTHERS = 0.
CLEAR: fs_events.
READ TABLE itab_events INTO fs_events WITH KEY name = slis_ev_top_of_page.
IF sy-subrc EQ 0.
MOVE 'F_ALV_TOP_OF_PAGE' TO fs_events-form.
MODIFY itab_events FROM fs_events INDEX sy-tabix.
ENDIF.
CLEAR fs_events.
READ TABLE itab_events INTO fs_events WITH KEY name = slis_ev_subtotal_text.
IF sy-subrc = 0.
MOVE wl_formname_subtotal_text TO fs_events-form.
MODIFY itab_events FROM fs_events INDEX sy-tabix.
ENDIF.
ENDFORM. " F_GET_EVENT
*& Form F_DISPLAY_ALV_OUTPUT
* Display the list output
* --> p1 text
* <-- p2 text
FORM f_display_alv_output .
DATA: loc_repid TYPE sy-repid.
CLEAR: loc_repid.
loc_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = loc_repid
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* i_callback_top_of_page = 'F_ALV_TOP_OF_PAGE'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
is_layout = fs_layout
it_fieldcat = itab_fieldcat
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
it_sort = itab_sort
* IT_FILTER =
* IS_SEL_HIDE =
i_default = 'X'
i_save = 'A'
* IS_VARIANT =
it_events = itab_events
* IT_EVENT_EXIT =
* IS_PRINT =
* IS_REPREP_ID =
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS =
* IT_HYPERLINK =
* IT_ADD_FIELDCAT =
* IT_EXCEPT_QINFO =
* IR_SALV_FULLSCREEN_ADAPTER =
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = itab_output
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.
ENDFORM. " F_DISPLAY_ALV_OUTPUT
*& Form SUBTOTAL_TEXT_form
* text
FORM subtotal_text_form USING p_subtot_text TYPE slis_subtot_text.
IF p_subtot_text-criteria = 'ACT_MANAGER'.
p_subtot_text-display_text_for_subtotal = 'Account Manager Level Subtotal'(020).
ENDIF.
ENDFORM. "SUBTOTAL_TEXT
*& Form f_alv_top_of_page
* text
FORM f_alv_top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = itab_top_of_page.
ENDFORM. "F_ALV_TOP_OF_PAGE -
How to get sub totals in alv list
Hi all,
i have a data in internal table which need to display by alv lis display, but i need to display
sub totals, like sub total by customer, subtotal by state, and complete total amount. In alv we have standard function
buttons , by i need by default it is displayed when i exe my report, hope to achieve that.
Please help me to know.
thanks,
rajeshhi Rajesh,
Check these threads out
http://www.sap-basis-abap.com/sapalv.htm
http://help.sap.com/saphelp_nw04/helpdata/en/ee/b99d37e188a049e10000009b38f8cf/content.htm
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
DATA SORTING AND SUBTOTAL
DATA: GS_SORT TYPE SLIS_SORTINFO_ALV.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD1'.
GS_SORT-SPOS = 1.
GS_SORT-UP = 'X'.
<b>GS_SORT-SUBTOT = 'X'.</b>
APPEND GS_SORT TO GT_SORT.
CLEAR GS_SORT.
GS_SORT-FIELDNAME = 'FIELD2'.
GS_SORT-SPOS = 2.
GS_SORT-UP = 'X'.
*GS_SORT-SUBTOT = 'X'.
APPEND GS_SORT TO GT_SORT.
Regards,
Santosh -
Sum for Dynamic Fields in a Dynamic Table with Field Symbol
Hi All,
I currently have an report which I am looking to update with some totals. The information is currently output in an ALV which is fed data from a dynamic table defined with a field symbol. The modification that needs to be applied is a summation per currency code where each of the fields to be summed is a dynamically named field at runtime. I am now just looking to see if anyone has any recommendations on how to obtain these totals it would be appreciated. I have no problem doing the leg work in piecing the solution together but am just stuck on which approach I should be investigating here. I have looked into several options but do to the fact that the totals are for dynamic fields in a dynamic table and it is a field symbol I am having some difficulties thinking of the easiest approach to obtain these totals.
Below is a simple sample of what the report currently looks like and what we are looking to add.
====================================================================================
As-Is Report:
DETAILED DATA ALV
Company Code | Plant | 2006 Total | 2007 Total | 2008 Total | CURRENCY
0001 | ABCD | 1,500 | 1,200 | 1,700 | USD
0001 | BCDE | 2,300 | 4,100 | 3,600 | GBP
0003 | DBCA | 3,200 | 1,600 | 6,200 | USD
Addition 1:
TOTALS PER CURRENCY
Currency | 2006 Total | 2007 Total | 2008 Total |
USD | 4,700 | 2,800 | 7,900 |
GBP | 2,300 | 4,100 | 3,600 |
Addition 2:
CONVERSIONS TO USD
| 2006 Curr | 2006 USD | 2008 Curr | 2006 USD |
USD | 4,700 USD | 4,700 USD | 7,900 USD | 7,900 USD |
GBP (1.5GBP/1 USD) | 2,300 GBP | 1,150 USD | 2,300 GBP | 1,800 USD |
====================================================================================
Any recommendations will be appreciated.Hi,
We cannot use the key word SUM in the loop at assigning statement.
The way i see is
When you are creating the first dynamic internal table , create one more with the structure below:
Currency | 2006 Total | 2007 Total | 2008 Total |
Then while populating the data into first itab,also move the contents to the second itab using collect statement. -
Hi gurus,
I have a problem, please help me out.
Iam doing an report program with alv display. In that iam calculating the AVG for the workcenter wise for the field TAT.
please observe my below o/p in general ALv format.
work center-- TAT- Tat(Yes/no)
qm0010------ 1 -- yes
qm0010-------2 -- yes
qm0010------ 4 -- yes
qm0010------ 7 -- No (because >5)
Subtotal(qm0010)--3 (avg caluculated)
qm0020-- 4 --- yes
qm0020-7-- No (because >5)
qm0020--10 - No (because >5)
qm002010- No (because >5)
Subtotal(qm0020)-- 7 (avg caluculated).
this is the rough o/p iam getting . this is acheived by programming the Field catalog for TAT field i.e... do_sum = 'C'.
then giving the sort table to REUSE_ALV_GRID_DISPLAY.
Now my problem is:
I want the avg to be calcuted by the business formula which is:
avg = sum of(TAT within 5 days) / total no of the entries .
Ex:
work center-- TAT- Tat(Yes/no)
qm0010------ 1 -- yes
qm0010-------2 -- yes
qm0010------ 4 -- yes
qm0010------ 7 -- No (because >5)
Subtotal(qm0010)---*7/4=2 (avg caluculated for tat<5)*
qm0020-- 4 --- yes
qm0020-7-- No (because >5)
qm0020--10 - No (because >5)
qm002010- No (because >5)
Subtotal(qm0020)--4/4=1 (avg caluculated for tat<5).
How can i acheive the above, since in field catalog and alv, i think we cannot pass any conditions(like for TAT which is less than 5). So is there any other way to acheive the above.
Please understand the problem and give me(please directly dont suggest any programs , since iam not a expert to understand)..
Please explain me in detail. Points will be duly rewarded.
Thanks in advance........Chaitu
Edited by: chaitanya on May 30, 2008 12:33 PM
Edited by: chaitanya on May 30, 2008 12:38 PM
Edited by: chaitanya on May 30, 2008 12:39 PMHi Chaitanya,
You can display in your report with totals and sub-totals using alv, but not average. That functionality has not provided by sap. Do one thing add one more extra column Average in your output, do the calculation for average and pass the value in the coding itself. Then last display your report with Average field.
Rgds,
Bujji
Maybe you are looking for
-
Podcasts simply won't sync correctly between mac
and iPhone 6. They sync randomly. I get old episodes I've already played, and not the new ones I haven't played. I've followed every instruction on the apple support site, and it simply doesn't work. It's very frustrating. So I have to go back to usi
-
Japanese input with non-English keyboard
I installed a brandnew iMac for my wife. She wanted to have the system in Japanese, however the keyboard layout needs to be Swiss German (where we bought the HW). Now - when I use Roman fonts in Text Edit etc with the Swiss Input menu, everything is
-
Oracle RAC requires ODP?
I am starting a new project with the following scenario: .Net 2.0 web application accessing Oracle RAC (64 bits) using Data Access Application Block. I would like to know if it is required to use ODP to access Oracle RAC or Microsoft Oracle Data Prov
-
Connecting multiple CRM systems to one backend R/3 and vice versa
Hello experts Can you tell me whether it is advisable to connect 2 CRM systems to a single backend R/3 and vice versa? Is it recommended by SAP? I require some notes or docs on this. I got some notes on this forum but they are all Internal ones which
-
Content status shows some DP's as unknown
content status shows some DP's as unknown, I checked the DP's and the package was successfully updated and if I drill into view status everything appears correct except the pie chart of my DP's shows most as unknown Rob Szarszewski