Skip to end of metadata
Go to start of metadata

Change Log:

  • September 29th 2021- IMPORTANT: SUNAT Changed the definition of 2 concepts (LegaMonetaryTotal at header level, and AllowanceTotalAmount), it will impact validations. This wiki is in  update process:


  • LMTLEAMTV1 - before: eDc Hd Ttl Amt noDisc noTax,     now: eDc Hd Ttl Amt +Disc noTax=> discounts and global surcharges must be added
  • LMTATAMTV1 - before: all surcharges and discounts,       now: only those not affecting the taxable amount


Introduction

Tax office requested that all the monetary information MUST BE PRESENT in the comercial and accounting systems, and not just in the XML presented, so this wiki provides sample pricing elements to help customers generate invoices compliant with the regulations.

Consider reading the blog https://blogs.sap.com/2020/06/19/invoicing-in-peru-via-sap-sales-distribution-pricing-details-required-from-sunat/ where the semantic meaning of each element are explained before proceeding to the configuration.

Note sometimes the IGV is referenced as “VAT” as it is a similar tax in English

Understanding taxes reporting

As explained in the Blog, tax information and the corresponding business reason must be reported. This is driven by configurable catalog 7 (issued and updated from SUNAT side on regular basis). Also, the entries from catalog 7 must be aggregated using catalog 5 at header level.

Notice the access sequence to report the taxes must contemplate the Order Reason.

Also, since this is not required in accounting, all these conditions are statistical. What is important to consider is that whenever a condition value must be transferred to SAP Document Compliance, it must be marked as printable (A,B,C,a,b,c) to keep consistency with the rest of the SAP ERP functionality.

Subtotals are not sufficient as SUNAT reporting requirements include taxable amounts and other elements that are supported with conditions.





Access Sequence
(Catalog 7)


Header Level Reporting


Sample Header Condition

Sample Item Condition

Tax

Des. Country

Customer Tax

Material Tax %

Order Reason

Sample Condition / Subtotal name

Cat 5 ID
(header)

Item Level Description

EDCH

EDCA

VAT
(MWST)

PE

Liable for taxes

18%

<empty>

eDc It VAT / eDc Hd Sum VAT

1000

L6.1 Tax Subtotal for IGV - Sales Operation

EDCI

EDCB

18%

Grant

eDc It VAT Grant / eDc Hd Sum Free Of Charge

9996

L6.4 Tax Subtotal for IGV - Grant

EDCE

0%

eDc It VAT Grant 0% / eDc Hd Sum Free Of Charge

L9.6 -  Tax Subtotal for 0% IGV Rate for Grant

EDCG

Not PE

<any>

eDc It VAT Export 0% / eDc Hd Sum Free Of Charge

L10.2 - Tax Subtotal IGV for Export with 0% rate

EDCK

EDCD

PE

<empty>

eDc It VAT 0% / eDc Hd Sum VAT 0%

9998

L9.1 -  Tax Subtotal for 0% IGV Rate

EDCJ

EDCC

PE

Exempt

<any>

<any>

eDc It Tax Exempt / eDc Hd Sum VAT Exempt

9997

L8.1 -  Tax Exempt



Sample statistical conditions and subtotals used in this document (sorted in feasible order)

Notice, if you are already generating invoices in a Peruvian company code, all this information should have been already considered as part of your pricing schema (not necessarily statistical!), so only minor adjustments to pricing should be required for transparent reporting purposes. Namely, as such, most of these entries and rules must be already in your current pricing procedure, it is not necessary to create or modify them.


EDC3

Line Item Discount subject to VAT, this is just to demonstrate how a regular discount works (%)

J1PD

Detraction (determination) – This is a sample condition to determine the Detraction Rate (see blog on detractions) based on material types

