web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Stored procedure that computes batch totals

(0) ShareShare
ReportReport
Posted on by 75,848 Moderator

Is there a stored procedure that computes batch totals? I have been asked to create an automated routine that will take an input file full of sales orders and change the batch ID to a batch containing today's date. This will tell their people which orders need to be transferred to invoices on any given day.

Categories:
I have the same question (0)
  • Richard Wheeler Profile Picture
    75,848 Moderator on at
    RE: Stored procedure that computes batch totals

    Yes, this matches the code I inserted previously.

  • GMA Profile Picture
    1,074 on at
    RE: Stored procedure that computes batch totals

    Not sure if this is what you are talking about, but I wrote some code to calculate the number of transactions and batch total for batches. I often move invoices to new batches for troubleshooting or selective posting so I often have to recalculate the batch totals.

    Declare @NumofTrx int = 0

    , @BchTotal numeric(19,5) = 0

    Select @NumofTrx = count(*)

    , @BchTotal = sum(DOCAMNT)

    from SOP10100 s

    where BACHNUMB = @BachNumb

    group by bachnumb

    Update SY00500 set NUMOFTRX = @NumofTrx, BCHTOTAL = @BchTotal where bachnumb = @BachNumb

  • Richard Wheeler Profile Picture
    75,848 Moderator on at
    RE: Stored procedure that computes batch totals

    Thanks for saving me the time looking for something that does not exist. The batch totals must be getting updated by Dexterity code. I will do the same thing.

  • Becky Berginski Profile Picture
    on at
    RE: Stored procedure that computes batch totals

    Hello Richard,

    Thank you for using Community Forums. My name is Becky.

    When you are making changes in GP on the fly, the code adds and subtracts and doesn't actually recalculate the totals on the batch with a stored procedure.

    When I captured this information in a trace, you can see that a stored procedure was not called.

    pastedimage1634762503940v1.png

    You would need to create a procedure that would do look at the remaining subtotal or the document amount from the SOP10200.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans