Exchange Rate: Routine to copy  the "Exchange Rate" value From TCURR table

Dear experts,
I have created a cutomised Key Figure (ZEXCHRATE) with the 0currency as the unit and this field is included in my ZCOPA_C21 Infocube.
In the update rule, it was then appointed with a simple routine below;
(PROGRAM UPDATE_ROUTINE.
$$ begin of global - insert your declaration only below this line  -
TABLES: TCURR.
DATA: IT_TCURT Type TCURR occurs 0 with header line.
$$ end of global - insert your declaration only before this line   -
FORM compute_data_field
  TABLES   MONITOR STRUCTURE RSMONITOR "user defined monitoring
  USING    COMM_STRUCTURE LIKE /BIC/CSZCOPA_TPL_IS
           RECORD_NO LIKE SY-TABIX
           RECORD_ALL LIKE SY-TABIX
           SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS
  CHANGING RESULT LIKE /BIC/VZCOPA_C21T-/BIC/ZEXCHRATE
           RETURNCODE LIKE SY-SUBRC
           ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update
$$ begin of routine - insert your code only below this line        -
fill the internal table "MONITOR", to make monitor entries
  SELECT        * FROM  TCURR appending corresponding fields of table
  IT_TCURT
         WHERE  KURST  = 'M'
         AND    FCURR  = 'USD'
         AND    TCURR  = 'IDR'.
      AND    GDATU  = ___.
      AND    UKURS  = ___.
  Sort IT_TCURT by GDATU descending.
  Loop at IT_TCURT.
    Move IT_TCURT-UKURS to RESULT.
    Exit.
  Endloop.
result value of the routine
RESULT = space.
if the returncode is not equal zero, the result will not be updated
  RETURNCODE = 0.
if abort is not equal zero, the update process will be canceled
  ABORT = 0.
$$ end of routine)
Which will basically copy all the contents of TCURR into an internal table (IT_TCURT), sort it and then only copy out the UKURS (Exchange rate) data into the customised ZEXCHRATE to get the latest exchange rate value.
Routine was checked and its fine.
The problem is, upon checking the update rule, it returned an error message;
"No Unit maintain for Key Figure Exchange Rate Local".
Double checked the declaration of ZEXCHRATE, the unit was there.
My questions;
1. Is this the correct way of doing it ? I just want to be able to show the exchange rate value in my query (hence the existence of ZEXCHRATE).
2. Is there an alternative way of achieving the same result ?
Your help or advice will be greatly appreciated.
Thanks
KG

Hi Sreeni,
Referring to the " but the conversion from VEF to USD is happening at a rate @0.23256 which is valid till 02/13/2013 only" part in your post, the date given in OB08 for currency rate is valid from and not valid till.  Hence, please check the setting once.  Once you enter the rate from 02/13/2013, the rate is valid till you enter another date later than 02/13/2013.
Regards,

