‎2007 Nov 27 4:44 PM
Hi,
I have a report that I am making that I am stuck on. I have to select a date range, sales org, and currency to view the report in. I have coded it and it looks right to me, but I don't get the correct results. In stead i get a message after the inputs that says "Enter rate / USD rate type M for 27.11.2007 in the system settings"
where usd is the user input currency and 27.11.2007 is the second range of the input date.
Here is my code:
&----
*& Report ZDCA01FN2 *
*& *
&----
*& *
*& *
&----
REPORT ZDCA01FN2 MESSAGE-ID ZD01.
*create type with wanted fields
TYPES: BEGIN OF VBRK_TYP,
SORG TYPE VBRK-VKORG,
TAX_AMT TYPE VBRK-MWSBK,
CURRENCY TYPE VBRK-WAERK,
SDATE TYPE VBRK-ERDAT,
END OF VBRK_TYP.
DATA: WA_DVBRK TYPE VBRK_TYP,
ITAB_VBRK TYPE STANDARD TABLE OF VBRK_TYP,
LOCAL_AMOUNT TYPE VBRK-MWSBK.
*select range of dates
SELECT-OPTIONS: PDATE FOR WA_DVBRK-SDATE OBLIGATORY.
*user select currency value use value and sales organization
PARAMETERS: CURRENCY TYPE VBRK-WAERK OBLIGATORY VALUE CHECK,
SALEORG TYPE VBRK-VKORG OBLIGATORY.
*select all first before function call and collect appropriate fields
*into itable
SELECT * FROM VBRK INTO CORRESPONDING FIELDS OF WA_DVBRK
WHERE VKORG = SALEORG AND
ERDAT IN PDATE.
COLLECT WA_DVBRK INTO ITAB_VBRK.
ENDSELECT.
*error check to see if needed to perform sub & function
IF SY-SUBRC NE 0.
MESSAGE A000.
EXIT.
ELSE.
PERFORM SUB_WRITE.
ENDIF.
FORM SUB_WRITE.
DATA: TOTAL_SALES TYPE VBRK-MWSBK,
MISSING_RATE TYPE I VALUE '5'.
LOOP AT ITAB_VBRK INTO WA_DVBRK.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
DATE = SYST-DATUM
FOREIGN_AMOUNT = WA_DVBRK-TAX_AMT
FOREIGN_CURRENCY = WA_DVBRK-CURRENCY
LOCAL_CURRENCY = CURRENCY
RATE = 0
TYPE_OF_RATE = 'M'
IMPORTING
LOCAL_AMOUNT = LOCAL_AMOUNT
EXCEPTIONS
MISSING_RATE = 5.
*check to see if conversion worked
IF SYST-SUBRC = MISSING_RATE.
MESSAGE A000.
*output report records
ELSE.
WRITE: /10 WA_DVBRK-SORG,
20 WA_DVBRK-CURRENCY,
20 WA_DVBRK-SDATE,
30 WA_DVBRK-TAX_AMT.
*add total sales for report
TOTAL_SALES = LOCAL_AMOUNT + TOTAL_SALES.
ENDIF.
ENDLOOP.
SKIP 4.
*write added total sales
WRITE: / TEXT-004,
TOTAL_SALES,
TEXT-005,
CURRENCY.
*FOOTER
SKIP 1.
ULINE: /02(70).
WRITE: /15 TEXT-001, SY-UNAME.
WRITE: /15 TEXT-002, SY-DATUM.
WRITE: /15 TEXT-003, SY-UZEIT.
ENDFORM.
Thanks for the help
‎2007 Nov 28 11:27 AM
Dear David,
It appears that configuration is missing for currency USD.
Consult your functional consultant to resolve the same.
In IMG (Transaction SPRO) under
SAP Netweaver -> General Settings -> Currencies -> Check Exchange Rate Types
SAP Netweaver -> General Settings -> Currencies -> Enter Exchange Rates
Regards,
Naveen.
‎2007 Nov 28 11:27 AM
Dear David,
It appears that configuration is missing for currency USD.
Consult your functional consultant to resolve the same.
In IMG (Transaction SPRO) under
SAP Netweaver -> General Settings -> Currencies -> Check Exchange Rate Types
SAP Netweaver -> General Settings -> Currencies -> Enter Exchange Rates
Regards,
Naveen.