Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

How to interpret the Flags column in SOP10100

Posted on by Microsoft Employee

I think I have this figured out, but wanted to post here in case others are struggling with it as well.  The SOP10100 Flags column stores various on/off switches for the following settings of a sales document (order, invoice, etc.):

 1 = SOPFLAGS_ADDREDITED  (Address Edited)
 2 = SOPFLAGS_COMMENTEDITED (Comment Edited)
 3 = SOPFLAGS_PACKINGSLIPPRINTED (Packing Slip Printed)
 4 = SOPFLAGS_PICKINGTICKETPRINTED  (Picking Ticket Printed)

So here is how I was able to query whether the setting was active or not, using SQL server and the bitwise function (& position):

SELECT SOPNUMBE, Flags,
CASE WHEN Flags & 1 > 0 Then 1 Else 0 END AS Address_Modified,
CASE WHEN Flags & 2 > 0 Then 1 Else 0 END AS Comment_Modified,
CASE WHEN Flags & 3 > 0 Then 1 Else 0 END AS PackingSlip_Printed,

CASE WHEN Flags & 4 > 0 Then 1 Else 0 END AS PickingList_Printed

FROM SOP10100

WHERE NOT Flags=0

You could also search for documents that have a certain setting enabled, however it will be slow (table scan), so you should limit the results down in other ways first.

SELECT RTRIM(SOPNUMBE), Flags FROM SOP10100 WHERE SOPTYPE=2 Flags & 1 = 0 --Returns orders with non-modified addresses

SELECT RTRIM(SOPNUMBE), Flags FROM SOP10100 WHERE Flags & 3 > 0 --Returns orders with packing slips printed

Credit to these other posts helping to clarify this issue:

https://www.gpug.com/communities/community-home/digestviewer/viewthread?MessageKey=1ca488e2-dc6c-4490-8586-515466dba547&CommunityKey=4754a624-39c5-4458-8105-02b65a7e929e&tab=digestviewer

https://groups.google.com/forum/#!topic/microsoft.public.greatplains/InhOur9pMvk

https://improve.dk/converting-between-base-2-10-and-16-in-t-sql/ 

(Comments)

*This post is locked for comments

  • Tim Wappat Profile Picture
    Tim Wappat 5,701 on at
    RE: How to interpret the Flags column in SOP10100

    Thanks for taking the time to post that information. Others searching in the future will no doubt find that valuable. 

    Tim.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans