Skip to Content
author's profile photo Former Member
Former Member

Closing a line in purchase order

Hi All,

I am trying to close a particular row on a Purchase order. For that I am using the code given below. Instead of closing that particular line , whole document is getting closed. Will anyone suggest me a solution for closing only that particular line.

SAPbobsCOM.Documents oPO = (SAPbobsCOM.Documents)Program.Arc_Com_AddOn.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseOrders);

bool str = oPO.GetByKey(139));

if (str == true)

{

int inttst;

string strerrMsg;

int intnErr;

oPO.Lines.LineStatus = SAPbobsCOM.BoStatus.bost_Close;

inttst = oPO.Update();

if (inttst != 0)

{

Program.Arc_Com_AddOn.Company.GetLastError(out intnErr, out strerrMsg);

}

}

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2008 at 01:49 PM

    the only thing which is missing is before

    oPO.Lines.LineStatus = SAPbobsCOM.BoStatus.bost_Close;

    use

    oPO.Lines.SetCurrentLine(linenum);

    thats all, Im using it so and it works properly.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 04, 2008 at 02:20 PM

    Hi u have to work with the SetCurrentLine to get the exactly row you want to close, remember the SetCurrentLine starts from zero, if you have 4 lines and want to close line 2:

    .SetCurrentLine(Line-1) = 2-1=1

    .CloseTheLine

    .Update The Object

    Try this and answer how this goes for you

    Gabriel Mendes

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 12, 2009 at 07:08 AM

    Hello, i''ve the same problem

    Script is correct

    oPO.Lines.SetCurrentLine(linenum);
    oPO.Lines.LineStatus = SAPbobsCOM.BoStatus.bost_Close;
    

    and i've allways the message

    Update Entry (-2039) Another user-modified table (ODBC -2039)

    (PL 45)

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.