Ansicht
Dokumentation
OFTV_MOD_BADI_10 - BAdI: Änderungen an Objekten nach der Abrechnung einer Reise
RFUMSV00 - Advance Return for Tax on Sales/Purchases Vendor Master (General Section)Diese Dokumentation steht unter dem Copyright der SAP AG.
Dieses Business Add-In ermöglicht das Ändern von Daten einer abgerechneten Reise bevor sie auf die Datenbank weggeschrieben wird.
Insbesondere steht Ihnen die interne Tabelle IT_ROT_NOT_COLLECTED zur Verfügung, die die Einträge der Ergebnistabelle ROT in nicht verdichteter Form enthält. In der Tabelle IT_ROT_NOT_COLLECTED ist es damit möglich bei jeder Zeile Rückschlüsse auf den Ursprung dieser Zeile zu ziehen (z.B. Zeile enthält das Ergebnis des Belegs 007).
Dies ist insbesondere dann wichtig, wenn einzelne Aspekte der Ergebnistabelle ROT 'korrigiert' werden sollen. Man würde in diesem Fall den entsprechenden Aspekt in der Tabelle IT_ROT_NOT_COLLECTED korrigieren, die Ergebnistabelle ROT zunächst löschen und anschließend aus der Tabelle IT_ROT_NOT_COLLECTED erneut aufbauen. Betrachten Sie dazu die beiden unten aufgeführten Beispiele.
In Großbritannien ist der Anteil an einem Bewirtungsbeleg, der für die teilnehmenden inländischen Mitarbeiter und Geschäftspartner aufgewendet wurde, vorsteuerlich vollständig abzugsfähig, während der für die übrigen (ausländischen) Gäste angefallene Anteil vorsteuerlich nicht abzugsfähig ist. In den Reisekosten erfaßte Bewirtungsbelege müssen daher bei der Buchung in das Rechnungswesen gemäß der Anzahl der teilgenommenen inländischen Mitarbeiter und Geschäftspartner einerseits sowie der Anzahl anderer (ausländischer) Gäste andererseits in zwei Anteile mit unterschiedlichen Vorsteuerkennzeichen gesplittet werden.
Betrachtet man als Beispiel ein Abendessen im Wert von 117,50 GBP, an dem ein inländischer Mitarbeiter, ein inländischer Partner und zwei weitere Gäste teilgenommen haben, so ist der Beleg für die Buchung im Rechnungswesen in einen Anteil für den inländischen Mitarbeiter und den inländischenPartner (117.50 GBP * Faktor (1+ 1) / 4)) einerseits und in einen Rest-Anteil für die weiteren zwei Gäste andererseits zu splitten:
117,50 GBP * ((1+ 1) / 4 ) = 58,75 GBP mit orginal Vorsteuerkennzeichen V1 und
117,50 GBP - 58,75 GBP = 58,75 GBP mit einem Vorsteuerkennzeichen V2 für nicht abzugfähige Vorsteuer.
Mit Hinweis 607880 ist es möglich, die benötigten Teilnehmeranzahlen getrennt voneinander als Belegzusatzinformation zu erfassen. Für eine korrekte Abrechnung und Buchung der Reisekosten ist außerdem die Methode CHANGE_TRV_OBJECTS wie folgt zu implementieren:
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_not_collected_help.
endloop.
* collect table
refresh it_rot.
loop at it_rot_not_collected into wa_rot_not_collected.
clear wa_rot.
move-corresponding wa_rot_not_collected to wa_rot.
collect wa_rot into it_rot.
endloop.
* re-number lines of table ROT
rot_line = 1.
loop at it_rot into wa_rot.
wa_rot-line = rot_line.
modify it_rot from wa_rot.
rot_line = rot_line + 1.
endloop.
endmethod.
Beispiel 2:
Im Einführungsleitfaden des SAP-Reisemanagements besteht die Möglichkeit Fahrtkostenpauschalen zu definieren, die an einen Kunden weiterfaktoriert werden sollen. Solche Pauschalen können als 'dritte' Pauschale in jedem Eintrag der View V_T706F hinterlegt werden. Eine Auswertung, Verarbeitung beziehungsweise Buchung einer solchen Pauschale bleibt jedoch dem Anwender überlassen. Hat der Anwender in der View V_T706F z.B. die folgenden Pauschalbeträge hinterlegt
steuerfreier Betrag:,,0,12 GBP
steuerplicht. Betrag:,,0,12 GBP
Betrag für Kunden:,,0,40 GBP,
so sollen zusätzlich zu den im Standard zu buchenden 0,12 GBP noch weitere 0,28 GBP ( 0,28 GBP = 0,40 GBP - 0,12 GBP ) auf den zugeordneten Kundenauftrag gebucht werden. Die interne Tabelle ROT des Clusters TE muss also um eine solche Zeile ergänzt werden. Dazu wäre die Methode CHANGE_TRV_OBJECTS wie folgt zu implementieren:
method if_ex_after_trip_settlement~change_trv_objects.
types: begin of wtype_for_mileage,
lgart type t706b4-lgarl,
number type ptk30-belnr,
betfz type ptk21-betfz,
betfa type ptk21-betfa,
betku type ptk21-betku,
end of wtype_for_mileage.
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_paufa type ptk21,
wa_kostv type fitv2_typ_kostv,
spkzl type ptk03-spkzl,
it_wtype_for_mileage type table of wtype_for_mileage,
wa_wtype_for_mileage type wtype_for_mileage.
* identify mileages with customer amount and store their wage types
* into table IT_WTYPE_FOR_MILEAGE
loop at it_paufa into wa_paufa where not betku is initial.
* store all amounts
wa_wtype_for_mileage-betfz = wa_paufa-betfz.
wa_wtype_for_mileage-betfa = wa_paufa-betfa.
wa_wtype_for_mileage-betku = wa_paufa-betku.
* store mileage number key
wa_wtype_for_mileage-number = wa_paufa-kmkey.
* determine 'receipt' type of this mileage for finding wage types
spkzl(3) = 'FAK'.
spkzl+3(1) = wa_paufa-kzpmf.
* store wage type of this mileage
select single lgarl into wa_wtype_for_mileage-lgart
from t706b4
where morei = is_ptrv_head-morei
and spkzl eq spkzl
and endda >= wa_paufa-datum
and begda <= wa_paufa-datum.
if sy-subrc is initial.
collect wa_wtype_for_mileage into it_wtype_for_mileage.
endif.
endloop.
loop at it_wtype_for_mileage into wa_wtype_for_mileage.
loop at it_rot_not_collected into wa_rot_not_collected
where lgart = wa_wtype_for_mileage-lgart
and spkzl = spkzl
and number = wa_wtype_for_mileage-number.
* remove original line from table
delete it_rot_not_collected index sy-tabix.
* append original line to help table (sorting reasons!)
append wa_rot_not_collected to it_rot_not_collected_help.
* fill help structure for calculation
move-corresponding wa_rot_not_collected to
wa_rot_not_collected_help.
* calculate customer amount
wa_rot_not_collected_help-betrg = wa_rot_not_collected-betrg *
( wa_wtype_for_mileage-betku - wa_wtype_for_mileage-betfa ) /
wa_wtype_for_mileage-betfa.
* new wagetype for customer amount (let's assume it is MJ32!)
wa_rot_not_collected_help-lgart = 'MJ32'.
* append new line for customer amount to help table
append wa_rot_not_collected_help to it_rot_not_collected_help.
endloop.
* append help table with original and newly created lines to table
* (but only if amount is not zero)
if wa_rot_not_collected_help-betrg is not initial.
append lines of it_rot_not_collected_help to it_rot_not_collected.
endif.
* clear help table
refresh it_rot_not_collected_help.
endloop.
* collect table
refresh it_rot.
loop at it_rot_not_collected into wa_rot_not_collected.
clear wa_rot.
move-corresponding wa_rot_not_collected to wa_rot.
collect wa_rot into it_rot.
endloop.
* re-number lines of table ROT
rot_line = 1.
loop at it_rot into wa_rot.
wa_rot-line = rot_line.
modify it_rot from wa_rot.
rot_line = rot_line + 1.
endloop.
endmethod.
Möchten Sie beide Beispiele gleichzeitig implementieren, so müsste die Methode CHANGE_TRV_OBJECTS wie folgt implementiert werden:
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.
TYPES: BEGIN OF wtype_for_mileage,
lgart TYPE t706b4-lgarl,
number TYPE ptk30-belnr,
betfz TYPE ptk21-betfz,
betfa TYPE ptk21-betfa,
betku TYPE ptk21-betku,
END OF wtype_for_mileage.
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.
Data: wa_exbel TYPE ptk33,
wa_beleg TYPE ptk03,
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.
Data: wa_paufa TYPE ptk21,
wa_kostv TYPE fitv2_typ_kostv,
spkzl TYPE ptk03-spkzl,
spkzl_3 TYPE Char3 value 'FAK',
it_wtype_for_mileage TYPE TABLE OF wtype_for_mileage,
wa_wtype_for_mileage TYPE wtype_for_mileage.
* Business Mileage adjustment....
* identify mileages with customer amount and store their wage types
* into table IT_WTYPE_FOR_MILEAGE
LOOP AT it_paufa INTO wa_paufa WHERE NOT betku IS INITIAL.
* store all amounts
wa_wtype_for_mileage-betfz = wa_paufa-betfz.
wa_wtype_for_mileage-betfa = wa_paufa-betfa.
wa_wtype_for_mileage-betku = wa_paufa-betku.
* store mileage number key
wa_wtype_for_mileage-number = wa_paufa-kmkey.
* determine 'receipt' type of this mileage for finding wage types
spkzl(3) = 'FAK'.
spkzl+3(1) = wa_paufa-kzpmf.
* store wage type of this mileage
SELECT SINGLE lgarl INTO wa_wtype_for_mileage-lgart
FROM t706b4
WHERE morei = is_ptrv_head-morei
AND spkzl EQ spkzl
AND endda >= wa_paufa-datum
AND begda <= wa_paufa-datum.
IF sy-subrc IS INITIAL.
COLLECT wa_wtype_for_mileage INTO it_wtype_for_mileage.
ENDIF.
ENDLOOP.
LOOP AT it_wtype_for_mileage INTO wa_wtype_for_mileage.
LOOP AT it_rot_not_collected INTO wa_rot_not_collected
WHERE lgart = wa_wtype_for_mileage-lgart
and spkzl = spkzl
AND number = wa_wtype_for_mileage-number.
* remove original line from table
DELETE it_rot_not_collected INDEX sy-tabix.
* append original line to help table (sorting reasons!)
APPEND wa_rot_not_collected TO it_rot_not_collected_help.
* fill help structure for calculation
MOVE-CORRESPONDING wa_rot_not_collected TO
wa_rot_not_collected_help.
* calculate customer amount
wa_rot_not_collected_help-betrg = wa_rot_not_collected-betrg *
( wa_wtype_for_mileage-betku - wa_wtype_for_mileage-betfa ) /
wa_wtype_for_mileage-betfa.
* new wagetype for customer amount (let's assume it is MJ32!)
wa_rot_not_collected_help-lgart = 'MJ32'.
* append new line for customer amount to help table
* (but only if amount is not zero)
if wa_rot_not_collected_help-betrg is not initial.
APPEND wa_rot_not_collected_help TO it_rot_not_collected_help.
endif.
ENDLOOP.
* append help table with original and newly created lines to table
APPEND LINES OF it_rot_not_collected_help TO it_rot_not_collected.
* clear help table
REFRESH it_rot_not_collected_help.
ENDLOOP.
* Split entertainment expense types according to attendees....
* 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), let's say 'V2'
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_not_collected_help.
ENDLOOP.
* rebuild table ROT...
* collect table
REFRESH it_rot.
LOOP AT it_rot_not_collected INTO wa_rot_not_collected.
CLEAR wa_rot.
MOVE-CORRESPONDING wa_rot_not_collected TO wa_rot.
COLLECT wa_rot INTO it_rot.
ENDLOOP.
* re-number lines of table ROT
rot_line = 1.
LOOP AT it_rot INTO wa_rot.
wa_rot-line = rot_line.
MODIFY it_rot FROM wa_rot.
rot_line = rot_line + 1.
ENDLOOP.
endmethod.
CPI1466 during Backup RFUMSV00 - Advance Return for Tax on Sales/Purchases
Diese Dokumentation steht unter dem Copyright der SAP AG.
Length: 42241 Date: 20240523 Time: 071310 sap01-206 ( 266 ms )