【ABAP系列】SAP ABAP 的替代和校验

摘要:
GGB0验证维护GGB1替换维护GCVZRule维护GGB4验证/替换操作选择,例如,应用区域的激活,所有消息或替代字段的使用GCX2用户退出的定义OB28激活金融机构验证OBB激活金融机构替代OBB激活销售账户成本替代(在金融机构区域)OKC7激活金融机构确认OKC9激活金融金融机构替代GCT9传输:验证GCT0传输:替代2.使用公式编辑器时,账户必须包含什么?a) 验证GGB0如果您为调用点创建了第一个验证,例如“财务会计-文档头”,则必须定义一个消息类。这对于所有支持的所有验证都无效。在某些情况下,不能使用所有字段进行验证,例如“FI中的完整文档”。这是因为存在多行重新编辑,因此无法确定要执行哪一行检查。只能使用数字字段。(注释413956)如果需要对此调用点进行更多检查,则应使用退出。b) 替换GGB1如果您创建了一个替换,例如“财务会计文档行项目”,则只有某些字段可用于替换。这是因为文件可能会出现问题,或者不同应用之间可能会出现一致性。您可以释放替换字段,但这可能会导致严重问题。这就是为什么您应该将以下更改视为修改(注释170183):GB01表包含可替换字段或无法替换字段的格式。您可以通过将BEXCLUDE字段更改为“”来替换字段。例如:“完整文档”与FII匹配根据故障,没有字段被删除或替换。您可以看到以下条目:BOOLLASSCLASSTYPEBCLTABBBCLFIELDBEXCLUDE015SBKPF*X015SBSEG*XBOOLCLASS SpecififiestBoolean类。这在应用程序区域中确定,并在任何情况下调用,例如:008文件头(FI)009行项(FI)015完整文件(FI)016-销售成本100-文件头(CO)CLASSTYPE指定的字段可用于以下验证(B)、替换(S)或其他BCLTAB表,该表包含可用BEXCLUDE的BLCFIELD字段“或不能使用”X“。如上所述,您应该将更改与修改等同起来。无法在“标准”支持下处理更改结果的问题。3.激活验证或替换时,需要考虑什么?通常,只有
公众号:matinal
本文作者:matinal
原文出处:http://www.cnblogs.com/SAPmatinal/
原文链接:【ABAP系列】SAP ABAP 的替代和校验
 

【ABAP系列】SAP ABAP 的替代和校验第1张

前言部分

大家可以关注我的公众号,公众号里的排版更好,阅读更舒适。

正文部分

以下内容请参考,懒得翻译了

I. Creating, activating and transporting validations and substitutions


1. Which transactions are required to use validation or substitution functions?
GGB0 Validation Maintenance
GGB1 Substitution Maintenance
GCVZ Rule Maintenance
GGB4 Action selection for validation/substitution, for example, activation of application areas, use of all messages or substituted fields
GCX2 Definition of the Includes for user exits


OB28 Activation of FI validations
OBBH Activation of FI substitutions
OBBZ Activation of cost of sales accounting substitution (in the FI area)
OKC7 Activation of CO validations
OKC9 Activation of CO substitutions


GCT9 Transport: Validations
GCT0 Transport: Substitutions
 
2. What must I take into account when using the formula editor?
a) Validation GGB0
If you create the first validation for a callup point, for example 'financial accounting - document header', you have to define a message class. This is then valid for ALL validations for this callup point.


Not all fields can be used for validations on certain callup points, for example 'Complete document in FI'. This is because there are several rows there and it is not clear on which row the check is to be carried out. You can only use numeric fields here. (Note 413956)
You should use a user exit if you need more checks on this callup point.
b) Substitution GGB1
If you create a substitution, for example 'financial accounting document line item', only certain fields are authorized for the substitution. This is because problems can occur with the documents or inconsistencies can occur between different applications.
You can release more fields for substitution but this can be critical as serious problems can occur as a result.
This is why you should regard the following change as a modification (Note 170183):
The GB01 table contains information about which table fields can or cannot be substituted for which callup point.
You can make a field substitutable by changing the BEXCLUDE field to ' '.


For example: 'Complete document' callup point in the FI
In accordance with the default, no field is released for substitution on this callup point. You can see this in the following entries:


BOOLCLASS CLASSTYPE BCLTAB BCLFIELD BEXCLUDE
015 S BKPF * X
015 S BSEG * X




BOOLCLASS - Specifies the Boolean class. This is determined in the application area and callup point in each case, for example:
008 - Document header (FI)
009 - Line item (FI)
015 - Complete document (FI)
016 - Cost of sales accounting
100 - Document header (CO)
CLASSTYPE Specifies if the field can be used in the case of validations (B), substitutions (S) or both
BCLTAB - Table that is used
BLCFIELD - Field of this table
BEXCLUDE - Can be used ' ' or cannot be used 'X'.


