Skip to Content
avatar image
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 comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded