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: 

Using control breaks in ALV

Former Member
0 Kudos
148

Hi all,

My requirement is at end of each material i have to display summarised open quantity in ALV.

I know how to do it with normal write statement using control breaks.

I want to display this requirement in ALV.

If possible please provide some code.

Thanks and Regards

Chandu.

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos
114

You Need to Specify in fieldcat of Field for which you are going to sum <b>DO_SUM = 'X'.</b>

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM       = V_REPID
      I_CALLBACK_PF_STATUS_SET = V_PF_STAT_FORMNAME
      I_CALLBACK_USER_COMMAND  = V_USER_FORMNAME
      IS_LAYOUT                = X_LAYOUT_DATA
      IT_FIELDCAT              = IT_FIELDCAT_DATA[]
   <b>   IT_SORT                  = IT_SORT_DATA[]</b>
      IT_EVENTS                = IT_EVENTS_DATA[]
    TABLES
      T_OUTTAB                 = IT_DISPLAY
    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.

reagards

vijay

8 REPLIES 8

former_member181962
Active Contributor
0 Kudos
114

When you fill the field catalog, fill the do_sum option.

Former Member
0 Kudos
114

Sai,

Pass those break level statements to ....events_get

or else after display u can set this using Layout setting where u will get subtotal as per the Materials.

Regards,

Amey

0 Kudos
114

It's is standard in the alv, you can sum, and sub-sum any field that you want, just make sure that this field is numeric.

Alexandre Nogueira.

former_member188685
Active Contributor
0 Kudos
114

Hi In alv Create a sort table based on your material.

in your sort table .

IT_SORT_DATA-SPOS = L_SPOS.

IT_SORT_DATA-FIELDNAME = 'MATNR'.

IT_SORT_DATA-TABNAME = 'IT_DISPLAY'.

IT_SORT_DATA-DOWN = 'X'.

IT_SORT_DATA-GROUP = 'X'. "Separations like breaks

IT_SORT_DATA-SUBTOT = 'X'.

APPEND IT_SORT_DATA.

CLEAR IT_SORT_DATA.

and in your field catlaog

specify DO_SUM = 'X'.

that will solve your Problem.

regards

vijay

former_member188685
Active Contributor
0 Kudos
115

You Need to Specify in fieldcat of Field for which you are going to sum <b>DO_SUM = 'X'.</b>

  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_CALLBACK_PROGRAM       = V_REPID
      I_CALLBACK_PF_STATUS_SET = V_PF_STAT_FORMNAME
      I_CALLBACK_USER_COMMAND  = V_USER_FORMNAME
      IS_LAYOUT                = X_LAYOUT_DATA
      IT_FIELDCAT              = IT_FIELDCAT_DATA[]
   <b>   IT_SORT                  = IT_SORT_DATA[]</b>
      IT_EVENTS                = IT_EVENTS_DATA[]
    TABLES
      T_OUTTAB                 = IT_DISPLAY
    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.

reagards

vijay

0 Kudos
114

Hi all,

Thanks alot for your replies.

My requirement is like this: at end of every material i have to select the summarized data some thing like this

AT END OF matnr.

SELECT SUM( vmeng ) SUM( off_wert )

INTO (gt_data-rueck, gt_data-rueckw)

FROM yvbbe WHERE matnr =

gt_data-matnr and mbdat < p_datum.

ENDAT.

Then I have to display that rueck and rueckw for each material in ALV.

I hope it will clear.

Please help.

Thanks & Regards

chandu.

0 Kudos
114

Hi why can't you maintain the data in the same table and

proceed in the same way as i told.

regards

vijay

0 Kudos
114

HI Vijay,

Thanks alot for your valuable replies.

regards

chandu.