J1PF

 Header Detraction PEN – sample detraction based on local currency documents. Requires calculation routines to locate maximum percentage and reason.


 Line Item Unit Price no Header Surcharges and no Taxes


 Line Item Amount (including Line Item Surcharges) +Line Item Discount and no Taxes


 Line Item Free of Charge


 Line Item Total Unit Price (item surcharges should be added here) +line items Discounts +Taxes (it is the consumer net amount)

EDCC

 Line Item Tax Exempt

EDCE

 Line Item VAT Grant 0%

EDCB

 Line Item VAT Grant

EDCD

 Line Item VAT 0%

EDCA

 Line Item VAT

EDCG

 Line Item VAT Export 0%

EDCL

 Header Summarization VAT Exp0%

EDCI

 Header Summarization Free Of Charge

EDCJ

 Header Summarization VAT Exempt

EDCK

 Header Summarization VAT 0%

EDCH

 Header Summarization VAT


 Header Summarization All Tax


 Header Total Amt no Discounts, no Taxes


 Header Percentage Internal Sales


 Header Surcharge (subject to Tax)


 Header Total Surcharges


 Header Total Discounts


 Header Total Amount + Tax


 Header Due Amount


 Line Item Total Tax



Sample pricing adjustments for Peruvian Companies

Assuming standard SAP pricing is used as basis, some extra elements might need to be added in order to generate all legally required reporting values:

Step

Counter

Condition

Description

From

To

Print Level

Requirement

Alternative Calc Type

Base Type

Other entries…..










809

4

EDC3

