Error adding Freight as Expense to Invoice in DI API after SAP upgrade

Hi All,
We recently upgrade from
SAP B1 2005 A (6.80.320) SP: 01 Patch Level 36
to
SAP B1 2007 A (8.00.178) SP: 00 Patch Level 42.
A .Net application using the DI API has successfully created orders/invoices with Tax and Freight charges successfully for years.  We upgraded to SAP 2007 and I upgraded the SAPbobComm library in the application (and 3 other integration apps).  Now, I can currently create new Invoices as long as the invoices don't require me to add the Freight charges.  If I include freight charges, I receive the following error:
"Internal error (-5002) occurred"
Here's the code I'm using to add the Freight charges:
oInvoice.Expenses.Add()
  oInvoice.Expenses.ExpenseCode = 1 'ExpnsCode value for the "Freight" expense in the OEXD table
  oInvoice.Expenses.LineTotal = dblFreight
  oInvoice.Expenses.TaxCode = "GEN"
returnCode = oInvoice.Add
I haven't touched this code in years, so any help would greatly appreciated.
Thanks.

How did you fix this issue?
Thanks,
Shea

Similar Messages

  • How to create Downpayment Invoice using DI API in SAP B1 2005 version?

    Hi there,
    I appreciate anyone that can suggest me how to create a down payment invoice using DI API in SAP B1 2005 version? What is the object that we need to use? I can't find any object to achieve this
    Many Thanks,
    Harianto Ng

    the object is SAPbobsCOM.BoObjectTypes.oDownPayments, but if i remember correctly this object wasnt exposed in DI for 2004 and maybe for 2005 too.

  • How to add Freight Charges to an invoice using DI API?

    I need to be able to add Freight Charges to an invoice of suppliers using DI API. Please I need help....!!!

    Hi,
    1. Step: Open the Invoice using oDocument.GetByKey("[DocEntry]")
    2. Step: Use the Lines in the BusinesObject (maybe copy them in an extra LinesObject for a better reading)
    3. Step: Use the Add()-Method to add a new Line
    4. Step: Fill the Line-Properties you want
    a.E.
    oInvoice.Lines.ItemCode = "FREIGHT"
    oInvoice.Lines.ItemDescription = "Freight Charge"
    oInvoice.Lines.Quantity = 1
    oInvoice.Lines.Price = 10.0
    oInvoice.Lines.UnitPrice = 10.0
    Remember: The Item (ItemCode) you want to insert must be existing
    5. Step: Update the main-Business-Object
    a.E.
    oInvoice.Update()
    Hope that help´s
    best regards
    Jochen

  • WCF-SAP Adapter throwing errors after SAP Upgrade from ECC 5 to ECC6 Release 640 to 700

    Hello Everyone,
    We were able to communicate(Send and Receive Idoc's) to SAP via WCF-SAP Adapter in BizTalk 2010.
    SAP Servers were upgraded to ECC5 to ECC 6 and we started facing below issue communicating on send and receive both.
    I am aware that there is a hotfix available but that is more on the Receive Side from SAP. Nevertheless I installed the hotfix but issue still persists. Any suggestions will be highly appreciated.
    Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: The segment name is not valid for the IDOCTYP, Release, or CIMTYP. Segment name: E2EDP01006GRP   IDOCTYP: ORDERS05   
    Release: 700    CIMTYP: . Ensure that your message xml validates against the operation schema.
    Server stack trace:
       at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
       at System.ServiceModel.Channels.ServiceChannel.EndRequest(IAsyncResult result)
    Exception rethrown at [0]:
       at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
       at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
       at System.ServiceModel.Channels.IRequestChannel.EndRequest(IAsyncResult result)
       at Microsoft.BizTalk.Adapter.Wcf.Runtime.
    Thanks,
    Vikingss

    I am aware that there is a hotfix available but that is more on the Receive Side from SAP. Nevertheless I installed the hotfix but issue still persists. Any suggestions will be highly appreciated.
    For this issue, you can contact Microsoft support directly(http://support.microsoft.com).

  • Error adding invoice - please help

    Hi Guys,
    I'm getting a weird error while trying to insert an invoice using DI API - the error is -5002,Invalid total  [OINV.Address]
    Any ideas how I can solve this?
    Thanks

    it has got something to do withe the Invoice Total, I suggest do, some tests to see if the object needs the Total set manually or not.
    for a breif experience service type invoices needed the total set.
    Indika.

  • Internal Error when adding Invoice from DI-API

    Hello All,
    I am trying to add an invoice using DI-API. I hv populated the object using XML and than adding it. Upon adding the error Internal Error (-10) is coming. I hv checked everything but am certainly missing something. Following is the XML of the invoice and the code to add it
    <?xml version="1.0" encoding="utf-16" ?>
    <BOM>
      <BO>
        <AdmInfo>
          <Object>13</Object>
          <Version>1</Version>
        </AdmInfo>
        <OINV>
          <row>
            <U_EntryId>1</U_EntryId>
            <DocType>I</DocType>
            <DocDate>20110923</DocDate>
            <DocDueDate>20111023</DocDueDate>
            <CardCode>JM0004</CardCode>
            <CardName>GAYAN BHARTI</CardName>
            <NumAtCard></NumAtCard>
            <DiscPrcnt>0.000000</DiscPrcnt>
            <DocTotal>755.000000</DocTotal>
            <Comments></Comments>
            <U_BranchTrans>1</U_BranchTrans>
            <SlpCode>-1</SlpCode>
            <IsICT>N</IsICT>
            <Series>40</Series>
            <TaxDate>20110923</TaxDate>
            <TrackNo></TrackNo>
            <SeqCode>0</SeqCode>
            <U_SlpName></U_SlpName>
            <U_WebCreated>N</U_WebCreated>
            <U_Territory></U_Territory>
            <U_InvType>C</U_InvType>
          </row>
        </OINV>
        <INV1>
          <row>
            <ItemCode>A003</ItemCode>
            <Dscription></Dscription>
            <Quantity>5.000000</Quantity>
            <DiscPrcnt>0.000000</DiscPrcnt>
            <WhsCode>JSP-FG</WhsCode>
            <PriceBefDi>11.000000</PriceBefDi>
            <TaxCode>NonTax</TaxCode>
            <U_WebCreated>N</U_WebCreated>
            <U_RetQty></U_RetQty>
            <U_SaleQty></U_SaleQty>
            <U_LineType>S</U_LineType>
          </row>
          <row>
            <ItemCode>A005</ItemCode>
            <Dscription>Ace Visual Dictonary 2</Dscription>
            <Quantity>10.000000</Quantity>
            <DiscPrcnt>0.000000</DiscPrcnt>
            <WhsCode>JSP-FG</WhsCode>
            <PriceBefDi>70.000000</PriceBefDi>
            <TaxCode>NonTax</TaxCode>
            <U_WebCreated>N</U_WebCreated>
            <U_RetQty></U_RetQty>
            <U_SaleQty></U_SaleQty>
            <U_LineType>S</U_LineType>
          </row>
        </INV1>
      </BO>
    </BOM>
    Program Code to add
                Dim oSapObject As SAPbobsCOM.Documents
                oCompany.XMLAsString = True
                oSapObject = oCompany.GetBusinessObjectFromXML(Body, 0)
                If oSapObject.Add <> 0 Then
                    Throw New Exception(oCompany.GetLastErrorDescription & " [" & oCompany.GetLastErrorCode & "]")
                End If
    Any help would be greatly appreciated. This is sort of urgent and needs to be done immediately.
    Regards,
    Rahul Jain
    PS: The error is coming on oSapObject.Add - it is able to read the invoice from XML, the error comes when trying to add it. All relevant values mentioned in XML are present in the database, and I am able to add an Invoice from the UI.
    Edited by: Rahul Jain on Sep 24, 2011 1:29 PM

    I realize this might not be to much help but everytime I have ever gotten an internal error code it has always turned out to be a SQL error. For instance there could be something in transaction notification that doesnt jive with your submission or something along those lines. Perhaps you could try a more simplified invoice as a test such as just send one item with a price and no UDFs .
    Sorry if that is not much help.

  • Assign Project Code to Freight charges in AP Invoice

    Project Code field is not available in Freight Charges window at all though it can be displayed and edited by selecting Project Code to be visible and Active in Journal Entry Form Settings Table Format.  As this is a limitation in SAP B1 please feedback to Development for improvement.
    It is important to allocate Project Code to Freight charges in AP Invoice as every Purchase expense of Inventory or Non Inventory is assigned a Project Code for recognition in Profit and Loss Statement.  
    Kedalene Chong

    Hello,
    Your requirement to add project code on Freight Charges form is valid. This is well known issue and we have it on the waiting list; however, I cannot specify in which release this will be fixed.
    Is there any other specific requirement on Cost Accounting you would like to solve?
    Thanks.
    Peter Dominik
    SAP
    B1 Product Definition

  • Freight in Down Payment Invoice

    Dear All,
    In Sales Order I have added freight in the document and now for this sales order a down payment invoice is been booked and in down payment i am using the option copy from - Sales order and in Document Draw Wizard I am clicking the option Draw All Data ( Including Freight & Witholding Tax ) but in Dow Payment Invoice the freight amount is not coming. Is it possible to bring freight in down payment or this option cannot be done in down payment invoice.
    I am using SAP Business One 2005B with patch level 39.
    An early response from your end would be highly appreciated.
    Thanks and Regards,
    Kawish Junaid Mazhari

    Dear Ivy,
    Thanks for the response. But as frieght charges cannot be copied to down payment invoice then what can be done if in a particular sales order, the Sales order value is less than the down payment. It happens sometimes that the customer gives on account payment and sales order is made after recieving the down payment. But in SAP Business One it seems that a down payment cannot be done more than the sales order value
    Does anyone has a solution for the above situation.
    Thanks and Regards,
    Kawish Junaid Mazhari

  • Adding Freight costs

    Hi folks,
    I have a requirement where I have to add freight costs to a delivery. I am using the following code.
    DECLARE
      action_code         VARCHAR2(15);
      pub_freight_costs   wsh_freight_costs_pub.pubfreightcostrectype;
      freight_cost_id     NUMBER;
      lv_freight_cost_id  NUMBER;
      lv_msg_data         VARCHAR2(10000);
      lv_msg_count        NUMBER;
      lv_ret_status       VARCHAR2(5);
      l_user_id           NUMBER;
      l_resp_id           NUMBER;
      l_appl_id           NUMBER;
      l_msg_index         NUMBER;
      lv_msg_index_out    NUMBER;
      lv_error_message    VARCHAR2(10000);
    BEGIN
      SELECT user_id
        INTO l_user_id
        FROM fnd_user
       WHERE user_name = 'ANUJ_K';
      SELECT responsibility_id, application_id
        INTO l_resp_id, l_appl_id
        FROM fnd_responsibility_vl
       WHERE responsibility_name = 'Order Management Super User';
      fnd_global.apps_initialize(l_user_id, l_resp_id, l_appl_id);
      mo_global.set_policy_context('S',82);
      mo_global.init('ONT');
      pub_freight_costs.freight_cost_type_id := 1;
      pub_freight_costs.unit_amount          := 20;
      pub_freight_costs.currency_code        := 'USD';
      pub_freight_costs.delivery_id          := 36661664;
      pub_freight_costs.delivery_detail_id   := 9319784;
      wsh_freight_costs_pub.Create_Update_Freight_Costs(p_api_version_number  => 1.0              ,
                                                        p_init_msg_list       => fnd_api.g_false  ,
                                                        p_commit              => fnd_api.g_false  ,
                                                        x_return_status       => lv_ret_status    ,
                                                        x_msg_count           => lv_msg_count     ,
                                                        x_msg_data            => lv_msg_data      ,
                                                        p_pub_freight_costs  => pub_freight_costs,
                                                        p_action_code         => 'CREATE'         ,
                                                        x_freight_cost_id     => lv_freight_cost_id
      COMMIT;
      dbms_output.put_line('Return Status: '||lv_ret_status);
      dbms_output.put_line('Message Count: '||lv_msg_count);
      dbms_output.put_line('Freight Cost ID: '||lv_freight_cost_id);
      IF (lv_ret_status = 'S') THEN
          DBMS_OUTPUT.put_line('Freight Costs added.');
      ELSE
          DBMS_OUTPUT.put_line('Error creating freight costs');
          FOR i IN 1 .. lv_msg_count LOOP
                       apps.fnd_msg_pub.get(p_msg_index     => i              ,
                                            p_encoded       => fnd_api.g_false,
                                            p_data          => lv_msg_data    ,
                                            p_msg_index_out => lv_msg_index_out);
                       --COMMIT;                    
                       IF lv_error_message IS NULL THEN
                          lv_error_message := SUBSTR(lv_msg_data, 1, 250);
                       ELSE
                          lv_error_message := lv_error_message || ' /' ||SUBSTR(lv_msg_data, 1, 250);
                       END IF;
                       --show_mesg('------------------------------------------','LOG');
                       --show_mesg('Return Status : ' || lv_return_status,'LOG');
                       --show_mesg('Error Message : ' || lv_error_message,'LOG');
                       --show_mesg('------------------------------------------','LOG');
                       dbms_output.put_line('------------------------------------------');
                       dbms_output.put_line('Return Status : ' || lv_ret_status);
                       dbms_output.put_line('Error Message : ' || lv_error_message);
                       dbms_output.put_line('------------------------------------------');
          END LOOP;
      END IF;
    EXCEPTION
      WHEN OTHERS THEN
         dbms_output.put_line('Error: '||SQLERRM);
    END;    
    But upon execution I get the following Error.
    Return Status: E
    Message Count: 0
    Freight Cost ID:
    Error creating freight costs
    Could someone help me as to where exactly I am going wrong? Since the message count is 0 so it is not displaying any error.
    Thanks                                                   

    Since you are already on R12 please refer to Note 781061.1. Please note that this is referring to 12.1.1 (after 12.1 which I believe is yet to be released). This functionality is available out of the box in that release. Since then if you want real time solution (cost has to change for the receipt and accounting needs to be correct) for the purchase receipt transaction, you have to use Costing hooks. You have to use transaction costing hooks as well as accounting hooks to offset receiving account value.
    Thanks
    Nagamohan

  • Issues in IDoc Sender Scenario:IDoc  with errors added

    Hi all
             Am working on an IDoc to JDBC scenario. In R/3 system, I have created distribution model, partner profile, RFC destination and port.The IDoc is generated and is sent to XI successfully. But in XI , there is no entry in SXI_MONITOR for this (unfortunately IDX5 is not available in the XI server! ;as of now). Instead an entry is made in WE05 and WE02 with stautus 56(IDoc with errors added). In the status record:
    status 56 : External segment name E2KOMG003 cannot be interpreted
    status 60 : Basic IDoc type COND_A03 could not be found.
    And the segments displayed in data record  are different from the segments in the data record of the IDoc generated at R/3. (say for E1KOMG at R/3, E2KOMG003 in XI).Earlier the flow was working fine and the DB table was updated successfully. And the entire stuff is believed to be 'unmodified' .
    Would any one help in resolving the issue.
    Thanks,
    Chilanka

    Hi,
    >>>>I have created partenr profile in R/3.Need I create a partner profile in XI for R/3 system?
    no you cannot create any partner profiles in XI
    for more about IDOC configuration in XI check :
    <a href="/people/michal.krawczyk2/blog/2006/10/11/xi-new-book-mastering-idoc-business-scenarios-with-sap-xi"><b>Mastering IDoc Business Scenarios with SAP XI</b></a>
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • Error while posting Idoc for customer invoice.

    hi,
    I m posting Customer Invoice through LSMW using IDocs.
    Basic type is FIDCCP02 and message is FIDCC2.
    While posting the Idoc I m getting error as:
    'Document or line item does not exist for invoice reference'.
    I m not getting the error why it is asking for invoice reference because
    in FB01 it is not asking for any reference or anything.
    In Idoc all the item level values are coming prorperly.
    If anybody worked on such issues then please reply.
    -Thanx.
    -Umesh

    Hi Umesh,
    Try posting customer invoice through TCode - F-22. There it may be asking for reference number. Generally we post customer invoice by F-22 not from FB01.
    If you are getting error you can add reference field in your LSMW it may be mandatory in F-22.
    Ashven

  • Error Message "Delete price or set "Invoice Expected Indicator" in PO.

    Hi Gurus,
    We are in extended classic scenario with version 5.0.
    We are getting error message "Delete price or set "Invoice Expected Indicator" when we are releasing the PO from Release PO option.
    We are getting this error message in below situation:
    We created shopping carts without vendor then after approval PO gets created in "Held status". When we edit the PO & add vendor then system gives error message "Delete price or set "Invoice Expected Indicator" (Line 1).
    In this case the invoice expected indicator is not sets when we add vendor in the PO but if we create Shopping cart with vendor & when PO create din that case the invoice expected indicator is automatialy comes.
    Can any one please help me to resolve this issue.
    Thanks & Regards,
    Manish
    Edited by: Manish Mamidwar on Jul 30, 2010 5:40 PM

    Hi All,
    I have the same problem, Delete price or set "Invoice Expected Indicator" in PO
    I have an Item Position of the PO that is Limit of Liability and for this position type I will not make invoice, then I would like remove the flag of invoice execution, but a recived your same message, can you tell me how did you resolve this problem?
    Kind regards
    Valentina Mari
    Edited by: Fuffo Fuffi on Nov 10, 2010 12:51 PM

  • Error adding buffer entry when using Asynchronous mode of JRA and JCO call

    Enviroment: XMII 12.1.4 / CE EhP1 SP03
    When I using SAP JRA Function Call or SAP JCO Funciton Call in transaction, it works well when I choose 'Process Type' as 'Synchronous processing' in 'Data Buffering Configuration' tab. But when I use 'Asynchronouse processing' it doesn't work.
    I check the Netweaver logs, there some logs like following:
    Error adding buffer entry (com.sap.xmii.dataqueue.DataBufferManager)
    Couldn't add buffer entry (com.sap.xmii.dataqueue.DataBufferManager)
    ManagedConnectionImpl.dissociateConnections(), dissociation of a non-cci transaction, H1, C1(com.sap.mw.jco.jra)
    how could I solve this problem?

    Solved after deploy 12.1 SP05 (xMII 12.1.5 build 91)

  • Error Message while creating A/P Invoice

    hi experts,
    I try to create AP invoice but system shows following error cannot create standalone AP/AR invoice with excisable item. please explain me the reason to understand.

    Hi Ratna Kumari,
    When ever you create Delivery for Excise able Item System Pop Up That You need to Create Excise able Invoice for this Delivery.
    If you will not Create Excise able Invoice then You will not be able to create Invoice.
    If Item is Excise able then you have to Create Excise able Invoice other wise you will not be able to create Invoice.
    If you have included Tax with 100% Non Deductible then also you have to create Excise Invoice for every Delivery of Excise able Item for Creating Invoice.
    This is Standard System Behavior. You to Create Excise able Invoice for Creation Invoice.
    Hope this help
    Regards::::
    Atul Chakraborty

  • Getting error while posting actual expense to f-02

    HI Every one
    Getting error while posting actual expense to f-02.Iam trying to post simple expense transation against a WBS element but iam getting the following error "FI: Postings" is not allowed for WBS element".Even i checked the status profile.In user status the FI postings business transaction is allowed but in System status it is not allowed but as far my understanding in either of one status the business transaction should be allowed.
    Please suggest me hw to change the system statuses and hw to resolve the error.
    Regards,
    Ragahvendra.M
    SAP-Practice

    Dear,
            I think ur project is not in released status.
            Or the account assignment element is not ticked.
             Check and try.
    Regards.

Maybe you are looking for