Application Development 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: 

URGENT : CONVERT_TO_LOCAL_CURRENCY

Former Member
0 Kudos
157

Hi Experts,

while using the function module CONVERT_TO_LOCAL_CURRENCY in the report.

when executing the report it showing the error

the error is showing in popup like this

Translation Result

101,913,673,676,50 USD is too long ..

please kindly do favor for me ...

programm.......

TABLES: zzsvendor, zzaddress, zzkioskact, zwf_upi, zzcnames,

t005, t005s, lfa1, t024e, zzfinsum, zzinsur, t059q, bnka, ekpo,t023t,

adrc, adr6.

DATA: BEGIN OF lt_summary OCCURS 0,

appno TYPE zzsvendor-appno,

vendor TYPE zzsvendor-vendor,

vendorname TYPE lfa1-name1,

reqdt TYPE zzkioskact-reqdt,

ismbe TYPE zzsvendor-ismbe,

iswbe TYPE zzsvendor-iswbe,

isdbe TYPE zzsvendor-isdbe,

street TYPE adrc-street,

str_suppl3 TYPE adrc-str_suppl3,

city1 TYPE adrc-city1,

city2 TYPE adrc-city2,

region TYPE adrc-region,

post_code1 TYPE adrc-post_code1,

country TYPE adrc-country,

tel_number TYPE adrc-tel_number,

fax_number TYPE adrc-fax_number,

smtp_addr TYPE adr6-smtp_addr,

pcat1 TYPE zzsvendor-pcat1,

pcat2 TYPE zzsvendor-pcat2,

pcat3 TYPE zzsvendor-pcat3,

po TYPE ekko-konnr,

povalue TYPE ekpo-netwr,

END OF lt_summary.

DATA: BEGIN OF lt_zzsvendor OCCURS 0,

appno TYPE zzsvendor-appno,

vendor TYPE zzsvendor-vendor,

vendorname TYPE lfa1-name1,

ismbe TYPE zzsvendor-ismbe,

iswbe TYPE zzsvendor-iswbe,

isdbe TYPE zzsvendor-isdbe,

pcat1 TYPE zzsvendor-pcat1,

pcat2 TYPE zzsvendor-pcat2,

pcat3 TYPE zzsvendor-pcat3,

END OF lt_zzsvendor.

DATA: lt_zzkioskact LIKE zzkioskact OCCURS 0 WITH HEADER LINE,

*Begin of changes by wb328936

lt_ekko LIKE ekko OCCURS 0 WITH HEADER LINE,

lt_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF mlist,

appno TYPE zzsvendor-appno,

vendor TYPE zzsvendor-vendor,

vendorname TYPE lfa1-name1,

reqdt TYPE zzkioskact-reqdt,

ismbe TYPE zzsvendor-ismbe,

iswbe TYPE zzsvendor-iswbe,

isdbe TYPE zzsvendor-isdbe,

street TYPE adrc-street,

str_suppl3 TYPE adrc-str_suppl3,

city1 TYPE adrc-city1,

city2 TYPE adrc-city2,

region TYPE adrc-region,

post_code1 TYPE adrc-post_code1,

country TYPE adrc-country,

tel_number TYPE adrc-tel_number,

fax_number TYPE adrc-fax_number,

smtp_addr TYPE adr6-smtp_addr,

pcat1 TYPE zzsvendor-pcat1,

pcat2 TYPE zzsvendor-pcat2,

pcat3 TYPE zzsvendor-pcat3,

po TYPE ekko-konnr,

          • povalue TYPE ekko-rlwrt,

povalue TYPE ekpo-netwr,

*End of changes by wb328936

END OF mlist,

mtlist LIKE mlist OCCURS 0.

DATA: lv_name1 TYPE lfa1-name1,

lv_adrnr TYPE lfa1-adrnr,

lv_email TYPE adr6-smtp_addr,

lv_street TYPE adrc-street,

lv_str_suppl3 TYPE adrc-str_suppl3,

lv_city1 TYPE adrc-city1,

lv_city2 TYPE adrc-city2,

lv_region TYPE adrc-region,

lv_post_code1 TYPE adrc-post_code1,

lv_country TYPE adrc-country,

lv_tel_number TYPE adrc-tel_number,

lv_fax_number TYPE adrc-fax_number,

delimiter(1) VALUE ' ',

lv_matg_code1 TYPE zzsvendor-pcat1,

lv_matg_name1 TYPE zzsvendor-pcat1,

lv_matg_code2 TYPE zzsvendor-pcat1,

lv_matg_name2 TYPE zzsvendor-pcat1,

lv_matg_code3 TYPE zzsvendor-pcat1,

lv_matg_name3 TYPE zzsvendor-pcat1,

lv_desc1 TYPE t023t-wgbez60,

lv_desc2 TYPE t023t-wgbez60,

lv_desc3 TYPE t023t-wgbez60,

lv_pcat1 TYPE zzpcat,

lv_pcat2 TYPE zzpcat,

lv_pcat3 TYPE zzpcat,

lv_count TYPE i,

          • lv_amt TYPE ekko-rlwrt.

lv_total_amt TYPE ekpo-netwr,

lv_amt TYPE ekpo-netwr.

*End of changes by wb328936

****************************

SELECTION-SCREEN BEGIN OF BLOCK date WITH FRAME TITLE text-023.

SELECT-OPTIONS s_date FOR zzkioskact-reqdt.

SELECTION-SCREEN END OF BLOCK date.

    • Checkboxes for MBE, WBE, and DBE status

SELECTION-SCREEN BEGIN OF BLOCK status WITH FRAME TITLE text-024.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETER p_mbe AS CHECKBOX.

SELECTION-SCREEN COMMENT (31) text-080 .

PARAMETER p_wbe AS CHECKBOX.

SELECTION-SCREEN COMMENT (28) text-081.

PARAMETER p_dbe AS CHECKBOX.

SELECTION-SCREEN COMMENT (31) text-082 .

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK status.

SELECTION-SCREEN BEGIN OF BLOCK appno WITH FRAME TITLE text-025.

SELECT-OPTIONS s_appno FOR zzsvendor-appno MATCHCODE OBJECT zapp.

SELECTION-SCREEN END OF BLOCK appno.

SELECTION-SCREEN BEGIN OF BLOCK vendor WITH FRAME TITLE text-011.

SELECT-OPTIONS s_vendor FOR zzsvendor-vendor MATCHCODE OBJECT zven.

SELECTION-SCREEN END OF BLOCK vendor.

Material Group

SELECTION-SCREEN BEGIN OF BLOCK matgroup WITH FRAME TITLE text-083.

SELECT-OPTIONS s_matgrp FOR zzsvendor-pcat1.

SELECTION-SCREEN END OF BLOCK matgroup.

*Begin of changes by wb328936

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN POSITION 12.

PARAMETER p_pos AS CHECKBOX.

SELECTION-SCREEN COMMENT 2(10) text-102.

SELECTION-SCREEN END OF LINE.

INCLUDE zalv_selection.

*

START-OF-SELECTION.

IF p_mbe IS INITIAL AND p_wbe IS INITIAL AND p_dbe IS INITIAL.

SELECT appno vendor ismbe iswbe isdbe pcat1 pcat2 pcat3

INTO CORRESPONDING FIELDS OF TABLE lt_zzsvendor

FROM zzsvendor

WHERE vendor IN s_vendor AND

appno IN s_appno.

ENDIF.

IF p_mbe IS NOT INITIAL AND p_wbe IS INITIAL AND p_dbe IS INITIAL.

SELECT appno vendor ismbe iswbe isdbe pcat1 pcat2 pcat3

INTO CORRESPONDING FIELDS OF TABLE lt_zzsvendor

FROM zzsvendor

WHERE ismbe EQ p_mbe AND

vendor IN s_vendor AND

appno IN s_appno.

