- 浏览: 174278 次
- 性别:
- 来自: 成都
文章分类
source:http://sapport.blogspot.com/2010/03/if-1-equals-2-whats-purpose.html
While debugging standard SAP ABAP code you might find for first look very strange code like following:
If 1 EQ 2.
MESSAGE W001(z100).
* plus do something else
EndIf.
Confusing? Of course! Based on the math this statement cannot be ever true. Then why do we need such an IF statement?
Actually there are certain situations when we need it. Just to name few of them. We need to make visible some parts of code which must not be executed under any circumstances. In this case we put it to such an IF. This can be make traceable usage of such a statement. E.g. message created in message’s transaction (TA SE91). In this way we just create reference point to “Where used” functionality of specific message. In case we would like to see where particular message 001 from message class Z100 is used we can achieve it. In general by this technique we can enhance ABAP code maintainability in larger scale.
This technique is often used in BW area as well. E.g. in data extraction ABAP function modules. See function modules called RSAX_BIW_GET_DATA_SIMPLE.
While debugging standard SAP ABAP code you might find for first look very strange code like following:
If 1 EQ 2.
MESSAGE W001(z100).
* plus do something else
EndIf.
Confusing? Of course! Based on the math this statement cannot be ever true. Then why do we need such an IF statement?
Actually there are certain situations when we need it. Just to name few of them. We need to make visible some parts of code which must not be executed under any circumstances. In this case we put it to such an IF. This can be make traceable usage of such a statement. E.g. message created in message’s transaction (TA SE91). In this way we just create reference point to “Where used” functionality of specific message. In case we would like to see where particular message 001 from message class Z100 is used we can achieve it. In general by this technique we can enhance ABAP code maintainability in larger scale.
This technique is often used in BW area as well. E.g. in data extraction ABAP function modules. See function modules called RSAX_BIW_GET_DATA_SIMPLE.
发表评论
-
DISABLE button(FCODE) from the GUI-Status
2014-08-04 15:54 6321. Goto-> Attributes->Pus ... -
Handy SAP function module to automate user events
2013-11-28 09:49 751*Begin-Auto triggers ENTER comm ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 819FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 744FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
Unpermitted combination of business object BUS2032 and sales doc. category H
2013-01-25 14:20 4135Q: create New Sales Order using ... -
Function Module: get all users who have specific role
2013-01-25 14:16 679CALL FUNCTION 'RSRA_USERS_O ... -
Create a SELECT-OPTIONS in a module pool screen
2012-03-07 15:35 1026source:http://abap-explorer.blo ... -
Converting OTF data from script to Spool Request
2012-03-06 17:25 0source:http://forums.sdn.sap.co ... -
Calculate the days, months and years between 2 dates.
2012-02-21 16:14 835FORM compute_2date_diff. DAT ... -
Retrieving Domain fixed values
2012-02-16 11:13 811source:http://www.saptechnical. ... -
get status name for batch input session
2012-01-31 14:47 922Line 601 in program SAPMSBDC_CC ... -
create zip folder with cl_abap_zip
2011-12-05 18:11 1208REPORT ztest. DATA: gv_file ... -
MIRO
2011-11-29 10:39 2064from: http://help-sap.blogspot. ... -
Create Vendor or Customer_master Data
2011-11-23 16:22 2920To Create or Change Vendor_mast ... -
Pay attention to the following points when using append structures
2011-10-27 13:43 1310You cannot create append str ... -
Help Views
2011-10-20 10:46 737source:http://help.sap.com/saph ... -
What is the Different Types and Usage of Views
2011-10-19 23:06 847source:http://www.sap-img.com/a ... -
Upload a Comma Delimited CSV file that contains commas in data
2011-09-23 17:22 2234source:http://wiki.sdn.sap.com/ ... -
What is the difference between SET SCREEN and CALL SCREEN ?
2011-09-19 21:50 763source:http://www.saptechies.co ... -
cl_gui_frontend_services=>file_open_dialog
2011-09-09 09:21 1419CALL METHOD cl_gui_frontend_ser ...
相关推荐
if (s1.equals(s2)) System.out.println("s1 equals s2"); else System.out.println("s1 not equals s2"); } } 这个程序的输出是:s1 != s2、s1 equals s2。这说明 s1 和 s2 分别引用了两个不同的 String 对象...
<input type="radio" name="roworCol" value="1" <s:if test="roworCol.equals('1'.toString())">checked="checked"</s:if>/> ``` 在这个简单的示例中,我们同样比较了一个变量`roworCol`的值与字符串“1”。注意...
if(this.name.equals(s.name) && this.gender.equals(s.gender)) { return true; } else { return false; } } else { return false; } } } ``` 结论 ---- equals 方法是一个非常重要的方法,它用于判断两...
在C#编程语言中,“==”运算符和“.Equals()”方法是两种常见的用于比较对象是否相等的方式,但它们之间存在着重要的差异。理解这些差异对于编写高效且准确的代码至关重要。 首先,让我们来探讨“==”运算符。在C#...
由于`stu1`和`stu2`是两个独立的对象,它们的引用地址不同,所以`stu1.equals(stu2)`的结果是`false`。 至于`String name="hck"`和`String s=new String("hck")`的区别,前者是在常量池中创建或查找已存在的"**hck*...
- `stu0`和`stu1`具有相同的属性值,因此`stu1.equals(stu0)`返回`true`。 - `stu2`与`stu0`的属性值不同,因此`stu2.equals(stu0)`返回`false`。 通过这种方式,`equals`方法的正确性得到了验证。 #### 四、注意...
return Objects.equals(this.char1, other.char1) && Objects.equals(this.char2, other.char2); } @Override public int hashCode() { return Objects.hash(char1, char2); } } ``` 在上述代码中,`Objects...
if (str1.equals(str2)) { System.out.println("对象 str1 和对象 str2 的值相等"); } else { System.out.println("对象 str1 和对象 str2 的值不相等"); } ``` 在上面的例子中,str1 和 str2 是两个字符串对象,...
if (s1.equals(s2)) { System.out.println("s1 equals s2"); } else { System.out.println("s1 not equals s2"); } } } 这时,输出结果是 "s1 != s2" 和 "s1 equals s2"。这意味着,s1 和 s2 引用的是不同的...
"equals(Object) 与 == 的区别" .equals(Object) 与 == 的区别是 Java 编程语言中一个常见的问题,许多初学者都感到困惑。下面我们将详细地解释这两个概念之间的区别。 首先,让我们看一个例子。假设我们有两个 ...
if (str1.equals(str2)) { System.out.println("对象 str1 的内容和 str2 的内容相同"); } } } ``` 在上面的例子中,equals 比较的是 str1 对象的内容和 "abc" 的内容是否相等,结果是 true。 Java 中的 equals...
2. 对称性:如果x.equals(y)返回true,那么y.equals(x)也应返回true。 3. 传递性:如果x.equals(y)和y.equals(z)都返回true,那么x.equals(z)也应返回true。 4. 一致性:多次调用x.equals(y)应该始终返回相同的布尔...
对于开发的程序员小伙伴,大家肯定对于==和equals不陌生,而且会经常用到他,那么又有几个能够说清楚了==和equals是怎么回事呢?他了呢两个有什么区别呢? 比较 == 比较的是栈中的值,基本数据类型是变量值,引用...
2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2....
if (obj1 === obj2) return true; if (obj1 == null || typeof obj1 !== 'object' || obj2 == null || typeof obj2 !== 'object') return false; const keys1 = Object.keys(obj1); const keys2 = Object.keys...
2. **类型检查**:在`Equals`方法内部,首先检查传入的对象是否与当前对象是同一种类型。如果不是,可以直接返回`false`,因为不同类型的对象不可能相等。 ```csharp if (obj == null || GetType() != obj.GetType...
回到给出的示例,我们看到`o1.equals(o3)`返回真,因为`o1`和`o3`引用的是同一个对象;而`o1.equals(o2)`返回假,因为它们代表的是两个独立的对象。对于字符串,`s1.equals(s2)`返回真,因为尽管`s1`和`s2`是独立...
2. 如果`o.equals(o1)`返回`true`,则`o1.equals(o)`也应该返回`true`(对称性)。 3. 如果`o.equals(o1)`和`o.equals(o2)`都返回`true`,那么`o1.equals(o2)`也应该返回`true`(传递性)。 4. 如果`o.equals(o1)`...
### Java中equals方法隐藏的陷阱 在Java编程中,正确实现`equals`方法至关重要,它不仅影响对象的比较逻辑,还直接关系到集合类(如`HashSet`、`HashMap`等)的行为。本文将深入探讨Java中`equals`方法的一些常见...