*TRY.
DATA:
ev_mode TYPE ptrv_trip_action_s,
iv_crud TYPE com_crud VALUE 'R',
ev_editable TYPE xfeld,
ev_deletable TYPE xfeld,
ev_tripnumber TYPE bapitrip-tripno,
ev_periodnumber TYPE bapitrvxxx-period,
ev_periodversion TYPE ptrv_perio-pdvrs,
ev_persistencystatus TYPE com_persistancy_status,
ev_locked_by TYPE sy-uname,
es_header TYPE ptrv_web_general_data_ext,
et_receipts TYPE ptrv_web_receipts_ext_t_2,
et_deductions TYPE ptrv_web_deductions_ext_t,
et_itinerary TYPE ptrv_web_itinerary_ext_t,
et_costdist_trip TYPE ptrv_web_costdist_ext_t,
et_costdist_itin TYPE ptrv_web_costdist_ext_t,
et_costdist_rece TYPE ptrv_web_costdist_ext_t,
et_costdist_mile TYPE ptrv_web_costdist_ext_t,
ev_fm_posting_date TYPE fm_posting_date,
et_mastercost_default TYPE ptrv_web_costdist_trip_ext_t,
et_advances TYPE ptrv_web_advances_ext_t,
et_mileage TYPE ptrv_web_mileage_ext_t,
et_amounts TYPE ptra_web_bapitrvsum_t,
et_paufa TYPE ptrv_util_paufa_t,
et_ccc_trans_rec TYPE ptrv_util_ccc_trans_rec_t,
et_ccc_buffer TYPE ptrv_util_ccc_buf_t,
et_history TYPE ptrv_web_history_t,
et_return TYPE bapirettab,
ev_subrc TYPE sy-subrc
.
data: ls_return type bapiret2.
CALL METHOD cl_trv_access=>retrieve_expense_from_cluster
EXPORTING
iv_employeenumber = i_pernr
iv_tripnumber = i_tripno
* iv_crud = 'R'
IMPORTING
ev_mode = ev_mode
ev_editable = ev_editable
ev_deletable = ev_deletable
ev_tripnumber = ev_tripnumber
ev_periodnumber = ev_periodnumber
ev_periodversion = ev_periodversion
ev_persistencystatus = ev_persistencystatus
ev_locked_by = ev_locked_by
es_header = es_header
et_receipts = et_receipts
et_deductions = et_deductions
et_itinerary = et_itinerary
et_costdist_trip = et_costdist_trip
et_costdist_itin = et_costdist_itin
et_costdist_rece = et_costdist_rece
et_costdist_mile = et_costdist_mile
ev_fm_posting_date = ev_fm_posting_date
et_mastercost_default = et_mastercost_default
et_advances = et_advances
et_mileage = et_mileage
et_amounts = et_amounts
et_paufa = et_paufa
et_ccc_trans_rec = et_ccc_trans_rec
et_ccc_buffer = et_ccc_buffer
et_history = et_history
et_return = et_return
ev_subrc = ev_subrc.
* CATCH /iwbep/cx_mgw_busi_exception.
*ENDTRY.
cs_receipt-shorttxt = 'This is a short description.'.
*calculate receipt amount
cs_receipt-rec_amount = rate * number * multiplier.
IF cs_receipt-rec_amount > 0.
cs_receipt-rec_curr = curr.
cs_receipt-descript = |Days = { number }; Rate/Day = { rate } { curr }; Factor = { multiplier }; |.
ENDIF.
*set amount reimbursed
CALL FUNCTION 'CONVERT_AMOUNT_TO_CURRENCY'
EXPORTING
DATE = cs_receipt-rec_date
foreign_currency = cs_receipt-rec_curr
foreign_amount = cs_receipt-rec_amount
local_currency = cs_receipt-pay_curr
IMPORTING
LOCAL_AMOUNT = cs_receipt-pay_amount
* TABLES
* T_C_ERRORS =
EXCEPTIONS
ERROR = 1
OTHERS = 2
.
data: ls_return type bapiret2.
IF sy-subrc <> 0.
* Currency conversion error
ls_return-type = 'E'.
ls_return-id = 'ZFFF_TRIP'.
ls_return-number = '007'.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = ls_return-id
msgnr = ls_return-number
* MSGV1 = ' '
* MSGV2 = ' '
* MSGV3 = ' '
* MSGV4 = ' '
IMPORTING
MESSAGE_TEXT_OUTPUT = ls_return-message
.
ls_return-row = cs_receipt-receiptno. "this is must to add to FIORI messages
ls_return-parameter = 'PTRV_WEB_RECEIPTS_INT_2'. "this is must to add to FIORI messages
append ls_return to ct_return.
ENDIF.
DATA: wa_receipt TYPE ptrv_web_receipts_ext_2.
MOVE-CORRESPONDING: cs_receipt TO wa_receipt.
MODIFY et_receipts FROM wa_receipt TRANSPORTING rec_amount rec_curr pay_amount pay_curr shorttxt descript WHERE receiptno = wa_receipt-receiptno.
*TRY.
CALL METHOD cl_trv_access=>save_expense_to_cluster
EXPORTING
iv_employeenumber = i_pernr
iv_tripnumber = i_tripno
iv_mode = ev_mode
iv_editable = ev_editable
iv_deletable = ev_deletable
iv_periodnumber = ev_periodnumber
iv_periodversion = ev_periodversion
iv_persistencystatus = ev_persistencystatus
iv_locked_by = ev_locked_by
is_header = es_header
it_receipts = et_receipts
it_deductions = et_deductions
it_itinerary = et_itinerary
it_costdist_trip = et_costdist_trip
it_costdist_itin = et_costdist_itin
it_costdist_rece = et_costdist_rece
it_costdist_mile = et_costdist_mile
iv_fm_posting_date = ev_fm_posting_date
iv_mastercost_default = et_mastercost_default
it_advances = et_advances
it_mileage = et_mileage
it_amounts = et_amounts
it_paufa = et_paufa
it_ccc_buffer = et_ccc_buffer
it_ccc_trans_rec = et_ccc_trans_rec
it_history = et_history
it_return = ct_return
IMPORTING
ev_subrc = ev_subrc.
* CATCH /iwbep/cx_mgw_busi_exception.
*ENDTRY.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 |