Copy the Frieght/AdditionalExpenses from SO to Delivery document

Hi,
I want to copy the Frieght/AdditionalExpenses from SO to Delivery document. I'm using the following code.
When I'm adding DL document, I get internal error -5002.
Please help me.
Thank you.
            Dim objBaseDoc As SAPbobsCOM.Documents
                    objBaseDoc = objSBOAPI.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
            If objBaseDoc.GetByKey(strFirstDocEntry) = True Then
                Call AddExpensesFromBaseDoc(objDLDoc, objBaseDoc.Expenses)
Private Function AddExpensesFromBaseDoc(ByRef objDLDoc As SAPbobsCOM.Documents, ByRef objExpenses As SAPbobsCOM.DocumentsAdditionalExpenses)
        Try
            Dim i As Integer, ncnt As Integer, nIndexToStart As Integer
            nIndexToStart = objDLDoc.Expenses.Count
            Try
                objDLDoc.Expenses.SetCurrentLine(nIndexToStart)
            Catch ex As Exception
                objDLDoc.Expenses.Add()
            End Try
            ncnt = objExpenses.Count
            For i = 0 To ncnt - 1
                objExpenses.SetCurrentLine(i)
                objDLDoc.Expenses.SetCurrentLine(nIndexToStart + i)
                objDLDoc.Expenses.ExpenseCode = objExpenses.ExpenseCode
                objDLDoc.Expenses.LineTotal = objExpenses.LineTotal
                'objDLDoc.Expenses.TaxCode = objExpenses.TaxCode
                If (i + 1) < ncnt Then
                    objDLDoc.Expenses.Add()
                End If
            Next
        Catch ex As Exception
            Call objSBOAPI.SBO_Appln.MessageBox("AddExpensesFromBaseDoc " & ex.Message)
        End Try
    End Function

Hi Geetha,
The most likely reason for that error message is that there's a blank expenses line in the delivery. If you put a break point just before you try and add the delivery, check to see if every expenses line in the delivery has an expense code.
I suspect the problem is that the document object will automatically have a Expenses.Count value of 1, even if no expenses have been added. Therefore, if you've just created a new instance of a delivery document your following code will add a new expenses line but leave the first line empty:
nIndexToStart = objDLDoc.Expenses.Count
Try
objDLDoc.Expenses.SetCurrentLine(nIndexToStart)
Catch ex As Exception
objDLDoc.Expenses.Add()
End Try
You need to add logic to this, if Count is 1, then check to see if an expenses code has been set for this line. If not, then you need to overwrite the values in the first expenses line. If the count is 1 and there is an expenses code set on this line then you need to add a new expenses line.
Kind Regards,
Owen