ENDIF.

IF p_mbe IS NOT INITIAL AND p_wbe IS NOT INITIAL AND p_dbe IS INITIAL.

SELECT appno vendor ismbe iswbe isdbe pcat1 pcat2 pcat3

INTO CORRESPONDING FIELDS OF TABLE lt_zzsvendor

FROM zzsvendor

WHERE ( ismbe EQ p_mbe OR iswbe EQ p_wbe ) AND

vendor IN s_vendor AND

appno IN s_appno.

ENDIF.

IF p_mbe IS NOT INITIAL AND p_wbe IS NOT INITIAL AND

p_dbe IS NOT INITIAL.

SELECT appno vendor ismbe iswbe isdbe pcat1 pcat2 pcat3

INTO CORRESPONDING FIELDS OF TABLE lt_zzsvendor

FROM zzsvendor

WHERE ( ismbe EQ p_mbe OR iswbe EQ p_wbe OR isdbe EQ p_dbe ) AND

vendor IN s_vendor AND

appno IN s_appno.

ENDIF.

IF p_mbe IS INITIAL AND p_wbe IS INITIAL AND

p_dbe IS NOT INITIAL.

SELECT appno vendor ismbe iswbe isdbe pcat1 pcat2 pcat3

INTO CORRESPONDING FIELDS OF TABLE lt_zzsvendor

FROM zzsvendor

WHERE ( isdbe EQ p_dbe ) AND

vendor IN s_vendor AND

appno IN s_appno.

ENDIF.

IF p_mbe IS INITIAL AND p_wbe IS NOT INITIAL AND

p_dbe IS NOT INITIAL.

SELECT appno vendor ismbe iswbe isdbe pcat1 pcat2 pcat3

INTO CORRESPONDING FIELDS OF TABLE lt_zzsvendor

FROM zzsvendor

WHERE ( iswbe EQ p_wbe OR isdbe EQ p_dbe ) AND

vendor IN s_vendor AND

appno IN s_appno.

ENDIF.

IF p_mbe IS INITIAL AND p_wbe IS NOT INITIAL AND

p_dbe IS INITIAL.

SELECT appno vendor ismbe iswbe isdbe pcat1 pcat2 pcat3

INTO CORRESPONDING FIELDS OF TABLE lt_zzsvendor

FROM zzsvendor

WHERE iswbe EQ p_wbe AND

vendor IN s_vendor AND

appno IN s_appno.

ENDIF.

IF p_mbe IS NOT INITIAL AND p_wbe IS INITIAL AND

p_dbe IS NOT INITIAL.

SELECT appno vendor ismbe iswbe isdbe pcat1 pcat2 pcat3

INTO CORRESPONDING FIELDS OF TABLE lt_zzsvendor

FROM zzsvendor

WHERE ( ismbe EQ p_mbe OR isdbe EQ p_dbe ) AND

vendor IN s_vendor AND

appno IN s_appno.

ENDIF.

REFRESH lt_summary.

LOOP AT lt_zzsvendor.

SELECT * FROM zzkioskact WHERE appno = lt_zzsvendor-appno

AND srno = '0000000001'.

ENDSELECT.

IF p_pos EQ 'X'.

CLEAR : lt_ekko, lt_ekpo, lv_count, lv_amt, lv_total_amt.

REFRESH : lt_ekko, lt_ekpo.

SELECT * FROM ekko INTO TABLE lt_ekko WHERE lifnr = lt_zzsvendor-vendor.

DESCRIBE TABLE lt_ekko LINES lv_count.

IF lv_count = 0.

lv_total_amt = 0.

ELSE.

LOOP AT lt_ekko.

SELECT * FROM ekpo INTO TABLE lt_ekpo WHERE ebeln = lt_ekko-ebeln.

LOOP AT lt_ekpo.

lv_total_amt = lv_total_amt + lt_ekpo-netwr.

ENDLOOP.

IF lt_ekko-waers <> 'USD'.

