Matrix row grand total, column grand total
matrix report layout in sql 2008
report shows column a column b column c total
row 1 4 5
8 17
row 2 3 5
2 10
row 3 2 7
6 15
total 9 17
16 grand total column 42
grand total row 42
How do I define the grand total cells to use column totals or row totals? Not just the sum of field in dataset?
Accounting wants justification that column totals add up to row totals.
Hi JimHoopsDSC,
Based on my understanding, you want to show grand total columns and grand total rows in the report.
For your requirement, you can create a matrix and add total for row groups and column groups. Then you can add an additional row and populate the total value. Please refer to screenshots below:
If you have any question, please feel free to ask.
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support
Similar Messages
-
Matrix Report Row Group Totals
dear experts,
I want to create a matrix report for purchase bills in which each bill may have mutiple items with diffrent rate and vat
i could create the matrix report but the grand total in each purchase master table having column billtotal, vattotal
the report shows one purchase row and vat column are displayed as multiple colums correctly
but grand total of billtotal, vattotal gets added as many times as the items are there in that each bill
any suggestion.
the data from various tables is attached as an xml and crude method i adopted to overcome the set repetation of masters
<PurchaseRrgister>
<y>
<doc_gl>500</doc_gl>
<doc_no>3</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>1835</supplier_billno>
<supplier_billdt>2012-03-31</supplier_billdt>
<amt>28641.6000</amt>
<z>
<suppliername>G.R.CORPORATION</suppliername>
<amount>28080.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>345.60</lstamt>
<w>
<vatname>C.S.T. 2%</vatname>
<syssrl>2</syssrl>
<f>
<glname>CLOTH</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>5</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>71</supplier_billno>
<supplier_billdt>2012-04-17</supplier_billdt>
<amt>30365.2700</amt>
<z>
<suppliername>GIRIRAJ TRADING COMPANY</suppliername>
<amount>28919.3000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>136.00</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
<z>
<suppliername>GIRIRAJ TRADING COMPANY</suppliername>
<amount>28919.3000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>750.00</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>3</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>8</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>2764</supplier_billno>
<supplier_billdt>2012-04-13</supplier_billdt>
<amt>14771.4000</amt>
<z>
<suppliername>FAVOURITE BOOK CLOTH & PAPER MART</suppliername>
<amount>13968.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>98.50</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>CLOTH</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>11</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>176</supplier_billno>
<supplier_billdt>2012-03-22</supplier_billdt>
<amt>61248.0000</amt>
<z>
<suppliername>VIGNESHWAR HOISERY MFG.</suppliername>
<amount>61248.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>0.00</lstamt>
<w>
<vatname>TAX FREE PURCHASE</vatname>
<syssrl>2</syssrl>
<f>
<glname>CLOTH</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>13</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>178</supplier_billno>
<supplier_billdt>2012-03-24</supplier_billdt>
<amt>56448.0000</amt>
<z>
<suppliername>VIGNESHWAR HOISERY MFG.</suppliername>
<amount>56448.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>0.00</lstamt>
<w>
<vatname>TAX FREE PURCHASE</vatname>
<syssrl>2</syssrl>
<f>
<glname>CLOTH</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>15</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>170</supplier_billno>
<supplier_billdt>2012-03-16</supplier_billdt>
<amt>58779.0000</amt>
<z>
<suppliername>VIGNESHWAR HOISERY MFG.</suppliername>
<amount>58779.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>0.00</lstamt>
<w>
<vatname>TAX FREE PURCHASE</vatname>
<syssrl>2</syssrl>
<f>
<glname>CLOTH</glname>
</f>
</w>
<w>
<vatname>TAX FREE PURCHASE</vatname>
<syssrl>3</syssrl>
<f>
<glname>CLOTH</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>21</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>13</supplier_billno>
<supplier_billdt>2012-04-05</supplier_billdt>
<amt>35280.0000</amt>
<z>
<suppliername>ROYALTY MINERALS</suppliername>
<amount>33600.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>520.00</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
<z>
<suppliername>ROYALTY MINERALS</suppliername>
<amount>33600.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>375.00</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>3</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
<z>
<suppliername>ROYALTY MINERALS</suppliername>
<amount>33600.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>275.00</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>4</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>22</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>14</supplier_billno>
<supplier_billdt>2012-04-03</supplier_billdt>
<amt>34102.5300</amt>
<z>
<suppliername>GIRIRAJ TRADING COMPANY</suppliername>
<amount>32478.6000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>1119.93</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
<z>
<suppliername>GIRIRAJ TRADING COMPANY</suppliername>
<amount>32478.6000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>204.00</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>3</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>29</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>2695</supplier_billno>
<supplier_billdt>2012-03-30</supplier_billdt>
<amt>52349.2200</amt>
<z>
<suppliername>VISHVARAJ ENTERPRISES</suppliername>
<amount>45200.8000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>1682.10</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>30</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>2694</supplier_billno>
<supplier_billdt>2012-03-30</supplier_billdt>
<amt>57675.4500</amt>
<z>
<suppliername>VISHVARAJ ENTERPRISES</suppliername>
<amount>49799.6000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>1544.20</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>43</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>2696</supplier_billno>
<supplier_billdt>2012-03-30</supplier_billdt>
<amt>46738.6500</amt>
<z>
<suppliername>VISHVARAJ ENTERPRISES</suppliername>
<amount>40300.3000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>1009.26</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
<z>
<suppliername>VISHVARAJ ENTERPRISES</suppliername>
<amount>40300.3000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>168.54</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>3</syssrl>
<f>
<glname>RAW MATERIAL</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>500</doc_gl>
<doc_no>58</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>44</supplier_billno>
<supplier_billdt>2012-04-11</supplier_billdt>
<amt>1820.2400</amt>
<z>
<suppliername>SAI ENTERPRISES</suppliername>
<amount>1440.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>73.74</lstamt>
<w>
<vatname>MVAT 12.5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>REPAIRS & MAINT - MACHINERY</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>501</doc_gl>
<doc_no>70</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>19601</supplier_billno>
<supplier_billdt>2012-04-23</supplier_billdt>
<amt>18678.9400</amt>
<z>
<suppliername>KISMAT MACHINARY SALES</suppliername>
<amount>16603.5000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>1214.81</lstamt>
<w>
<vatname>MVAT 12.5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>REPAIRS & MAINT - MACHINERY</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>501</doc_gl>
<doc_no>71</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>92</supplier_billno>
<supplier_billdt>2012-04-22</supplier_billdt>
<amt>5400.0000</amt>
<z>
<suppliername>AMIT TOOLS CO.</suppliername>
<amount>4800.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>237.50</lstamt>
<w>
<vatname>MVAT 12.5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>LABORATORY EXPENSES</glname>
</f>
</w>
</z>
</y>
<y>
<doc_gl>501</doc_gl>
<doc_no>75</doc_no>
<doc_dt>2012-04-29</doc_dt>
<supplier_billno>19832</supplier_billno>
<supplier_billdt>2012-04-27</supplier_billdt>
<amt>898.8000</amt>
<z>
<suppliername>STEEL TRADERS|</suppliername>
<amount>856.0000</amount>
<bed_amt>0.0000</bed_amt>
<ecess_amt>0.00</ecess_amt>
<vattotal>0.0000</vattotal>
<misc_charg>0.0000</misc_charg>
<prevatcharges>0.0000</prevatcharges>
<postvatcharges>0.00</postvatcharges>
<packingAmt>0.00</packingAmt>
<lstamt>14.00</lstamt>
<w>
<vatname>MVAT 5%</vatname>
<syssrl>2</syssrl>
<f>
<glname>CONSUMABLE STORES</glname>
</f>
</w>
</z>
</y>
</PurchaseRrgister>Hi Sushil Agarwal,
As per my understanding, you want to create a matrix and use xml as data source for purchase bills, each purchase bill has multiple items with different rate and vat. In order to improve the efficiency of troubleshooting, I need to ask several questions:
Please provide corresponding column name for purchase, rate, billtotal and vattotal.
“but grand total of billtotal, vattotal gets added as many times as the items are there in that each bill” What’s the meaning of this sentence?
What function do you want to achieve? What’s the state of report now? please provide some more detailed information of your requirements. I would be appreciated it if you could provide screenshot of the report in design mode.
This may be a lot of information to ask for at one time. However, by collecting this information now, it will help us move more quickly toward a solution.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
Ordering row wise totals in a column.
Hi,
I have a report in Pivot view having two columns namely Count and Category. I have to apply sort on these two columns-first on Count and then on Category.
The Total Count is also calculated row wise. Now when I apply sort on count column, only the values in that column are being sorted and not according to row wise total count. But my requirement is to sort the total count row wise first and then by Category.I am unable to do so.
Kindly provide me the solution to this problem.
Thanks
AnkitaUse RunningSum() function.
Regards,
Rohit -
Hi,
I would like to access a total(which is a sum of some 25 rows) in another column cell.
How do i do that.
Regards,
Tulsi.Hi Tulsi,
Create variable
=If [Product]InList("A";"B";"C") Then Sum([Amount]+[Amount2]+[Amount3])
or use this formula
= If [Product]=[Product] Then Sum([Amount]+[Amount2]+[Amount3])
Regards
Mustafa -
Add a row after Total row in ALV report
Hi Experts,
I have a report is displayed by ALV format(not use function module to display it but use Class cl_gui_custom_container),I want to add a row after the total row. for example,
Customer amount1 amount2 amount3
10000 1,234 1,000 2,000
10001 4,000 2,000 1,000
10002 1,300 1,000 3,000
11000 1,200 4,000 3,000
Total: 7,734 8,000 9,000
Ratio% 31.27 32.34 36.39
the row of 'Total' is calculated by fieldcat-do_sum = 'X' But after the Total row we need a Ratio row to display the ratio. Yes we can calculate the total amout and ratio and then append it into the output itab, but we don't like this solution.We want to keep the total function in the ALV report.Any experts can poit me a direction. Thanks in advance.
JoeDjoe,
First you need to handle the user command,in order to capture the button action. For this you need to implment a class, i am attaching sample codes here
In top include write the following code
CLASS lcl_event_handler DEFINITION .
PUBLIC SECTION .
METHODS:
handle_toolbar FOR EVENT toolbar " To add new functional buttons to the ALV toolbar
OF cl_gui_alv_grid
IMPORTING e_object,
handle_user_command FOR EVENT user_command " To implement user commands
OF cl_gui_alv_grid
IMPORTING e_ucomm .
PRIVATE SECTION.
ENDCLASS. " Lcl_event_handler DEFINITION
Now <b>Class implementation</b>
CLASS lcl_event_handler IMPLEMENTATION .
METHOD handle_toolbar. " Handle Toolbar
PERFORM f9500_handle_toolbar USING e_object.
ENDMETHOD . " Handle_toolbar
METHOD handle_user_command . " Handle User Command
PERFORM f9600_handle_user_command USING e_ucomm .
ENDMETHOD.
ENDCLASS . " lcl_event_handler IMPLEMENTATION
FORM f9600_handle_user_command USING p_e_ucomm TYPE sy-ucomm.
CONSTANTS:c_newl(4) TYPE c
VALUE 'NEWL', " New line
c_copy(4) TYPE c
VALUE 'COPY', " Copy
c_corr(4) TYPE c
VALUE 'CORR'. " Correction
CASE p_e_ucomm .
WHEN c_newl.
Create a new line
PERFORM f9610_insert_new_line.
ENDFORM. " f9600_handle_user_command
FORM f9610_insert_new_line .
*Data Declarations
DATA: lt_rows TYPE lvc_t_row, " Itab for row property
ls_rows TYPE lvc_s_row, " Work area for row
lv_cntid TYPE i. " Counter
DATA: gv_index TYPE sy-index.
CLEAR gs_last.
CALL METHOD gr_alvgrid->get_selected_rows
IMPORTING
et_index_rows = lt_rows.
READ TABLE lt_rows INTO ls_rows INDEX 1.
IF sy-subrc EQ 0.
gv_index = ls_rows-index + 1.
ELSE.
gv_index = 1.
ENDIF.
DESCRIBE TABLE gt_last LINES lv_cntid.
lv_cntid = lv_cntid + 1.
gs_last-cntid = lv_cntid.
INSERT gs_last INTO gt_last INDEX gv_index.
LOOP AT gt_last INTO gs_last FROM gv_index TO gv_index.
Make the new line editable
PERFORM f9611_style.
ENDLOOP.
CALL METHOD gr_alvgrid->refresh_table_display
EXCEPTIONS
finished = 1
OTHERS = 2.
ENDFORM. " f9610_insert_new_line
You can ask questions doubts if any!
regards
Antony Thomas -
How to get fourthly row (row4) first column value (col1) in matrix
Hi to all,
In FMS, how to get fourthly row (row4) first column value (col1) in matrix in document.
select $[$38.1.4]
But it display the first row
Please give me hint.
Thank youHi Eric,
FMS may only apply to current row. There is no way to get any other fixed row.
Thanks,
Gordon -
How to transpose rows into multiple columns using pivot table
I have 1 row containing 12 columns with value "JAN", "FEB", "MAR", "J-1","F-1","M-1","J-2","F-2","M-2","J-3","F-3","M-3"
I want to display as
JAN J-1 F-1 M-1
FEB J-2 F-2 M-2
MAR J-3 F-3 M-3
How do I achieve the above?Today you have only 3 months JAN, FEB, MAR. Is it always the same number of columns. What if there are more months added to this row?
Is your data really coming from relational source or some sort of text file?
There is a better way to do this in narrative view using HTML if your requirement is just to show them in multiple rows and do some calculations.
Go to Narrative View;
In prefix, use <html> <table>
In 'Narrative' text box add something like this
<tr> <td> @1 </td> <td> @4 </td> <td> @7 </td> </tr>
<tr> <td> @2 </td> <td> @5 </td> <td> @8 </td> </tr>
<tr> <td> @3 </td> <td> @6 </td> <td> @9 </td> </tr>
In Suffix, use </table> </html>
You can also add simple calculations like sum etc at the very bottom of these rows as grand totals.
kris -
I have 105 rows with alternating columns of No. sold
I have 105 rows with alternating columns of No. Sold and Amount Sold, for six different dates. I want the two totals columns on the right to sum every other column for the Total No. Sold and the same but one over for Total Amount Sold. I know how to do this for a single row, as I have done for the last totals row. How could I do the formula for all rows without entering it for each one, or if that is not possible, maybe I could copy the formula in some way to make it easier?
rogerfrombellingham wrote:
... I know how to do this for a single row, as I have done for the last totals row. How could I do the formula for all rows without entering it for each one, or if that is not possible, maybe I could copy the formula in some way to make it easier?
Yes, Roger, you can easily copy those formulas for all the rest of the 105 rows.
Select the two totals cells, click on the little circle in the lower right corner of the selection and drag it to the bottom.
Jerry -
Adding Specific columns of dynamic internal table row into another column
Hi Gurus,
I need to add few columns of a dynamic internal table row into another column:
Article description hy01 hy02 total
101 panza 10 12 22
102 masht 12 12 24
dynamic internal table is created and columns hy01 hy02.... can increase
How to add the the values in hy01 hy 02... into total.
Regards,
DepHi,
If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
Here an example how to generate a dynamic table based on another internal table, hope this will help you.
TYPE-POOLS: slis.
PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
* Type ZST_T:
* matnr TYPE matnr
* maktx TYPE maktx
* hy01 TYPE i
* total TYPE i
TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
PERFORM main.
*& Form main
* text
FORM main.
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_t TYPE ty_t,
lr_new_t TYPE REF TO data.
FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
"Add some lines to LT_T just to have something to display on screen
DO 10 TIMES.
APPEND INITIAL LINE TO lt_t.
ENDDO.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ZST_S'
CHANGING
ct_fieldcat = lt_fieldcat.
"Copy LT_T to LR_NEW_T
PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
CLEAR lt_t. "Not needed anymore...
ASSIGN lr_new_t->* TO <lt_new_t>.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <lt_new_t>.
ENDFORM. "main
*& Form extend_and_copy_table
FORM extend_and_copy_table USING ut_t TYPE STANDARD TABLE
uv_nb_hy TYPE i
CHANGING cr_t TYPE REF TO data
ct_fieldcat TYPE slis_t_fieldcat_alv
RAISING cx_sy_struct_creation cx_sy_table_creation.
DATA: lo_tabledescr TYPE REF TO cl_abap_tabledescr,
lo_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_structdescr TYPE REF TO cl_abap_structdescr,
lo_new_tabledescr TYPE REF TO cl_abap_tabledescr,
lt_components TYPE cl_abap_structdescr=>component_table,
ls_component TYPE cl_abap_structdescr=>component,
lv_field_cnt TYPE numc2,
ls_fieldcat TYPE slis_fieldcat_alv,
lr_fieldcat TYPE REF TO slis_fieldcat_alv.
FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
<lt_new_t> TYPE STANDARD TABLE,
<ls_new_s> TYPE ANY.
"Get the list of all components from UT_T line structure
lo_tabledescr ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
lt_components = lo_structdescr->get_components( ).
"The new columns will be from type of column HY01
ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
"The new columns will have the same fieldcat info as column HY01
READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
"HY<lv_field_cnt> = new field name
lv_field_cnt = uv_nb_hy + 1.
"For each new column...
DO uv_nb_hy TIMES.
"Generate the new column field name
CONCATENATE 'HY' lv_field_cnt INTO ls_component-name.
ls_fieldcat-fieldname = ls_component-name.
"Add the new field to the components of the new structure
INSERT ls_component INTO lt_components INDEX 4.
"Add the new field's fieldcat info to the fieldcat
INSERT ls_fieldcat INTO ct_fieldcat INDEX 4.
lv_field_cnt = lv_field_cnt - 1.
ENDDO.
"Adjust the COL_POS from fieldcat
LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
lr_fieldcat->col_pos = sy-tabix.
ENDLOOP.
"Create the new table
lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
lo_new_tabledescr = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
ASSIGN cr_t->* TO <lt_new_t>.
"Copy all data from old to new table
LOOP AT ut_t ASSIGNING <ls_old_s>.
APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
ENDLOOP.
ENDFORM. "main -
Hi
I have been observing that my matrix row deleted before executing my code for delete the matrix row. I write my code in BeforeAction=False and I use the menu id to delete the row in matrix.
Some code snap
If pval.BeforeAction = False Then
Select Case pval.MenuUID
Case MenuID.Add_Row
BubbleEvent = Me.AddRow
Case MenuID.Delete_Row
BubbleEvent = Me.DeleteRow
Case MenuID.Duplicate_Record
'oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE
End Select
Else
And My Delete Row logic is
Private Function DeleteRow() As Boolean
If iRow <= 0 Then
Return False 'If no row selected
End If
'oSIONMstDtl = oForm.DataSources.DBDataSources.Item("@INCM_SIONDTL")
oExeMatDtl.Clear()
Try
oMatrix = oForm.Items.Item("MtxExeMat").Specific
oMatrix.DeleteRow(iRow)
' oForm.DataSources.DBDataSources.Item("@INCM_SIONDTL").RemoveRecord(iRow)
Catch ex As Exception
MsgBox(ex.Message)
End Try
For i As Integer = oMatrix.RowCount To 1 Step -1
oEdit = oMatrix.Columns.Item("ColSr").Cells.Item(i).Specific
oEdit.Value = i
oMatrix.GetLineData(i)
Next
If oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE Then
oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
End If
Return False
End Function
Edited by: Manmath Das on Feb 10, 2010 1:26 PM
Edited by: Manmath Das on Feb 10, 2010 1:28 PMI use this code in deleting row. and it works fine in all may addon. I use C# in my development.
public virtual void menuevent(string FormUID, ref SAPbouiCOM.MenuEvent pVal, ref bool BubbleEvent)
if (pVal.BeforeAction)
switch (pVal.MenuUID)
case "1293": // deleterow
ondeleterow(is_CurrentMatrixUID, il_CurrentMatrixRow, ref BubbleEvent, false);
break;
public override void ondeleterow(string matrixuid, int row, ref bool BubbleEvent, bool innerevent)
base.ondeleterow(matrixuid, row, ref BubbleEvent, innerevent);
int li_rowcount;
SAPbouiCOM.Matrix oMatrix;
GC.Collect();
oForm.Freeze(true);
oMatrix = (SAPbouiCOM.Matrix)oForm.Items.Item(matrixuid).Specific;
oForm.DataSources.DBDataSources.Item("@FAIAC1").RemoveRecord(row - 1);
oMatrix.DeleteRow(row);
li_rowcount = oMatrix.RowCount;
for (int li_row = 1; li_row <= li_rowcount; li_row++)
setColumnString(matrixuid, "LineId", li_row, li_row.ToString());
oForm.Freeze(false);
BubbleEvent = false;
Hope this will help you.
Regards
John Wilson de los Santos -
Hello,
My form is in ADD Mode and i'm deleting some rows from it thru my code using the following code:
matItems = SBO_Application.Forms.ActiveForm.Items.Item("38").Specific
matItems.DeleteRow(intMatRow)
Now,
This deletes the row at intMatRow, but the matrix row numbers do not reset as they do when we select and delete a row manually.
For. eg.: if there are 3 rows in my matrix and i delete the first row, then the row numbers remain 2 and 3 for the remaining rows.
I want them to change to 1 and 2 as there are only 2 rows now.
Please help me with this.Hi Rohan
try This
in menu event pval before action false
If pVal.MenuUID = "1293" Then
If objForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE Then
For intCurrentRow = 1 To objMatrix.VisualRowCount
objMatrix.Columns.Item("V_-1").Cells.Item(intCurrentRow).Specific.Value = intCurrentRow
Next
End If
End If
in item event for any validation regarding matrix use visualrowcount
ex code:
If objMatrix.Columns.Item(1).Cells.Item(objMatrix.VisualRowCount).Specific.Value = "" Then
Call objMain.objUtilities.MatrixDeleteRow(FormUID, "11", objMatrix.VisualRowCount)
End If
Rgds
Micheal
Edited by: micheal willis on Aug 11, 2009 8:06 PM -
Udo matrix rows saving problem
Hi,
i am creating a form by using UDO form generator.
in that documet and doucument rows are existed. if user select the combobox value from the form, by taking that value and i am generating a query, i am generating a recordset. by using Userdatasources i am binding each column in matrix.
i binded all values to the matrix successfully. but
but when i press Add button, this matrix rows are not getting saved. and also if i have two rows, when i press add, in database only one row is adding with NULL values. how to save that matrix data?
i am sending my code here. plz help me
ds = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
ds.DoQuery("select a.code as Code,b.Itemname as Desc1,a.quantity as Quantity from itt1 a,oitm b where a.code=b.Itemcode and a.code=' " & oComboBox.Selected.Value & ' "")
'User datasources creation
oForm = SBO_Application.Forms.Item("TBL_JOBWORK_")
oUserDataSource = oForm.DataSources.UserDataSources.Add("dsItemcode", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
oUserDataSource = oForm.DataSources.UserDataSources.Add("dsItemdesc", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
oUserDataSource = oForm.DataSources.UserDataSources.Add("dsQuantity", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 40)
ds.MoveFirst()
oForm = SBO_Application.Forms.Item("TBL_JOBWORK_")
oItem = oForm.Items.Item("mtx_0")
oMatrix = oItem.Specific
oColumns = oMatrix.Columns
Dim oColumn1 As SAPbouiCOM.Column
Dim oColumn2 As SAPbouiCOM.Column
Dim oColumn3 As SAPbouiCOM.Column
' Dim oColumn4 As SAPbouiCOM.Column
oColumn1 = oColumns.Item("col_0")
oColumn2 = oColumns.Item("col_1")
oColumn3 = oColumns.Item("col_2")
' oColumn3 = oColumns.Item("col_3")
While Not ds.EoF
oMatrix.FlushToDataSource()
oForm.DataSources.UserDataSources.Item("dsItemcode").Value = ds.Fields.Item("Code").Value
oColumn1.DataBind.SetBound(True, "", "dsItemcode")
oForm.DataSources.UserDataSources.Item("dsItemdesc").Value = ds.Fields.Item("Desc1").Value
oColumn2.DataBind.SetBound(True, "", "dsItemdesc")
oForm.DataSources.UserDataSources.Item("dsquantity").Value = ds.Fields.Item("Quantity").Value
oColumn3.DataBind.SetBound(True, "", "dsQuantity")
oMatrix.AddRow()
ds.MoveNext()
End While
plz help me any suggesions. in that. i want to save that matrix data in to tables. plz help me urgent asap
regards,
nagababu.Hi,
UDOs don't save data from UserDataSources (UDS) (and BTW: your code is wrong: you mustn't bind the UDSs to to columns time after time in the loop; that's just wrong). YOu have to handle such data in your code.
Regards,
Frank -
Another Delete matrix row thread
I have read some threads with Q&A on the delete matrix row subject but I cant make it work properly. Deleted rows have a tendency to return.
I first tried to make my own:
If pVal.MenuUID = "RmLine" And pVal.BeforeAction = True Then
Set oMatrix = m_oForm.Items("MatrixM").Specific
i = 1
While i <= oMatrix.RowCount
If oMatrix.IsRowSelected(i) Then
If oMatrix.RowCount = 1 Then
oMatrix.AddRow
End If
oMatrix.DeleteRow i
m_oForm.DataSources.DBDataSources("@ITCCR_DM").Clear
oMatrix.LoadFromDataSource
m_oForm.Mode = fm_UPDATE_MODE
End If
i = i + 1
Wend
End If
Problem here is that I cant remove last row without having it return right after.(Thats why I tried the addrow)
Then I tried using SAP's function:
m_oForm.EnableMenu "1293", True
But as soon I hit "Update" the row returns so what do I need to add to the menu event to make it work?I use the two following standard methods for add and delete of rows... so far no problems with them (½ a year)
(Please not that I've have wrapped the entire UI for faster use, so not every method in here are core SDK, but hope you get the idea for the approach)
public int Add(B1ItemEvent pVal,B1DBDatasource Dbds, bool SwitchToUpdateMode, string ColumnToSelect) {
InnerMatrix.FlushToDataSource();
if(Dbds.GetValue_String(0,0)!="" || InnerMatrix.RowCount!=0) {
Dbds.InsertRecord(Dbds.Size);
Dbds.SetValue_String(0,Dbds.Size-1,"");
InnerMatrix.LoadFromDataSource();
InnerMatrix.Update();
if(SwitchToUpdateMode) {
if(pVal.IsFormModeOK) {
InnerForm.SwitchToUpdate();
InnerMatrix.Columns[ColumnToSelect].Focus (InnerMatrix.RowCount);
return Dbds.Size-1;
public bool RemoveSelected(B1ItemEvent pVal, B1DBDatasource Dbds, bool SwitchToUpdateMode, string WarningIfNoRowsSelected) {
InnerMatrix.FlushToDataSource();
int row = InnerMatrix.GetNextSelectedRow(0,BoOrderType.ot_RowOrder);
if(row!=-1) {
InnerForm.Freeze(true);
while(row != -1) {
InnerMatrix.DeleteRow(row);
if(InnerMatrix.RowCount==0) {
Dbds.BlankRecord(0);
row = InnerMatrix.GetNextSelectedRow(0,BoOrderType.ot_RowOrder);
InnerForm.Freeze(false);
InnerMatrix.FlushToDataSource();
InnerMatrix.Update();
if(SwitchToUpdateMode) {
if(pVal.IsFormModeOK) {
InnerForm.SwitchToUpdate();
return true;
else {
Notification.Statusbar_Warning (WarningIfNoRowsSelected);
return false; -
How to get multiple records in one row and different column
Hi All,
I am using oracle database 11g
and i have a two tables table_1, table_2
table_1 having columns
emp_no
first_name
middle_name
last_name
email
and table_2 having columns
emp_no
phone_type
phone_number
and having entires
emp_no phone_type phone_number
1001 MOB 9451421452
1001 WEMG 235153654
1001 EMG 652341536
1002 MOB 9987526312
1003 WEMG 5332621456
1004 EMG 59612356
Now i want the output of values with phone type as MOB or WEMG in a single row with different columns
emp_no first_name middle_name last_name email mobile officeno
1001 mark null k [email protected] 9451421452 235153654
1002 john cena gary [email protected] 9987526312 null
1003 dany null craig [email protected] null 5332621456
1004 donald finn sian [email protected] null null
can i have any inputs to achive this???
Regards
$sidFrank Kulash wrote:
sonething like this:Frank, you missed aggregate function (pivot requires one). However main thing is it will cause ORA-01748:
with table_1 as (
select 1001 emp_no,'mark' first_name,null middle_name,'k'last_name,'[email protected]' email from dual union all
select 1002,'john','cena','gary','[email protected]' from dual union all
select 1003,'dany',null,'craig','[email protected] null' from dual union all
select 1004,'donald','finn','sian','[email protected]' from dual
table_2 as (
select 1001 emp_no,'MOB' phone_type,9451421452 phone_number from dual union all
select 1001,'WEMG',235153654 from dual union all
select 1001,'EMG',652341536 from dual union all
select 1002,'MOB',9987526312 from dual union all
select 1003,'WEMG',5332621456 from dual union all
select 1004,'EMG',59612356 from dual
SELECT *
FROM table_1 t1
JOIN table_2 t2 ON t1.emp_no = t2.emp_no
PIVOT ( max(t2.phone_number)
FOR t2.phone_type IN ( 'MOB' AS mob
, 'WEMG' AS wemg
FOR t2.phone_type IN ( 'MOB' AS mob
ERROR at line 19:
ORA-01748: only simple column names allowed hereYou need to:
with table_1 as (
select 1001 emp_no,'mark' first_name,null middle_name,'k' last_name,'[email protected]' email from dual union all
select 1002,'john','cena','gary','[email protected]' from dual union all
select 1003,'dany',null,'craig','[email protected] null' from dual union all
select 1004,'donald','finn','sian','[email protected]' from dual
table_2 as (
select 1001 emp_no,'MOB' phone_type,9451421452 phone_number from dual union all
select 1001,'WEMG',235153654 from dual union all
select 1001,'EMG',652341536 from dual union all
select 1002,'MOB',9987526312 from dual union all
select 1003,'WEMG',5332621456 from dual union all
select 1004,'EMG',59612356 from dual
table_3 as (
select t1.emp_no,first_name,middle_name,last_name,email,
phone_type,phone_number
FROM table_1 t1
LEFT JOIN table_2 t2 ON t1.emp_no = t2.emp_no
SELECT *
FROM table_3
PIVOT ( max(phone_number)
FOR phone_type IN ( 'MOB' AS mob
, 'WEMG' AS wemg
EMP_NO FIRST_ MIDD LAST_ EMAIL MOB WEMG
1004 donald finn sian [email protected]
1003 dany craig [email protected] null 5332621456
1001 mark k [email protected] 9451421452 235153654
1002 john cena gary [email protected] 9987526312
SQL>SY. -
Converting each row in a column to an XML
Hi everyone,
Using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
I have a table where there is a comments column which is VARCHAR2. That column contains string data in the form of XML tags.
Like for eg. *<tag_name attr_name="10"/>* (sorry cant provide the exact values as I'm not allowed to)
There are many such rows. Now I want to use these strings and operate on them as XML like using XPath to find certain attributes etc.
I tried using the extract function and to use it i need a XMLType object. So I tried to create one using the XMLType() constructor.
But it gives me the error ORA-19032: Expected XML tag , got no content
When I looked it up on the net, I found that this error number doesn't correspond to the error message that I'm getting. The error msg found on the internet was Expected XML tag string got string
I used this query
SELECT XMLType (<column>) FROM <table>;But when I modified it (based on someone's hunch) to
SELECT XMLType (<column>)
FROM <table>
WHERE ROWNUM <= 1;The query worked fine. Like it can take only one row.
I also tried like this
SELECT XMLType ('<tag_name attr_name="10"/>')
FROM DUAL;This too worked fine.
So finally this has left me completely confused. Is there a way to convert every row in a column to an XMLType object so that I can use the extract function to gather information about it.
For the time being I have used REGEXes to write the code. But having the flexibility of xml would be better.
Any help would be appreciated.
Regards,
Arijit
Edited by: Arijit Kanrar on May 23, 2013 5:27 AMArijit,
The error message is correct. What you found is merely the generic message with string placeholders.
The error message is also pretty self-explanatory : you can't pass an empty string (NULL) to the XMLType constructor.
SQL> select xmltype('') from dual;
ERROR:
ORA-19032: Expected XML tag , got no content
ORA-06512: at "SYS.XMLTYPE", line 310
ORA-06512: at line 1
no rows selectedYou have to either add a WHERE clause to filter out NULL columns, or use a CASE statement to only convert strings that aren't empty :
SELECT XMLType (<column>)
FROM <table>
WHERE <column> IS NOT NULL ;
SELECT CASE WHEN <column> IS NOT NULL THEN XMLType (<column>) END
FROM ...And do not use EXTRACT if you want to access scalar values, use EXTRACTVALUE instead :
SQL> select extractvalue(xmltype('<tag_name attr_name="10"/>'), '/tag_name/@attr_name') from dual;
EXTRACTVALUE(XMLTYPE('<TAG_NAMEATTR_NAME="10"/>'),'/TAG_NAME/@ATTR_NAME')
10
Maybe you are looking for
-
I just need to know how you get an iTunes library off the original hard drive of an imac and onto an external hard drive and still have it work as it normally would?
-
*****Standby light stays on on one monitor******
I have a dual monitor set up but whe I shut down the standby LED of the additional monitor (both Apple Cinema Display) stays on, Any ideas why?
-
I'm fairly new to video making and have been using iMovie 09. I want to improve my product and am trying to migrate to Final Cut Express. I have done some basic editing in FCE and now want to Print to Video. I don't have a tape deck so I'm using my c
-
How do I get my iPod songs to stay on a RANDOM SHUFFLE AT ALL TIMES??
I know I have done it before. But I just had my iPod Nano replaced and cannot figure out how to shuffle my songs. It used to start ar 1 of # every song but now if I pick the third song on the list it's 3 of # and continues down on the list. The only
-
I have accessed my iTunes account onto my new laptop and have been re-downloading all purchases to my new library. All but one of my movies will not re-download. It was set as a 'hidden purchase' so I then chose to unhide it so I can download it agai