Getting Error Code as -5002 while posting A/R Invoice as Draft using  C#

In the following code we are getting an error while posting the invoice as an draft. Can any one help ?
            com.Server = ConfigurationManager.AppSettings["Server"];
            com.CompanyDB = ConfigurationManager.AppSettings["CompanyDB"];
            com.DbUserName = ConfigurationManager.AppSettings["DBUsername"];
            com.DbPassword = ConfigurationManager.AppSettings["DBPassword"];
            com.UserName = ConfigurationManager.AppSettings["Username"];
            com.Password = ConfigurationManager.AppSettings["Password"];
            com.UseTrusted = true;
          long RetCode = com.Connect();
            Documents sapDoc;
            sapDoc = (SAPbobsCOM.Documents)(com.GetBusinessObject(BoObjectTypes.oDrafts ));
            sapDoc.DocObjectCode = BoObjectTypes.oInvoices;
            sapDoc.DocDueDate = dDueDate.Value;
            sapDoc.CardCode = txtCustomerCode.Text.Trim();
            sapDoc.HandWritten = BoYesNoEnum.tNO;
            sapDoc.DocTotal = Convert.ToDouble(txtTotalbeforeDiscount.Text.Trim());
            for (int i = 0; i < dgInvoice.Rows.Count - 1; i++)
                //sapDoc.Lines.LineNum = i;
                sapDoc.Lines.ItemCode = dgInvoice.Rows<i>.Cells[1].Value.ToString().Trim();
                sapDoc.Lines.Quantity = Convert.ToDouble(dgInvoice.Rows<i>.Cells[2].Value.ToString().Trim());
                sapDoc.Lines.Expenses.ExpenseCode = 4;
                sapDoc.Expenses.LineTotal = sapDoc.Lines.Quantity * 1500;
                sapDoc.Lines.Add();
                MessageBox.Show(sapDoc.Lines.LineNum.ToString ());
            long j = sapDoc.Add();
            if (j == 0)
                MessageBox.Show("Added to SAP Business One as Draft!");
I'm getting an error code as -5002 and its not getting stored as an draft. This was done based on SDK Example given in the help document. Can any body throw light on the same.
Edited by: Sadanand Manda on Nov 24, 2008 11:45 AM
Edited by: Sadanand Manda on Nov 24, 2008 11:46 AM

SAP Note Number: 1179405
Error -5002 when trying to copy a document with Sales BOM
In order to create the delivery via the DI, you need to set the oDoc.Lines.BaseLine value to the LineNum value from the RDR1 table (in the above example you should enter the value 2).
we set oDoc.Lines.BaseLine=0 before starting the lines loop. This has resolved the issue.
This note was really helpful and it was found in another query.
You can also refer to this. https://forums.sdn.sap.com/click.jspa?searchID=19070513&messageID=6178079
Thanks.
Edited by: Sadanand Manda on Nov 24, 2008 12:16 PM