As mentioned above, you should equate this change with a modification. Problems that occur as a result of this change cannot be handled in the 'standard' support.
 
3. What must I take into account when activating validations or substitutions?
You can activate validations and substitutions in two ways.
Activation level: 1 - Active
2 - Active, except during 'batch input' processing


Because the activation in the financial accounting (FI) is company-code-specific, the validations or substitutions should be activated in both company codes in the case of cross-company code transactions.
 
4. What must I take into account when transporting validations or substitutions?
Usually, only table entries are transported when validations or substitutions are transported. The generated source code should not be transported, since this can cause problems. After the import into the target system, the source code is generated automatically when the RGUGBR00 report is started.


If you would like to delete a validation/substitution, and do not want to do this in each system individually, proceed as described in Note 840981.
 
 
II. Using user exits in validations or substitutions


1. Where can I maintain user exits for validations and substitutions?
The exits for validations and substitutions are stored in an Include of your choice.
The following Includes are delivered as examples by default:
RGGBR000 Val/Sub: Exits for rules
RGGBS000 Val/Sub: Exits for substitutions
You should copy these into the customer namespace, for example ZGGBR000.
The length of the name you choose should not exceed 8 characters. This is because the name is also generated in the source code, and so a certain line length may be exceeded as a result.
You can also create a separate Include per client as this can improve performance.


In Transaction GCX2, you should then define where your Include is used. To do this, enter the name of your Include as a form pool in the relevant application area.
 
2. How should I create a user exit?
Define your user exit in the FORM Routine GET_EXIT_TITLES with the correct exit category (EXITS-PARAM). You can use the existing sample entries as a model for this.


The exit types required in the FORM Routine GET_EXIT_TITLES are organized as follows:
·         C_EXIT_PARAM_NONE No parameter
Apart from the return value (B_TRUE or B_FALSE), you do not need any parameters for the validation. If you do not want to substitute a field, use this parameter in the substitution (select "Only exit").


However, you must then use a TABLE statement in the formpool (not in the actual form) to identify the structure concerned.
·         C_EXIT_PARAM_FIELD A Field is transferred as a parameter
You only use this type in the substitution. Exactly one field is substituted. Enter user exits of this type in the substitution maintenance instead of assigning a constant value.
·         C_EXIT_PARAM_CLASS A complete type is transferred as a parameter
Matrix validations/substitutions ("Only exit"). This exit type can only be used in the case of callup points with complete documents, for example in the FI and the LC. You cannot use this exit category on any other callup points. The transferred type contains all information of a class. An example is the use of the document header and all corresponding line items in the FI area.


In the FORM routine GET_EXIT_TITLES, change the NAME and TEXT field of the EXITS internal table to the values you want.


Use one of the sample routines as a model and copy these to the names you selected. You can now implement the functions you want in this form routine.
After you have finished creating the user exit, you can use it in your validations or substitutions.


3. What must I take into account when implementing the user exit?
No dialog boxes, warning messages, information messages and error messages can be issued in an exit nor can a "COMMIT WORK" be rejected. This would, for example, interrupt the batch processing or cause problems with the documents to be posted. If you find a serious error in the field contents in the exit, send a termination message (A or X), which will ensure that the transaction is terminated.


Do not use any ABAP commands that cause the exit to be left directly, for example 'LEAVE (TO) SCREEN ...' or 'SUBMIT ...' or 'CALL TRANSACTION ...'


In an exit, use only structure fields that belong to the Boolean class of the calling substitution, validation or rule. The other structure fields are not filled or are not filled properly on the callup point of the calls of the substitution, validation or rule.


Changes to field contents may only be made in a substitution exit if this field can be substituted in the Boolean class. You can display such fields by selecting the "Add entry" function in the substitution maintenance.


In the Includes of the substitution exits, you must not use the commands MODIFY, INSERT or DELETE in the internally used structures such as BSEG or BKPF. These structures are interpreted internally as database tables because they are defined by a TABLES statement. As a result, database records are written, deleted or changed when you use the commands mentioned above. This can cause serious inconsistencies and problems in the document processing.


If you want to change field contents in Exit Types C_EXIT_PARAM_CLASS, you should make the changes in the internal table BOOL_DATA (for example BOLL_DATA-BSEG).
 
 
III. Problem analysis


1. What must I take into account before I analyze the problem?
Before you analyze a problem with validations/substitutions, make sure that the generated source code is up-to-date. You can use Report 'RGUGBR00' to do this.
Call this report in Transaction SE38. You receive the following selection screen:


