another blog


About Microsoft Dynamics GP :-)

Calling Sales Document Numbers Lookup

Often developers need to open available lookup on their custom form from dynamics GP.Sales Document Number lookup is a very common and much used lookup and every dynamics technical person needs to call it in once (or more) in their lifetime. 🙂

Dynamics GP SDK provide a prototype of coding on how to open various lookup. Although it has given a much detailed list of parameters, the drawback is that we can not apply filter on the GP traditional lookup.

As with SDK prototype, desired document type can be focused but we can not make a lookup to fill only specific document type.

This leads developers to design 3rd party windows and then calling them.

SDK Prototype:

open form SOP_Document_Lookup return to ‘(L) DummySOPReturn’;
call OPEN of form SOP_Document_Lookup,
‘Sort By’, {initial sort unless overridden by starting seed of below parameters}
l_display, {documents to display}
work_or_history, {initially display WORK or HISTORY documents}
GB_locked, {lock the work/history radio group}
iSOPType, {seed value for SOP Type}
sSOPNumber, {seed value for SOP Number}
sCustomerNumber, {seed value for Customer Number}
sBatchNumber, {seed Number of Batch Number, Work Documents only}
sTRXSource, {seed Audit Trail code, History Documents only}
dDocDate, {seed Document Date}
iMasterNumber; {seed Master Number value}

In this SDK scrip calling example there are two optional parameters not used, but mentioned in parameters description which you can get detail from parameter list.

  • IN12 optional OpenedFromTrx parameter used by the SmartList product
  • IN13 optional RestrictSOPType parameter that will restrict the lookup to a specific SOP Type.

By supplying these two parameters we can filter lookup with desired sales type and can avoid designing of a whole new custom lookup form.Below is a code of calling lookup, I am just giving the idea of passing parameter and so hard-coded the values.

open form SOP_Document_Lookup return to ‘(L) FromDocNumb’;
call OPEN of form SOP_Document_Lookup,

The last  parameter is telling that you are about to filter the lookup with the selected type on custom form. This will work find if your alternate smartlist lookup is marked, but if traditional GP lookup is marked, it will not filter the document types.



The hard thing for many developers is that they can not test the code in debug mode\test mode, as the lookup mark is in another dictionary and gives a message “Cannot access this form because the dictionary containing it is not loaded.”, so to test code functionality, developer have to create a chunk and then add a code in GP.



Filed under: Dexterity Development, Dynamics GP, Dynamics GP Lookups, dynamics-gp, ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: