Application Development 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: 

How to Get Subtotal Text

Former Member
0 Kudos
72

Hi all,

iam able to display subtotals for grid alv using class cl_gui_alv_grid

but not able to display text for subtotals

please let me known how to achive this.

Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
36

Hi RK,

Please check the forms before asking

Create one dummy field in the final table and hide that field.

check the bits of below code.


TYPES: BEGIN OF TY_VBAP,
       VBELN1 TYPE VBAP-VBELN,        
       VBELN  TYPE VBAP-VBELN,         " Dummy field
       NETWR  TYPE VBAP-NETWR,
       END OF TY_VBAP.



  GT_FCAT-FIELDNAME = 'VBELN'.
  GT_FCAT-REF_TABLE = 'VBAP'.
  GT_FCAT-TECH = 'X'.
  GT_FCAT-NO_OUT = 'X'.
  APPEND GT_FCAT.
  CLEAR GT_FCAT.


FORM SUB_TEXT USING ES_SUBTOTTXT_INFO TYPE LVC_S_STXT
                    E_EVENT_DATA      TYPE REF TO CL_ALV_EVENT_DATA
                    EP_SUBTOT_LINE    TYPE REF TO DATA.

  DATA LS_VBAP LIKE VBAP.
  FIELD-SYMBOLS: <FS1> LIKE GT_VBAP ,
                 <FS2>.
  IF ES_SUBTOTTXT_INFO-CRITERIA = 'VBELN'.
    ASSIGN EP_SUBTOT_LINE->* TO <FS1>.
    ASSIGN E_EVENT_DATA->M_DATA->* TO <FS2>.

   CONCATENATE 'Subtotal' ':'
    <FS1>-VBELN INTO <FS2> SEPARATED BY SPACE.
  ENDIF.

Regards,

Kumar M

1 REPLY 1

Former Member
0 Kudos
37

Hi RK,

Please check the forms before asking

Create one dummy field in the final table and hide that field.

check the bits of below code.


TYPES: BEGIN OF TY_VBAP,
       VBELN1 TYPE VBAP-VBELN,        
       VBELN  TYPE VBAP-VBELN,         " Dummy field
       NETWR  TYPE VBAP-NETWR,
       END OF TY_VBAP.



  GT_FCAT-FIELDNAME = 'VBELN'.
  GT_FCAT-REF_TABLE = 'VBAP'.
  GT_FCAT-TECH = 'X'.
  GT_FCAT-NO_OUT = 'X'.
  APPEND GT_FCAT.
  CLEAR GT_FCAT.


FORM SUB_TEXT USING ES_SUBTOTTXT_INFO TYPE LVC_S_STXT
                    E_EVENT_DATA      TYPE REF TO CL_ALV_EVENT_DATA
                    EP_SUBTOT_LINE    TYPE REF TO DATA.

  DATA LS_VBAP LIKE VBAP.
  FIELD-SYMBOLS: <FS1> LIKE GT_VBAP ,
                 <FS2>.
  IF ES_SUBTOTTXT_INFO-CRITERIA = 'VBELN'.
    ASSIGN EP_SUBTOT_LINE->* TO <FS1>.
    ASSIGN E_EVENT_DATA->M_DATA->* TO <FS2>.

   CONCATENATE 'Subtotal' ':'
    <FS1>-VBELN INTO <FS2> SEPARATED BY SPACE.
  ENDIF.

Regards,

Kumar M