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

subtotal in table control issue

Former Member
0 Likes
638

Hi Abapers,

               i have faced a problem in table control. i have a input screen with a input field 'purchase order no' where i put ebeln value. 2nd screen is table control with 4 fields (ebeln ebelp matnr netwr).

  2nd screen flow logic:

   PBO

   loop at it_ekpo with control TC cursor TC-current_line.    [TC= table control name]

   endloop.

   PAI.

   loop at it_ekpo.

   endloop.

i have got result. but requirement is subtotal.

ebeln            ebelp      matnr      netwr

45006789       10          m-10     598,00

45006789        20         m-20     898,00

45006789        30         m-30     988,00

                                               2484,00

this will be output....

i think for subtotal i have to code in PBO.

loop at it_ekpo with control TC cursor TC-current_line

MODULE SUM.

   endloop.

have to code in module sum.... but how can it show in table control in specific position???

Please help me.

Regards

Sabyasachi Karforma

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
483

Hello,

There is no easy or standard way to get subtotals in a Table control. I would suggest to use ALV grid reporting and it would be easy to do it there.

Anyways in your case for a table control you need to do something like this

SORT it_likp by vbeln.

LOOP AT it_likp INTO wa_it_likp.

    v_stot = v_stot + wa_it_likp-LGMNG

   AT END OF vbeln.

    SUM.

    wa_it_likp-text = 'Sub Tot'.

    wa_it_likp-subtot = v_stot.

    v_tot = v_tot + v_stot

    append  wa_it_likp to it_likp.

  ENDAT.

  AT LAST.

    SUM.

    wa_it_likp-text == 'Grand Tot'.

    wa_it_likp-total = v_tot.

    append  wa_it_likp to it_likp.

  ENDAT.

where it_likp is table attached to the table control. This logic will be before displaying the table control in the PBO event.

best regards,

swanand

Hello,

There is no easy or standard way to get subtotals in a Table control. I would suggest to use ALV grid reporting and it would be easy to do it there.

Anyways in your case for a table control you need to do something like this

SORT it_likp by vbeln.

LOOP AT it_likp INTO wa_it_likp.

    v_stot = v_stot + wa_it_likp-LGMNG

   AT END OF vbeln.

    SUM.

    wa_it_likp-text = 'Sub Tot'.

    wa_it_likp-subtot = v_stot.

    v_tot = v_tot + v_stot

    append  wa_it_likp to it_likp.

  ENDAT.

  AT LAST.

    SUM.

    wa_it_likp-text == 'Grand Tot'.

    wa_it_likp-total = v_tot.

    append  wa_it_likp to it_likp.

  ENDAT.

where it_likp is table attached to the table control. This logic will be before displaying the table control in the PBO event.

best regards,

swanand

1 REPLY 1
Read only

Former Member
0 Likes
484

Hello,

There is no easy or standard way to get subtotals in a Table control. I would suggest to use ALV grid reporting and it would be easy to do it there.

Anyways in your case for a table control you need to do something like this

SORT it_likp by vbeln.

LOOP AT it_likp INTO wa_it_likp.

    v_stot = v_stot + wa_it_likp-LGMNG

   AT END OF vbeln.

    SUM.

    wa_it_likp-text = 'Sub Tot'.

    wa_it_likp-subtot = v_stot.

    v_tot = v_tot + v_stot

    append  wa_it_likp to it_likp.

  ENDAT.

  AT LAST.

    SUM.

    wa_it_likp-text == 'Grand Tot'.

    wa_it_likp-total = v_tot.

    append  wa_it_likp to it_likp.

  ENDAT.

where it_likp is table attached to the table control. This logic will be before displaying the table control in the PBO event.

best regards,

swanand