Skip to Content
author's profile photo Former Member
Former Member

Multiple subtotals UOM wise

Presently creating a reports for display of Billing details. The reports display the output in ALV grid.

User wants to see the sub total UOM wise. At present the subtotal is appearing after evry UOM while the user wants the display of all the quantities and UOM collectively at the bottom or top like standard transaction VF05.

How to display that. Kindly help.

thanks

anya

Add comment
10|10000 characters needed characters exceeded

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2007 at 11:37 AM

    Hi richard,

    i have defined like this

    clear l_fieldcat.

    l_fieldcat-fieldname = 'FKIMG'.

    l_fieldcat-outputlen = 13.

    l_fieldcat-datatype = 'QUAN'.

    l_fieldcat-do_sum = 'X'.

    l_fieldcat-seltext_l = 'Total Qty'.

    append l_fieldcat to p_fieldtab.

    clear l_fieldcat.

    l_fieldcat-fieldname = 'MEINS'.

    l_fieldcat-datatype = 'UNIT'.

    l_fieldcat-do_sum = 'X'.

    l_fieldcat-seltext_l = 'UOM'.

    append l_fieldcat to p_fieldtab.

    and no sorting criteria. But still only subtotal of quantity is appearing. Kindly reply

    Add comment
    10|10000 characters needed characters exceeded

    • Just add the unit/cucy fieldname to this sample

      Unit of Measure for quantity fields QUAN

      l_fieldcat-qfieldname  = 'fieldname of unit of measure'.

      or

      Currency Key for currency amount fields CURR

      l_fieldcat-cfieldname = 'fieldname of currency key' 

      in anya code :

      clear l_fieldcat.
      l_fieldcat-fieldname = 'FKIMG'.
      l_fieldcat-qfieldname  = 'MEINS'.
      l_fieldcat-outputlen = 13.
      l_fieldcat-datatype = 'QUAN'.
      l_fieldcat-do_sum = 'X'.
      l_fieldcat-seltext_l = 'Total Qty'.
      append l_fieldcat to p_fieldtab.

      So at each total level you will get as many total lines than there are unit or currency.

      Regards

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2007 at 11:17 AM

    hi,

    use this code for example.

    ls_sort-fieldname = 'BUKRS'.

    ls_sort-spos = '1'.

    ls_sort-up = 'X'.

    ls_sort-subtot = 'X'.

    APPEND ls_sort TO lt_sort.

    and pass this lt_sort to reuse_alv_grid_display.

    regards,

    Santosh

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2007 at 11:20 AM

    hi,

    Try like this.

    DATA: gt_subtot TYPE slis_t_sortinfo_alv,

    subtot LIKE LINE OF gt_subtot.

    subtot-spos = 1.

    subtot-fieldname = 'NAME1'.

    subtot-tabname = 'ITAB_HEAD'.

    subtot-up = 'X'.

    subtot-group = 'X'.

    subtot-subtot = 'X'.

    subtot-expa = 'X'.

    APPEND subtot TO gt_subtot.

    subtot-spos = 2.

    subtot-fieldname = 'WGBEZ'.

    subtot-tabname = 'ITAB_HEAD'.

    subtot-up = 'X'.

    subtot-group = 'X'.

    subtot-subtot = 'X'.

    subtot-expa = 'X'.

    APPEND subtot TO gt_subtot.

    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'

    EXPORTING

    i_callback_program = 'ZRAW_COST'

    it_fieldcat = fcat

    <b> it_sort = gt_subtot</b>

    it_events = eve

    i_tabname_header = 'ITAB_HEAD'

    i_tabname_item = 'ITAB_ITM'

    is_keyinfo = alv_keyinfo

    TABLES

    t_outtab_header = itab_head

    t_outtab_item = itab_itm

    EXCEPTIONS

    program_error = 1

    OTHERS = 2.

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    ENDFORM. "dis_data

    U can use REUSE_ALV_GRID_DISPLAY instead of REUSE_ALV_HIERSEQ_LIST_DISPLAY

    reward if useful.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 28, 2007 at 11:22 AM

    What you want is the standard behavior of ALV modules, if your data are defined as quantities (type QUAN) or currency amounts (CURR) and the associated field unit of measure (UNIT) or currency key (CUKY) must be assigned and filled.

    Don't put a sub-total and a sort criteria on unit, only sulmm the column, each UOM will be summed separately, and displayed collectively at the total and sub-total levels.

    Regards

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 28, 2007 at 11:50 AM

    Thanks a lot raymond,

    Your reply was simple, concise.

    have rewarded points to u.

    thanks once again.

    anya

    Add comment
    10|10000 characters needed characters exceeded