on 03-18-2009 7:08 AM
HI experts,
I am using smartforms, i want to the subtotals for customer wise,
example :
i have an internal table itab..
Cust NO I Name I Amount
100 I Ram I 111
100 I Ram I 222
100 I Ram I 444
*100 I Ram I 777 ( is the sub total for cust no '100' )
200 I Ravi I 011
200 I Ravi I 112
*200 I Ravi I 123 ( is the sub total for cust no '200 ).
and thi ssub totals i want in bold.
i am using smartforms..
can any one pleas suggestion me...
Thanks & Best Regards,
Praveen.
Hi Praveen.
Ist use an extra field in itab to inform the smart from that it is total line.
Here is sample code according to ur need.
data: begin of it_tab occurs 10,
custno(20),
name(30),
amount type i,
sform(1), " Smartform indicator to bold this line
end of it_tab .
data: wa_it_tab like it_tab.
data: itab2 like standard table of it_tab with header line,
wa_itab2 like it_tab.
it_tab-custno = '100'. it_tab-name = 'Ram'. it_tab-amount = 111 .append it_tab.
it_tab-custno = '100'. it_tab-name = 'Ram'. it_tab-amount = 222 .append it_tab.
it_tab-custno = '100'. it_tab-name = 'Ram'. it_tab-amount = 444 .append it_tab.
it_tab-custno = '200'. it_tab-name = 'Ravi'. it_tab-amount = 11 .append it_tab.
it_tab-custno = '200'. it_tab-name = 'Ravi'. it_tab-amount = 112 .append it_tab.
sort it_tab by custno.
data: count type i.
loop at it_tab into wa_it_tab.
wa_itab2 = wa_it_tab.
append wa_itab2 to itab2.
at end of custno.
sum.
wa_it_tab-sform = 'X'.
wa_it_tab-name = wa_itab2-name.
append wa_it_tab to itab2.
endat.
endloop.
Copy paste this code and execute it.
Now u will get total of customer also in itab2.Now pass this itab2 to smartform.
in smartform as u make the line to show the simple record , on this table line apply the following
condition.
condition can be applied in Condition Tab of table line.
display one line when itab-sform neq 'X'. then display this as normal line.
and when itab-sform eq 'X' , then bold this line.
reply if any query
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.
Then it will be easy for u if u have created smart forms b4.
Now conidtion have to give there in global definitions.
just in form interface in Tables tab u have to pass the structure which u have to created to pass data to smartforms.
steps are as follows.
1) When u open the smart from , right click on the Main Window -> Create -> Table. It will create HEADER,Main Area & Footer Sections.
2) Create Table Line which have to show four fields of ur internal table.
3) Now Right Click on the main area -> Create -> Table Line.
4) Give the Line type name which u created in 2nd step.
5) Now Place the cursor on table line u created.
6) see in side window that it have two tabs . One of OutPut Options and 2nd of Conditions Tab.
7) Now go in conditions tab. In Field Name tab write itab-sform and comparison value NE 'X'. Which is for simple records
😎 now create again table line of the same line type and give here condition itab-sform EQ 'X'. which is for subtotal. And make bold the contents of this table line
Hi tahir,
i have desinged the smartform also with your suggestion,
while calling the smartform function module in the driver program..
tables
itab = itab2.
is it correct ?
if i give like this i am gettin the erroer messgae that, " itab2 is unknowm it is neither in one of the specified tables nor defined by data statements ".
but i have declreard the itab2 in data statements.
can u please sugget me how to over come this problem.
Thanks & Best Regards,
Praveen.
Hi Praveen.
To bold a line u will have to create the style of bold type by using t-code 'SMARTSTYLES'.
It is very easy to create ur own customized style and while creating style u can bold it. when u create a style
it will appear in smartfroms too. there u can assign this style to ur subtotal line & other style which u are already using to other records lines
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen
see this link.It explains you the subtotaling in SMARTFORM with example ans screen shots.
[https://wiki.sdn.sap.com/wiki/display/ABAP/SUBTOTALINSAP+SMARTFORMS]
Regards
Hareesh Menon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create the Event on sort Begin for the customer number .
-
>Create Program lines---->Calculate Subtotal i.e Sub_tot = Subtot+Amount.
-
>Create Text node Dispaly &Sub_tot&
Dont Forget to Clear The Value of Sub_tot Before Sort of Begin event.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
U can decalre like this your problem will solve.
RG ,, Kunnr,,name1,, <F1>&G_SUBTOTAL+4(14R)&</>
Here <F1> characterformat should be in Bold.
Regards,
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
1.Sort the internal table on the basis of Cust no.
2.AT NEW CUST NO
sum "this will add up the amount for all the cust no
End at.
3.write sum.
Or append the sum into a new column in the internal table
Pooja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
If you are using SAP 6.0, U need not write any calculation for that..
Go to main window-> table-> calculation tab ->
Put Operation as Total
Put field name in column field name like wa_tab-fname
and put any variable in target field name
You can choose after loop in time
Then you can print the variable which will have subtotal
Regards
P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen
Create the Event on sort Begin for the customer number .Create the text node and after create the program lines for the subtotals
For the subtotals to be bold create the smart styles character format and include in the smart forms output options and display the text bold
Regards,
Sravanthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
26 | |
10 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.