Dynamics GP: Adding more comment lines to POP Purchase Orders
Introduction
Customer had an issue with their line item comments truncating at 4 lines. In essence, the customer wanted the ability to print more than 4 lines of comments at the line item level on their purchase orders.
They have strict requirements to provide contract information, start/end dates, and a number of regulatory and compliance information on purchase orders. Some of this information is very critical to the transportation of certain products on United States highways. So as you can imagine, the request for additional comment lines was critical.
The following shows an example of what the customer was facing:
http://4.bp.blogspot.com/-NuWgYsWE5c4/T7Qb6PJo7rI/AAAAAAAACNM/FXRrSSeIjP4/s640/PurchasingComments01.png |
Purchasing Comment Entry window and POP Purchase Order Blank form |
As you can see, the comments are printing only 4 lines and truncating the rest of the text.
Before going into the details, they are a few articles that guided me through the solution:
References
- How to Display More Than Four Line Item Comments in the "SOP Blank Invoice Form" Report in Sales Order Processing in Microsoft Dynamics GP
- Adding more comments to SOP Documents (Developing for Dynamics GP)
Of course, these articles refer to SOP, but the underlying techniques used in them will allow us to make the necessary changes to the report. This blog post should be used in conjunction with the How To article above to provide some additional steps to get the best result for making the changes to the POP Purchase Order report.
Background
See: Adding more comments to SOP Documents > section "Background"
If you look at a POP document report, such as the POP Purchase Order Blank Form, you will see that the 4 comment lines are printed using 4 additional footer sections.
http://1.bp.blogspot.com/-YBRraRMqg10/T7Qf5Q0JBBI/AAAAAAAACNY/Rym8FJI7F2I/s640/PurchasingComments02.png |
POP Purchase Order Blank Form Report Writer Layout showing 4 footers (F3 - F6) |
Solution
See: Adding more comments to SOP Documents > Solution
For an explanation on why not using additional footers instead, see Adding more comments to SOP Documents over at Developing for Dynamics GP.
The parameters for the RW_POPLINECommentText function are as follows:
RW_POPLINECommentText()
1.function returns string OUT_string;
2. in integer IN_Type; { POP Type of Document }
3. in string IN_Number; { POP Number of Document }
4. in long IN_Ord; { Ord Number of Line }
5. in integer IN_characters; { Number of Characters per Line }
6. in integer IN_line; { Line Number to Return }
Implementation
See: Adding more comments to SOP Documents > Implementation
The article references to SOPLINE, which you need to replace with the right POPLINE (or POP, POP_PO) reference.
1. Create 8 calculated fields of result type string for the 8 Line level comment lines:
(C) Line 1 Comments = FUNCTION_SCRIPT( RW_POPLINECommentText POP_PO.PO Type POP_PO.PO Number popPOLineRollupTemp.Ord 80 1 )
(C) Line 2 Comments = FUNCTION_SCRIPT( RW_POPLINECommentText POP_PO.PO Type POP_PO.PO Number popPOLineRollupTemp.Ord 80 2 )
(C) Line 3 Comments = FUNCTION_SCRIPT( RW_POPLINECommentText POP_PO.PO Type POP_PO.PO Number popPOLineRollupTemp.Ord 80 3 )
(C) Line 4 Comments = FUNCTION_SCRIPT( RW_POPLINECommentText POP_PO.PO Type POP_PO.PO Number popPOLineRollupTemp.Ord 80 4 )
(C) Line 5 Comments = FUNCTION_SCRIPT( RW_POPLINECommentText POP_PO.PO Type POP_PO.PO Number popPOLineRollupTemp.Ord 80 5 )
(C) Line 6 Comments = FUNCTION_SCRIPT( RW_POPLINECommentText POP_PO.PO Type POP_PO.PO Number popPOLineRollupTemp.Ord 80 6 )
(C) Line 7 Comments = FUNCTION_SCRIPT( RW_POPLINECommentText POP_PO.PO Type POP_PO.PO Number popPOLineRollupTemp.Ord 80 7 )
(C) Line 8 Comments = FUNCTION_SCRIPT( RW_POPLINECommentText POP_PO.PO Type POP_PO.PO Number popPOLineRollupTemp.Ord 80 8 )
2. Expand each of the comment additional footers to 2 lines height.
3. Move the 4 existing Comment fields to the right of the report.
4. Double Click on each of the 4 old Comment array fields and set the Visibility to Invisible.
http://1.bp.blogspot.com/-Z-6_tBbWBss/T7QuFX_nX1I/AAAAAAAACNk/PVHEKel-TX8/s640/PurchasingComments03.png
Comment Footers and Invisible Fields
5. From Calculated Fields drag out the 8 new calculated fields placing two fields in each section. Drag out the field width as desired (at least 370).
http://3.bp.blogspot.com/-GqehRcu0ilM/T7Qxlx7l2XI/AAAAAAAACNw/MBSIm7GueDE/s640/PurchasingComments04.png |
Calculated fields on footer sections |
6. The 4 sSuppressCommentX calculated fields will need to be changed to conditional fields and the return type changed to Integer, as shown:
http://2.bp.blogspot.com/-cjqonlCPjJs/T7Q5_4pxo9I/AAAAAAAACOE/7OnrBSEnMv4/s640/CalculatedFieldDefinition.png |
Calculated Field definition |
sSuppressComment1 = F6_LAST (C) Line 1 Comments = "" AND F6_LAST (C) Line 2 Comments = ""
sSuppressComment2 = F5_LAST (C) Line 3 Comments = "" AND F5_LAST (C) Line 4 Comments = ""
sSuppressComment3 = F4_LAST (C) Line 5 Comments = "" AND F4_LAST (C) Line 6 Comments = ""
sSuppressComment4 = F3_LAST (C) Line 7 Comments = "" AND F3_LAST (C) Line 8 Comments = ""
After all these changes, it's time to save the report and test:
http://1.bp.blogspot.com/-RnHFFbrFxb4/T7Q68YFRVOI/AAAAAAAACOM/qAj6b_paQoI/s640/POForm.png |
Purchase Order Blank Form |
Now we can see the full line item comment displays nicely on the report.
Downloads
You can download the package file for this customization here.