使用号码范围对象实现流水号或者字段的自动给号

2023-10-31 06:08

本文主要是介绍使用号码范围对象实现流水号或者字段的自动给号,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在应用中时常会遇到需要自己创建流水编号的情形。SAP中给出了一个号码范围对象的概念来实现这个功能。

号码范围对象的创建步骤:

1 TCODE:SNRO

2 输入号码范围对象名字,然后创建

3 填写编号长度域和警告百分比以及其他必要信息。

4  选择号码范围,创建自己的号码范围。

这样,号码范围对象创建完毕,接下来就可以在程序中引用这个对象了。

在程序中可以使用FM:NUMBER_GET_NEXT来取得一个未使用的号码。

另外,为了防止在同步运行的时候出现号码的冲突,在取得号码之前,有必要使用FM:NUMBER_RANGE_ENQUEUE来锁定对象,并在取得号码之后使用FM:NUMBER_RANGE_DEQUEUE来解除锁定。

关于号码对象范围的FM还有如下一些:

 

3.1 函数组(SNR0)


NUMBER_RANGE_SHOW
This function module displays the groups which exist for a particular number range object, with their number range intervals.
After return, the return code chosen by the user (Back or Cancel) is available.
NUMBER_RANGE_ELEMENTS_SHOW *
This function module displays all elements, which are assigned to a number range interval.
After return, the return code chosen by the user (Back or Cancel) is available. (only object types 4-8)
This function module enables you to copy number range objects from groups and intervals of an existing sub-object of a given number range object to another of its existing sub-objects.
After return, the return code chosen by the user (Back or Cancel) is available. (only object types 4-8)
This function module provides a dialog box in which the user can enter a sub-object for a given number range object. If the specified sub-object already exists for the number range object, it is returned in the export parameter. If it does not exist, either an exception is raised or the return code "A" for user abort is returned.

NUMBER_RANGE_INTERVAL_MAINTAIN
With this function module the maintenance dialog for number range intervals for a given number range object is offered. A parameter specifies the processing type. Possible processing types are:
Maintain intervals
Change number status
Display intervals
Create new groups (only for object types 2 and 3 and 5-8)
The dialog path is determined by the object type.
After return, the return code chosen by the user (Back or Cancel) is available.

NUMBER_RANGE_GROUP_MAINTAIN *
This function module is the maintenance dialog (Create, Change, Display) for number range groups for a given number range object. A processing flag determines whether the object is to be displayed only or whether it can be maintained. Groups are deleted by deleting their intervals.
After return, the return code chosen by the user (Back or Cancel) is available.
NUMBER_RANGE_SUBOBJECT_COPY
NUMBER_RANGE_SUBOBJECT_GET
 

3.2 函数组(SNR1)


NUMBER_RANGE_ENQUEUE
With this function module, you lock the number range object which is to be maintained, and its groups and intervals, for access by other users. Lock errors are returned as exceptions.
NUMBER_RANGE_DEQUEUE
With this function module, you unlock the number range object which has been maintained.
NUMBER_RANGE_ELEMENT_LIST *
This function module gets the elements which are assigned to a particular number range interval for a number range object. The elements found are passed in a table. Errors are returned as exceptions.
NUMBER_RANGE_ELEMENT_TEXT_LIST *
With this function module you can find element texts in the specified language for a given number range object. The texts are returned in a table. Execution errors are returned as exceptions.
NUMBER_RANGE_GROUP_LIST *
This function module gets information about groups and the associated group and element texts for a specified number range object. The information is put in a table. The table can be used to change the element assignment or the group text. The change request is to be passed to the function module NUMBER_RANGE_GROUP_UPDATE.
Errors are returned as exceptions.
NUMBER_RANGE_GROUP_UPDATE *
With this function module, already assigned elements can be assigned to other intervals, or the assignment can be withdrawn. Group texts can also be maintained. All change requests are checked. Request errors are returned in an error table.
The changes are passed in an internal table and are copied into the local memory of the function group.
Before you call this function module, you must lock the number range object in question with NUMBER_RANGE_ENQUEUE, and unlock it again with NUMBER_RANGE_DEQUEUE after writing the changes to the database.
To copy the contents of local memory to the database, call the function module NUMBER_RANGE_UPDATE_CLOSE.

NUMBER_RANGE_INTERVAL_LIST
This function module gets the existing intervals to a given number range object, and puts them in a table. The table can be passed to the function module NUMBER_RANGE_INTERVAL_UPDATE to change intervals.
NUMBER_RANGE_INTERVAL_UPDATE
With this function module you maintain intervals for a given number range object.
The changes are passed in an internal table, and are copied into local memory.
Before you call this function module, you must lock the number range object in question with NUMBER_RANGE_ENQUEUE, and unlock it again with NUMBER_RANGE_DEQUEUE, after the changes have been written to the database.
To copy the contents of local memory to the database, call the function module NUMBER_RANGE_UPDATE_CLOSE.
NUMBER_RANGE_OBJECT_GET_INFO
This function module gets information for a given number range object. This information is put in a table structure, which must be declared like the table structure INROI.
NUMBER_RANGE_SUBOBJECT_LIST (only object types 4-8)
This function module gets the existing sub-objects of a given number range object, and puts them in the table passed.
NUMBER_RANGE_SUBOBJ_GET_INFO
This function module gets information about the existing sub-objects of a given number range object. This information is put in a table structure, which must be declared like the table structure INROI.
NUMBER_RANGE_UPDATE_CLOSE
With this function module you write changes which have been made to local memory to the database, with NUMBER_RANGE_GROUP_UPDATE and NUMBER_RANGE_INTERVAL_UPDATE. After calling this function module, you should unlock the changed number range object.
NUMBER_RANGE_UPDATE_INIT
With this function module, you can initialize local memory if you want to discard the changes which have not yet been copied to the database.

 

 
3.3 函数组(SNR2)


NUMBER_RANGE_OBJECT_MAINTAIN
This function module provides all the screens needed to maintain a given number range object, with the possibility of branching to interval maintenance and change document display.
An export parameter states which action the user has performed with the number range object.
NUMBER_RANGE_OBJECT_CLOSE
With this function module, you write all changes to a given number range object, which were put in local memory with NUMBER_RANGE_OBJECT_UPDATE, to the database. If intervals are affected by the changes, they are updated. Change documents are created for all changes. A flag states whether intervals have been updated.
NUMBER_RANGE_OBJECT_DELETE
With this function module, you can delete either the whole definition of a given number range object, including texts, or only the texts. The deletion is performed directly in the database.
The function module provides no connection to the correction and transport system.
NUMBER_RANGE_OBJECT_INIT
With this function module, you initialize local memory for a given number range object.
You only need this call when you offer number range object maintenance in a user transaction, in which you want to provide the possibility of canceling changes which have not been saved.
NUMBER_RANGE_OBJECT_LIST
This function module gets a list of all number range objects with their texts and attributes. The information is put in a table.
The contents of local memory are not taken into account.
NUMBER_RANGE_OBJECT_READ
This function module gets the texts and attributes of a given number range object. The records returned can be used for changes with the function modules NUMBER_RANGE_OBJECT_UPDATE and NUMBER_RANGE_OBJECT_DELETE.
NUMBER_RANGE_OBJECT_UPDATE
This function module copies new number range objects or changes to existing number range objects into local memory, after error checks.
The function module does not provide a connection to the correction and transport system.

3.4 函数组(SNR3)


NUMBER_CHECK
检查号码是否在号码区间内,一般是外部给号需要检查号码时,你的程序调用该函数.
NUMBER_GET_INFO
读取一个号码范围数据的相关信息.
NUMBER_GET_NEXT
分配下一个可用的空号
2.5 函数组(SNR4)

NUMBER_RANGE_INTERVAL_INIT
对号码对象间隔的数值状态的初始化.
注意带*的函数只适用于以下几类号码对象: 2 and 3 and 5-8的号码范围对象

 

