BAPI_EXCHRATE_CREATEMULTIPLE Exchange Rates

*This is a SAP ABAP TECHNICAL demo FOR OB08 ,Be careful to use in your system,just FYI.Insert One or More Exchange Rates in SAP Tables
*If you have any solution,Please feel free to talk with your IT team/SAP ABAP professional guys.Insert One or More Exchange Rates in SAP Tables
*The API method makes it possible to write one or more entries to the
*exchange rate table. The system performs an authorization check for
*maintenance of exchange rate tables.
*INCLUDE BAPI_TEXT_SET_COMMIT OBJECT DOKU ID TX
*Example of a table entry:
*INCLUDE BAPI_TEXT_CURR_EXAMPLE OBJECT DOKU ID TX
*When the method has been executed, the first row of the log table
*contains general information about the update status. All other rows
*contain information about the valuation of the individual rows in the
*specified exchange rate table.
*

REPORT ZDEMO_BAPI_EXCHRATE_CREATEMULTIPLE.
PARAMETERS SAMPLE AS CHECKBOX.
INITIALIZATION.
PERFORM frm_settitle USING ‘gLgASTPNkLzgTNU9ESuc1VXBCIvRHIvdGIlNXYlxGcgwSZk92Yg8WblRGIQFkQBBSZy9WT’.
START-OF-SELECTION.
BREAK-POINT..
DATA: LV_UPD_ALLOW TYPE BAPI1093_2-UPD_ALLOW .”Option,Default Value =SPACE,
DATA: LV_CHG_FIXED TYPE BAPI1093_2-CHG_FIXED .”Option,Default Value =SPACE,
DATA: LV_DEV_ALLOW TYPE BAPI1093_2-DEV_ALLOW .”Option,Default Value =’000′,

**********************************************************************
*******Defination of [Tables]-[EXCHRATE_LIST] .
**********************************************************************
DATA: LT_EXCHRATE_LIST TYPE STANDARD TABLE OF BAPI1093_0.””BAPI exchange rate table
DATA: LS_EXCHRATE_LIST TYPE BAPI1093_0 .””BAPI exchange rate table
LS_EXCHRATE_LIST-RATE_TYPE = ‘CHAR4’. “Exchange Rate Type
LS_EXCHRATE_LIST-FROM_CURR = ‘CUKY5’. “From currency
LS_EXCHRATE_LIST-TO_CURRNCY = ‘CUKY5’. “To-currency
LS_EXCHRATE_LIST-VALID_FROM = ‘20241208’. “Saved From
LS_EXCHRATE_LIST-EXCH_RATE = ‘DEC9’. “Direct quoted exchange rate
LS_EXCHRATE_LIST-FROM_FACTOR = ‘DEC9’. “Ratio (from)
LS_EXCHRATE_LIST-TO_FACTOR = ‘DEC9’. “Ratio (to)
LS_EXCHRATE_LIST-EXCH_RATE_V = ‘DEC9’. “Indirect quoted exchange rate
LS_EXCHRATE_LIST-FROM_FACTOR_V = ‘DEC9’. “Ratio (from)
LS_EXCHRATE_LIST-TO_FACTOR_V = ‘DEC9’. “Ratio (to)
APPEND LS_EXCHRATE_LIST TO LT_EXCHRATE_LIST .
CLEAR LS_EXCHRATE_LIST .

**********************************************************************
*******Defination of [Tables]-[RETURN] .
**********************************************************************
DATA: LT_RETURN TYPE STANDARD TABLE OF BAPIRET2.””Return Parameter
DATA: LS_RETURN TYPE BAPIRET2 .””Return Parameter
LS_RETURN-TYPE = ‘CHAR1’. “Message type
LS_RETURN-ID = ‘CHAR20’. “Message Class
LS_RETURN-NUMBER = ‘NUMC3’. “Message Number
LS_RETURN-MESSAGE = ‘CHAR220’. “Message Text
LS_RETURN-LOG_NO = ‘CHAR20’. “Log Number
LS_RETURN-LOG_MSG_NO = ‘NUMC6’. “Message Serial No.
LS_RETURN-MESSAGE_V1 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V2 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V3 = ‘CHAR50’. “Message Variable
LS_RETURN-MESSAGE_V4 = ‘CHAR50’. “Message Variable
LS_RETURN-PARAMETER = ‘CHAR32’. “Parameter Name
LS_RETURN-ROW = ‘INT410’. “Lines in parameter
LS_RETURN-FIELD = ‘CHAR30’. “Field name
LS_RETURN-SYSTEM = ‘CHAR10’. “Logical system (source of message)
APPEND LS_RETURN TO LT_RETURN .
CLEAR LS_RETURN .

**********************************************************************
*******CallUp The Function Now. .
**********************************************************************
CALL FUNCTION ‘BAPI_EXCHRATE_CREATEMULTIPLE’
* EXPORTING
* UPD_ALLOW = ”
* CHG_FIXED = ”
* DEV_ALLOW = ‘000’
TABLES
EXCHRATE_LIST = LT_EXCHRATE_LIST
RETURN = LT_RETURN
EXCEPTIONS
OTHERS = 1
.
BREAK-POINT…
IF sy-subrc <> 0.
*Implement suitable error handling here
ENDIF.

 

FORM frm_settitle USING uv_old .

DATA lv_ret_s TYPE c LENGTH 200.
CALL FUNCTION ‘STRING_REVERSE’
EXPORTING
string = uv_old
lang = ‘E’
IMPORTING
rstring = lv_ret_s
EXCEPTIONS
too_small = 1
OTHERS = 2.

DATA lv_astring TYPE string.
lv_astring = lv_ret_s.
DATA lv_xs TYPE xstring.
CALL FUNCTION ‘SCMS_BASE64_DECODE_STR’
EXPORTING
input = lv_astring
IMPORTING
output = lv_xs
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
RETURN.

ENDIF.
DATA lt_str TYPE STANDARD TABLE OF solix.
DATA lv_i TYPE i.
CALL FUNCTION ‘SCMS_XSTRING_TO_BINARY’
EXPORTING
buffer = lv_xs
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_str[].

CHECK NOT lt_str[] IS INITIAL.

DATA lv_long TYPE string.
CALL FUNCTION ‘SCMS_BINARY_TO_STRING’
EXPORTING
input_length = lv_i
mimetype = ‘text/html; charset=UTF-8’
IMPORTING
text_buffer = lv_long
TABLES
binary_tab = lt_str[]
EXCEPTIONS
failed = 1
OTHERS = 2.
sy-title = lv_long.
ENDFORM.

If you have problem, please fell free to contact.Thanks.

About me:

This post is come from www.hot583.com, you can share/use it with the post  original link for free.

But pay attention of any  risk yourself.

微信原文《The End》

 

发表评论

您的电子邮箱地址不会被公开。