Similar Messages

  • How to return the same SUM value from two tables

    Hello,
    I have the following data:
    SQL> SELECT * FROM t1;
         T1_ID   T1_VALUE
             1        500
             1        500
    SQL> SELECT * FROM t2;
         T2_ID   T2_VALUE
             1       1000
    SQL> SELECT t1_id, SUM(t1_value), SUM(t2_value)
      2    FROM t1, t2
      3   WHERE t1_id = t2_id
      4   GROUP BY t1_id;
         T1_ID SUM(T1_VALUE) SUM(T2_VALUE)
             1          1000          2000How is it possible that SUM(T2_VALUE) returns also 1000.
    Thank you

    Here's one way:
    with t1 as (select 1 t1_id, 500 t1_value from dual union all
                select 1 t1_id, 500 t1_value from dual),
         t2 as (select 1 t2_id, 1000 t2_value from dual)
    select t3.t3_id, t3.t3_sum, t4.t4_sum
    from   (select t1_id t3_id, sum(t1_value) t3_sum from t1
            group by t1_id) t3,
           (select t2_id t4_id, sum(t2_value) t4_sum from t2
            group by t2_id) t4
    where  t3.t3_id = t4.t4_id

  • Exch.Rate Type for Determining the Proposed Rate

    Dears,
    I defined, in the document type to be used for Goods Receipt, the field T003-KURST (Exch.Rate Type for Determining the Proposed Rate) equal to u2018Pu2019: exchange rate type used also for standard translation for cost planning.
    Then, I created a Purchase Order using a vendor in foreign currency, and in the header section within tab u2018Delivery/Invoiceu2019 in field "Exchange Rate" I filled in the exchange rate valid at the moment of the Purchase Order creation and I also put the flag in the indicator "Fixing of Exchange Rate".
    Afterwards, I posted  the Goods Receipt against the Purchase Order created at the previous step.
    My expectations were to find in FI accounting:
    - 1 line item for stock increase (transaction BSX) valuated using the exchange rate defined in the document type in field T003-KURST;
    - 1 line item for GR/IR increase (transaction WRX) valuated using the exchange rate defined in the Purchase Order and indicated as fixed;
    - 1 line item for difference (transaction PRD) between stock and GR/IR.
    but when I checked the accounting document, these my expectations were not met, because:
    - the line item for stock increase (transaction BSX) has not been valuated using the exchange rate defined in the document type in field T003-KURST, but a differet exchange rate that I didnu2019t find defined for this couple of currencies;
    - the line for GR/IR increase (transaction WRX) has been valuated as expected using the exchange rate defined in the Purchase Order and indicated as fixed;
    - the line item for difference (transaction PRD) between stock and GR/IR has been created.
    The help (F1) for field T003-KURST, show the following indication:
    Exch.Rate Type for Determining the Proposed Rate
        Rate type under which the proposed rate is defined for foreign currency documents.
    Use
        If no exchange rate is specified in the document header when entering documents in foreign currencies, the system will automatically select a rate from the currency translation rate table.  The system then converts all amounts in the document's line items using this exchange rate.
        The system uses the average rate as a default value as long as no other exchange rate type is entered here.
    Based on this message, my expectation is that all documentu2019s line items have to be converted at the exchange rate type defined in field T003-KURST. And in the case mentioned above, the line for stock (BSX) should be converted at exchange rate type defined in field T003-KURST.
    While, correctly, the line for GR/IR (WRX) has been converted at the exchanged rate fixed in the purchase order.
    Can you please let me know how can be fixed the problem for the line related to the stock allowing the conversion using the exchange rate type defined in field T003-KURST?
    Thanks and Regards,
    Jody

    Hello Jody,
    kindly consider the information contained under the attached note:
    191927 - Posting logic: GR for foreign currency PO.
    As stated in it:
    Postings to the material stock account (BSX):
    In order to be able to determine the value of the stock posting, the
    valuation methods which exist in the material master in local currency
    (standard price, total value of stock) must be converted into document
    currency. This translation is thus carried out on the posting date with
    the exchange rate type that is assigned to the FI document type used,
    that is, independent from the exchange rate defined in the purchase
    order!
    If no exchange rate type is assigned to an FI document type, the system
    uses exchange rate type M.
    Please, check in your system the settings stored in the customizing
    transaction OBF4 for the document type WE (Goods receipt). If the field
    'Exch.Rate Type for foreign currency documents' is empty, the exchange
    rate type M is used.
    The fixed conversion rate in the purchase order refers to the valuation
    approach in the purchase order and, therefore, to the costs for the
    purchased material. Therefore, the posting amount to the GR/IR clearing
    account (WRX) is converted according to the fixed conversion rate in the
    purchase order header.
    On the other side the fixed conversion rate in the purchase order is not
    designed for converting the posting values to the material stock account
    (BSX). This conversion reflects the situation of the valuation of the
    material stock and is therefore designed to be independent of the
    conversion rate defined in the purchase order. This is what note 191927
    outlines.
    In the note 191927 you will also locate relevant information about the
    postings to the KDM key:
    Exchange rate differences (KDM):
    As of Release 4.0A, exchange rate differences (KDM) can be posted to a
    separate account. The exchange rate differences result from the
    difference of the clearing value on the GR/IR clearing account (WRX) in
    document currency that is translated to the current exchange rate stored
    in the system in local currency from the clearing value in local
    currency that is determined with the conversion factor from the purchase
    order or the invoices.
    The offsetting entry for the exchange rate differences is settled with
    the price difference.
    (Price difference = GR/IR amount - stock value - exchange rate
    difference)
    KDM is only posted during the GR if the flag T169P-XPLCU is initial,
    therefore, KDM postings will not occur during incoming invoices.
    This is determined in the IMG path:
    Materials Management
    -> Logistics Invoice Verification
       -> Incoming Invoice
          -> Configure How Exchange Rate Differences Are Treated
    Here, you have the following options per Company Code:
    .- The exchange rate differences will be calculated from the difference
       between the exchange rate at the time of the goods receipt and the
       exchange rate at the time of the invoice receipt.
    .- The exchange rate differences will be calculated from the difference
       between the exchange rate at the time of the invoice receipt and an
       assumed exchange rate that is valid for a specific amount of time,
       such as a year or a season.
    .- No exchange rate differences will be calculated. Instead, differences
       from exchange rate variations will be considered as price differences
       and posted to a price difference account.
    The field T001A-CURDT for the company code will determine which date is
    relevant to calculate the exchange rate difference.
    This is set under the IMG path:
    Financial Accounting
    -> Financial Accounting Global Settings
       -> Company Code
          -> Multiple Currencies
             -> Define Additional Local Currencies
    So, finally, the value for KDM calculates as difference between
    GR/IR amount in local currency - GR/IR amount in foreign
    currency*exchange rate.
    I hope this information can be of help.
    cheers
    ray

  • I paired my old LG phone using bluetooth exchange and uploaded all of the Voice Memo files from it to my macbook and I can't find the file, where would it be located ?

    I paired my old LG phone using bluetooth exchange and uploaded all of the Voice Memo files from it to my macbook and I can't find the file, where would it be located ?

    You cannot update iPhone 4 to IOS 8.1.2, the highest you can update is IOS 7.1.2.
    Unless you've iPhone 4S (looks similar to iPhone 4)

  • I am switching computers. Is there a way to copy the mozilla program file from my old computer and "install" it on my new computer? Or do I need to redo the complette install?

    I have a new computer. Can I copy the mozilla program folder from my old computer to the new or do I need to do anew install from the website? I do know that I can transfer bookmarks and such but what about the entire program?
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C)

    Download CS5 products

  • Can we copy the terms of payment from Purchasing info record in PO instade

    Dear All,
    Can we copy the terms of payment from Purchasing info record in PO instade of Vendor master.
    My requirement is that client want to maintain terms of payment as per Vendor - Material combination in Purchasing info record and same should be appeared while creation of PO.
    I am able to maintain the terms of payment in Pinfo record but same is not getting copied while creation of purchase order thats the issue now.
    I had maintain the terms of payment in condition tab-- addtional data tab but still system is taking the payment terms from vendor master.
    its urgent if u have any solution please help.
    Regards,
    Sunil

    Dear Sir,
    I am able to maintain the terms of payment in Pinfo record but same is not getting copied while purchase order thats the issue now.
    I had maintain the terms of payment in condition tab-- addtional data tab but still system is taking the payment terms from vendor master.
    so please tell me if there is anything we have to do to update the terms of payment from info record not from vendor master.
    VSR is not feasible as no. of record are very much.
    regards,
    umesh

  • Copying the error records in a custom table

    Hi,
    I  have a report program which is fetching Invoice header and line items . I need to copy the error records (records having a custom field ZZKUNNR as blank) in a custom table . I am executing this report in background daily .
    The records in the custom table can be corrected by functional guys
    Daily the report should fetch the data from SAP and also it should check whether there are correct records in the custom table .
    If the records are found from custom table then those records also must be fetched.
    Finally the output is stored in an application server .
    Kindly help how to write the code for error records.

    Hang on a moment here... I am sure we deleted your user ID a few months ago for ponits gaming!
    Did it "pay off" somehow and now you have a "real job" but don't have a clue what you are doing?
    Doesn't that make you feel just a little bit unconfident about life, the universe and ABAP?
    Cheers,
    Julius

  • Why iTunes can't let us copy the songs that is from our iPod to our PC?

    I do not know why iTunes can't let us copy the songs that is from our iPod to our PC.

    They should be in iTunes or on your backup.
    If for some reason they are not on your computer and you have failed to maintain regular backups, see this post by Zevoneer -> http://discussions.apple.com/thread.jspa?messageID=11646661&#11646661

  • When I type fi in InDesign, the f is deleted.  If I hit backspace, the f comes back, but the i is deleted.  I even tried to copy the text I need from Word.  When I paste it, the f is deleted.  I've restarted InDesign and tried a different keyboard.

    When I type fi in InDesign, the f is deleted.  If I hit backspace, the f comes back, but the i is deleted.  I even tried to copy the text I need from Word.  When I paste it, the f is deleted.  I've restarted InDesign and tried a different keyboard.

    Try turning off Ligatures in your style.

  • Synchronized my iPhone 3G 8G to copy the contacts and calendars from Outlook, I wonder if I can do the same synchronization to copy the same data from Gmail

    Synchronized my iPhone 3G 8G to copy the contacts and calendars from Outlook, I wonder if I can do the same synchronization to copy the same data from Gmail ?

    Right, I finally managed to get it sorted out.
    iCloud only accept version 3.0 vcards, and the one I was using were version 2.1 so that's why it wasn't picking it up. So the easy way to get that sorted out is, use a gmail account.
    I know you don't wanna do it because you think it's too much hassle and stuff, but trust me it only takes 5 minutes and that's it.
    1. Create a Gmail Account.
    2. Export your Old VCard files to the Gmail Account.
    3. Now Import them from Gmail to your PC again.
    And, that's it, that's just makes the new imported version in 1 file contains your all contacts in version 3.0. Now you can just upload that on icloud and then sync it with your iphone.
    That's what I did and it worked, and I am sure if you wanna replace this file in the Contacts folder under your User Account in Windows and then try to sync Contacts in Tunes, it should work, but as I said, I did it with iCloud and it worked for me. So aye, that's pretty much it. Phewwww..
    Been searching for it for the whole day and it took 5 minutes in the end, badass...
    Anyway, don't lose hope and always Google for everything!

  • Copy selected values from a table control into another table control

    hi there,
    as seen in the subject i need to copy selected values from a table control into another table control in the same screen. as i dont know much about table controls i made 2 table controls with the wizard and started to change the code... right now im totally messed up. nothing works anymore and i don't know where to start over.
    i looked up the forums and google, but there is nothing to help me with this problem (or i suck in searching the internet for solutions)
    i have 2 buttons. one to push the selected data from the top table control into the bottom tc and the other button is to push selected data from the bottom tc into the top tc. does somebody has a sample code to do this?

    you're funny
    i still don't get it... can't believe, there is no tutorial or sample code around how to copy multiple selected rows from a tc.
    here's my code, maybe you can tell me exactly were i have to change it:
    tc1 = upper table control
    tc2 = lower table control
    SCREEN 0100:
    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
      MODULE get_nfo. --> gets data from the dictionary table
      MODULE tc1_change_tc_attr.
      LOOP AT   it_roles_tc1
           INTO wa_roles_tc1
           WITH CONTROL tc1
           CURSOR tc1-current_line.
      ENDLOOP.
      MODULE tc2_change_tc_attr.
      LOOP AT   it_roles_tc2
           INTO wa_roles_tc2l
           WITH CONTROL tc2
           CURSOR tc2-current_line.
      ENDLOOP.
    PROCESS AFTER INPUT.
      LOOP AT it_roles_tc1.
        CHAIN.
          FIELD wa_roles_tc1-agr_name.
          FIELD wa_roles_tc1-text.
        ENDCHAIN.
        FIELD wa_roles_tc1-mark
          MODULE tc1_mark ON REQUEST.
      ENDLOOP.
      LOOP AT it_roles_tc2.
        CHAIN.
          FIELD wa_roles_tc2-agr_name.
          FIELD wa_roles_tc2-text.
        ENDCHAIN.
        FIELD wa_roles_tc2-mark
          MODULE tc2_mark ON REQUEST.
      ENDLOOP.
      MODULE ok_code.
      MODULE user_command_0100.
    INCLUDE PAI:
    MODULE tc1_mark INPUT.
      IF tc1-line_sel_mode = 2
      AND wa_roles_tc1-mark = 'X'.
        LOOP AT it_roles_tc1 INTO g_tc1_wa2
          WHERE mark = 'X'.    -
    > big problem here is, that no entry has an 'X' there
          g_tc1_wa2-mark = ''.
          MODIFY it_roles_tc1
            FROM g_tc1_wa2
            TRANSPORTING mark.
        ENDLOOP.
      ENDIF.
      MODIFY it_roles_tc1
        FROM wa_roles_tc1
        INDEX tc1-current_line
        TRANSPORTING mark.
    ENDMODULE.                    "TC1_MARK INPUT
    MODULE tc2_mark INPUT.
      IF tc2-line_sel_mode = 2
      AND wa_roles_tc2-mark = 'X'.
        LOOP AT it_roles_tc2 INTO g_tc2_wa2
          WHERE mark = 'X'.             -
    > same here, it doesn't gets any data
          g_tc2_wa2-mark = ''.
          MODIFY it_roles_tc2
            FROM g_tc2_wa2
            TRANSPORTING mark.
        ENDLOOP.
      ENDIF.
      MODIFY it_roles_tc2
        FROM wa_roles_tc2
        INDEX tc2-current_line
        TRANSPORTING mark.
    ENDMODULE. 
    thx for anybody who can help with this!

  • How to retrieve the values from a table if they differ in Unit of Measure

    How to retrieve the values from a table if they differ in Unit of Measure?

    If no data is read
    - Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
    If no quanity in result internal table
    - There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
    - - Remove the CORRESPONDING, so quantity will fill the first field adqntp1.  ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
    - - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
    * Fill the internal table
    SELECT msehi adqntp
      INTO TABLE internal table
      FROM lipso2
      WHERE vbeln = wrk_doc1
        AND msehi IN ('KL','K15','MT').
    * If required move the read quantity in the appropriate column.
    LOOP AT internal_table ASSIGNING <fs>.
      CASE <fs>-msehi.
        WHEN 'K15'.
          <fs>-adqnt2 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
        WHEN 'MT'.
          <fs>-adqnt3 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
      ENDCASE.
    ENDLOOP.
    - You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
    Regards,
    Raymond

  • Fetch the values from internal table inside an internal table (urgent!!)

    data : BEGIN OF PITB2_ZLINFO occurs 0,
             BEGDA LIKE SY-DATUM,
             ENDDA LIKE SY-DATUM,
             PABRJ(4) TYPE N,                       "Payroll Year
             PABRP(2) TYPE N,                       "Pay. Period
             ZL LIKE PC2BF OCCURS 0,
           END OF PITB2_ZLINFO.
    I have a internal table like this,
    How to Fetch the values from internal table inside an internal table.
    Kindly Help me on this..
    Regards,
    Ram.

    Hi,
    Try this....
    Loop at PITB2_ZLINF0.
    Loop at PITB2_ZLINF0-ZL.
    endloop.
    Endloop.
    Thanks...
    Preetham S

  • How to extract the values from WPBP table

    Hi experts,
    We are in preparation of a custom report.
    In the report we want to have a  value from WPBP table.
    We want to extract the value of Capacity utilization level from WPBP table.
    Could you please let me know the way to extract the value.
    Please advice.
    Regards,
    Sairam.

    Hi Sairam,
    Why do you try to get capacity utilization level from WBPB. Even if there is split in payroll capacity utilizatian level in WPBP shows the value in IT0008 basic pay.
    So instead you can get the required information from table PA0008 Field for capacity utilization level is BSGRD
    Regards;
    Okan

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

