12-09-2009 11:38 AM
Dear All,
I have to take currency values from flat file and i have to assign those flat file value to function module .
Eg: "Convert_to_local_currency". I need technical code how to calculate those amount in work area and how to assign those amount value function module.
I need sample program for currency conversion from flat file to function module. My requirement is based on flat file amount i have to calculate in work area and assign those work area to function module.
With Regards,
Baskaran
12-09-2009 11:49 AM
Hi,
First get the data into an internal table using GUI_UPLOAD function module & then pass it to the convert function module.
A sample code snippet for you reference :-
*---CONVERT THE GROSS UNIT AMOUNT (RATE) TO DOC CURRENCY
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = ekko-bedat
foreign_currency = konv-waers
local_currency = ekko-waers
foreign_amount = konv-kbetr
type_of_rate = 'M'
IMPORTING
local_amount = tvals-gross.
ENDIF.
Regards
Abhii
12-09-2009 12:20 PM
Hi Satish or Baskaran,
First conform in which format the flat file is present, as abhi mentioned if it is there in notepad
try to use F.M GUI_UPLOAD as shown below...
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\Desktop\rpf1.TXT'
TABLES
DATA_TAB = ITAB.
.
Now loop at ITAB Into Work_area and press the respect currency fields which you want and in the same way
if the file is in EXCEL format use F.M ALSM_EXCEL_TO_INTERNAL_TABLE
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = P_FNAME
i_begin_col = 1
i_begin_row = 1
TABLES
intern = ITAB
.
LOOP AT ITAB INTO WA.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
foreign_currency = wa-waers
local_currency = wa-waers
IMPORTING
local_amount = tvals-gross.
ENDIF.
endloop.
And as mentioned loop the records into work area and process the currenct field which is present in the
ITAB according to its field name. And make sure within the loop you call your function module.
Regards
VEnk@
Edited by: Venkat Reddy on Dec 9, 2009 5:51 PM
12-09-2009 1:24 PM
Dear Vikrant,
I got the answer . Thank you very much..
With Regards,
Baskaran