Hierarchy

⤷

⤷

IMG Activity
ID | OFTV_MOD_BADI_10 | BAdI: Changes to Objects After Trip Settlement |
Transaction Code | S_ALN_01002157 | (empty) |
Created on | 20030404 | |
Customizing Attributes | OFTV_MOD_BADI_10 | Business Add-In: Make Changes to Objects After Trip Settled |
Customizing Activity | OFTV_MOD_BADI_10 | Business Add-In: Make Changes to Objects After Trip Settled |
Document
Document Class | SIMG | Hypertext: Object Class - Class to which a document belongs. |
Document Name | AFTER_TRIP_SETTLEMEN |
Use
This Business Add-In enables you to change the data of a settled trip before the data is written to the database.
Internal table IT_ROT_NOT_COLLECTED contains the entries of the results table ROT in non-aggregated form. Table IT_ROT_NOT_COLLECTED therefore enables you to determine the origin of each row (for example, that a row contains the result of receipt 007).
This is particularly important when individual aspects of the ROT results table need to be corrected. In this case, the procedure would be as follows: First correct the relevant aspect in table IT_ROT_NOT_COLLECTED. Then delete results table ROT and rebuild it from table IT_ROT_NOT_COLLECTED. See the following examples for more information.
Example 1:
In Great Britain, the share of an entertainment receipt used by domestic employees and business partners is fully deductible as regards input tax, while for the remaining (foreign) guests this share is not deductible. When you post to accounting, therefore, you must split the entertainment receipts entered in travel expenses into two parts, each with different input tax codes. One part is based on the number of domestic employees and business partners, and the other part on the number of other (foreign) guests.
Suppose a domestic employee, a domestic business partner, and two other guests participated in a dinner costing GBP 117.50. Here you would need to split the receipt for posting to accounting into two parts: one for the domestic employee and the domestic business partner (117.50 * factor (1+ 1) / 4)), and one for the other two guests:
117.50 * ((1+ 1) / 4 ) = 58.75 with original input tax code V1
117.50 - 58.75 = 58.75 with input tax code V2 for non-deductible input tax
Note 607880 explains how you can enter the required numbers of participants separately as additional receipt information. To ensure that payroll and posting are performed correctly for the travel expenses, implement method CHANGE_TRV_OBJECTS as follows:
method if_ex_after_trip_settlement~change_trv_objects .
types: begin of wtype_for_entertainment,
lgart type t706b4-lgarl,
n_stf type i,
n_ptn type i,
n_gst type i,
number type ptk03-belnr,
betrg type ptk03-betrg,
end of wtype_for_entertainment.
data: rot_line type ptk30-line,
wa_rot type ptk30,
wa_rot_not_collected type fitv2_rot_not_collected,
wa_rot_not_collected_help type fitv2_rot_not_collected,
it_rot_not_collected_help type fitv2_t_rot_not_collected,
wa_exbel type ptk33,
wa_beleg type ptk03,
spkzl_3 TYPE Char3 value 'FAK',
total type p,
wa_t706d type t706d,
wa_rot_betrg type ptk03-betrg,
it_wtype_for_entertainment type
table of wtype_for_entertainment,
wa_wtype_for_entertainment type wtype_for_entertainment.
* identify receipts with numbers of staff, partners or guests
loop at it_exbel into wa_exbel where not n_stf is initial or
not n_ptn is initial or
not n_gst is initial.
* store these numbers
wa_wtype_for_entertainment-n_stf = wa_exbel-n_stf.
wa_wtype_for_entertainment-n_ptn = wa_exbel-n_ptn.
wa_wtype_for_entertainment-n_gst = wa_exbel-n_gst.
* store receipt amount ( and number from 4.7 on)
read table it_beleg into wa_beleg with key belnr = wa_exbel-belnr.
if sy-subrc is initial.
check wa_beleg-betrg is not initial.
wa_wtype_for_entertainment-number = wa_beleg-belnr.
wa_wtype_for_entertainment-betrg = wa_beleg-betrg.
* store wage type of this receipt
select single lgarl into wa_wtype_for_entertainment-lgart
from t706b4
where morei = is_ptrv_head-morei
and spkzl eq wa_beleg-spkzl
and endda >= wa_beleg-bldat
and begda <= wa_beleg-bldat.
if sy-subrc is initial.
collect wa_wtype_for_entertainment into it_wtype_for_entertainment.
endif.
endif.
endloop.
* read zero VAT sign
select single * into wa_t706d
from t706d
where morei = is_ptrv_head-morei.
if sy-subrc ne 0.
wa_t706d-mwaus = 'V0'.
endif.
loop at it_wtype_for_entertainment into wa_wtype_for_entertainment.
loop at it_rot_not_collected into wa_rot_not_collected
where lgart = wa_wtype_for_entertainment-lgart
and number = wa_wtype_for_entertainment-number.
check wa_rot_not_collected-spkzl(3) ne spkzl_3.
* only if number of other participants not zero
if wa_wtype_for_entertainment-n_gst gt 0.
* and only if VAT is not zero
if wa_rot_not_collected-mwskz ne wa_t706d-mwaus.
* calculate total participants for actual ROT line
total = wa_wtype_for_entertainment-n_stf +
wa_wtype_for_entertainment-n_ptn +
wa_wtype_for_entertainment-n_gst.
* remove original ROT line
delete it_rot_not_collected index sy-tabix.
* fill help structure for calculation
move-corresponding wa_rot_not_collected to
wa_rot_not_collected_help.
* calculate amount for VAT participants
wa_rot_not_collected_help-betrg =
wa_rot_not_collected-betrg *
( wa_wtype_for_entertainment-n_stf +
wa_wtype_for_entertainment-n_ptn ) / total.
if wa_rot_not_collected_help-betrg gt 0.
* append new ROT line for VAT participants (with original VAT sign)
append wa_rot_not_collected_help to
it_rot_not_collected_help.
endif.
* calculate amount for non VAT participants (difference)
wa_rot_not_collected_help-betrg =
wa_rot_not_collected-betrg -
wa_rot_not_collected_help-betrg.
* new VAT sign for non VAT participants (must be non-deductible)
wa_rot_not_collected_help-mwskz = 'V2'.
* append new ROT line for non VAT participants (with changed VAT sign)
append wa_rot_not_collected_help to it_rot_not_collected_help.
endif.
endif.
endloop.
* append help structure with newly created ROT lines to ROT.
append lines of it_rot_not_collected_help to it_rot_not_collected.
* clear help structure
refresh it_rot_
Business Attributes
ASAP Roadmap ID | 153 | Design enhancements |
Mandatory / Optional | 3 | Nonrequired activity |
Critical / Non-Critical | 2 | Non-critical |
Country-Dependency | A | Valid for all countries |
Maintenance Objects
Maintenance object type | E | Business Add-In - Definition |
History
Last changed by/on | SAP | 20050726 |
SAP Release Created in | 200 |