CLEAR lv_amt.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

CLIENT = SY-MANDT

DATE = SY-DATUM

FOREIGN_AMOUNT = lv_total_amt

FOREIGN_CURRENCY = lt_ekko-waers

LOCAL_CURRENCY = 'USD'

  • RATE = 0

TYPE_OF_RATE = 'M'

  • READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE =

  • FOREIGN_FACTOR =

LOCAL_AMOUNT = lv_amt

  • LOCAL_FACTOR =

  • EXCHANGE_RATEX =

  • FIXED_RATE =

  • DERIVED_RATE_TYPE =

  • EXCEPTIONS

  • NO_RATE_FOUND = 1

  • OVERFLOW = 2

  • NO_FACTORS_FOUND = 3

  • NO_SPREAD_FOUND = 4

  • DERIVED_2_TIMES = 5

  • OTHERS = 6

.

IF SY-SUBRC = 0.

lv_total_amt = lv_amt.

ELSE.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

IF zzkioskact-reqdt IN s_date.

SPLIT lt_zzsvendor-pcat1 AT delimiter

INTO lv_matg_code1 lv_matg_name1.

SPLIT lt_zzsvendor-pcat2 AT delimiter

INTO lv_matg_code2 lv_matg_name2.

SPLIT lt_zzsvendor-pcat3 AT delimiter

INTO lv_matg_code3 lv_matg_name3.

CLEAR : lv_desc1,lv_desc2,lv_desc3,lv_pcat1,lv_pcat2,lv_pcat3.

SELECT SINGLE wgbez60 FROM t023t INTO lv_desc1

WHERE spras = 'E'

AND matkl = lv_matg_code1.

IF sy-subrc EQ 0.

CONCATENATE lv_matg_code1 lv_desc1 INTO lv_pcat1 SEPARATED BY '-'.

ENDIF.

SELECT SINGLE wgbez60 FROM t023t INTO lv_desc2

WHERE spras = 'E'

AND matkl = lv_matg_code2.

IF sy-subrc EQ 0.

CONCATENATE lv_matg_code2 lv_desc2 INTO lv_pcat2 SEPARATED BY '-'.

ENDIF.

SELECT SINGLE wgbez60 FROM t023t INTO lv_desc3

WHERE spras = 'E'

AND matkl = lv_matg_code3.

IF sy-subrc EQ 0.

CONCATENATE lv_matg_code3 lv_desc3 INTO lv_pcat3 SEPARATED BY '-'.

ENDIF.

IF ( lv_matg_code1 IN s_matgrp OR

lv_matg_code2 IN s_matgrp OR

lv_matg_code3 IN s_matgrp ).

MOVE: zzkioskact-reqdt TO lt_summary-reqdt,

lt_zzsvendor-appno TO lt_summary-appno,

lt_zzsvendor-vendor TO lt_summary-vendor,

lt_zzsvendor-ismbe TO lt_summary-ismbe,

lt_zzsvendor-iswbe TO lt_summary-iswbe,

lt_zzsvendor-isdbe TO lt_summary-isdbe,

lv_pcat1 TO lt_summary-pcat1,

lv_pcat2 TO lt_summary-pcat2,

lv_pcat3 TO lt_summary-pcat3.

CLEAR: lv_name1,

lv_adrnr,

lv_street,

lv_str_suppl3,

lv_city1,

lv_city2,

lv_region,

lv_post_code1,

lv_country,

lv_tel_number,

lv_fax_number,

lv_email.

SELECT name1 adrnr

INTO (lv_name1, lv_adrnr)

FROM lfa1

WHERE lifnr = lt_zzsvendor-vendor.

ENDSELECT.

IF lv_name1 IS NOT INITIAL.

MOVE lv_name1 TO lt_summary-vendorname.

ELSE.

SELECT name1

INTO lv_name1

FROM zzsvendor

WHERE appno = lt_zzsvendor-appno.

MOVE lv_name1 TO lt_summary-vendorname.

ENDSELECT.

