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

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

相关文章

pandas中位数填充空值的实现示例

《pandas中位数填充空值的实现示例》中位数填充是一种简单而有效的方法,用于填充数据集中缺失的值,本文就来介绍一下pandas中位数填充空值的实现,具有一定的参考价值,感兴趣的可以了解一下... 目录什么是中位数填充?为什么选择中位数填充?示例数据结果分析完整代码总结在数据分析和机器学习过程中,处理缺失数

Golang HashMap实现原理解析

《GolangHashMap实现原理解析》HashMap是一种基于哈希表实现的键值对存储结构,它通过哈希函数将键映射到数组的索引位置,支持高效的插入、查找和删除操作,:本文主要介绍GolangH... 目录HashMap是一种基于哈希表实现的键值对存储结构,它通过哈希函数将键映射到数组的索引位置,支持

Java学习手册之Filter和Listener使用方法

《Java学习手册之Filter和Listener使用方法》:本文主要介绍Java学习手册之Filter和Listener使用方法的相关资料,Filter是一种拦截器,可以在请求到达Servl... 目录一、Filter(过滤器)1. Filter 的工作原理2. Filter 的配置与使用二、Listen

Pandas使用AdaBoost进行分类的实现

《Pandas使用AdaBoost进行分类的实现》Pandas和AdaBoost分类算法,可以高效地进行数据预处理和分类任务,本文主要介绍了Pandas使用AdaBoost进行分类的实现,具有一定的参... 目录什么是 AdaBoost?使用 AdaBoost 的步骤安装必要的库步骤一:数据准备步骤二:模型

使用Pandas进行均值填充的实现

《使用Pandas进行均值填充的实现》缺失数据(NaN值)是一个常见的问题,我们可以通过多种方法来处理缺失数据,其中一种常用的方法是均值填充,本文主要介绍了使用Pandas进行均值填充的实现,感兴趣的... 目录什么是均值填充?为什么选择均值填充?均值填充的步骤实际代码示例总结在数据分析和处理过程中,缺失数

Java对象转换的实现方式汇总

《Java对象转换的实现方式汇总》:本文主要介绍Java对象转换的多种实现方式,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录Java对象转换的多种实现方式1. 手动映射(Manual Mapping)2. Builder模式3. 工具类辅助映

如何使用 Python 读取 Excel 数据

《如何使用Python读取Excel数据》:本文主要介绍使用Python读取Excel数据的详细教程,通过pandas和openpyxl,你可以轻松读取Excel文件,并进行各种数据处理操... 目录使用 python 读取 Excel 数据的详细教程1. 安装必要的依赖2. 读取 Excel 文件3. 读

Go语言开发实现查询IP信息的MCP服务器

《Go语言开发实现查询IP信息的MCP服务器》随着MCP的快速普及和广泛应用,MCP服务器也层出不穷,本文将详细介绍如何在Go语言中使用go-mcp库来开发一个查询IP信息的MCP... 目录前言mcp-ip-geo 服务器目录结构说明查询 IP 信息功能实现工具实现工具管理查询单个 IP 信息工具的实现服

SpringBoot基于配置实现短信服务策略的动态切换

《SpringBoot基于配置实现短信服务策略的动态切换》这篇文章主要为大家详细介绍了SpringBoot在接入多个短信服务商(如阿里云、腾讯云、华为云)后,如何根据配置或环境切换使用不同的服务商,需... 目录目标功能示例配置(application.yml)配置类绑定短信发送策略接口示例:阿里云 & 腾

解决Maven项目idea找不到本地仓库jar包问题以及使用mvn install:install-file

《解决Maven项目idea找不到本地仓库jar包问题以及使用mvninstall:install-file》:本文主要介绍解决Maven项目idea找不到本地仓库jar包问题以及使用mvnin... 目录Maven项目idea找不到本地仓库jar包以及使用mvn install:install-file基