Maybe you are looking for

  • How to get the Last releaser of PR ?

    Dear Expert, I am working on PR release Workflow.As it is Overall relase so I am using BUS2105. Depending different value and document type differen person is responsible for relasing the PR.I got the requirement that when  the last releasing authori

  • USB speaker used to solve "No Audio Device is Installed" problem...​USB microphone ok too?

    After trying all of the solutions that have been offered for this extremely common problem of losing sound, I purchased USB powered speakers...and they work great. Today I purchased a USB microphone and I can't seem to get that to work properly.  Sho

  • HH3, Mario Kart online, Apple TV and Sony Internet...

    I'm reasonably techy and have tried many of the 'solutions' given to stop Mario Kart online dropping out (none of them worked) and now, I am scared of upgrading my TV to a Sony Internet TV or getting Apple TV since I think my HH3 would not work with

  • I'am looking for Firefox 4 web browser to download.

    I am having trouble with this web site because it has a lot of pop's which my work use's this web base software. And the company said that at this time the web site only supports Firefox 4 or Internet explorer 8. I am trying to download Firefox 4 but

  • Finder Strange Behaviour

    Hello In the last few weeks my Finder has begun behaving strangely. I have two problems with which I would like help. 1. The menu option that allows access to Finder prefs has disappeared from the Finder Menu and I have not downloaded any software th