Application area ' '
Application callup point ' '


' ' Regenerate main program
' ' Generate table file
' ' Generate rules
' ' Generate validations
' ' Generate substitutions
' ' Generate sets
' ' Generate rule use
' ' Generate validation use
' ' Generate substitution usage
' ' Generate substitution export routines
' ' Generate substitution routines in all clients
' ' Generate trace program calls


Now update the source code for the application area and application callup point in which the validation or substitution was created.
To do this, enter the application area, for example FI, and the application callup point (0003/complete document), and set all indicators except for 'Generate substitution routine in all clients' and 'Generate trace program calls'. Then execute the report.


The source code is now at its current status.
 
2. How can the validation and substitution trace be used?
a) Validation trace
You created and activated a validation.
You can now activate the trace, for example in Transaction GGBO. To do this, place the cursor on the validation and select 'Extras -> Activate trace'.
Example:
You created an FI validation on the 'Line item' callup point. To test the validation, execute, for example, Transaction FB01. The trace is displayed as soon as the validation is run. You can now see different things in the trace, for example the values contained in the fields of the various structures. From this, you can deduce whether additional checks are required, or tell what the cause of a problem is.
b) Substitution trace
Activate the trace in the same way as you activate validations.
Example:
You created a substitution in the same way as you activated the trace in the case of the validation. The trace for substitutions has an additional function, in that you can view the field contents before the substitution as well as after the substitution. There, problems can be reproduced in the same way.
 
3. How can I use the DEBUGGER to analyze a problem?
a) Basic information
All Includes for validations and substitutions are created in this form: GBTmmaa0.
mm stands for two digit client key.
You can use the G_CLIENT_ENCODE function module to convert a three-digit client (>099) to a two-digit client, for example: client 100 --> AA
client 800 --> TQ
AA stands for the application area, for example FI --> Financial Accounting
CO --> Cost Accounting
You will find this abbreviation in the maintenance transaction.
Therefore, GBTAAFI0 is the Include in client 100 for FI validations and substitutions.
b) Structure of the Includes and form routines for validations and substitutions and tips on how to 'debug'


The above-mentioned Includes are structured in the following way (sample Include in FI, Client 800):


INCLUDE GBTTQFIA. " Rules
INCLUDE GBTTQFIB. " Substitutions
INCLUDE GBTTQFIC. " Substitution conditions
INCLUDE GBTTQFID. " Validations
INCLUDE GBTTQFIE. " Validation conditions
INCLUDE GBTTQFIF. " Validation checks
INCLUDE GBTTQFII. " Application rules
INCLUDE GBTTQFIJ. " Substitution export routines
INCLUDE GBTTQFIM. " Trace/simulation
INCLUDE GBTTQFIS. " Substitution import routines
c) The form routines for validations have the following sample structure (sample validation with the name VAL01):


FORM VAL_VAL01.
G_BFOUND = B_TRUE.
DATA: COND LIKE D_BOOL,
CHECK LIKE D_BOOL,
NVALSEVEREST LIKE SY-SUBRC VALUE -1.


G_STEP = '001'.
PERFORM VALCOND_1VAL01##001
CHANGING
COND.


IF COND = B_TRUE .
PERFORM VALCHCK_2VAL01##001
CHANGING
CHECK.


IF CHECK = B_FALSE .
PERFORM MESSAGE_OUTPUT
USING
" ...Nachrichtenparameter
CHANGING
NVALSEVEREST.
ENDIF.
ENDIF.
ENDFORM. " VAL_VAL01


Statement G_STEP = '001' indicates the step that is executed.
The prerequisite of the step is defined in Form Routine VALCOND_..., the form routine VALCHCK_... checks the validation step.


To analyze this step, you should create breakpoints on these two PERFORM statements and also on the code line 'IF CHECK = FALSE'. In doing so, you can determine whether your prerequisite or the check is causing the problem you have, for example a field that is to be checked does not contain the value that you expect.
d) The form routines for substitutions have the following sample structure (sample substitution with the name SUB01):


FORM SUB_SUB01.
G_BFOUND = B_TRUE.
DATA: COND LIKE D_BOOL.
G_CLASSID = '009'.
G_SUBST_PERFORMED = B_FALSE.


IF G_TAB_FLAG-BSEG <> B_TRUE .
PERFORM READ_MASTER_DATA
USING
'BSEG'
G_BFOUND.
IF G_BFOUND = B_FALSE .
MESSAGE E083 WITH 'BSEG'.
ENDIF.
ENDIF.


G_STEP = '001'.
PERFORM SUBCON_3SUB01##001
CHANGING
COND.


IF COND = B_TRUE .
BSEG-SGTXT = 'This is a Test'. " Text
G_SUBST_PERFORMED = B_TRUE.
ENDIF.
ENDFORM. " SUB_SUB01


As mentioned above for validations, 'G_STEP = '001' indicates the step, and the prerequisite of the substitution is defined in Form Routine SUBCON_.... The actual substitution is carried out by the statements in the 'IF COND = B_TRUE --> ENDIF' structure. These statements vary depending on the 'type' of substitution created (field allocation, constant value, user exit).


In the substitutions, you should also set a breakpoint on the PERFORM on the prerequisite and the statement 'IF COND = B_TRUE'.
 
4. Function modules that call validations and substitutions
Validations - Function module G_VSR_VALIDATION_CALL
The different structures/tables, the name of the validation, callup point and application area are assigned to this function module.
Substitutions - Function module G_VSR_SUBSTITUTION_CALL
The parameters transferred to validations are also transferred to this function module. However, structures/tables that contain the changed values are also returned.


You could set a breakpoint to analyze both function modules. In doing so, you could see which data was transferred, which data the validation or substitution attains, and which values are returned.
 
5. What must I take into account during the set usage?
When sets are used in validations or substitutions, source code is generated from the values in the sets.
Performance problems can occur if a set is of a certain size, since the generated source code causes longer runtimes.
A runtime error can also occur.


To reduce the size of the source code of the sets used, you can proceed as follows:


Use a smaller set in the validation, substitution or rule. To do so, group single values in the set into intervals (for example, instead of the single values 0001, 0002 and 0003, use the interval 0001 - 0003)


Instead of " IN SET", use the rule "( IN SET1 OR IN SET2)" in which SET1 and SET2 contain the values from SET (for example, subhierarchies on the highest hierarchy level).


The simplest way to determine the number of single values or intervals in a set hierarchy is to execute Program RGSEX000.
Enter the name of the set and execute the program. All contained sets and values/intervals are listed and the sequential number of the entries is contained in the first column.
 
6. Why does a validation or substitution work in the development system, but not work in another system after a transport?
You should make sure that validations and substitutions are activated in the target system. You can also use Report RGUGBR00 to execute the regeneration of the source code again.


There could be another cause in the case of substitutions:
You try to substitute a field that is not released as a default by SAP. To substitute a field, you have adjusted Table GB01 in your development system. However, this did not occur in the target system. The generated source code is correct and the value was changed in the substitution, but the change was not returned to the calling application via the export routines.
 
相关Notes:
Note 42615 - Substitution in FI

免责声明:文章转载自《【ABAP系列】SAP ABAP 的替代和校验》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇英特尔® 实感™ 前置摄像头 SR300 和 F200 的比较如何在Ubuntu 20.04 / 18.04或更老版本中安装ifconfig下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

表单操作

引言:JavaScript最早被设计出来就是为了实现对注册表单的验证,本文简单的介绍了JavaScript的表单操作 1.获取表单对象的方法 1.通过表单ID获取:document.getElementById("formId"); 2.通过表单的索引获取:document.forms[index];3.通过表单的name获取:document.forms...

vue 查询分页

后端用的flask,前端vue,查询结果展示以及分页 如图: 代码如下: 前端: 1 <template> 2 <div> 3 <el-row> 4 <el-col :span="18"> 5 <el...

Spring MVC-表单(Form)标签-隐藏字段(Hidden Field)示例(转载实践)

以下内容翻译自:https://www.tutorialspoint.com/springmvc/springmvc_hidden.htm 说明:示例基于Spring MVC 4.1.6。 以下示例显示如何使用Spring Web MVC框架在窗体中使用隐藏字段。首先,让我们使用Eclipse IDE,并按照以下步骤使用Spring Web Framewo...

layui select动态添加option

<form class="layui-form" action=""> <div class="layui-form-item proSelect"> <label class="layui-form-label">产品类别</label> <div...

php获取form表单单选按钮和复选框的值

获取单选按钮的值 在<form>表单中,单选按钮 radio 一般是成一组一组出现的,具有相同 name值 和不同的 value 值,在一组单选按钮中,同一时间只可能有一个被选中。 来举一个单选按钮 radio的例子,在这个代码实例中有两个 name = "sexy" 的单选按钮,选中其中一个并单击"提交"按钮,将会返回被选中的单选按钮的 va...

asp.net MVC中防止跨站请求攻击(CSRF)的ajax用法

参考: Preventing Cross-Site Request Forgery (CSRF) AttacksValidating .NET MVC 4 anti forgery tokens in ajax requests 在mvc中,微软提供了一个简单的方法来防止CSRF,就是在前端form表单里加上Anti-Forgery Tokens <...