Similar Messages

  • Copy the pricing conditions from Sales Order to Delivery

    Hi all,
    I have to send the princing conditions from the delivery trough Idoc.
    That's the reason why I need the princing conditions in the delivery. But I can't redetermine the pricing procedure in the delivery creation. I need to copy the pricing conditions from order to delivery.
    Because if there is any manual modification of a condition in the sales order, If I redeterminate the pricing procedure in the delivery, I would lost the changes.
    Anybody knows any User Exit or anyway to copy the pricing conditions from SO to Delivery?
    Thanks in advance

    I think pricing will not determine in delivery, if any shipmentchanges will copy to delivery, not standard pricing.
    Logically, when you create delivery by that time your pricing need to finsh, no changes, so send pricing infor from order to customer, as its standard process in any client.

  • HT2548 how do i copy the domain file from OS 10.4 to a lion OS computer?  I made a copy of the domain file and copied it to my new computer, but it doesn't open in iweb when I double-click on it.

    How do I import an iweb domain file from an ibook (OS 10.4) to an imac (OS 10.73)?
    I copied the domain file from my ibook to my imac, but when I double-click on the file, it doesn't open in iweb. 

    In Lion the Library folder is now invisible. To make it permanently visible enter the following in the Terminal application window: chflags nohidden ~/Library and hit the Enter button - 10.7: Un-hide the User Library folder.  Then place the domain file in your Users/Home/Library/Application Support/iWeb folder.
    To open your domain file in Lion or to switch between multiple domain files Cyclosaurus has provided us with the following script that you can make into an Applescript application with Script Editor. Open Script Editor, copy and paste the script below into Script Editor's window and save as an application.
    do shell script "/usr/bin/defaults write com.apple.iWeb iWebDefaultsDocumentPath -boolean no"delay 1
    tell application "iWeb" to activate
    You can download an already compiled version with this link: iWeb Switch Domain.
    Just launch the application, find and select the domain file you want to open and it will open with iWeb. It modifies the iWeb preference file each time it's launched so one can switch between domain files.
    WARNING: iWeb Switch Domain will overwrite an existing Domain.sites2 file if you select to create a new domain in the same folder.  So rename your domain files once they've been created to something other than the default name.
    OT

  • I have a new pc. If I copy the Itunes folder from my old pc onto my new one in the music folder will I be able to sync just as if it were the old one? This is from a Widows Vista machine to Windows 7.

    If I copy the Itunes folder from my old pc onto my new one in the music folder will I be able to sync just as if it were the old one? This is from a Widows Vista machine to Windows 7.

    I suspect design rather than a bug, it's too useful. The behaviour seems to have been consistent for quite a long time on both Windows and Mac machines...
    Here are the typical layouts for the iTunes folders:
    In the layout above right, with the media folder (everything in the red box) inside the library folder, the library will be portable. A portable library can be moved from one path to another, or even between Windows & Mac computers, without breaking the links between the library and the media, and being self-contained is much easier to backup (You do backup, don't you?). Anything that isn't stored inside the media folder must stay put or be restored to precisely the same path on a new machine or iTunes won't know where to find it. Within the media folder the relative paths from the library to the media remain unchanged and iTunes can cope even when the absolute paths are updated.
    Should your library not be in the usual layout I've written some general posts on how to make a split library portable or I can give specific instructions on request.
    tt2

  • How to copy the Pricing conditions from one Distribution Channel to another

    Generally we use VK11 transaction to create conditional records .
    but I Need to Know whether is it Possible to copy the Pricing conditions from one Distribution Channel to another with same name and same internal Characteristics .
    Since we have around 70+ of Condition type with different parameter Sequence.So Instead of Going for BDC whether is there any standard Funct Modules/programs/BAPIs to do this?
    How to make a copy Condition types from One Distribution Channel to another.
    since SAP has already provided to copy conditions from Customer to customer.
    Likewise i need to know whether SAP is facilitating for these feature also.
    Iam Dubious in this issue.
    Hope Fully looking for the answers.
    Harish.N

    - IDOC_INPUT_COND_A (you can create IDOC, but also call directly)
    - call transaction / batch input (use transaction XK15, as used by LSMW)
    - use group of function modules RV_CONDITION_COPY, RV_CONDITION_SAVE, RV_CONDITION_RESET + commit.
    if you search SDN on 'RV_CONDITION_COPY' you'll find more info I believe.
    Someone mentioned BAPI_PRICE_CONDITIONS as well.

  • I am changing to a larger hard drive on my Mac. Can I copy the Aperture library from my backup disk running Time Machine without loosing anything?

    I am installing a larger harddrive on my Mac. Can I copy the Aperture library from my backup disk running Time Machine without loosing anything? I am getting help migrating everything else on to the new harddrive, but since copying the 350Gb Aperture library takes a lot of time, I am planning to do that part myself.

    I found the following information on Time Machine help about restoring Aperture library from TM
    Restoring Your Aperture System
    If you buy a new computer or use another system at a different location and want access to the Aperture library, you can install Aperture and then transfer the library from your vault (on your backup disk) to the other computer. If you experience equipment failure or other unexpected events, such as fire or weather-related damage to your equipment, you can easily restore the entire library to your new computer from a backup disk.
    HideTo restore the entire library from an external backup disk
    Restoring Your Aperture System
    If you buy a new computer or use another system at a different location and want access to the Aperture library, you can install Aperture and then transfer the library from your vault (on your backup disk) to the other computer. If you experience equipment failure or other unexpected events, such as fire or weather-related damage to your equipment, you can easily restore the entire library to your new computer from a backup disk.
    HideTo restore the entire library from an external backup disk
    If you buy a new computer or use another system at a different location and want access to the Aperture library, you can install Aperture and then transfer the library from your vault (on your backup disk) to the other computer. If you experience equipment failure or other unexpected events, such as fire or weather-related damage to your equipment, you can easily restore the entire library to your new computer from a backup disk.
    HideTo restore the entire library from an external backup disk
    Connect the hard disk drive that contains the most up-to-date vault to your computer and open Aperture.
    Choose File > Vault > Restore Library.The Restore Library dialog appears.
    Choose the vault you want to use to restore your library from the Source Vault pop-up menu.If the vault doesn’t appear in the Source Vault pop-up menu, choose Select Source Vault from the Source Vault pop-up menu, navigate to the vaults location in the Select Source Vault dialog, then click Select.
    Click Restore, then click Restore again.

  • How can i copy the music files from itunes in mp3 format to my PC

    How can i copy the music files from itunes in mp3 format to my PC

    Dr. P,
    Song files are just files.  You can copy them the way you copy any other files, like photos or documents.
    If any of the files are not already in MP3 format, and you wish to create MP3 versions, then you can convert them using iTunes, by following this guide:  http://support.apple.com/kb/HT1550

  • How do I copy the drum track from my iphone over to my mac

    Hello - I just bought an iphone and downloaded Garageband. I noticed that my iphone version of GB has some really useful drum loops that are not present on my Mac. How can I copy the drum loops from my iphone to my mac, which is where I do most of my recording? I don't want to just send them to itunes because they lose some functionality that way.
    Thanks!
    Mark

    OkieMark wrote:
    How can I copy the drum loops from my iphone to my mac
    you would need to export the project. these instructions are for iPad, but i believe the steps are very similar, if not the same:
    http://www.bulletsandbones.com/GB/GBFAQ.html#exportgbitogbx
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • How do i copy The iMovie video from Mac, to iPad mini?

    How do i copy The iMovie video from Mac, to iPad mini?

    The easiest way is to firstly export the movie to iTunes (Share > iTunes), then sync the iPad Mini with iTunes. In iTunes, include your movie as an item to be synced. After syncing, on the iPad it will appear in the Videos app. That's how I do it for my wife's Mini.
    If you need help with exporting or with syncing to iTunes, please post back.
    I'm caught up with something else at the moment, otherwise I'd give you full instructions now (just wanted to get this to you quickly).
    John
    Message was edited by: John Cogdell

  • Copy the inspection  result  from one lot to multiples lots!!

    Hi SAP expert,
    I want to copy the inspection  result  from one lot to multiples lots, currently i know how to setup  the copy to another lot(SAML Response from SAP ID Service ) , but  i dont know to do to multiples lot.
    ¿Someone can help me?
    Thank you

    First you have to customizing the functionality of Copy of Inspection Results using the following path, where you have to entry the inspection types, plant .etc., where you want to have the functionality.
    SPRO -> Quality Management -> Quality Inspection -> Make Settings for Copy of Inspection Results
    Then when you are in Record Result screen you select Menu -> Edit -> Copy Inspection Results ,
    then a pop-up window is displayed and you filled in with the inspection lot which has the results and then another pop-up window is displayed to select the characteristics that you want to copy.
    A.P.

  • Copying the negative value from 1 base entity to another base entity

    I am trying to copy the negative value from 1 entity to another base entity in rules.
    I am not sure if this can be done
    Example Paris has netinc of 100 dollars I want the other entity ParisNeg to receive the negative value or netinc -100
         If pov_scenario = "Actual" then
              'If pov_entity = "ParisNeg" Then
              If pov_year > "2012" Then
                   If pov_Value = "<Entity Currency>" or pov_Value = "<Entity Curr Adjs>" Then
                        For Each Acc In HS.Account.List("","(Base)")
         HS.EXP "E#Paris" ="E#ParisNeg"
         End If 'default_currency
         End If 'Year
         'End If 'Entity
    End If 'pov_Scenario

    This might work:
    If pov_scenario = "Actual" then
    If pov_year > "2012" Then
    If pov_Value = "<Entity Currency>" or pov_Value = "<Entity Curr Adjs>" Then
    If right(pov_entity, 3) = "Neg" Then
    HS.EXP "A#ALL = -E#" & Left(pov_entity, Len(pov_entity)-3) & ".A#ALL"
    End If 'pov_entity
    End If 'default_currency
    End If 'Year
    End If 'pov_Scenario
    *Did not test this.  You might need a member list or loop to roll through the accounts instead of all.  Another thing to consider would be changing the consolidation percent to -100% or something.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Why is the link to my form getting this message?  I copied the link right from the page.  An error has occurred. The form does not exist. Please re-enter the web address as the link may be misspelled. [ref: cixTdh4JnkymYgz7awKoQ, BadRequest]

    Why is the link to my form getting this message?  I copied the link right from the page.  An error has occurred. The form does not exist. Please re-enter the web address as the link may be misspelled. [ref: cixTdh4JnkymYgz7awKoQ, BadRequest]

    My form - which was working great - disappeared when I did some editing; here is the message I get now.
    The form does not exist. Please re-enter the web address as the link may be misspelled.
    The link for the form is:
    https://adobeformscentral.com/?f=UqJr%2Aas2RJIHPVA4iGIQ6w
    Please look into the matter and resolve the issue at the earliest.
    Regards,
    Vaibhav Nigam

  • I have a tolino vision 2 and cant copy the e-books from my pc to the tolino. I have the same adobe ID for the tolino and for the PC. I get the message I'm not authoriesed to copy, and/ or my adobe ID does not fit/match to the one at my PC. What can  do? C

    I have a tolino vision 2 and cant copy the e-books from my pc to the tolino. I have the same adobe ID for the tolino and for the PC. I get the message I'm not authoriesed to copy, and/ or my adobe ID does not fit/match to the one at my PC. What can  do? Can someone answer in German?

    I suspect you will want to ask your question at the forum for Adobe Digital Editions which is eBook, eBook reader device focused.
    Be well...

  • How to copy the backup files from TAPE to Local disc

    Hi Gurs,
    i want to make as replica trrough  PRD offline backup , on new server, while database installing i will take the option systemcopy /backup/restore , so for that how installation master can recognise the tape from tape device, so that now i wanted to copy the backup files from Tape to local disk so that it was already mounted ,i can show the path of backup files.
    the OS is Susi 9
    Oracle 9i
    ECC 5.0
    please any one can help me
    cheers

    What do you use to backup the files to disk? cpio? dd?
    Markus

  • Sales order should not copy the net value from contract

    Hi,
    When we are creating the sales order,Where we can maintain that sales order should not copy the net value from contract.
    Regards
    Prabudh

    Hi,
    When I am creating the sales order with reference to contract,it's copying the net value and quantity from the contract.
    But I want  that sales order should not copy the net value and quantity from the contract and user can take new required quantity at the time creating the sales order.
    Regards
    Prabudh

Maybe you are looking for

  • Java Stack in BI 7.0.

    Hi, Friends Please help me in the foliwng situation.. We are using BI 7.0 and which is not having Java Stack. Please clarify me.. 1. Is it Mandatory to Install Java Stack in SAP BI. 2. When we need Java Stack in BI server. 3. We have Portal also, and

  • How to decrypt data when you can't get the private key in Windows?

    I'm very confuse. My english is poor, but I try to say my question clearly. When browser connects to a https website which needs client certificate to authenticate the identity, the browser will send client certificate to web server. Then the web ser

  • ISync to nokia asha 503: is there a plug-in to enable this?

        I have recently bought a new Nokia Asha 503 phone, and when I got it home, tried to sync it to my Mac.  iSync tells me "this device is not supported".  Is there a plug-in I can install, or should I carry on entering contacts onto the phone by han

  • Can a Nexus 1000v be configured to NOT do local switching in an ESX host?

    Before the big YES, use an external Nexus switch and use VN-Tag. The question is when there is a 3120 in a blade chassis that connects to the ESX hosts that have a 1000v installed on the ESX host. So, first hop outside the ESX host is not a Nexus box

  • Package  org.jdesktop.swingx.autocomplete    ??? (import problem )

    how to import Package org.jdesktop.swingx.autocomplete in my code its Giving error ,,, i am using Auto Complete Supprt For my Combo Box .......but i am unable to import the package containg nesseary classes like AutoCompleteSupport support = AutoComp