问题
So I am now working with a form in Dynamics GP 2013 that does not openly display the line item sequence of an item in a list on the form, and am looking for the proper way to find this number so that I can pass it along to a SQL query to find a very specific item among a table. I know the line item sequence is a multiple of 16384, but in these forms, there seems to be know way to pass that along to the SQL query for each individual item. Some orders have just one item on the list, by which in those circumstances it is obvious, but we are talking about thousands of different orders, that range from one to upwards of a hundred line items, and I need to be able to find the exact line for each item when that item is brought into focus. Has anyone had a similar issue like this, where you are trying to query an SQL table with the line item sequence and SOP number?
回答1:
You have to query sales detail (sop line) table with parameters sop number and sop type, further if you know the item you can also include it in where clause, so the query will list down all the items or no of lines for the selected item.
SELECT * FROM SOP10200 where SOPTYPE=3 AND SOPNUMBE='STDINV2338'
SOP Type= 3 is for Invoice
2 for Order
1 for Quote
If you know item number too.
SELECT * FROM SOP10200
where SOPTYPE=3
AND SOPNUMBE='STDINV2338'
AND ITEMNMBR='URG001'
If you know any other information like description of item etc, you can also query.
SELECT * FROM SOP10200
where SOPTYPE=3
AND SOPNUMBE='STDINV2338'
AND ITEMDESC='Green Phone'
来源:https://stackoverflow.com/questions/30059116/microsoft-dynamics-gp-2013-how-to-find-line-item-sequence