on 2011 Aug 25 6:17 AM
Hi All,
i have used sort event in my smartform and found the subtotal of my line item,wat i need now is to obtain the subtotal of a character variabe,ie., in my sub-group line item i have variable values like
line item-1 name= ram
line item-2 name = richard
line item-3 name = khan
after the event i need t subtotal of the above as ram,richard,khan separated by comma. How to obtain this????
Edited by: Suhas Saha on Aug 25, 2011 12:52 PM
Hi,
For that table in DATA maintain the field name 'NAME' in Sort and activate start and end of control by checking the check boxes. Now declare variable for sum and total. Now for every Start clear the sum variable and create program line to add values. And at the end concatenate the sum to total. So at the end you will get all the values in total.
Edited by: 118775 on Aug 25, 2011 7:53 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
dear freind,
i have sorted accordintg to my matnr field
Matnr = 001 Name = ram.
matnr = 001 Name = richard
matnr = 001 Name = khan
_________________________________________
i want subtotal of Name = ram,richard,khan
___________________________________________
Matnr = 002 Name = rani.
matnr = 002 Name = richy
matnr = 002 Name = kunthee
_________________________________________
i want subtotal of Name = rani,richy,kunthee
___________________________________________
Hi,
Yes so create one variable say 'TOTAL' type string in global declaration.
Now While displaying the table in DATA tab maintain fieldname in sort as 'MATNR' click on both the checkboxes which will enables 2 new folder/events in table. Now for these events create program lines. In first program line for start of new matnr clear the total. At in the event at end of matnr create text and display this variable 'TOTAL.
Now in between create a program line in table and write concatenate total wa_tab-name into total separated by ','.
It will solve your problem.
Edited by: 118775 on Aug 25, 2011 11:28 AM
Hi Raghav,
Use Events and tick event on sort END and give MATNR as field to be sorted on.
Right Click on event and create > Table Line and select line type used for MAIN AREA.
if you names:
Under table line create Program lines and in that write code and fetch names for that MATNR.
Next under Program lines create text node and display the names using below syntax:
CONCATENATE LINES OF itab INTO result SEPARATED BY ','.
if you want to add numeric fields at end of MATNR:
Under calculations tab:
Operation > SUM Total
Field Name > <f1> " which you want to be subtotalled.
Target field name > <f_sub> " value of subtotal
Time > A After Loop.
Now under the line type of EVENT > Cell > create a text and use <f_sub> to display subtotals.
BR
Dep
Edited by: DeepakNandikanti on Aug 25, 2011 11:49 AM
User | Count |
---|---|
67 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.