Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Do_sum and Subtotal

Former Member
0 Likes
891

Hi,

I copied the VL06 Transaction in Zprogram and i am trying to sum for fields (ANZPOS- Number of total items) and subtotal on the basis of picking date(KODAT).

In the fieldcatlog for the field ANZPOS I checked the DO_SUM = 'X' and for subtotal i modified the sortinfo internal table and i checked sub_tot = 'x' for the goods issue date . But result is not coming as expected... What should be done???

Regards

Prince

7 REPLIES 7
Read only

Former Member
0 Likes
825

wa_fieldcat2-col_pos = '10'.

wa_fieldcat2-fieldname = 'FAKWR'.

wa_fieldcat2-tabname = 't_output2'.

wa_fieldcat2-seltext_l = 'Amount'.

<b> wa_fieldcat2-do_sum = 'X'. "SUM UPON DISPLAY

wa_fieldcat2-datatype = 'CURR'.</b>* wa_fieldcat-just = 'L'.

wa_fieldcat2-outputlen = '15'.

wa_fieldcat2-do_sum = 'X'.

APPEND wa_fieldcat2 TO t_fieldcat2.

CLEAR wa_fieldcat2.

Read only

0 Likes
825

Hi Sumi,

I am checking the DO_SUM = 'X' and this is Hirerchical list display. But nothing is happening......

Regards

Prince

Read only

0 Likes
825

Hi

Can i have your sample code

Regards

Pavan

Read only

0 Likes
825

Hi Pavan,

This is the copy of standard transaction VL06 for picking and the list is being displayed in Hierarchical format.

    • sample code

      • Building Fieldcatlog

ls_fieldcat-fieldname = 'ANZPOS'.

ls_fieldcat-tabname = 'GT_OUTTAB'.

ls_fieldcat-do_sum = charx.

ls_fieldcat-no_out = space.

modify ct_fieldcat from ls_fieldcat

transporting do_sum no_out

where fieldname eq 'ANZPOS'.

ls_sort-spos = 1.

ls_sort-fieldname = 'KODAT'. " Picking Date

ls_sort-tabname = 'GT_OUTTAB'. "IT_D_POSTAB_KODAT

ls_sort-up = charx.

ls_sort-subtot = charx. " Added as per DEV319

append ls_sort to gt_sort.

clear ls_sort .

Thanks

Prince

Read only

0 Likes
825

Hi

Try to use this

ls_sort-subtot = &2.

Check this sample for your knowledge how to declare the things

*&---------------------------------------------------------------------*
*& Report  ZALVTOTAL                                                   *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  ZALVTOTAL                               .

TYPES :
  BEGIN OF ty_vbak,
    vkorg TYPE vbak-vkorg,             " Sales organization
    kunnr TYPE vbak-kunnr,             " Sold-to party
    vbeln TYPE vbak-vbeln,             " Sales document
    netwr TYPE vbak-netwr,             " Net Value of the Sales Order
    waerk TYPE vbak-waerk,             " Document currency
  END OF ty_vbak.

DATA:
  vbak    TYPE vbak,
  gt_vbak TYPE TABLE OF ty_vbak.

SELECT-OPTIONS :
  s_vkorg FOR vbak-vkorg,              " Sales organization
  s_kunnr FOR vbak-kunnr,              " Sold-to party
  s_vbeln FOR vbak-vbeln.              " Sales document

SELECTION-SCREEN :
  SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
SELECTION-SCREEN END OF LINE.

*---------------------------------------------------------------------*
INITIALIZATION.

  v_1 = 'Maximum of records to read'.

*---------------------------------------------------------------------*
START-OF-SELECTION.

  PERFORM f_read_data.

  PERFORM f_display_data.

*---------------------------------------------------------------------*
*      Form  f_read_data
*---------------------------------------------------------------------*
FORM f_read_data.

  SELECT vkorg kunnr vbeln netwr waerk
      UP TO p_max ROWS
    INTO TABLE gt_vbak
    FROM vbak
   WHERE kunnr IN s_kunnr
     AND vbeln IN s_vbeln
     AND vkorg IN s_vkorg.

ENDFORM.                               " F_READ_DATA
*---------------------------------------------------------------------*
*      Form  f_display_data
*---------------------------------------------------------------------*
FORM f_display_data.

  TYPE-POOLS: slis.                    " ALV Global types

  DEFINE m_fieldcat.
    add 1 to ls_fieldcat-col_pos.
    ls_fieldcat-fieldname   = &1.
    ls_fieldcat-ref_tabname = 'VBAK'.
    ls_fieldcat-do_sum      = &2.
    ls_fieldcat-cfieldname  = &3.
    append ls_fieldcat to lt_fieldcat.
  END-OF-DEFINITION.

  DEFINE m_sort.
    add 1 to ls_sort-spos.
    ls_sort-fieldname = &1.
    ls_sort-up        = 'X'.
    ls_sort-subtot    = &2.
    append ls_sort to lt_sort.
  END-OF-DEFINITION.

  DATA:
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv,
    lt_sort     TYPE slis_t_sortinfo_alv,
    ls_sort     TYPE slis_sortinfo_alv,
    ls_layout   TYPE slis_layout_alv.

  m_fieldcat 'VKORG' ''  ''.
  m_fieldcat 'KUNNR' ''  ''.
  m_fieldcat 'VBELN' ''  ''.
  m_fieldcat 'NETWR' 'X' 'WAERK'.
  m_fieldcat 'WAERK' ''  ''.

  m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
  m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
  m_sort 'VBELN' ''.                   " Sort by vbeln

  ls_layout-cell_merge = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            is_layout   = ls_layout
            it_fieldcat = lt_fieldcat
            it_sort     = lt_sort
       TABLES
            t_outtab    = gt_vbak.

ENDFORM.                               " F_DISPLAY_DATA

Reward all helpfull answers

Regards

Pavan

Read only

Former Member
0 Likes
825
Read only

0 Likes
825

Hi,

My Problem is solved only the thing which I was not getting that in the copied zprogram Standard variant was coming bydefault and in the function module "Reuse_ALV_HIERSEC_DISPLAY" I put my custom varaint then my program is working fine.

Thanks for your support!!!!!!

Cheers

Regards

PR