on 05-15-2012 11:50 AM
How to display the output of multiple line item into single line item.In smartforms
eg: I have
material desc color date qty amount.
aaaa red 15/05/2012 3 55
aaaa red 15/05/2012 4 500
aaaa red 15/05/2012 10 45
now i nedd the answer like
aaaa red 15/05/2012 17 600
You can do this using Control Break in Smartforms.
In the LOOP Node, add your field, Say material desc in the Sort criteria.
Click on Event on Sort End check box.
A new event will be created under the LOOP Node.
There you can write the subtotal.
Make sure you have program lines to get the subtotal before the event is executed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI,
loop at t_final into x_final.
read table lt_final into lx_final with key matnr = x_final-matnr
colour = x_final-colour
date = x_final-date.
if sy-subrc eq 0.
lx_final-qty = lx_final-qty + x_final-qty.
lx_final-amount = lx_final-amount + x_final-amount.
modify lt_final from lx_final
transporting qty
amount
where matnr = x_final-matnr
colour = x_final-colour
date = x_final-date.
else.
append x_final to lt_final.
endif.
endloop.
finally your T_FINAL will have 3 records whereas LT_FINAL have 1 record and use LT_FINAL to display the data or assign LT_FINAL to T_FINAL.
(Create LT_FINAL & LX_FINAL in global definition of your form)
try this code by creating a program lines above your main window or in your driver program.
Jshree
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Loop your internal table ,and inside the loop use Collect statement to combine all quantity fields.
For Eg:
LOOP AT ITAB.
COLLECT itab into itab1.
ENDLOOP.
Best regards
Naresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What are the data types of your internal table fields.?..i tried by creating sample test case by using the following code.in my case it is working fine.
data:it_collect type table of ty_collect,
ls_collect type ty_collect.
ls_collect-maktx = 'aaaa'.
ls_collect-color = 'red'.
ls_collect-date = '20120303'.
ls_collect-qty = '6'.
ls_collect-amt = '500'.
collect ls_collect into it_collect.
ls_collect-maktx = 'aaaa'.
ls_collect-color = 'red'.
ls_collect-date = '20120303'.
ls_collect-qty = '4'.
ls_collect-amt = '500'.
collect ls_collect into it_collect.
loop at it_collect into ls_collect.
write:ls_collect-maktx,
ls_collect-color,
ls_collect-date,
ls_collect-qty,
ls_collect-amt.
endloop.
Please check your data types with above code and let me know if any issue.
Thanks
Naresh
Message was edited by: Naresh Bammidi
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.