eDc It Disc (sbj to

0

0

a

0

0

0

other entries…..










960

0

J1PD

Detraction (determ)

0

0


0

0

4

961

0

J1PF

eDcHd Detraccion PEN

0

0

B

0

(header detraction: max %

4

other entries…..










972

0


eDc It UnPrc noHdSur noTax

0

0

a


(item detraction: mat group)

0

973

0


eDc It Amt +ItDsc+ItSur noTax

908

908

a


0

0

974

0


eDc It Free Of Charg

920

920

b

(free of charge -> net =0 - 954)

(free of charge -> net =0)

0

975

0


eDc It TTLUnPrc+lSur+lDisc+Tax

920

920

b

(item - 951)

(value of condition for unit)

0

977

0

EDCC

eDc It Tax Exempt

0

0

a

(tax mutual exclusion
at item level - 952)

0

16

978

0

EDCE

eDc It VAT Grant 0%

0

0

a

0

16

979

0

EDCB

eDc It VAT Grant

0

0

a

2

5

980

0

EDCD

eDc It VAT 0%

0

0

a

0

16

981

0

EDCA

eDc It VAT

0

0

b

0

16

982

0

EDCG

eDc It VAT Export 0%

0

0

a

2

5

984

0

EDCL

eDc Hd Sum VAT Exp0%

0

0

A

(tax mutual exclusion
at header level -953)

0

16

985

0

EDCI

eDc Hd Sum Free Of C

0

0

A

2

5

986

0

EDCJ

eDc Hd Sum VAT Exemp

0

0

A

2

5

987

0

EDCK

eDc Hd Sum VAT 0%

0

0

A

0

16

988

0

EDCH

eDc Hd Sum VAT

0

0

B

0

16

989

0


eDc Hd Sum All Tax

984

988

A

(header only - 950 )

0

0

990

0


eDc Hd Ttl Amt noDisc noTax

100*

100

A

0

0

992

0


eDc Hd Perc Internal Sales

970

970

B

0

0

993

0


eDc Hd Surch (sbj to Tax)

811*

811

B

0

0

994

0


eDc Hd Ttl Surchages

992

993

B

0

0

995

0


eDc Hd Ttl Discounts

809*

810

B

0

0

996

0


eDc Hd Ttl Amt + Tax

989

990

A

0

0

997

0


eDc Hd Due Amount

994

996

A

0

0

998

0


eDc It Ttl Tax

977

983

a

(item -951)

0

0

999

0

J1PE

eDc Hd Detraction St

0

0

B

0

(max % and gross)

4

* 100 = gross / 811: sample surcharge e.g. Freight / 809-810: sample discounts

Monetary Information to be contained in billing documents

This is the list of UBL 2.1 constructs requested from SUNAT and the corresponding definition

SUNAT Semantic Layer

SAP Sales and Distribution

Document & Regulation

Level

SUNAT definition (in English)

UBL 2.1 node…

(XML Node ID)

Reference Catalog

Catalog Code

Catalog Description

Source SD Pricing Step

Sample Condition/Subtotal

INVOIC-114-2019

Header

This tag reflects discounts, surcharges, perceptions and other factors that result in deviation from the regular sale price.

AllowanceCharge (ALLCHRGV1)

Cat 53 - Surcharges, Discounts and Perceptions

2

Global Header Discount

810

HA00

Percentage Discount

49

Global Header Surcharge

811

EDC2

eDc Hd Surch (sbj to

51

Perception

815

XXXX

Perception

This element totalizes the amount of header and item level discounts..

AllowanceTotalAmount (LMTATAMTV1)

No reference to catalogs



995


eDc Hd Ttl Discounts

This element totalizes the amount of header item surcharges for gratuities or warranties.

ChargeTotalAmount (LMTCTAMTV1)



994


eDc Hd Ttl Surchages

This element represents the total net amount without line item discounts, surcharges or taxes

LineExtensionAmount (LMTLEAMTV1)



990


eDc Hd Ttl Amt noDisc noTax

This element represents the payable amount.

PayableAmount (LMTPYAMTV1)



997


eDc Hd Due Amount

This element represents the total amount with taxes (LMTLEAMNTV1 + header TXAMNT_1

TaxInclusiveAmount (LMTTIAMTV1)



996


eDc Hd Ttl Amt + Tax

This element has been redefined by the tax authorities and it is only relevant for the detraction statement. It represents the percentage and the calculation method used for the detraction amount.

Payment Means (PAYTMNSV1)



999

J1PE

eDc Hd Detraction St

This element has been redefined by the tax authorities and it is only relevant for the detraction statement. It represents the bank account used to deposit the detraction amount.

PaymentTerms (PAYTRMV2

54 Cat. No.54 - Goods and Services Subject to Detraction

1


999

J1PE

eDc Hd Detraction St

This element represents the total amount of taxes, summarizing all the subtotals. It is present at header level and at item level.

TaxTotal (TXAMNTV1)

No reference to catalogs



989


eDc Hd Sum All Tax

This element represents individual tax information for each item and also for header-level summarization.

TaxTotal/TaxSubtotal (TXSUBTV1)

Cat 5 - Header level tax reporting

9995

Export

984

EDCL

eDc Hd Sum VAT Exp0%

9996

Free

985

EDCI

eDc Hd Sum Free Of C

9997

Customer not subject

986

EDCJ

eDc Hd Sum VAT Exempt

9998

0% VAT

987

EDCK

eDc Hd Sum VAT 0%

1000

Regular VAT rate

988

EDCH

eDc Hd Sum VAT

Line Item

This tag reflects discounts, surcharges, perceptions and other factors that result in deviation from the regular sale price.

AllowanceCharge (ALLCHRGV1)

Cat 53 - Surcharges, Discounts and Perceptions

00

Line item discount

809

EDC3

eDc It Disc (sbj to VAT)

This is a line-item-level element indicating the total amount with line item discounts and without taxes. It is a result of multiplying the unit price by the quantity and subtracting item-level-only discounts. This amount is neither considering tax (for example, General Sales Tax, ISC or others) nor header level surcharges or discounts.

LineExtensionAmount (LEAMNTV1)




973


eDc It Amt +ItDsc+ItSur noTax

This element represents line item unit price without taxes or any surcharges.

Price (LPRICEV1)




972


eDc It UnPrc noHdSur noTax

This element represents either the unit price with line item discounts, surcharges and taxes, or the reference market price. This is a line-item-level element.

AlternativeConditionPrice (PRACPR1V1)

Cat 16 - Operation or reference price

2

Market price

974


eDc It Free Of Charge

1

Efective sales price

975


eDc It TTLUnPrc+lSur+lDisc+Tax

This element represents the total amount of taxes, summarizing all the subtotals. It is present at header level and at item level.

TaxTotal (TXAMNTV1)




998


eDc It Ttl Tax

This element represents individual tax information for each item and also for header-level summarization.

TaxSubtotal (TXSUBTV1)

Cat 7 - Item level tax/reason porting

209997

Custumer not subject - Sales Operation

977

EDCC

eDc It Tax Exempt

359996

0%VAT - Grant

978

EDCE

eDc It VAT Grant 0%

119996


979

EDCB

eDc It VAT Grant

309998


980

EDCD

eDc It VAT 0%

101000


981

EDCA

eDc It VAT

409996


982

EDCG

eDc It VAT Export 0%

409995


983

EDCF

eDc It VAT Export 0%














Summarization Rules

In order to prevent warnings in CDRs (official approval from SUNAT or designee OSE), it is required to perform all corresponding summarization for the legal monetary totals section, see this example:


Relevant Pricing Components

Notice: specific VOFM transaction routines are not provided, customers are required to perform specific calculations:


Requirements

Some subtotal or tax exclusions might be required to eliminate items not required

Formula Condition Values

To produce the required information, e.g. the detraction rules in particular, requires specific calculations.

Formula base values

When the unit price is required, the quantity for the condition must be set to the unit.

Printing Indicators

As explained above, all new printing indicators must be used (cannot be combined with old as that is not supported from SD side). It is important to configure this pricing indicator in such a way that it keeps records of empty or zero value tags when requested by SUNAT.


Relevant Catalog Tables - Sample Data

Tax Offices provides catalogs to map the XML semantic information. The information is highly dynamic, SAP does not deliver the content, it must be completed and maintenained from the SUNAT validation spreadsheets (Validations) updated normally on monthly basis.


The first column of each catalog table is a FREE key, you can define any value (Catalog Item Code - this is ment to be mnemotechnical)


Sample rows for catalogs 5 and 7:


Catalog 5 - Tax Types, etc.. summarized at header level

Catalog Item CodeTax Type CodeDescriptionUNECE 5153Local NameUNECE 5303
10001000IGV Impuesto General a las VentasVATIGVS
10161016Impuesto a la Venta Arroz Pilado

VATIVAP
20002000ISC Impuesto Selectivo al ConsumoEXCISCS
99959995ExportaciónFREEXP
99969996GratuitoFREGRAZ
99979997ExoneradoVATEXOE
99989998InafectoFREINAO
99999999Otros TributosOTHOTROS

Catalog 7 - Types of Tax Impact detailed at line item level

Catalog Item CodeDescriptionTax Impact and Reason CodeTax Type Code (reference to Cat 5)
101000Gravado - Operación Onerosa101000
102000Gravado - Operación Onerosa - affected to ISC102000
119996Gravado – Retiro por premio119996
129996Gravado – Retiro por donación129996
139996Gravado – Retiro139996
149996Gravado – Retiro por publicidad149996
159996Gravado – Bonificaciones159996
169996Gravado – Retiro por entrega a trabajadores169996
171016Gravado - IVAP171016
179996Gravado - IVAP - with 0% rate179996
209997Exonerado - Operación Onerosa209997
219996Exonerado - Transferencia gratuita219996
309998Inafecto - Operación Onerosa309998
319996Inafecto – Retiro por Bonificación319996
329996Inafecto – Retiro329996
339996Inafecto – Retiro por Muestras Médicas339996
349996Inafecto - Retiro por Convenio Colectivo349996
359996Inafecto – Retiro por premio359996
369996Inafecto - Retiro por publicidad369996
379996Inafecto - Transferencia gratuita379996
409995Exportación de Bienes o Servicios409995
409996Exportación de Bienes o Servicios - with 0% rate409996


Catalogs 09, 10, 16, 51, 53 and 54 have to be filled up in a samilar fashion from SUNAT latest validation spreadheet. Remember the first column (Catalog item code) is free and should be used to generate mnemotechnical codes.

Catalogs Metadata

Catalog Metadata explains SUNAT the reference information used for semantic, this information is not changing frequently

CatalogCatalog URICatalog Name (DO NOT TRANSLATE OR CONDENSE!)Catalog Agency
01urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo01Tipo de DocumentoPE:SUNAT
05urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo05Codigo de tributosPE:SUNAT
06urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo06Código de tipo de documento de identidadPE:SUNAT
07urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo07Afectacion del IGVPE:SUNAT
08urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo08Código de tributo por líneaPE:SUNAT
09urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo09Tipo de nota de creditoPE:SUNAT
10urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo10Tipo de nota de debitoPE:SUNAT
16urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo16Tipo de PrecioPE:SUNAT
51urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo51Tipo de OperacionPE:SUNAT
53urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo53Cargo/descuentoPE:SUNAT
54urn:pe:gob:sunat:cpe:see:gem:catalogos:catalogo54Codigo de detraccionPE:SUNAT


Amounts Mapping (view EDOPEMAPAMOUNTV)

Amount mapping transfer the pricing information to the XML constructs.


Press F1 in the XML Node ID column to read the SUNAT definition for the element.

Sample data for Invoice (copy to credit note, debit note, boleta, etc...):

Mapping ID
(Document Type)
XML Node IDLevel
(Header /Line)
SD Pricing Procedure
(not delivered)
Pricing StepSUNAT CatalogCatalog Item CodeSome explanationXML TagSample Pricing ConditionRequired?
(Always: printing "A" or "a"
If Any: printing "B" or "b")
SUNAT-114-2019ALLCHRGV1HRVAAPE8105302HDThis is a header level discountAllowangeCharge
if any
SUNAT-114-2019ALLCHRGV1HRVAAPE8115349HSThis is a header level  surchargeAllowangeCharge
if any
SUNAT-114-2019ALLCHRGV1HRVAAPE8155351HSVAT PerceptionAllowangeCharge
if any
SUNAT-114-2019ALLCHRGV1LRVAAPE8095300LDThis is a line item level  discountAllowangeCharge
if any
SUNAT-114-2019LEAMNTV1LRVAAPE973

Net amount without taxesInvoiceLine/LineExtensionAmounteDc It Amt +ItDsc+ItSur noTaxAlways
SUNAT-114-2019LMTATAMTV1HRVAAPE995

All DiscountsLegalMonetaryTotal(Requested)/AllowanceTotalAmounteDc Hd Ttl Discountsif any
SUNAT-114-2019LMTCTAMTV1HRVAAPE994

All Surcharges (before only header level was allowed)LegalMonetaryTotal(Requested)/ChargeTotalAmounteDc Hd Ttl Surchagesif any
SUNAT-114-2019LMTLEAMTV1HRVAAPE990

Total amount, but without any discount or surcharge. Notice it is only a subtotal without business meaning.LegalMonetaryTotal(Requested)/LineExtensionAmounteDc Hd Ttl Amt noDisc noTaxAlways
SUNAT-114-2019LMTPYAMTV1HRVAAPE997

Amount to be payedLegalMonetaryTotal(Requested)/PayableAmountPayableAmountAlways
SUNAT-114-2019LMTTIAMTV1HRVAAPE996

Total amount, without any discount or surcharge, but with Taxes. Notice it is only a subtotal without business meaning.LegalMonetaryTotal(Requested)/TaxInclusiveAmounteDc Hd Ttl Amt + TaxAlways
SUNAT-114-2019LPRICEV1LRVAAPE972

List or Market Price (not amount!)PriceeDc It UnPrc noHdSur noTaxAlways
SUNAT-114-2019PAYTMNSV1HRVAAPE999

Detraction percentage (see it here) - redefined after 114-2019Payment MeanseDc Hd Detraction Stif any
SUNAT-114-2019PAYTRMV2HRVAAPE99954001Detraction Reference + Payment Method (new since 193/220)PaymentTermseDc Hd Detraction Stif any
SUNAT-114-2019PRACPR1V1LRVAAPE9751601/0201- Item unit gross price (not amount!) customer is paying for
02- Item reference market or list unit price customer is receiving somehow for free. 
PricingReference/AlternativeConditionPrice

01: eDc It TTLUnPrc+lSur+lDisc+Tax
or
02: eDc It Free Of Charge

Always
SUNAT-114-2019TXAMNTV1HRVAAPE989

Final sumarization of taxes, no SD condition is needed as taxable amount is not present, summary works.TaxTotal

eDc Hd Sum All Tax

Always
SUNAT-114-2019TXAMNTV1LRVAAPE998

Item level sumarization of taxes, no SD condition is needed as taxable amount is not present, summary works.TaxTotal

eDc It Ttl Tax

Always
SUNAT-114-2019TXSUBTV1HRVAAPE984051000Summarization of taxes using catalog 5 (e.g. 9995: export, 1000: regular VAT). SD Condition required to report the taxable amount.TaxTotal/TaxSubtotaleDc Hd Sum VAT Exp, eDc Hd Sum Free Of C, eDc Hd Sum VAT Exempt,eDc Hd Sum VAT 0, eDc Hd Sum VAT

if any

SUNAT-114-2019TXSUBTV1LRVAAPE98107101000Splitting taxes at line item level with catalog 7, 101000→ regular VAT). SD Condition required to report the taxable amount.TaxTotal/TaxSubtotal

eDc It Tax Exempt,eDc It VAT Grant 0%,eDc It VAT Grant, eDc It VAT 0%,eDc It VAT, eDc It VAT Export 0%,eDc It VAT Export 0%

if any


Sample Pricing  Coding snippets for particular element (VOFM transaction)

This is a list of sample pricing requirements and value calculation useful to produce SUNAT required values.

DISCLAIMER: Notice these snippets are highly dependent on the existing pricing configuration and can be used only as reference if needed and adjusted accordingly. SAP has neither responsibility nor support for any of the snippets.


Pricing Requirements:

950 - How to turn on and off header level elements (not required, but useful for business user)

  *********************************************************************
* Monetary Totals configuration
* Header level subtotal
* This requirement is ment to be used in SAP Document Compliance
* for subtotal activations (XML elements construction)
*

FORM KOBED_950.
* Turn off header level sub total for items
  if KOMP-KPOSN = '000000'.
    sy-subrc = 0.
  else.
    sy-subrc = 4.
  endif.
ENDFORM.


FORM KOBEV_950.
  sy-subrc = 0.
ENDFORM.


951 - How to turn on and off item level elements (not required, but useful for business user)

  *********************************************************************
* Monetary Totals configuration
* Item level subtotal
* This requirement is ment to be used in SAP Document Compliance
* for subtotal activations (XML elements construction)
*

FORM KOBED_951.
* Turn on item level sub total for items
  if KOMP-KPOSN = '000000'.
    sy-subrc = 4.
  else.
    sy-subrc = 0.
  endif.
ENDFORM.


FORM KOBEV_951.
  sy-subrc = 0.
ENDFORM.


952 - How to exclude repeating VAT conditions at item level (can be also achieved using conditions groups if preferred)

*********************************************************************

* Tax exclusion at item level
* This requirement is ment to be used in SAP Document Compliance
* for subtotal activations (XML elements construction)
*

FORM KOBED_952.

FIELD-SYMBOLS: <xkomv> type komv_index,
                 <komv>  type komv.


data w_remove like sy-subrc VALUE 0.   " 999 --> remove, 0 ---> stay


* Check if VAT condition is already set
loop at XKOMV ASSIGNING <xkomv>
where KPOSN    = KOMP-KPOSN.

if <XKOMV>-KSCHL = 'EDCC'
or <XKOMV>-KSCHL = 'EDCE'
or <XKOMV>-KSCHL = 'EDCB'
or <XKOMV>-KSCHL = 'EDCD'
or <XKOMV>-KSCHL = 'EDCA'.
           w_remove = 999.
exit.
endif.
endloop.

if w_remove = 999.
  sy-subrc = 4.
endif.

ENDFORM.


FORM KOBEV_952.

ENDFORM.


953- How to exclude repeating VAT conditions at header level 

*********************************************************************
* VAT exclusion at header level
* This requirement is ment to be used in SAP Document Compliance
* for subtotal activations (XML elements construction)
*

FORM KOBED_953.

FIELD-SYMBOLS: <xkomv> type komv_index,
                 <komv>  type komv.
data w_remove like sy-subrc VALUE 0.   " 999 --> remove, 0 ---> stay

* Check if VAT condition is already set
loop at XKOMV ASSIGNING <xkomv>
where KPOSN    = KOMP-KPOSN.

if <XKOMV>-KSCHL = 'EDCI'
or <XKOMV>-KSCHL = 'EDCJ'
or <XKOMV>-KSCHL = 'EDCK'.
           w_remove = 999.
exit.
endif.
endloop.

if w_remove = 999.
  sy-subrc = 4.
endif.


ENDFORM.


FORM KOBEV_953.

ENDFORM.

954- How to Turn On and Off Free of charge conditions


***********************************************************************
* This item determines the free of charge based on the total amount
* This requirement is ment to be used in SAP Document Compliance
* for subtotal activations (XML elements construction)
*

FORM KOBED_954.
  sy-subrc = 4.
if KOMP-KPOSN ne 0 and KOMP-NETWR eq 0.
    sy-subrc = 0.
endif.
ENDFORM.


FORM KOBEV_954.
  sy-subrc = 0.
ENDFORM.


Condition Value:


980- List Price

*********************************************************************
* List Prices - calculate list price
* This requirement is ment to be used in SAP Document Compliance
* for subtotal activations (XML elements construction)
*

FORM FRM_KONDI_WERT_980.

FIELD-SYMBOLS <xkomv> type komv_index.


*search for basic price

loop at XKOMV assigning <XKOMV>
where KSCHL = 'PR00'.
    xkwert = <XKOMV>-kbetr.
endloop.

ENDFORM.


981- Net Unit Price

*********************************************************************
* Net Unit Price - calculate final unit price
* This requirement is ment to be used in SAP Document Compliance
* for subtotal activations (XML elements construction)
*

FORM FRM_KONDI_WERT_981.

FIELD-SYMBOLS <xkomv> type komv_index.

loop at XKOMV ASSIGNING <xkomv> where stunr = xkomv-stunB. "← adjust as appropriate
 xkwert = <xkomv>-KBETR.
 exit.
endloop.

ENDFORM.


982- Detraction statement, maximum percentage selection

*********************************************************************

* Peruvian Detraction - calculate statement amount
* This requirement is ment to be used in SAP Document Compliance
* for subtotal activations (XML elements construction)
*

FORM FRM_KONDI_WERT_982.

  FIELD-SYMBOLS <tkomv> type komv.

  data lv_max_kbetr like komv-kbetr.

*search for the maximum detraction (percentage)

  loop at TKOMV assigning <TKOMV>
    where KSCHL = 'J1PD'.
     if lv_max_kbetr < <Tkomv>-kbetr.
        lv_max_kbetr = <Tkomv>-kbetr.
    endif.
  endloop.

*Apply to condition total

   xkomv-kbetr = LV_MAX_KBETR.
   xkwert = xkomv-kbetr * xkomv-KAWRT / 100000.

ENDFORM.




Helper validation spreadsheet

Since monetary values calculation is pretty complex, this sample spreasheet can be used to verify calculations. Notice that depending on your use case, the spreadsheet might need to be adjusted.


  • No labels