Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to Use document.Lines.SetCurrentLine

Hi there, due to an enormous amount of time spent on this issue, I thought I would share how to use the SetCurrentLine method as posted to me by SAP support:

It seems very cumbersome, as I have now to do an extra Recorset look up to get all the lines if I want to get the correct index - but at least it works (hopefully).


        • SUPPORTS MESSAGE ****

the way the SetCurrentLine works is as following:

You do not have to use neither the LineNum nor the VisOrder as your

parameterfor the setCurrentLine method.

The system will use the corresponding index (starting at zero)linked to

that line when running a query on the database and sorting the lines by


#,,DocEntry,, Item ,,LineNum,,Price,,VisOrder

1,,11669,, A1001,,,, 600,00,,

2,,11669,, A1003,,2,, 3,00,, 2

3,,11669,, A1005,,3,, 600,00,,1

See example above, that is the result of querying the database on that

sales order and sorting by LineNum.

The order in which the items are displayed in the application is based

on the VisOrder. In this example items are displayed A1001, A1005 amd


In order to update Item A1005 I will need to create a recordset, query

the database and then loop the recordset to find the corresponding item

and then use that index from the recordset to set the value for the

SetCurrentLine method. In the example above index 0 from recordset

points at item A1001, index 1 points at item A1003 and index 2 points at

A1005 so your code should use setCurrentLine(2) to update item A1005.

If you try to use LineNum (3 in this case) you will get an error message

as index 3 does not exist in the recordset collection ( only 3 items

with indexes 0,1 and 2). If you use visOrder 1(for item A1005) then the

system will update item A1003 as 1 is the index for A1003 in the


                • END OF SUPPORTS MESSAGE ********

Former Member
Not what you were looking for? View more on this topic or Ask a question