I created Table called Import Traffic. And there I have following fileds: 'Customer No.', 'Posting Date', 'Document Date', 'Fiscalization Type', 'Document Type', 'Responsibility Center', 'Salesperson Code'. and some filed for like on sales line 'Quanity', Amount, etc.
I created an action and when I run action I want to create Sales Invoices, on this logic:
If we have three records: Three different Customers, in any way, we will create three invoices. If we have on two records one Customer, and on one record another customer, but If on all three records we have all different Responsibility Centers, we will create also three Invoices.
If we have three records: Same customer on three records, and two Responsibitlity centers, and Three different Posting Dates, we will create three Invoices, but If we have, all 7 fields ('Customer No.', 'Posting Date', 'Document Date', 'Fiscalization Type', 'Document Type', 'Responsibility Center', 'Salesperson Code) same for all tree records we will create just one Invoice, but three Sales Line Records for that Invoice.
Like to count how many different combination we have of that 7 fields, and to create that many invoices.
After create I store Sales Invoice No into Import Traffic, for every row, if that row went to Invoice.
Maybe looks little confused, but I don't have a way to explain different.
Do you know how to do that.?
Thank you :)