Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Stored procedure that computes batch totals

Posted on by 75,730

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:
  • Richard Wheeler Profile Picture
    Richard Wheeler 75,730 on at
    RE: Stored procedure that computes batch totals

    Yes, this matches the code I inserted previously.

  • GMA Profile Picture
    GMA 1,072 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
    Richard Wheeler 75,730 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.

  • 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

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans