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

currency-wise subtotal in normal interactive reporting

Former Member
0 Likes
846

i have two tables vbap, vbak. in the report i have to print vbeln, netwr from vbap table & waerk from vbak table.

now for every change in the currency a subtotal will be printed.

e.g. suppose i have 15 rows in the list. there are 6 dem(currency), 5 usd (currency), 4 euro (currency).

the summation of 6 dem's will be printed, 5 usd's will be printed, 4 euro's will be printed. how this can be achieved?

thanx..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
792

if you are directly relating the field definition as their data elements then vbeln would be char10, netwr is a curency and waerk is currency key(char type).

so

create you final table as:

types: begin of gty_final,
             vbeln type vbak-vbeln,
             netwr type vbap-netwr,
             waerk type vbak-waerk,
           end of gty_final. 

loop at gt_vbap into gs_vbap.
  clear : gs_vbak.
  read table gt_vbak into gs_vbak with key vbeln = gs_vbap-vbeln.
  if sy-subrc = 0.
     gs_final-vbeln = gs_vbap-vbeln.
     gs_final-netwr = gs_vbap-netwr.
     gs_final-waerk = gs_vbak-waerk.
     COLLECT gs_final into gt_final.
   endif.  
endloop.

i have two tables vbap, vbak. in the report i have to print vbeln, netwr from vbap table & waerk from vbak table.

now for every change in the currency a subtotal will be printed.

e.g. suppose i have 15 rows in the list. there are 6 dem(currency), 5 usd (currency), 4 euro (currency).

the summation of 6 dem's will be printed, 5 usd's will be printed, 4 euro's will be printed. how this can be achieved?

thanx..

3 REPLIES 3
Read only

GauthamV
Active Contributor
0 Likes
792

Define like this.


  fieldcatalog-fieldname   = 'NETWR'.
  fieldcatalog-seltext_l   = 'TRANSACTION CURRRENCY'.
  fieldcatalog-cfieldname   = 'WAERS'.  --> this willl give you currencywise subtotal
  fieldcatalog-do_sum   = 'X'.
  append fieldcatalog to fieldcatalog.
  clear  fieldcatalog.

Read only

Former Member
0 Likes
792

thanks gautham,

but i want to achieve it through interactive reporting not ALV. again thank you for your answer.

i know it will be achieved through control statements in internal table but fail to achieve that.

Read only

Former Member
0 Likes
793

if you are directly relating the field definition as their data elements then vbeln would be char10, netwr is a curency and waerk is currency key(char type).

so

create you final table as:

types: begin of gty_final,
             vbeln type vbak-vbeln,
             netwr type vbap-netwr,
             waerk type vbak-waerk,
           end of gty_final. 

loop at gt_vbap into gs_vbap.
  clear : gs_vbak.
  read table gt_vbak into gs_vbak with key vbeln = gs_vbap-vbeln.
  if sy-subrc = 0.
     gs_final-vbeln = gs_vbap-vbeln.
     gs_final-netwr = gs_vbap-netwr.
     gs_final-waerk = gs_vbak-waerk.
     COLLECT gs_final into gt_final.
   endif.  
endloop.