Addition of Amounts Based on Currency's

Hi all,
I have in an internal table 1) Amounts,
                                     2) Currency,
                                     3) Debit(s)/Credit(h)   indicator as three fields.
According to my requirement, i have to add up all the amounts which are credit of a perticular Currency also add up debit amounts of that currency.
For example if i have dollars,pounds and Rupees as entries
            Amount             Currency               debit/credit
            400                    USD                        s
            100                    USD                        s
              30                    GBP                        s
            200                    USD                        h
              10                    GBP                        s
            3000                   INR                         s
              20                    GBP                        h
             2000                   INR                        s
            1500                   INR                        h
my result should be---->  USD  = (400+100) - 200 -
> 300 USD.
                                     GBP = (30+10) - 20 -
> 20 GBP.
                                     INR   =  (3000+2000)-1500 -
>3500 INR.
     Basically we are adding up all the 's' types induvisually & 'd' types induvisually for each curency and
        final out put is [total of s types] - [total of d types] for each currency.           
Plz Suggest me a sloution and if posible plz send in a pseudocode.
THANKS IN ADVANCE.
Reddy.

Hi Pami,
Pseudocode
Loop at itab into wa.
if indicator= h
multiply amount by -1.
endif.
endloop.
sort itab by currency.
loop at itab into wa.
case wa-currency.
when'USD'
usd_tot = usd_tot + wa-amount.
when 'GBP'
gbp_tot = gbp_tot + wa-amount.
similarily for all currencies.
endcase
endloop.
<b>Reward points, if helpful.</b>
Regards,
Atin

Similar Messages

  • Display amount in ALV Grid with different Decimal Places based on Currency

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
    we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65
    i need to display values like AED : 22.56

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
    i need to display values like AED : 22.56
                                             KWD---22.565 but here field is NETWR with 2 decimal.
    Need to Display amount in ALV Grid with different Decimal Places based on Currency
    Regards,
    Dileep Kumar Reddy

  • FB50 - Amount in Local Currency

    Gurus,
    When we use the transaction FB50, on the first screen the field u2018Amount in local currencyu2019 is grayed out. This field becomes editable when we double-click the entered line item. Since this involves additional steps, our requirement is to make the field editable in the first screen itself (like when we use transaction F-02).
    Is this possible and if yes, how. I have tried transaction FB00 but could not make the field editable in the first screen.
    Thanks & Regards,
    Sameer S. Gupte

    Hello,
    It is not possible
    Based on the Currency and Amount in document currency that you have entered in FB50, the amount is local currency gets calculated.
    Regards,
    Ravi

  • CFM /TR - how system calculate amount based on rate FX 60A

    Hi all,
    i need to know how system calculates amount based on rate entered upon creating a contract (t-code TX01).
    steps input:-
    1. header - comp code, product type, trans type
    2. partner
    3. purchase curr & amount (eg. IDR 8,345,545,500)
    4. sale currency only (amount system will auto calculate) USD
    5. rate field = 11.553
    6. spot rate will auto pick up from rate
    7. value date
    8. contract date
    upon TBB1 no error. posting log as follows:-
    FX1000+ : 40 8,345,545,500 IDR bank GL acc
                    50 8,345,545,500 IDR clearing acc
    FX2000- : 40 722370.42 USD clearing acc
                   50 722370.42 USD bank GL acc
    but upon TPM18 error occurred as follows:
    DBT_C009 - GL not maintain in acc symbol 5.3.4
    DBT_E039 - no posting spec assigned to update type
    DBT_B018 : 40 0 USD, 431,977,511 IDR gain/loss
                       50 0 USD, 431,977,511 IDR clearing acc
    so, after maintained DBT_C009 as follows still error for DBT_E039:
    40  0 USD, 38 IDR clearing acc
    50  0 USD, 38 IDR P&L gl acc
    what i don't understand is how system calculate and get DBT_C009 & DBTE039.
    what is the function of TPM18?
    thanks.

    Hello Prarnod,
    I have done the first node only for actuals that come from the integration to the internal order.
    I have tried setting up 2 and 3 even though the 3rd one does not make any sense to me
    Thanks,
    Paul

  • TDS Amount in Local currency and document currency

    Dear All,
    When we deduct TDS amount on Vendor Transactions in foreign currency, the TDS amount is dispalyed only in document curreny(Foreign currency) in T.Code "FBL1N".
    Now We want to see the TDS amount in local currency in T.Code "FBL1N". layout when we post TDS transactions in foreign currency(USD). B,caz there is no such fields "Withholding tax amount in local currency" in the change layout.
    So, Plz advise me whether it is possible or not ? If Yes, explain me.
    If you have any query, plz do let me know.
    Thanks in Advance.
    Regards,
    Kumar.D

    Hi Prasad,
    In Logistics Invoice Verification, when you enter an invoice in foreign
    currency, the system automatically translates the foreign currency
    amounts to local currency. The system calculates the exchange rate using
    the following rule:
    1.If the buyer entered a fixed exchange rate in the purchase order, the
    system uses this rate to translate the amounts to local currency.
    2.If an exchange rate was entered in Invoice Verification, the system
    uses this rate to translate the amounts to local currency.
    3.If an exchange rate was entered neither in the purchase order nor in
    Invoice Verification, the system uses the exchange rate pre-defined in
    Customizing for Financial Accounting valid for the posting date.
    Exchange Rate Differences
    If a purchase order is entered in foreign currency,the amounts are
    translated from foreign currency into local currency at goods receipt.
    If you enter the invoice for the purchase order in the foreign currency,
    this can lead to currency translation differences between the goods
    receipt and the invoice receipt.
    How these differences are posted depends on how your system is
    configured in Customizing for Invoice Verification
    Exchange Rate Rounding Differences
    When an invoice is posted in a foreign currency, the amounts are translated into local currency.Since the system rounds off the amounts in each posting line, this can lead to rounding differences due to the currency translation.
    These differences are posted to an expense or income account.
    Addition in transaction OB22 for the second local currency, it should be defined 'Translation taking transaction currency as a basis' is defined.
    Pls. also  refer to note:335608  Trnsln of 2nd and 3rd lcl crcy fm 1st lcl/trns crcy.
    I hope the above information helps you out......
    Best Regards,
    Gladys Xing

  • Get transactional currency total based on currency type

    hi,
    i have created a custom report related to fi which is working fine.
    but now the issue is in that report we r having a transaction currency field WRBTR.the users want to calculate totals based on currency.
    for example my output is
    tran curr  curr type
    500        inr
    600        inr
    400        inr
    200        usd
    500        usd
    400        usd
    so now the totals shld be calculated based on currncy wise.
    i.e we need to get 2 lines in total
    1500    inr
    1100    usd
    Any suggestions in this issue will be helpful.

    Hi,
    Try to fill Field cataloue in the following manner .
    then it will summ automatically based on  Currency.
    lfs_fieldcat-fieldname     = 'AMOUNT'.
      lfs_fieldcat-tabname       = text-022.
    lfs_fieldcat-CFIELDNAME = 'CURRENCY'.
      lfs_fieldcat-col_pos       = '1'.
      APPEND lfs_fieldcat TO t_fieldcat.
    lfs_fieldcat-fieldname     = 'CURRENCY'.
      lfs_fieldcat-tabname       = text-022.
      lfs_fieldcat-col_pos       = '2'.
      APPEND lfs_fieldcat TO t_fieldcat.
    Regards.
    Eshwar.

  • Can we writeoff/any other solution for difference amount in group currency?

    Hi All,
    One of the G/L account are getting difference between Local Currency (Co. Code Currency - CAD) and Group Currency (USD) as follows. Our Client wants to clear this amount in Group Currency (USD). Can any one help me out on this?
    Problem description: at month end of february 2008 the Cumulative balance needs to be zero (blank) and it is zero in the local currency (CAD)
    whereas it is showing an odd amount of USD 528 for the same, which we want to get rid of somehow,  to make it show as blank. in USD also for the month end february 2008.
    Hence please suggest any method to write off that balance/ reverse / any other alternative. so that both in USD and CAD it would be blank for month end february 2008
    To view: FS10N  with currency USD and with currency CAD

    Hi Prasad,
    In Logistics Invoice Verification, when you enter an invoice in foreign
    currency, the system automatically translates the foreign currency
    amounts to local currency. The system calculates the exchange rate using
    the following rule:
    1.If the buyer entered a fixed exchange rate in the purchase order, the
    system uses this rate to translate the amounts to local currency.
    2.If an exchange rate was entered in Invoice Verification, the system
    uses this rate to translate the amounts to local currency.
    3.If an exchange rate was entered neither in the purchase order nor in
    Invoice Verification, the system uses the exchange rate pre-defined in
    Customizing for Financial Accounting valid for the posting date.
    Exchange Rate Differences
    If a purchase order is entered in foreign currency,the amounts are
    translated from foreign currency into local currency at goods receipt.
    If you enter the invoice for the purchase order in the foreign currency,
    this can lead to currency translation differences between the goods
    receipt and the invoice receipt.
    How these differences are posted depends on how your system is
    configured in Customizing for Invoice Verification
    Exchange Rate Rounding Differences
    When an invoice is posted in a foreign currency, the amounts are translated into local currency.Since the system rounds off the amounts in each posting line, this can lead to rounding differences due to the currency translation.
    These differences are posted to an expense or income account.
    Addition in transaction OB22 for the second local currency, it should be defined 'Translation taking transaction currency as a basis' is defined.
    Pls. also  refer to note:335608  Trnsln of 2nd and 3rd lcl crcy fm 1st lcl/trns crcy.
    I hope the above information helps you out......
    Best Regards,
    Gladys Xing

  • Problem in printing amount in different currencies in adobe form

    Hi All,
    I have a requirement to print the amount as space for thousand seperator and comma for decimals.
    I have set the pattern format such that the amount is printing in below format as required.
    Locale---Italian.
    Space as thousand seperator and comma as decimal seperator.
    for example 1 234,45
    As some of the Currencies will not have decimals, now users would like to print amount without decimals. For example in my case amount  printing in KRW ( Korean currency ) is also similar to the above format which is wrong.
    for example Now amount is printing as 55 000,00. But actually it should be 550 000. Similarly for JPY currency also, as it doesnot haves decimals ( checked in TCURX table ).
    I have written some logic in the interface. below is the logic.
    WRITE:
        wa_mhnd1-wrshb to wa_item-wrshb CURRENCY WA_ITEM-WAERS.
    *READ TABLE lt_tcurx INTO lwa_tcurx WITH KEY currkey = wa_item-waers BINARY SEARCH.
      IF sy-subrc  = 0.
      IF lwa_tcurx-currdec = '0'.
      REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
      REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
      else.
       REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
        REPLACE ALL OCCURRENCES OF '.' in  wa_item-wrshb WITH ','.
    endif.
    ENDIF.
    a. when the write statement gets executed amount will be in ,. ( 1,234.45 )format. Then my logic gets executed correctly. In this company code is CH10 ( EUR ) and KR10.
    b. But sometimes after the write statement gets executed amount will be in ., format ( 1.234.45 ). In this case my logic works, but gives the wrong value. In this case company code is VN10 ( EUR )
    In both the cases currency is EUR.
    Will the decimal format change accordingly based on the company code code currency.Can anyone please tell me why write statement behaved differently.
    Do I need to change any locale in the adobe form, or any other logic to be written in interface. ?  I am trying it out from long time, but not able to fix it. I will have to fix it ASAP.
    Can anyone kindly please help me how to achieve this ?
    Thanks and Regards,
    Karthik Ganti.

    Hi Ayan,
    Thanks for your reply.
    I have already made the locale to default in adobe form and tried. In the interface I have written the logic to print the amount in particluar currency.
    WRITE:
        wa_mhnd1-wrshb to wa_item-wrshb CURRENCY WA_ITEM-WAERS.
    *READ TABLE lt_tcurx INTO lwa_tcurx WITH KEY currkey = wa_item-waers BINARY SEARCH.
      IF sy-subrc  = 0.
      IF lwa_tcurx-currdec = '0'.
      REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
      REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
      else.
       REPLACE ',' WITH SPACE INTO WA_ITEM-WRSHB.
        REPLACE ALL OCCURRENCES OF '.' in  wa_item-wrshb WITH ','.
    endif.
    ENDIF.
    I dont know why the above write statement is behaving differently. In one case the value is shown as 1,234.00, but in another test case it shows 1.234,00.
    In both the test cases the currency is 'EUR'. In case if the above write statement works correctly, my issue will be solved.
    Can anyone tell me why the write statement is behaving differently. Will the currency be dependent on any other factor ( for example company code,customer )
    I would like to fix this ASAP.
    Thanks and Regards,
    Karthik Ganti.

  • Amount in Local Currency of documents of material  (mov 251)

    Hello Gurus,
    We have a problem in the Amount in Local Currency of documents of material  (mov 251), resulting from the idoc WPUUMS01. When is the posting date before the current period.
    example:
    Material X
    August  Moving Price  150u20AC >>Total Stock 10 Total Value1500u20AC
    September Moving Price  181.82u20AC >> Total Stock 11 Total Value 2000u20AC
    If we integrate an August sale, the system registers the document with the cost of September (Amount Local Currency 181.82u20AC).
    After registration of the document is the stock with the following values
    August Total Stock 9 >>Total Value 1318,19u20AC
    September Total Stock 9 >> Total Value 1636,36u20AC
    If we manually register the movement 251 by MIGO or MB11  with a date of August, the system records the cost value of 150u20AC (MAP August).
    Any suggestion?
    Regards,
    Vera Monteiro

    Hi,
    Please check SAP report-S_P00_0700139 this will help to investigate exact reason for change of moving average . This is one of the best report of sap ,it will give you moving average price based on every transaction happened in SAP.
    Hope this will be helpful.
    Thanks & Regards,
    Sandesh Sawant

  • MIgo- Mvt Type 101- Amount in Local Currency

    Dear Experts,
    Require you valuable suggestions in resolving issue concerned with MIGO, MVT Type 101, Amount in local currency.
    I have the following scenario../ steps followed..
    a.  Material Master created  with Moving Average price
    b.  No Stock exists for the material
    c.  Purchase Order Created for material with Quantity - 1 ea and  price PBxx= 100.00 GBP.  No Taxes applicable
    d.  GR/ IR check in unticked and  Inv. Receipt is ticked in the Invoice tabl of the Purchase Order. GR/ IR not to be maade mandatory.
    e.  Initially invoice is posted for qty 1.  and value of 70.00 GBP
    f.  Further another  move invoice is posted for the same line item of the PO for Qty 1 and value of 30.  GBP.
    g.  Referring point e & f above- 2 invoices have been posted for quantity 2 toial value of 100.00 GBP
    h.  MIGO Posted for qty - 1 ea referring the Purchase order and a material document has been generated.
    i.   In Display mode of  Material Document, in the quantity tab, the amount in local currency is populating as 50.00 GBP.
    The following have been tested
    1.  Cancelled the Material Document
    2. Cancelled both the invoices.
    3. Cleared FI documents manually.
    4. Posted Single invoice for 100.00GBP
    5. Posted MIGO- GR- 101 for 1 qty.
    6. In material document the value is reflecting as 100.00GBP
    Kindly suggest..
    1.   to get a  amount in local currecy  asf 100.00GBP in the migo - value of the PO line item, even if  2 invoices exits with different values.
    2. User exit to control this.
    3. Any other solution.
    Regards,
    M. Suresh
    4. Posted

    Dear Suresh
    This is a standard behaviour only.
    1. when you ost intital invoice for Qty1 and value 70 GBP, then perform GR, the amount in local currency will be shown as 70 GBP with Quantity 1.
    2. When you post GR for Quantity 1 after posting two IRs (one with Qty1-70 GBP + second with Qty 1-30 GBP), , the amount shown in local currency will be 100/2 = 50 GBP. System will show as Quantity 1 due for GR.
    Always use GR based IR which will not create any issue or Please define the over delivery/under delivery tolerences which will not allow to post more than the PO quantity. Main reason is posting IR mroe than the PO quantity. We can't use userexit for this. This is standard process. If you bypass these controls, will create a inconsistencies.
    Warm regards
    Ramakrishna.

  • TX01, - incorrect calcualte amount in local currency  upgrade 4.7- ECC6.0

    Hello, Gurus,
    I've problem with currency transaction, especially with additional flows
    When I created  currency forward and I add additional flows :
    1) 0011      +    1.000.000 EUR   ( exchange rate fixed 4,00)
    2) 0011      -     4.000.000 PLN
    And I saved transaction
    then I post this flows: using TBB1 :
    And system try post :
    flow 1) 1.000.000,00 EUR   -> 4.000.000 PLN - this is correct
    flow 2) 1.007.556,68 EUR   -> 4.000.000PLN - this is incorrect
    Why system try calculate second flow despite that in additional flow was set as PLN ?
    This situation was after upgrade to ECC 6.0
    In previous version of system second flow was posted:
    flow2) 4.000.000PLN    -> 4.000.000PLN
    Could you help me
    *PLN is local currency

    Hi,
    to avoid inconsistencies, the system posts all flows in position currency and, if necessary, the amount in local currency is recalculated with rates to the posting date. If you would like to keep the same rate, then in the transaction you should also fix the rate for the PLN flow.
    Regards,
    Tomislav

  • Difference between GR IR amount in local currency

    Hi all,
    I hav created one PO in foreign currency for 10 items. GR is happening for all 10 lines with rate say Rs 50. Now when i am doing MIRO with same rate i.e. Rs 50, 8 materials are getting posted correctly. But for 2 materials there is inventory posting for fixed amount (in local currency) irrespective of quantty.this case amount in foreign currency is same but dieefernce for GR/IR account is in local currency.
    When line items analysed it was observed that fo these 2 materials exchange rate picked up is different than header exchange rate. the difference in exchange rate is posted to stock account.
    In short system icking differen xchange rate for different line items for one invoice ( MIRO is happening against only one invoice)
    Can any one please explai this phenomena and any solution for this?
    thanks

    Hi
    Header exchange rate picked up at time of PO creation with reference to document date in header.
    If you fix exchange rate then it will be same for all items in purchase order.
    In your case if exchange rate is different then check whether you have done goods receipt in two lots (say 8 items first and then 2 items) with different posting dates. Check accounting documents generated and in that document check translation dates for checking exchange rate in OB08 transaction.
    And in invoice what is the currency you are using - if you do not use any special currency (foreign) then PO currency will be picked up. If exchange rate fixed indicator is not there in PO - depending upon system baseline date (posting date) exchange rate will be coming.
    Thanks

  • Amount in local currency for GRs

    Hello gurus,
    can anyone please explain to me this phenomenon:
    We have got a PO for 10 pieces of a material. The price is $7,40 per 10 pieces, so $7,40 total.
    Someone posted a goods receipt for 7 pieces. For whatever reason the amount in local currency (Amount in LC) for that GR is $6,17.
    Later, this GR was reversed using movement type 122 and a new GR for 10 pieces was posted. This time, the Amount in LC is $15,66.
    Can someone please explain to me where those values come from? I cannot change the price in MIGO, can I? And if I cannot, how does the system calculate those values?
    The problem is that now there is a difference between GR and invoice (correct price = $ 7,73)...
    Thanks
    Alicia

    Hi
    The problem is due to non sequential operation.
    Generally,
    Step 1: When GR is done after P.O , system will pick the price of P.O and Post.
    Inventory (Dr)  and GR/IR ( Cr.)
    Step 2 : If the IR is done after P.O and latter GR, then IR price take precedence over the P.O price.
    Step 3 : If there is no stock and Partial IR is done after P.O , tehn while GR system will take partial value from P.O and Partial from P.O
    In this case.
    PO: 10 pcs., $7,40 : Unit Price is .74$
    GR (101): 7 pcs., $6,17 (incl. VAT) : Base Price 5.18 + 0.99 = 6.17$
    GR (122): -7 pcs., $6,17 (goods return)
    Till now it is o.k
    Now : IR: 1 pc., $ 7,73 (wrong IR, 1 pc instead of 10) : Unit price is 7.73$.
    GR (101): 10 pcs., = 1 pc. price from IR ( 7.73) + 9*(.86) = 15.47$
    *0.86 : refers to the P.O value inclusive of Tax ( assuming the Tax as 16.04)
    The problem in such cases is due to in appropriate GR/IR entry .
    Solution : Always Can cell all the documents last come first basis then post the document one by one.
    Solution 2 : Do clear the GR/IR account through Manual JV from FI module and Change the price by MR21 entry.

  • Goods Receipt Amount based on PO price instead of moveing average price

    Is it possible to customise SAP so that the amount in Goods Receipt transactions is calculated based on quantity * PO price instead of quantity * moving average price?
    Thanks.

    Thanks for your reply.
    Standard SAP functionality:
    1. When material ledger is active, the GR amount is based on pre-GR moving average price.
    2. When material ledger is not active, the GR amount is based on PO price.
    We use the material ledger but want the GR transactions to record the amount based on PO price.
    Any suggestions?

  • "Amount in Local Currency" in MIGO

    Hi Experts!
    I want to enter value in  "Amount in Local Currency" field, in MIGO during Goods Receipt against Purchase Order (101 movement type). "Amount in Local Currency" field is not  visible in "Quantity" tab of MIGO during GR. But after GR is posted, in display of material document, it is showing in "Quantity" tab.
    I tried to add this filed to movement type 101 in SPRO-MM-IM-Settings for Enjoy Transactions-Field selection per Mvt type. But there is no provision to add "EXBWR" to 101 Mvt type.
    Can anyone suggest a solution for this.
    Thanks in advance.
    Regards,
    Sree

    Hi Guys,
    Thank you very much for your replies.
    The requirement is during MIGO (101), system should valuate the stocks with a different price other than the PO price. For this purpose, I want to use the filed "Amount in Local currency" in MIGO. If this field is in input mode during MIGO, we can enter the required price and then stocks will be valuated at this price (like in case of mov type 561, we have the same option). Can we get this filed in MIGO in input mode through any configuration or not? If not through configuraton, any Exit/Badi etc ? Kindly suggest the solution.
    Thanks in advance.
    Regards,
    Sree.

Maybe you are looking for

  • Can't connect to Windows 8 or 7 with Lumia 920

    I've tried to connect to both w7 and w8, in the case of w7 the drivers install and the icon for the windows phone is visible under My Computer, but any attempt to interact with it produces an error.  On w8 the new Windows Phone app downloads when the

  • Connection to oracle via php

    hi, I am making a site with a connection to oracle Xe but I am not able to connect me; here script: <?php $user = @$_post['login']; $passwd = @$_post['pass']; $bd = "(DESCRIPTION =(ADDRESS =(PROTOCOL = TCP) (HOST = titanium)(PORT = 1521)) (CONNECT_DA

  • Photos in iPhoto disappeared

    My photos in iPhoto have disappeared.  When attempting to open iPhoto, I get the message to choose a Library.  There is no library to choose.  How do I get my photos back?

  • How do I save files to my computer?

    How do I save a file I created and uploaded to my computer?

  • Burning Multiple Movies to one DVD in Premiere Elements 7.0

    I am compiling a series of movies which I shot of the first year of the lives of my grandchildren. Each is a separate movie, about 10 minutes long. I would like to burn all of them onto one DVD - how can I do that? The burning option seems to be avai