Similar Messages

  • Getting error code 0xC0000005 while installing windows 8.1 x64

    Please help me..
    I am getting error code 0xC0000005 while installing fresh copy of windows 8.1 x64
    When the installation process arrives at 87% every time I get the error code saying that installation can not be done.
    I can not install windows 8.1 x64 version on my laptop.
    please tell me how to solve the problem and install windows 8.1 x64 version on my laptop.
    I tried with dvd-rom and usb as well, but the result is same..just stuck at 87%...can not be installed....
    how to overcome it...please...
    This question was solved.
    View Solution.

    Hi there @Achintya-only
    Welcome to the HP Support Forums! It is a great place to find the help you need, both from other users, HP experts and other support personnel.
    I see that you are getting an error code, when you try to install Windows 8.1 from USB or DVD. I am happy to assist.
    Just to clarify, you are using a standalone Windows installation disk, you are not using a factory recovery image. Is that correct?
    Have you run the hardware diagnostics on your notebook? HP Notebook PCs - Testing for Hardware Failures (Windows 8)
    What operating system was on the system before, and have you made a set of recovery media, for your original factory installation?
    Please let me know what you find.
    Malygris1
    I work on behalf of HP
    Please click Accept as Solution if you feel my post solved your issue, it will help others find the solution.
    Click Kudos Thumbs Up on the right to say “Thanks” for helping!

  • While activating a request in DSO getting error code 10

    While activating a request in DSO getting error code 10
    Hi All,
    I am trying to load data into Billing: Condition Data (0SD_O06) using 2LIS_13_VDKON. First while loading data I am getting error
    Record 8778 :InfoObject SOLD_TO does not contain alpa-conforming value 100000 which I changed manually in PSA maintenence and tried to load data again and now I am getting an error (Error 10 in the update) ID:RSAR No119.
    I have checked the formula in Transformation and it works fine. Still I am not able to load data.
    Please help.
    Thanks and regards
    Vishal Pardeshi

    Check the log for the request from the manage screen of the DSO, it will be there next to the monitor button.
    Otherwise you can check the error from the monitor screen of the request in Details tab.
    Veerendra.

  • Getting error code 5002 in itunes

    Getting error code 5002 in itunes and tried the recommendations.  Makes no sense!  I can enter my account in safari and on iTunes store, but not through Itunes software!

    Hello jmmairs,
    It sounds like you are getting error code 5002 when trying to use the iTunes Store. Take a look at this info from the following featured discussion:
    iTunes Store Error message 5002
    https://discussions.apple.com/thread/4852016
    This alert is often the result of an issue with verifying your billing.
    Quit iTunes.
    Open iTunes.
    Test the issue.
    If it persists, sign in to store.apple.com using your iTunes account.
    Change your country if necessary
    Click on Change account information
    Modify or remove your credit card information.
    Click Continue.
    Test the issue.
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • HT1918 why do I keep getting error code 5002 when trying to make a purchase? Has been almost a week now!

      Why do I keep getting Error Code 5002 when trying to make a purchase from the Itunes store? I am using Vista Home edition> havent had any problems before. This has been going on for a week.

    This alert is often the result of an issue with verifying your billing.
    Quit iTunes.
    Open iTunes.
    Test the issue.
    If it persists, sign in to store.apple.com using your iTunes account
    Click on Change account information
    Modify or remove your credit card information.
    Click Continue.
    Test the issue.

  • TS1424 I get error code 1009 while trying to download an application from app stor

    I get error code 1009 while trying to download an application from app storp

    You will need to do what it says, contact iTunes support. Click the Support tab above, then the Get Started link in the Contact Apple Support area and you'll be guided.
    Regards.

  • While performing travel sensor calibration get error code 1802. What is this means in plain language.

    We are using NI configurator 3.1. On our DVC5010f fisher controllers we have replaced potentiometer.  While performing calibration thru NI we are getting error code 1802. Can some one explain in plain language what is this means and what can be done to fix this.

    We have replaced potentiometer (Travel sensor ) on our Digital Valve Controller DVC5010F (Fisher). After Replacing this travel sensor, we were doing calibration using NI configurator software. During the calibration the software did not recognized the set range (variable) of travel sensor and gave us error code # 1802. These codes are accesible through www.ni.com web site. To get to listing of error codes. go to main page and in search block type in Fieldbus error code and select option 2 from several choices. these gives you listing of error codes. Code # 1802 derived from combination of error codes 0x0002, 0x0800 and 0x1000. These is where I am getting confused ...what is this? can some one explain this in simple term.
    Attachments:
    FieldBus Error Code 1802.JPG ‏47 KB
    FieldBus Error Code tavel count.JPG ‏53 KB

  • I am getting Error code : 50 while installing update on CC

    I am getting Error code : 50 while installing update on CC@

    Please see Error "Failed to Install" Creative Cloud Desktop application - http://helpx.adobe.com/creative-cloud/kb/failed-install-creative-cloud-desktop.html for information on how to resolve your current error.
    Regards
    Rajshree

  • Getting Error Code U44M1P7 while upgrading, how do I correct?

    Getting Error Code U44M1P7 while upgrading, how do I correct?

    Which product's update you are trying to install?
    Is it from Creative Cloud or perpetual?
    Please check following if you are having Creative Cloud.
    http://helpx.adobe.com/creative-suite/kb/error-u44m1p7-installing-updates-ccm.html

  • HT3204 unable to purchase music - keep getting error code 5002 on - using Vista

    Unable to purchase songs - keep getting error code 5002 - using Vista

    I am having the EXACT same problem. It started on June 16th also. I found out that code 5002 is supposedly a billing issue. The article directed me to edit my billing information (even though it was correct). I tried to submit the new information and was told my request could not be processed, try later. I have been trying for 3 days. Was in contact with customer service. first they said it was an Itunes Stores issue with the software. they told me it was resolved. Then they had me uninstall and then reinstall Itunes, which still didnt resolve it. I am starting to think its still an Itunes Store issue. Still trying to cintact customer service about this.

  • I get error code 5002 when try to buy John Goodwin tune, but no problem with buying other titles

    I get error code 5002 when trying to purchase any titles from John Goodwin "She Lay Her Whip Down." I can buy other songs but not this. Benn trying for days.  What is this code? I just want to buy a song.

    Hi
    Error -50 paramErr  Error in user parameter list
    Can there be any external hard disks - if so How is/are it/they formatted ? Must be Mac OS Extended (hfs) if used for Video.
    UNIX/DOS/FAT32/Mac OS Exchange - works for most but not for VIDEO.
    What this means in Your situation is above me.
    • free space on internal boot hard disk? How much ?
    Video codec
    • streamingDV, AIC etc. (not .avi, .mp4, .m4v, .wmv etc as they are containers not codecs)
    Pictures
    • in what format ? .jpg, .bmp, .tif, else ?
    Audio
    • from where/what format ? iTunes, .avi, .mp3, .aiff, else ?
    The "com.apple.iMovie.plist" file
    Many users has not observed that there are TWO libraries.
    • Library - at root level
    • Library - in user/account folder - THIS IS THE ONE to look into
    from Luke Burns
    I fixed the problem.. but it was very, very strange. I had a very long section for credits and set the line spacing to 1.0.. for some reason this caused it. I removed it, and it worked fine. I put it back, and I couldn't preview or play the video.
    I don't know why that could cause that big of a problem, but it did..
    Klaus1
    You need more free space on your hard drive.
    jonorparkerjon
    After phone support from apple I ended up creating a new project and adding all 117 clips back in individually till I found out what clips flagged and would not allow me to export. I had 3 I deleted and replaced and everything works now 1hr after tedious work....
    Where do Your material come from
    • Camera
    • External hard disk
    • USB-memory
    And all are connected so that iMovie can find it ?
    Yours Bengt W

  • HT203164 while burning audio cd keep getting error code 4265 what is the problem

    Trying to burn a audio cd on itunes keep getting error code 4265 please help

    Oh man it looks like a problem with the web server.
    Its an error that happens on SAP, even my dad reported an error like this to me but i wasn't able to solve it.
    What i find is that its an error with browser incompatibility,
    Check this http://scn.sap.com/message/10338540

  • Keep getting Error Code 12 while attempting to use VXI-8360 ExpressCard

    Using Dell XPS M1530 laptop running Win XP SP3.  Everything ran great with same hardware back in September 08.  Now I am getting Error Code 12, "This device cannot find enough free resources that is can use. (Code 12)".  I have tried disabling other devices in my laptop like the Broadband card and the Media Slot with no symptom changes.  Is there a better way to understand what is going on and to get my computer back to working with the MXIExpress card? 
    Solved!
    Go to Solution.

    rhoover17,
    Are you getting this error in Measurement & Automation Explorer, or in the windows device manager?  If the device shows up correctly in device manager as a PCI-PCI bridge but is having issues in Measurement & Automation Explorer, it may be best to try resetting the Measurement & Automation Explorer database. This can be done by:
    1. For MAX 4.1 or earlier, navigate to the folder found at: C:\Program Files\National Instruments\MAX
    For MAX 4.2 in Windows XP and 2000, navigate to the folder found at:
    C:\Documents and Settings\All Users\Application Data\National Instruments\MAX\Data
    2. Rename the Data folder to Data1. If you cannot rename the folder, go to the Windows Task
    Manager and end the process called nimxs.exe and then go back and rename the folder.
    3. Now navigate to the directory \Windows.
    4. Delete the pxisys.ini and the pxiesys.ini if using MXI express.
    5. Restart the PC and launch MAX. This will cause MAX to find the installed devices again and also recreate
    the pxisys.ini and pxiesys.ini, if MXI express used. Now you should be able to identify your chassis without error in MAX.
    If this does not work, I would encourage you to try using the MXI card in a different PC if you have one available, just to make sure that this isn't an issue with the card itself.  You also may want to have a look at the thread at http://forums.ni.com/ni/board/message?board.id=270&message.id=4887&requireLogin=False, as it deals with a very similar issue that ended up being just the MXI cable plugged in backward, but good troubleshooting steps were still discussed.
    Eric K
    Applications Engineering
    National Instruments

  • I keep getting error code 2330 while trying to update my itunes. I'm not able to udate, repair or uninstall., I keep getting error code 2330 while trying to update my itunes. I'm not able to udate, repair or uninstall.

    I'm getting error code 2330 when I try to update my itunes. I'm not able to update, repair or uninstall!!!!

    Hi I was having the same problem using ADE 2.0.
    I contacted the LiveChat support (link button did not show when using Firefox 31), which gave me this link. http://helpx.adobe.com/digital-editions/kb/error-e_act_not_ready.html 
    After I edited the Registry and then restarted ADE I was able to ReAuthorize my machine.  Hope this works for you.

  • Error while posting depot excise invoice

    Dear SAP Experts,
    We are continually facing the following error while posting "Depot
    Excise Invoice" on Production sever
    "Error in allocating Depot Invoice number interval not found Number
    object J_1IDEPINV"
    Message no is 8I336
    We have already maintained the number interval for the above object i.e
    J_1IDEPINV with respective series group 62.
    Here is the business process:
    1. First, we make transfer posting thr’ MB1B. We get material doc no
    2. Second, we make selection for RG23D for this material doc thr’ J1IJ.
    RG 23D register gets updated
    3. Third, we make ‘verify/post’ thr’ J1IJ itself. Here we are getting the
    error when we post it.
    Please do needful.
    Its an urgent isue
    Regards
    Tushar

    hello,
    In transaction SNRO check number range for object J_1IDEPINV. There you choose number intervals abd check number intervals.
    Regards
    Kedar Kulkarni

Maybe you are looking for

  • How to customize error mess, when an Web Dynpro application Deployed

    Hi Frndz... When we r deploying any web dynpro application , if there was any error in that WDP application its showing an error page the list of errors with HOST name  n patch level n OS details n so many n with the line number of that error in the

  • Problem in msg mapping

    Hi all,    I have 3 fields (Emp_no,Name,Salary)...i am sorting those values based upon  Emp_no.  Now the problem is only the emp_no is getting sorted and the remaining things are coming as it is. Source Structure=Target Structure Mt_src   Employee   

  • Reports not displaying properly on server

    <p>I have created several crystal reports using Visual Studio 2005.  They work fine on my local IIS on Windows XP.  However, when I move them to my server none of the report buttons, drop downs, etc. display correctly, they just display a red X.  Any

  • Startup.dll error

    everytime when I try to start premiere pro CS6, this error message pops up: i really dont know what do do now, please help me....

  • Space constraints

    I have a macbook that is giving me errors that its low on space. its a 150gb Hard drive and i can only account for 50 gigs. is there a way i can find out where this space is? it is all in my user folder somewhere... in the pc i would search all files