Skip to Content
author's profile photo Former Member
Former Member

Summation of different currencies in a column.

Hi Experts,

I have a report whose output has various quantity columns and currency columns.The currency column specifies whether the corresponding value in the quantity column is in gbp or eur or inr etc..

I want that when I select a quantity column and press the sum button it should give me the sum of all the different currencies there

eg..

currency | quantity

gbp | 20

inr | 50

eur | 50

inr | 40

inr | 100

gbp | 70

when i chose the quantity column and press sum it should give me the result as gbp 90

inr 190

eur 50 at the end of the column.

Please suggest how i should go about this..

Thanks in advance.

Regards,

Puja

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 27, 2009 at 10:50 AM

    Dear Puja,

    Can you use ALV reports. use the subtotal functionality.

    Do something like this:

    FS_FIELDCAT-COL_POS = '10'.
    FS_FIELDCAT-FIELDNAME = 'amount''.
    FS_FIELDCAT-TABNAME = 'itab-fieldname'.
    FS_FIELDCAT-OUTPUTLEN = 15.
    FS_FIELDCAT-DO_SUM = 'X'.
    FS_FIELDCAT-SELTEXT_M = 'INC ORDER QTY'.
    APPEND FS_FIELDCAT TO FT_FIELDCAT.
    CLEAR FS_FIELDCAT.
    
    FS_SORT-FIELDNAME = ''currency field name'''.
    FS_SORT-UP = 'X'.
    FS_SORT-SPOS = 1.
    FS_SORT-SUBTOT = 'X'.
    APPEND FS_SORT TO FT_SORT.
    CLEAR FS_SORT.
    
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
        I_CALLBACK_PROGRAM                = G_REPID
        IS_LAYOUT                         = LAYOUT
        IT_FIELDCAT                       = FT_FIELDCAT
        IT_SORT                           = FT_SORT
      TABLES
        T_OUTTAB                          = Itab
     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.

    Regrds,

    Nikhil.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 27, 2009 at 10:50 AM

    Are you using ALV ? if yes then in filedcatelog for column 'quantity' fill the fileld LVC_S_FCAT-CFIELDNAME = fieldname_of_currency.

    Otherwise you need to create another internal table with currenct and quantiry and using COLLECT satement you can have desire result.

    Edited by: Pawan Kesari on Aug 27, 2009 4:20 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 27, 2009 at 10:51 AM

    Hi Puja,

    The question to ur question is ...In which currency do u want the output to be??

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 27, 2009 at 10:51 AM

    Hi,

    In the user command i.e. after clicking on SUM button, here you need to code as below.

    Function module CONVERT_TO_LOCAL_CURRENCY, will convert the amount from source currency to target currency as per the exchange rates maintained in the system.

    Consider the target currency as say USD for all the items, and do sum and display it in USD.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.