Filtering PO line items based on Buy-from Vendor field
kkutty2007
Member Posts: 6
Hi,
1. User creates a PO with a buy-from vendor field.
2. An Vendor Item table is maintained that contains (vendor_no, item_no). Each vendor will have a list of approved items that he can supply.
3. While in PO line item ( purchase order subform ), while looking up in No. field, it currently lists all the items from item table.
I am trying to restrict this list to items supplied by the vendor selected ( in PO header).
I modified No.Lookup() function in Purchase Order subform as follows.
IF Type = Type::Item THEN BEGIN
tblPurchaseHeader.GET("Document Type","Document No.");
tblVendorItem.SETRANGE("Vendor No.",
tblPurchaseHeader."Buy-from Vendor No.");
intRecCount := tblVendorItem.COUNT;
IF(intRecCounter = 0) THEN
BEGIN
MESSAGE('There are no certified items supplied by this vendor');
EXIT;
END;
Now if I take Item numbers from tblVendorItem, it will contain all the items supplied by that supplier. May some one please tell me as how to take the list of items from tblVendorItem and filter Item table using the
list of items in tblVendorItem.
{ // I am missing few statements here....
// how to filter tblItem (Item Table) using list of items provided by
// tblVendor Item
}
CLEAR(frmItemList);
frmItemList.SETTABLEVIEW(tblItem);
frmItemList.SETRECORD(tblItem);
frmItemList.LOOKUPMODE(TRUE);
IF frmItemList.RUNMODAL = ACTION::LookupOK THEN BEGIN
frmItemList.GETRECORD(tblItem);
VALIDATE("No." , tblItem."No.");
END;
1. User creates a PO with a buy-from vendor field.
2. An Vendor Item table is maintained that contains (vendor_no, item_no). Each vendor will have a list of approved items that he can supply.
3. While in PO line item ( purchase order subform ), while looking up in No. field, it currently lists all the items from item table.
I am trying to restrict this list to items supplied by the vendor selected ( in PO header).
I modified No.Lookup() function in Purchase Order subform as follows.
IF Type = Type::Item THEN BEGIN
tblPurchaseHeader.GET("Document Type","Document No.");
tblVendorItem.SETRANGE("Vendor No.",
tblPurchaseHeader."Buy-from Vendor No.");
intRecCount := tblVendorItem.COUNT;
IF(intRecCounter = 0) THEN
BEGIN
MESSAGE('There are no certified items supplied by this vendor');
EXIT;
END;
Now if I take Item numbers from tblVendorItem, it will contain all the items supplied by that supplier. May some one please tell me as how to take the list of items from tblVendorItem and filter Item table using the
list of items in tblVendorItem.
{ // I am missing few statements here....
// how to filter tblItem (Item Table) using list of items provided by
// tblVendor Item
}
CLEAR(frmItemList);
frmItemList.SETTABLEVIEW(tblItem);
frmItemList.SETRECORD(tblItem);
frmItemList.LOOKUPMODE(TRUE);
IF frmItemList.RUNMODAL = ACTION::LookupOK THEN BEGIN
frmItemList.GETRECORD(tblItem);
VALIDATE("No." , tblItem."No.");
END;
0
Comments
-
Have a look at requisition worksheet.
Its a step before creating purchase order. The form shows only those vendor who are defined in the Item Vendor table. From there you can selct the vendor and then "carry out action message" option and it will create purcahse order.CA Sandeep Singla
http://ssdynamics.co.in0 -
You can mark the items and run the item list with markedonly.0
-
Mbad wrote:You can mark the items and run the item list with markedonly.
Thank you. It did work. The code below works!!
IF Type = Type::Item THEN BEGIN
tblPurchaseHeader.GET("Document Type","Document No.");
tblVendorItem.SETRANGE("Vendor No.", tblPurchaseHeader."Buy-from Vendor No.");
intRecCount := tblVendorItem.COUNT;
tblItem.RESET;
IF ( intRecCount > 0 ) THEN
BEGIN
tblVendorItem.FIND('-');
REPEAT
tblItem.GET(tblVendorItem."Item No.");
tblItem.MARK(TRUE);
UNTIL tblVendorItem.NEXT=0;
END;
tblItem.MARKEDONLY(TRUE);
CLEAR(frmItemList);
frmItemList.SETTABLEVIEW(tblItem);
frmItemList.SETRECORD(tblItem);
frmItemList.LOOKUPMODE(TRUE);
IF frmItemList.RUNMODAL = ACTION::LookupOK THEN BEGIN
frmItemList.GETRECORD(tblItem);
VALIDATE("No." , tblItem."No.");
END;
END;0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions