10-17-2008 10:55 AM
Hi,
I want to do the Subtotal of the columns in the ALV by using any of the FMs:
ALV_OPTIONS_FOR_SUBTOTALS
ALV_SUBTOTALS_GET
ALV_SUBTOTALS_GET_H
But since the functional documentation is not available.
I am not getting how to use.
Please provide me the code or reply me about how to go about.
Thanks & Regards,
Pooja
10-17-2008 10:58 AM
did you check here
The functions you are referring may be internally used by the mainfunctions. check in the above thread you can see the example on that.
10-17-2008 10:58 AM
Hi Pooja,
we are defining the sub-totals in sortcatalog and grand totals in field catalog.
With Regards,
Narasimha Rao.
10-17-2008 10:58 AM
did you check here
The functions you are referring may be internally used by the mainfunctions. check in the above thread you can see the example on that.
10-17-2008 11:08 AM
Hi,
Consider i have 3 fields
lifnr curr DMBTR
5600 GBP 1000
5600 GBP 1000
5600 USD 1000
5600 TND 1000
5601 GBP 1000
5602 GBP 1000
I want output to be :
lifnr curr DMBTR
5600 GBP 1000
5600 GBP 1000
5600 USD 1000
5600 TND 1000
-
5600 GBP 2000
USD 1000
TND 1000
-
5601 GBP 1000
________________
5601 GBP 1000
5602 GBP 1000
_________________
5602 GBP 1000
Actually i tried using the using subtotal option here:
**Method 1:
lv_fieldname = lc_lifnr.
lw_sort-spos = 1.
lw_sort-fieldname = lv_fieldname.
lw_sort-up = c_mark.
lw_sort-subtot = 'X'.
APPEND lw_sort TO i_sort.
Next i tried using the modifying field catalog like this
**Method 2:
LOOP AT i_fieldcat INTO wa_fieldcat.
IF wa_fieldcat-fieldname EQ 'DMBTR'.
wa_fieldcat-do_sum = 'X'.
ENDIF.
IF wa_fieldcat-fieldname EQ 'WRBTR'.
wa_fieldcat-do_sum = 'X'.
ENDIF.
MODIFY i_fieldcat FROM wa_fieldcat
TRANSPORTING do_sum .
ENDLOOP.
But both the methods didnt work .
So kindly tel me how to go about?
Regards,
Pooja
10-17-2008 11:14 AM
sort part is ok.
Fieldcatalog part.
LOOP AT i_fieldcat INTO wa_fieldcat.
IF wa_fieldcat-fieldname EQ 'DMBTR'.
wa_fieldcat-do_sum = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat
TRANSPORTING do_sum .
ENDIF.
IF wa_fieldcat-fieldname EQ 'WRBTR'.
wa_fieldcat-do_sum = 'X'.
MODIFY i_fieldcat FROM wa_fieldcat
TRANSPORTING do_sum .
ENDIF.
clear wa_fieldcat.
ENDLOOP.
and how are you -population the i_fieldcat..?
for currency fields are you giving the reference fields.
10-17-2008 12:01 PM
Hi Vijay,
Thanks for ur reply.
I am filling the field catalog manually as shown below:
*local currency
lw_fieldcat-tabname = 'I_OUTPUT'.
lw_fieldcat-fieldname = 'LCURR'.
lw_fieldcat-outputlen = 12.
lw_fieldcat-seltext_l = text-004.
APPEND lw_fieldcat TO i_fieldcat.
CLEAR lw_fieldcat.
*Amount O/s [local]
lw_fieldcat-tabname = 'I_OUTPUT'.
lw_fieldcat-fieldname = 'DMBTR'.
lw_fieldcat-outputlen = 15.
lw_fieldcat-seltext_l = text-005.
APPEND lw_fieldcat TO i_fieldcat.
CLEAR lw_fieldcat.
*Document currency
lw_fieldcat-tabname = 'I_OUTPUT'.
lw_fieldcat-fieldname = 'DCURR'.
lw_fieldcat-outputlen = 15.
lw_fieldcat-seltext_l = text-006.
APPEND lw_fieldcat TO i_fieldcat.
CLEAR lw_fieldcat.
*Amount O/s [document]
lw_fieldcat-tabname = 'I_OUTPUT'.
lw_fieldcat-fieldname = 'WRBTR'.
lw_fieldcat-outputlen = 15.
lw_fieldcat-seltext_l = text-007.
APPEND lw_fieldcat TO i_fieldcat.
CLEAR lw_fieldcat.
I didnt understand "for currency fields are you giving the reference fields.????". How should give reference fields for it?
Regards,
Pooja
10-17-2008 12:13 PM
Hi,
In fieldcatalogue use the following :
Reftab and RefFld and from the database table for the currency field under consideration get the respective reference table and field and pass it to your field catalogue....
10-17-2008 12:13 PM
take example
fcat-REF_FIELD = 'DMBTR'.
fcat-ref_table = 'MSEG'.
fcat-cfieldname = 'L_CURR'.
fcat-ctabname = 'I_OUTPUT'.
if you are populating manually what is the problem in adding the DO_SUM = 'X' , for that you are looping and doing.
*Amount O/s local
lw_fieldcat-tabname = 'I_OUTPUT'.
lw_fieldcat-fieldname = 'DMBTR'.
lw_fieldcat-outputlen = 15.
lw_fieldcat-do_sum = 'X'.
lw_fieldcat-seltext_l = text-005.
APPEND lw_fieldcat TO i_fieldcat.
CLEAR lw_fieldcat.
...
*Amount O/s document
lw_fieldcat-tabname = 'I_OUTPUT'.
lw_fieldcat-fieldname = 'WRBTR'.
lw_fieldcat-outputlen = 15.
lw_fieldcat-do_sum = 'X'.
lw_fieldcat-seltext_l = text-007.
APPEND lw_fieldcat TO i_fieldcat.
CLEAR lw_fieldcat.
10-17-2008 12:32 PM
Hi Vijay,
Thanks, the problem is solved.
I was not referencing the document curr with the document amount. I used a struture and in that i used the reference field and ref table which is same as mentioned by you above.
Yes, thats correct i could have added the do_sum directly.
I need not have used modify_alv. I didnt realise that at the time of coding.
Regards,
Pooja
10-17-2008 11:03 AM
hi read this will give you the answer...
http://help.sap.com/saphelp_nw04/helpdata/en/ee/c8e056d52611d2b468006094192fe3/frameset.htm