- 浏览: 169290 次
- 性别:
- 来自: 成都
文章分类
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 5741. Goto-> Attributes->Pus ... -
Handy SAP function module to automate user events
2013-11-28 09:49 696*Begin-Auto triggers ENTER comm ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 746FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
set Billing block to blank for Sals Order
2013-04-17 15:16 715FM: SD_WF_ORDER_DEL_BILLING_BLO ... -
Unpermitted combination of business object BUS2032 and sales doc. category H
2013-01-25 14:20 4049Q: create New Sales Order using ... -
Function Module: get all users who have specific role
2013-01-25 14:16 588CALL FUNCTION 'RSRA_USERS_O ... -
Create a SELECT-OPTIONS in a module pool screen
2012-03-07 15:35 987source: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 794FORM compute_2date_diff. DAT ... -
Retrieving Domain fixed values
2012-02-16 11:13 784source:http://www.saptechnical. ... -
get status name for batch input session
2012-01-31 14:47 888Line 601 in program SAPMSBDC_CC ... -
create zip folder with cl_abap_zip
2011-12-05 18:11 1178REPORT ztest. DATA: gv_file ... -
MIRO
2011-11-29 10:39 2030from: http://help-sap.blogspot. ... -
Create Vendor or Customer_master Data
2011-11-23 16:22 2847To Create or Change Vendor_mast ... -
Pay attention to the following points when using append structures
2011-10-27 13:43 1274You cannot create append str ... -
Help Views
2011-10-20 10:46 690source:http://help.sap.com/saph ... -
What is the Different Types and Usage of Views
2011-10-19 23:06 811source:http://www.sap-img.com/a ... -
Upload a Comma Delimited CSV file that contains commas in data
2011-09-23 17:22 2190source:http://wiki.sdn.sap.com/ ... -
What is the difference between SET SCREEN and CALL SCREEN ?
2011-09-19 21:50 700source:http://www.saptechies.co ... -
cl_gui_frontend_services=>file_open_dialog
2011-09-09 09:21 1376CALL METHOD cl_gui_frontend_ser ...
相关推荐
equals和==的区别?equals与==的区别?equals和==有什么区别? Java解惑系列之一--equals和==之间究竟有什么区别 稍微学过一些java的同学都可能在网络上看到这样的一道题: 在java语言当中,equals和==之间究竟有...
stu1.equals(stu2)的返回值是(stu1==stu2) 相当于比较地址啊!的却是false 我想问stu1的String name="hck",这个"hck"存在常量池中,它和String s=new String("hck")有什么区别! String s1=new String("abc"); ...
在本文中,我们将讨论“ ==”与“ .Equals in C#”之间的区别。
对于开发的程序员小伙伴,大家肯定对于==和equals不陌生,而且会经常用到他,那么又有几个能够说清楚了==和equals是怎么回事呢?他了呢两个有什么区别呢? 比较 == 比较的是栈中的值,基本数据类型是变量值,引用...
2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2.javaequals()方法.zip2....
How do you override the equals sign?
Java 2实用教程(第三版)实验指导与习题解答 清华大学出版社 (编著 耿祥义 张跃平) 实验模版代码 建议使用文档结构图 (选择Word菜单→视图→文档结构图) 上机实践1 初识Java 4 实验1 一个简单的应用程序 ...
HashCode相同equals不同的2位字符集合算法 另附ASCII码表
java_equals用法,用来熟悉重写equals方法的
==和equals方法究竟有什么区别? == 操作符专门用来比较两个变量的值是否相等,也就是用于比较变量所对应的内存中所存储的数值是否相同,要比较两个基本类型的数据或两个引用变量是否相等,只能用==操作符。 ...
The API's main purpose is not for transporting, delivering, and forwarding messages; this is the purview of applications such as sendmail and other Mail Transfer Agent (MTA) type programs. MUA-type...
equals(Object) 与 == 的区别
重载equals方法示例重载equals方法示例重载equals方法示例重载equals方法示例重载equals方法示例
equals()和hashcode()这两个方法都是从object类中继承过来的。当String 、Math、还有Integer、Double。。。。等这些封装类在使用equals()方法时,已经覆盖了object类的equals()方法.
Java中的==与equals()实例方法Java中测试两个变量是否相等的方法有两个,一个是用==运算符,另一个就是object类提供的equals()方法。2
本文讲述了什么时候重写equals方法和如何重写equals方法。
Java中equals方法隐藏的陷阱
一. Java基础部分 1、一个".java"源文件中是否可以包括多个类(不是内部类)?有什么限制? 2、Java有没有goto? 3、说说&和&&的区别。 4、在JAVA中如何跳出当前的多重嵌套...11、"=="和equals方法究竟有什么区别?
能够加强对java中equals与==区别的理解。