Skip to Content

DI API- Delivery Discount Percentage

Hi expert,

I m trying to create new delivery from another company with DI API.

I am saving xml with code docfrom.SaveXML(filePath);

Then i get this xml with

Documents d1 = (Documents)Initializer.oCompany.GetBusinessObjectFromXML(filePath, 0);

var c = d1.Add();

I'm succes with that. But when i look at the newly created delivery i saw the discount percentage is different from other. The first one is 3, the newly created one is 3.03

I think these value is calculated again. But i dont know how it is calculated?

Because when i write the 3,35 to discount total the discount percentage is calculated as 2,98 not 3,03. Does anybody know how is it?

fromdelivery.pngtodelivery.png?

fromdelivery.png (11.1 kB)
todelivery.png (11.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • What fields are you sending in XML? The percent or the value?

    Could you share part of xml here?

  • I am getting xml from my first company with docform.savetoxml(filepath) . This code gives me full xml.

    I dont change any part of this xml. And create new document with this xml by code (Documents)Initializer.oCompany.GetBusinessObjectFromXML(filePath, 0);

    Xml is like this.

    I have tried to add new document to same company. Again different discount percentage.

    <?xml version="1.0" encoding="UTF-16"?>
    -<BOM>
    -<BO>
    -<AdmInfo>
    <Object>15</Object>
    <Version>2</Version>
    </AdmInfo>
    -<Documents>
    -<row>
    <DocEntry>23</DocEntry>
    <DocNum>23</DocNum>
    <DocType>dDocument_Items</DocType>
    <HandWritten>tNO</HandWritten>
    <Printed>psNo</Printed>
    <DocDate>20171002</DocDate>
    <DocDueDate>20171002</DocDueDate>
    <CardCode>S1</CardCode>
    <CardName>S1</CardName>
    <DocTotal>13.460000</DocTotal>
    <DocCurrency>TRY</DocCurrency>
    <DocRate>1.000000</DocRate>
    <Reference1>23</Reference1>
    <JournalMemo>Teslimatlar - S1</JournalMemo>
    <PaymentGroupCode>-1</PaymentGroupCode>
    <DocTime>1725</DocTime>
    <SalesPersonCode>-1</SalesPersonCode>
    <TransportationCode>-1</TransportationCode>
    <Confirmed>tYES</Confirmed>
    <SummeryType>dNoSummary</SummeryType>
    <ContactPersonCode>0</ContactPersonCode>
    <ShowSCN>tNO</ShowSCN>
    <Series>6</Series>
    <TaxDate>20171002</TaxDate>
    <PartialSupply>tYES</PartialSupply>
    <DocObjectCode>15</DocObjectCode>
    <DiscountPercent>3.000000</DiscountPercent>
    <DocTotalFc>0.000000</DocTotalFc>
    <RevisionPo>tNO</RevisionPo>
    <BlockDunning>tNO</BlockDunning>
    <Pick>tNO</Pick>
    <PaymentMethod/>
    <PaymentBlock>tNO</PaymentBlock>
    <MaximumCashDiscount>tNO</MaximumCashDiscount>
    <WareHouseUpdateType>dwh_Consignment</WareHouseUpdateType>
    <Rounding>tNO</Rounding>
    <DeferredTax>tNO</DeferredTax>
    <NumberOfInstallments>1</NumberOfInstallments>
    <ApplyTaxOnFirstInstallment>tNO</ApplyTaxOnFirstInstallment>
    <DocumentSubType>bod_None</DocumentSubType>
    <Address2/>
    <UseShpdGoodsAct>tNO</UseShpdGoodsAct>
    <IsPayToBank>tNO</IsPayToBank>
    <DownPayment>0.000000</DownPayment>
    <ReserveInvoice>tNO</ReserveInvoice>
    <LanguageCode>31</LanguageCode>
    <SequenceModel>0</SequenceModel>
    <UseCorrectionVATGroup>tNO</UseCorrectionVATGroup>
    <DownPaymentAmount>0.000000</DownPaymentAmount>
    <DownPaymentPercentage>0.000000</DownPaymentPercentage>
    <DownPaymentType>dptInvoice</DownPaymentType>
    <DownPaymentAmountSC>0.000000</DownPaymentAmountSC>
    <DownPaymentAmountFC>0.000000</DownPaymentAmountFC>
    <VatPercent>0.000000</VatPercent>
    <ServiceGrossProfitPercent>0.000000</ServiceGrossProfitPercent>
    <RoundingDiffAmount>0.000000</RoundingDiffAmount>
    <ControlAccount>120010100</ControlAccount>
    <InsuranceOperation347>tNO</InsuranceOperation347>
    <ArchiveNonremovableSalesQuotation>tNO</ArchiveNonremovableSalesQuotation>
    <ExtraMonth>0</ExtraMonth>
    <ExtraDays>0</ExtraDays>
    <CashDiscountDateOffset>0</CashDiscountDateOffset>
    <StartFrom>pdt_None</StartFrom>
    <NTSApproved>tNO</NTSApproved>
    <EDocGenerationType>edocNotRelevant</EDocGenerationType>
    <EDocStatus>edoc_Ok</EDocStatus>
    <DownPaymentStatus>so_Open</DownPaymentStatus>
    <GroupHandWritten>tNO</GroupHandWritten>
    <CreateOnlineQuotation>tNO</CreateOnlineQuotation>
    <ApplyCurrentVATRatesForDownPaymentsToDraw>tNO</ApplyCurrentVATRatesForDownPaymentsToDraw>
    <ClosingOption>coByCurrentSystemDate</ClosingOption>
    <OpenForLandedCosts>tYES</OpenForLandedCosts>
    <RelevantToGTS>tNO</RelevantToGTS>
    <IsAlteration>tNO</IsAlteration>
    <DocumentDelivery>ddtNoneSeleted</DocumentDelivery>
    <ReuseDocumentNum>tNO</ReuseDocumentNum>
    <ReuseNotaFiscalNum>tNO</ReuseNotaFiscalNum>
    <PrintSEPADirect>tNO</PrintSEPADirect>
    <InterimType>boidt_None</InterimType>
    <RelatedType>-1</RelatedType>
    </row>
    </Documents>
    -<Document_Lines>
    -<row>
    <LineNum>0</LineNum>
    <ItemCode>I1</ItemCode>
    <ItemDescription>I1</ItemDescription>
    <Quantity>1.000000</Quantity>
    <Price>11.760000</Price>
    <PriceAfterVAT>13.880000</PriceAfterVAT>
    <Currency>TRY</Currency>
    <Rate>0.000000</Rate>
    <DiscountPercent>2.000000</DiscountPercent>
    <VendorNum/>
    <WarehouseCode>01</WarehouseCode>
    <SalesPersonCode>-1</SalesPersonCode>
    <CommisionPercent>0.000000</CommisionPercent>
    <TreeType>iNotATree</TreeType>
    <AccountCode>600000000</AccountCode>
    <UseBaseUnits>tNO</UseBaseUnits>
    <SupplierCatNum/>
    <ProjectCode/>
    <VatGroup>S01</VatGroup>
    <Height1>0.000000</Height1>
    <Height2>0.000000</Height2>
    <Lengh1>0.000000</Lengh1>
    <Lengh2>0.000000</Lengh2>
    <Weight1>0.000000</Weight1>
    <Weight2>0.000000</Weight2>
    <Factor1>1.000000</Factor1>
    <Factor2>1.000000</Factor2>
    <Factor3>1.000000</Factor3>
    <Factor4>1.000000</Factor4>
    <BaseType>-1</BaseType>
    <Volume>0.000000</Volume>
    <VolumeUnit>2</VolumeUnit>
    <Width1>0.000000</Width1>
    <Width2>0.000000</Width2>
    <Address/>
    <TaxType>tt_Yes</TaxType>
    <TaxLiable>tYES</TaxLiable>
    <BackOrder>tYES</BackOrder>
    <FreeText/>
    <ShippingMethod>1</ShippingMethod>
    <CorrectionInvoiceItem>ciis_ShouldBe</CorrectionInvoiceItem>
    <CorrInvAmountToStock>0.000000</CorrInvAmountToStock>
    <CorrInvAmountToDiffAcct>0.000000</CorrInvAmountToDiffAcct>
    <WTLiable>tNO</WTLiable>
    <DeferredTax>tNO</DeferredTax>
    <UnitsOfMeasurment>1.000000</UnitsOfMeasurment>
    <LineTotal>11.760000</LineTotal>
    <TaxPercentagePerRow>18.000000</TaxPercentagePerRow>
    <TaxTotal>2.050000</TaxTotal>
    <ConsumerSalesForecast>tNO</ConsumerSalesForecast>
    <ExciseAmount>0.000000</ExciseAmount>
    <SWW/>
    <DistributeExpense>tYES</DistributeExpense>
    <RowTotalFC>0.000000</RowTotalFC>
    <TaxOnly>tNO</TaxOnly>
    <UnitPrice>12.000000</UnitPrice>
    <LineStatus>bost_Open</LineStatus>
    <PackageQuantity>1.000000</PackageQuantity>
    <LineType>dlt_Regular</LineType>
    <COGSAccountCode>620000000</COGSAccountCode>
    <ChangeAssemlyBoMWarehouse>N</ChangeAssemlyBoMWarehouse>
    <GrossBuyPrice>0.000000</GrossBuyPrice>
    <GrossBase>-2</GrossBase>
    <GrossProfitTotalBasePrice>0.000000</GrossProfitTotalBasePrice>
    <ActualDeliveryDate>20171002</ActualDeliveryDate>
    <RequiredQuantity>0.000000</RequiredQuantity>
    <WithoutInventoryMovement>tNO</WithoutInventoryMovement>
    <ShipToDescription/>
    <DocEntry>23</DocEntry>
    <Surpluses>0.000000</Surpluses>
    <DefectAndBreakup>0.000000</DefectAndBreakup>
    <Shortages>0.000000</Shortages>
    <ConsiderQuantity>tNO</ConsiderQuantity>
    <PartialRetirement>tNO</PartialRetirement>
    <RetirementQuantity>0.000000</RetirementQuantity>
    <RetirementAPC>0.000000</RetirementAPC>
    <ThirdParty>tNO</ThirdParty>
    <UoMEntry>-1</UoMEntry>
    <InventoryQuantity>1.000000</InventoryQuantity>
    <Incoterms>0</Incoterms>
    <TransportMode>0</TransportMode>
    <ChangeInventoryQuantityIndependently>tNO</ChangeInventoryQuantityIndependently>
    </row>
    </Document_Lines>
    -<TaxExtension>
    -<row>
    <NetWeight>0.000000</NetWeight>
    <GrossWeight>0.000000</GrossWeight>
    <StreetS/>
    <BlockS/>
    <BuildingS/>
    <CityS/>
    <ZipCodeS/>
    <CountyS/>
    <StateS/>
    <CountryS/>
    <GlobalLocationNumberS/>
    </row>
    </TaxExtension>
    -<AddressExtension>
    -<row>
    <ShipToStreet/>
    <ShipToStreetNo/>
    <ShipToBlock/>
    <ShipToBuilding/>
    <ShipToCity/>
    <ShipToZipCode/>
    <ShipToCounty/>
    <ShipToState/>
    <ShipToCountry/>
    <ShipToAddressType/>
    <ShipToGlobalLocationNumber/>
    <ShipToAddress2/>
    <ShipToAddress3/>
    </row>
    </AddressExtension>
    </BO>
    </BOM>
  • Get RSS Feed

2 Answers

  • Best Answer
    Oct 03, 2017 at 05:00 AM

    Hi,

    SAP has a few ways of calculation.
    If you provide Quantity, Price and discount, the line total will be calculated.
    If you provide Quantity, Price and line total, the discount will be calculated regardless of what discount you have entered.
    For import from XML, all the values are provided for, and as such SBO recalculate the discount.

    To workaround your problem, modify the XML file first by removing the below fields:
    1. LineTotal (Doc Lines)
    2. DocTotal (Doc Header)
    3. PriceAfterVat (Doc Lines)

    Regards
    Edy

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 28, 2017 at 08:52 PM

    Hi Gul aly or Edy Simon

    i have some problem using GetBusinessObjectFromXML , becouse i am traying to export from one database to another some documents

    like : stocktransfer , Invoices , deliverys,

    etc ,

    but when use

    Documents d1 = (Documents)Initializer.oCompany.GetBusinessObjectFromXML(filePath, 0);

    var c = d1.Add();

    i get an error : (-5002) You cannot change the total for this document

    how can you solve this problem?

    Add comment
    10|10000 characters needed characters exceeded