10-03-2008 1:59 PM
Hi Experts ,
i need to give subtotal , table is sorted on 4 fields . BUKRS , SAKNR , LIFNR , WAERS . Subtotal shld come according to SAKNR & BUKRS . For 1 BUKRS there may be multiple SAKNR .For one SAKNR there are multiple LIFNR & for 1 LIFNR , multiple WAERS . I m getting the subtotal irrespective of WAERS (Currency) but i need saperate line of subtotal for each WAERS .
Example .
BUKRS SAKNR LIFNR Amount WAERS
EG01 20010 3010 1000 EUR
EG01 20010 3010 2000 SAR
EG01 20010 3011 500 EGP
EG01 20010 3011 1000 EUR
EG01 20010 3011 1000 SAR
EG01 20010 500 EGP (subtotal)
EG01 20010 2000 EUR (subtotal)
EG01 20010 3000 SAR (subtotal)
I need o/p as shown above . irrespective of LIFNR , it shld give subtotal of amount for each curr . at present i m getting a single line for SAKNR & WAERS field is blank , as shown below
*EG01 20010 5500 * (subtotal)
Please help me on this issue . It will be better if u provide any example .
thanks in advance .
Vijeta .
10-03-2008 2:16 PM
Define fields in internal table in sequence
BUKRS SAKNR WAERS LIFNR Amount
Sort on
BUKRS SAKNR WAERS
then AT END OF WAERS. do SUM
10-03-2008 2:50 PM
i m using ALV . Below is the code & sorting criteria
DATA: ls_sort TYPE slis_sortinfo_alv.
CLEAR ls_sort.
ls_sort-fieldname = 'BUKRS'.
ls_sort-spos = 1.
ls_sort-up = gc_x.
ls_sort-subtot = gc_x.
IF NOT listsep IS INITIAL.
ls_sort-group = '*'.
ENDIF.
APPEND ls_sort TO xt_sort.
CLEAR ls_sort.
ls_sort-fieldname = 'SAKNR'.
ls_sort-spos = 2. "changed from 2 to 3
ls_sort-up = gc_x.
ls_sort-subtot = 'X'. "commented by vijeta
APPEND ls_sort TO xt_sort.
CLEAR ls_sort.
ls_sort-fieldname = 'LIFNR'.
ls_sort-spos = 3. "changed from 3 to 4
ls_sort-up = gc_x.
APPEND ls_sort TO xt_sort.
CLEAR ls_sort.
ls_sort-fieldname = 'WAERS2'.
ls_sort-spos = 4.
ls_sort-up = gc_x.
APPEND ls_sort TO xt_sort.
in this code when i m giving " ls_sort-subtot = 'X'. " for WAERS then in o/p subtotal is coming after each line . but i want them after each respective SAKNR .
i would be glad if u provide any example .
thanks in advance .
vijeta