ENDIF.

IF lv_adrnr IS NOT INITIAL.

SELECT smtp_addr

INTO lv_email

FROM adr6

WHERE addrnumber = lv_adrnr AND

flgdefault = 'X'.

MOVE lv_email TO lt_summary-smtp_addr.

ENDSELECT.

SELECT street str_suppl3 city1 city2 region post_code1 country

tel_number fax_number

INTO (lv_street,lv_str_suppl3, lv_city1, lv_city2,

lv_region, lv_post_code1, lv_country, lv_tel_number,

lv_fax_number)

FROM adrc

WHERE addrnumber = lv_adrnr.

MOVE lv_street TO lt_summary-street.

MOVE lv_str_suppl3 TO lt_summary-str_suppl3.

MOVE lv_city1 TO lt_summary-city1.

MOVE lv_city2 TO lt_summary-city2.

MOVE lv_region TO lt_summary-region.

MOVE lv_post_code1 TO lt_summary-post_code1.

MOVE lv_country TO lt_summary-country.

MOVE lv_tel_number TO lt_summary-tel_number.

MOVE lv_fax_number TO lt_summary-fax_number.

ENDSELECT.

ELSE. "No Vendor Number for this Application

SELECT cemail

INTO lv_email

FROM zzsvendor

WHERE appno = lt_zzsvendor-appno.

MOVE lv_email TO lt_summary-smtp_addr.

ENDSELECT.

ENDIF.

SELECT stras str_suppl3 ort01 non_us_regio regio pstlz

land1 telf1 telfx

INTO (lv_street,lv_str_suppl3, lv_city1, lv_city2,

lv_region, lv_post_code1, lv_country, lv_tel_number,

lv_fax_number)

FROM zzaddress

WHERE appno = lt_zzsvendor-appno AND

adrnr = '1'.

MOVE lv_street TO lt_summary-street.

MOVE lv_str_suppl3 TO lt_summary-str_suppl3.

MOVE lv_city1 TO lt_summary-city1.

MOVE lv_city2 TO lt_summary-city2.

MOVE lv_region TO lt_summary-region.

MOVE lv_post_code1 TO lt_summary-post_code1.

MOVE lv_country TO lt_summary-country.

MOVE lv_tel_number TO lt_summary-tel_number.

MOVE lv_fax_number TO lt_summary-fax_number.

ENDSELECT.

*Begin of changes by wb328936

MOVE lv_count TO lt_summary-po.

MOVE lv_total_amt TO lt_summary-povalue.

*End of changes by wb328936

APPEND lt_summary.

CLEAR lt_summary.

ENDIF.

ENDIF.

ENDLOOP.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
100

Hi,

Try by clearing the variable 'lv_total_amt' after calling the function module 'CONVERT_TO_LOCAL_CURRENCY'.

Regards,

Aravind JM.

3 REPLIES 3

Former Member
0 Kudos
100

In Debug mode check the value foreign currency value you pass to the FM and the conversion rate too.

if the amount length is too long if there is some mismatch correct th same.

Hope this helps you.

Thanks,

Arun

Former Member
0 Kudos
101

Hi,

Try by clearing the variable 'lv_total_amt' after calling the function module 'CONVERT_TO_LOCAL_CURRENCY'.

Regards,

Aravind JM.

Former Member
0 Kudos
100

Hi Nagendra,

The variable lv_amt which you are importing from the FM Convert_To_Local_Currency is of type

Ekpo-Netwr and this field is of length 13(2) i.e 13 digits with 2 decimal places and for the value you pass to this Fm its returning a value into lv_amt which is of more length than 13(2).

So declare lv_amt as type P decimals 2 and then run your program.

My suggestion is that you increase the length of lv_amt by declaring it and not by giving it as type of Ekpo-Netwr and if you want it to be as Type of Ekpo-Netwr then pass a suitable value to FM so that it returns a value within the range of 13(2).

Hope this will help you.

Reward if useful.

With regards,

Syed