Skip to Content
0
Former Member
Jul 13, 2006 at 11:14 AM

code check

35 Views

Hi all,

the code below i wrote in update rules for currency conversion.

the code has no syntx errors but raising an exception that source currency is not initialized which is the case statement in the code.

plz could you check the error in the program.

DATA : l_sellp type f,

l_src_cur type RSD_CUKY,

l_trg_cur type RSD_CUKY,

l_time type RSD_CHAVL,

rcurr type RSD_CHAVL.

  • Get target currency

SELECT SINGLE /bic/yrepcurr FROM /bi0/psalesorg INTO

l_trg_cur WHERE salesorg = COMM_STRUCTURE-salesorg and

objvers = 'A'.

  • Reporting currency not found or no translation necessary

CASE COMM_STRUCTURE-/bic/yselprcur. "source currency

WHEN '' OR l_trg_cur .

RESULT = COMM_STRUCTURE-/BIC/YSELPRICE.

WHEN OTHERS.

  • Translate

l_sellp = COMM_STRUCTURE-/bic/yselprice.

l_src_cur = COMM_STRUCTURE-/bic/yselprcur.

l_time = COMM_STRUCTURE-/bic/yperiodfr.

CALL FUNCTION 'RSW_CURRENCY_TRANSLATION'

EXPORTING

I_CTTNM = 'YRC_CONV'

I_AMOUNT = l_sellp

I_SCUR = l_src_cur

I_TCUR = l_trg_cur

I_TIME_IOBJVL = l_time

I_PERIV = 'JJ'

IMPORTING

E_AMOUNT = l_sellp.

RESULT = COMM_STRUCTURE-/bic/yselprice.

IF SY-SUBRC <> 0.

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

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

RETURNCODE = 4.

ENDIF.

ENDCASE.