Monday, October 27, 2014

CASE Statement for SOPTYPE in Dynamics GP Sales Tables


I have amassed a number of useful CASE statements, which can be incorporated into SQL queries run against Dynamics GP. When Querying the SOP Type Field in Dynamics GP Sales Open [SOP10100].[SOPTYPE] or History [SOP30200].[SOPTYPE] tables: use the following case statement to return text versions of the default SOPTYPE in Dynamics GP:


select
CASE SOPTYPE
      WHEN 1 THEN 'Quote'
      WHEN 2 THEN 'Order'
      WHEN 3 THEN 'Invoice'
      WHEN 4 THEN 'Return'
      WHEN 5 THEN 'Back Order'
      WHEN 6 THEN 'Fulfillment Order'
      ELSE 'ERROR'
END SOPTYPE_TEXT,

2 comments: