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: 

Routine code

Former Member
0 Kudos

Hello ALL ,

iam working in BW but i need to find out the cause of error because of abap routine can please help me in understanding the code.

iam having below routine between 2 ods(Tables) when i first load data from 1st ODS(Table) to second iam getting wrong value but when i do repair full request iam getting correct value can anybody help me why its happening is it because of below routine.

Points will be assigned for every helpful answer

Main Program

PROGRAM UPDATE_ROUTINE.

$$ begin of global - insert your declaration only below this line -

TABLES: ...

DATA: ...

INCLUDE RS_BCT_MM_UPDATE_RULES.

$$ 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/CS8YO02_SCL

RECORD_NO LIKE SY-TABIX

RECORD_ALL LIKE SY-TABIX

SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS

CHANGING RESULT LIKE /BIC/AYO02_POH00-ORDER_VAL

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

result value of the routine

IF ( COMM_STRUCTURE-PROCESSKEY = '001' or "Bestellung

COMM_STRUCTURE-PROCESSKEY = '011' or

COMM_STRUCTURE-PROCESSKEY = '021' or

COMM_STRUCTURE-PROCESSKEY = '004' or "LP

COMM_STRUCTURE-PROCESSKEY = '014' or

COMM_STRUCTURE-PROCESSKEY = '024' )

AND COMM_STRUCTURE-BWAPPLNM EQ 'MM'

AND COMM_STRUCTURE-ORDER_VAL 0.

PERFORM LOC_CURR_CONVERT

USING COMM_STRUCTURE-ORDER_VAL

COMM_STRUCTURE-DOC_DATE

COMM_STRUCTURE-ORDER_CURR

COMM_STRUCTURE-LOC_CURRCY

COMM_STRUCTURE-EXCHG_RATE

CHANGING RESULT.

if the returncode is not equal zero, the result will not be updated

RETURNCODE = 0.

else.

RETURNCODE = 4.

endif.

if abort is not equal zero, the update process will be canceled

ABORT = 0.

Include program

-


FORM LOC_CURR_CONVERT *

-


........ *

-


--> LC_DOCUMENT_VALUE *

--> LC_DATE *

--> LC_DOCUMENT_CURRENCY *

--> LC_LOCAL_CURRENCYY *

--> LC_RATE *

<-> LC_LOCAL_VALUE *

-


FORM loc_curr_convert

USING lc_document_value

lc_date

lc_document_currency

value(lc_local_currency)

lc_rate

CHANGING lc_local_value.

conversion of lc_rate from floating-point to decimal. Necessary for *

call of CONVERT_TO_LOCAL_CURRENCY.

data lc_rate_dec type p decimals 5.

lc_rate_dec = lc_rate.

IF lc_document_currency = lc_local_currency

no conversion necessary -> Main case 1

AND NOT ( lc_document_currency IS INITIAL

OR lc_local_currency IS INITIAL ) .

lc_local_value = lc_document_value.

ELSEIF NOT ( lc_document_currency IS INITIAL

OR lc_local_currency IS INITIAL OR lc_date IS INITIAL ) .

conversion necessary with lc_date -> Normally not possible

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

date = lc_date

foreign_amount = lc_document_value

foreign_currency = lc_document_currency

local_currency = lc_local_currency

rate = lc_rate_dec

IMPORTING

EXCHANGE_RATE =

local_amount = lc_local_value

EXCEPTIONS

NO_RATE_FOUND = 1

OVERFLOW = 2

NO_FACTORS_FOUND = 3

NO_SPREAD_FOUND = 4

DERIVED_2_TIMES = 5.

IF sy-subrc NE 0.

message a802 with lc_date lc_document_currency lc_local_currency

sy-subrc.

ENDIF.

ELSE.

if conversion not possible -> assign target values

lc_local_value = lc_document_value.

lc_local_currency = lc_document_currency.

ENDIF.

ENDFORM.

Thanks & Regards

3 REPLIES 3

matt
Active Contributor
0 Kudos

What do mean by "wrong value". What is the "right" value. What data are you putting in? What data do you expect out?

matt

Former Member
0 Kudos

iam value coming from R/3 24,795.23 gbp for odervalue but iam getting -4600.68 but it should be same as R/3.

Thankyou

Priya

Former Member
0 Kudos

problem solved