Unique serial numbers for different products, API or Dispatch ?

Customer follows a different set of serial numbers for different products. There are of 21 of them each which follows unique serial number.

Example Product A follows Rohm_01_1001 and the increment in serial number is unique for it, likewise Product B follows Rohm_02_1001 & so on.

The last four digits 1001 should be a unique serial number, the increment should be such as 1001,1002,1003 etc for each of them. Please let me know how to do this. Thanks in advance.

Hima.

SolidworksApi macros