这篇关于使用号码范围对象实现流水号或者字段的自动给号的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/313340

相关文章

Conda与Python venv虚拟环境的区别与使用方法详解

《Conda与Pythonvenv虚拟环境的区别与使用方法详解》随着Python社区的成长,虚拟环境的概念和技术也在不断发展,:本文主要介绍Conda与Pythonvenv虚拟环境的区别与使用... 目录前言一、Conda 与 python venv 的核心区别1. Conda 的特点2. Python v

Spring Boot中WebSocket常用使用方法详解

《SpringBoot中WebSocket常用使用方法详解》本文从WebSocket的基础概念出发,详细介绍了SpringBoot集成WebSocket的步骤,并重点讲解了常用的使用方法,包括简单消... 目录一、WebSocket基础概念1.1 什么是WebSocket1.2 WebSocket与HTTP

C#中Guid类使用小结

《C#中Guid类使用小结》本文主要介绍了C#中Guid类用于生成和操作128位的唯一标识符,用于数据库主键及分布式系统,支持通过NewGuid、Parse等方法生成,感兴趣的可以了解一下... 目录前言一、什么是 Guid二、生成 Guid1. 使用 Guid.NewGuid() 方法2. 从字符串创建

SpringBoot+Docker+Graylog 如何让错误自动报警

《SpringBoot+Docker+Graylog如何让错误自动报警》SpringBoot默认使用SLF4J与Logback,支持多日志级别和配置方式,可输出到控制台、文件及远程服务器,集成ELK... 目录01 Spring Boot 默认日志框架解析02 Spring Boot 日志级别详解03 Sp

Python使用python-can实现合并BLF文件

《Python使用python-can实现合并BLF文件》python-can库是Python生态中专注于CAN总线通信与数据处理的强大工具,本文将使用python-can为BLF文件合并提供高效灵活... 目录一、python-can 库:CAN 数据处理的利器二、BLF 文件合并核心代码解析1. 基础合

Python使用OpenCV实现获取视频时长的小工具

《Python使用OpenCV实现获取视频时长的小工具》在处理视频数据时,获取视频的时长是一项常见且基础的需求,本文将详细介绍如何使用Python和OpenCV获取视频时长,并对每一行代码进行深入解析... 目录一、代码实现二、代码解析1. 导入 OpenCV 库2. 定义获取视频时长的函数3. 打开视频文

golang版本升级如何实现

《golang版本升级如何实现》:本文主要介绍golang版本升级如何实现问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录golanwww.chinasem.cng版本升级linux上golang版本升级删除golang旧版本安装golang最新版本总结gola

SpringBoot中SM2公钥加密、私钥解密的实现示例详解

《SpringBoot中SM2公钥加密、私钥解密的实现示例详解》本文介绍了如何在SpringBoot项目中实现SM2公钥加密和私钥解密的功能,通过使用Hutool库和BouncyCastle依赖,简化... 目录一、前言1、加密信息(示例)2、加密结果(示例)二、实现代码1、yml文件配置2、创建SM2工具

Mysql实现范围分区表(新增、删除、重组、查看)

《Mysql实现范围分区表(新增、删除、重组、查看)》MySQL分区表的四种类型(范围、哈希、列表、键值),主要介绍了范围分区的创建、查询、添加、删除及重组织操作,具有一定的参考价值,感兴趣的可以了解... 目录一、mysql分区表分类二、范围分区(Range Partitioning1、新建分区表:2、分

MySQL 定时新增分区的实现示例

《MySQL定时新增分区的实现示例》本文主要介绍了通过存储过程和定时任务实现MySQL分区的自动创建,解决大数据量下手动维护的繁琐问题,具有一定的参考价值,感兴趣的可以了解一下... mysql创建好分区之后,有时候会需要自动创建分区。比如,一些表数据量非常大,有些数据是热点数据,按照日期分区MululbU