Support Debugging Tool Customization #8 – Displaying Long Item Descriptions on SOP Blank Invoice

| 10/31/2011 | 4 Comments

This article is based on a recent support request on the SOP Blank Invoice Report form. The Item Description on the report was just 60 characters and the actual item description was about 100 characters. This resulted in the item description getting truncated.

I have written this article using the article titled “How to display more than 80 characters of an Extender Long String field in reports using the Support Debugging Tool” written by David Musgrave as a base.

Version Information

Dynamics GP : 11.0.1752 (SP2)

Support Debugging Tool : 11.00.0015

Screenshots of the Configuration

Create a Runtime Execute script block with the code given below with the script ID as ITEMDESC.

image

local string MBS_TableLineString;
local string MBS_Number;
local integer MBS_Type;
local currency MBS_SequenceOne;
local currency MBS_SequenceTwo;
local integer MBS_Control;
local string MBS_String;
local integer MBS_Status;
local string MBS_String_Value;
local string MBS_String_Value1;
local integer MBS_Integer_Value2;
local long MBS_Long_Value3;
local long MBS_Long_Value4;
 
{Declarations}
local string ls_ItemDesc;
 
call with name "MBS_Param_Get" in dictionary 5261, "Number", MBS_Number;
call with name "MBS_Param_Get" in dictionary 5261, "Type", MBS_String;
MBS_Type = integer(value(MBS_String));
call with name "MBS_Param_Get" in dictionary 5261, "SequenceOne", MBS_String;
MBS_SequenceTwo = currency(value(MBS_String));
call with name "MBS_Param_Get" in dictionary 5261, "SequenceTwo", MBS_String;
MBS_SequenceOne = currency(value(MBS_String));
call with name "MBS_Param_Get" in dictionary 5261, "Control", MBS_String;
MBS_Control = integer(value(MBS_String));
MBS_TableLineString = "";
 
{ Add your code below here }
clear table SOP_LINE_WORK;
set 'SOP Number' of table SOP_LINE_WORK to MBS_Number;
set 'SOP Type' of table SOP_LINE_WORK to MBS_Type;
set 'Component Sequence' of table SOP_LINE_WORK to MBS_SequenceOne;
set 'Line Item Sequence' of table SOP_LINE_WORK to MBS_SequenceTwo;
get table SOP_LINE_WORK by number 1;
if err() = OKAY then
	set ls_ItemDesc to 'Item Description' of table SOP_LINE_WORK;
end if;
set MBS_TableLineString to RW_ParseString(ls_ItemDesc, 50, MBS_Control);
{ Add your code above here }
 
call with name "MBS_Param_Set" in dictionary 5261, "TableLineString", MBS_TableLineString;

Then modify the SOP Blank Invoice Report and create the following Calculated Fields.

Calculated Field Name : ComponentSequence

Calculated Field Type : Currency

Formula : SOP_LINE_WORK.Component Sequence * 1.00000

Calculated Field Name : LineItemSequence

Calculated Field Type : Currency

Formula : SOP_LINE_WORK.Line Item Sequence * 1.00000

And finally create 2 calculated fields for Item Descriptions as explained below.

Calculated Field Name : ItemDescription1

Calculated Field Type : String

Formula : FUNCTION_SCRIPT(  rw_TableLineString  5261  “ITEMDESC”  SOP_LINE_WORK.SOP Number  SOP_LINE_WORK.SOP Type  (C) LineItemSequence  (C) ComponentSequence  1  )

Calculated Field Name : ItemDescription2

Calculated Field Type : String

Formula : FUNCTION_SCRIPT( rw_TableLineString 5261 “ITEMDESC” SOP_LINE_WORK.SOP Number SOP_LINE_WORK.SOP Type (C) LineItemSequence (C) ComponentSequence 2 )

In the formulae, (C) LineItemSequence is the calculated field which we have created for the Line Item Sequence and (C) ComponentSequence is the calculated field which we have created for the Component Sequence field.

Note that for the first calculated field for Item Description, we are passing the fifth parameter for the rw_TableLineString function as 1 and for the second calculated field, we are passing the fifth parameter as 2. This will return the full item description split into 2 calculated fields. If you have a custom field where you have captured a longer description, you can add additional description fields and pass the appropriate index value to the function to return the value to the appropriate calculated field.

Once the report is saved and access granted to the modified report, the report prints as shown below.

image

Update – 11/01/2011: Based on recommendation from David Musgrave, I have split the Item Description to 50 characters for each field in the code set MBS_TableLineString to RW_ParseString(ls_ItemDesc, 50, MBS_Control); . This makes it more readable and evenly distributed characters. The configuration file has been updated with the specific change.

You can download the configuration file for this customization here.

Reference

Take a look at the article below which summarizes the usage of Support Debugging Tool with some real life examples. Great compilation by David! http://blogs.msdn.com/b/developingfordynamicsgp/archive/2011/08/05/using-the-support-debugging-tool-with-real-life-examples.aspx

Hope this helps the community…

Until next post!

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Support Debugging Tool Customization #8 - Displaying Long Item Descriptions on SOP Blank Invoice, 10.0 out of 10 based on 1 rating

Tags: , , , , , , , ,

Category: Customizations, Dynamics, Great Plains, Support Debugging Tool

About the Author ()