Stock Control related queries, topics and discussions
User avatar
By admin
#10 Compress Stock Transactions is achieved by selecting Special Data File Function 12, which runs program SY0112.

On the initial screen the user selects a date up to which transactions should be compressed, whether Purchase Transactions (Type 00) should be included, and whether Weekly, Monthly or Yearly Totals should be produced.

On the second screen the user selects the fields to be compressed from the list:
1. Reference (SC07006)
2. Order Number (SC07007)
3. Warehouse (SC07009)
4. Accounting Code (SC07011)
5-13. Further Accounting Dimensions if defined (discrete segments of SC07012)

Transactions in the selected date range (including purchase transactions if selected) are then processed by replacing the selected fields by hyphens, e.g. if order number is selected, all order numbers are replaced by "----------". The cost type in SC07008 is set to "07" and the Batch ID in SC07021 is replaced by "************".

The transaction date in SC07002 is replaced by the Monday of the same week if weekly compression is specified, by the first day of the same month if monthly compression is specified, or by 1 January in the same year if yearly compression is specified.

The amended transactions are then written to a temporary table, SC07ccSR, and sorted by Stock Code, Transaction Date, Reference, Order Number, Cost Type and Warehouse. The sorted records are then passed to program SY01121.

Program SY01121 reads the sorted transactions, grouping them by Transaction Date, Stock Code, Reference, Order Number, Cost Type, Warehouse and Accounting Code, and accumulating the following for each set of transactions to be compressed:

• For Volume-Related Transactions (00, 01, 02, 04, 05, 06, 09), Quantity = SC07004, Value = SC07004 * SC07005, CCValue = SC07004 * SC07028

• For Non Volume-Related Transactions (03, 07, 08, 10), Value = SC07005, CCValue = SC07028

The resulting sums are used to generate the compressed transaction as follows:

• If the accumulated Quantity is non-zero, a type 01 transaction is generated with SC07004 = Accumulated Quantity, SC07005 = Accumulated Value / Accumulated Quantity, SC07028 = Accumulated CCValue / Accumulated Quantity.

• If the accumulated Quantity is zero, a type 03 transaction with cost type 06 is generated with SC07004 = 0, SC07005 = Accumulated Value, SC07028 = Accumulated CCValue.

Program SY01121 then writes its output to a further temporary table, SC07ccWR, appending the transactions which were not saved.

Finally, SC07ccSR and SC07cc00 are deleted, and SC07ccWR is renamed as SC07cc00, so that it becomes the new stock transaction file.