直接上代码
代码语言:javascript复制**&&OB08BAPI参数
DATA: exch_rate LIKE bapi1093_0 OCCURS 1 WITH HEADER LINE,
rettab LIKE bapiret2 OCCURS 1 WITH HEADER LINE.
exch_rate-rate_type = ls_item_input-extype.
exch_rate-from_curr = ls_item_input-domcurr.
exch_rate-to_currncy = ls_item_input-forcurr.
exch_rate-valid_from = ls_item_input-date.
exch_rate-exch_rate = ls_item_input-rate.
exch_rate-from_factor = '1'.
exch_rate-to_factor = '1'.
APPEND exch_rate.
CALL FUNCTION 'BAPI_EXCHANGERATE_CREATE'
EXPORTING
exch_rate = exch_rate
* UPD_ALLOW = ' ' "如果需要更新汇率 此参数值设置为X
* CHG_FIXED = ' '
* DEV_ALLOW = '000'
IMPORTING
return = ret2
* RATE_TYPE =
* FROM_CURR =
* TO_CURRNCY =
.
IF ret2[] IS INITIAL .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
lt_return-msgty = 'S' .
APPEND lt_return.
CLEAR lt_return.
ELSE.
LOOP AT ret2.
CASE ret2-type.
WHEN 'A' OR 'E' OR 'X'.
CALL METHOD cl_soap_commit_rollback=>rollback.
lt_return-msgty = 'E'.
CONCATENATE ret2-id ret2-number ret2-message
INTO lt_return-msgtx.
APPEND lt_return.
CLEAR lt_return.
WHEN 'W'.
CALL METHOD cl_soap_commit_rollback=>commit.
lt_return-msgty = 'S' .
APPEND lt_return.
CLEAR lt_return.
WHEN OTHERS.
CALL METHOD cl_soap_commit_rollback=>commit.
lt_return-msgty = 'S' .
APPEND lt_return.
CLEAR lt_return.
ENDCASE.
ENDLOOP.
ENDIF.