If 1=2. What is this code about? MESSAGE where used list
2010-12-01 15:29
441 查看
http://www.saptechnical.com/Tips/ABAP/if1=2.htm
We all might have seen the code "IF 1=2. ....do this...EndIF" and we also know that this code never turns true. The main purpose of such code is for "Maintainability" of the program. Confused?? Read the following:
Depending upon the scenario, we would either issue the messages in the program using MESSAGE statement or sometimes might have to call the standard function module MESSAGE_PREPARE to prepare the whole message and use it wherever required.
CALL FUNCTION 'MESSAGE_PREPARE'
EXPORTING
msg_id = msg_id
msg_no = msg_no
MSG_VAR1 = sy-msgv1
MSG_VAR2 = sy-msgv2
MSG_VAR3 = sy-msgv3
MSG_VAR4 = sy-msgv4
IMPORTING
MSG_TEXT = tdoc-text
EXCEPTIONS
FUNCTION_NOT_COMPLETED = 1
MESSAGE_NOT_FOUND = 2
OTHERS = 3.
Assume that we have defined custom message class for issuing the messages. If we have to modify certain message in this message class, we first need to check for the where-used list of the message to study the impact of the message change. If the message is issued using the MESSAGE statement in any program, then that program would appear in the where-used list. But if the message is used in the program using the FM MESSAGE_PREPARE or any similar function module, then this program would not appear in the where-used list. So in order to have this program include in the where-used list, we would code the following after the call to the function module MESSAGE_PREPARE.
IF 1=2.
Message E003(xx).
ENDIF.
Since the check "IF 1=2" never gets true, the message would never trigger in the program and this program would appear in the where-used list of that message.
We all might have seen the code "IF 1=2. ....do this...EndIF" and we also know that this code never turns true. The main purpose of such code is for "Maintainability" of the program. Confused?? Read the following:
Depending upon the scenario, we would either issue the messages in the program using MESSAGE statement or sometimes might have to call the standard function module MESSAGE_PREPARE to prepare the whole message and use it wherever required.
CALL FUNCTION 'MESSAGE_PREPARE'
EXPORTING
msg_id = msg_id
msg_no = msg_no
MSG_VAR1 = sy-msgv1
MSG_VAR2 = sy-msgv2
MSG_VAR3 = sy-msgv3
MSG_VAR4 = sy-msgv4
IMPORTING
MSG_TEXT = tdoc-text
EXCEPTIONS
FUNCTION_NOT_COMPLETED = 1
MESSAGE_NOT_FOUND = 2
OTHERS = 3.
Assume that we have defined custom message class for issuing the messages. If we have to modify certain message in this message class, we first need to check for the where-used list of the message to study the impact of the message change. If the message is issued using the MESSAGE statement in any program, then that program would appear in the where-used list. But if the message is used in the program using the FM MESSAGE_PREPARE or any similar function module, then this program would not appear in the where-used list. So in order to have this program include in the where-used list, we would code the following after the call to the function module MESSAGE_PREPARE.
IF 1=2.
Message E003(xx).
ENDIF.
Since the check "IF 1=2" never gets true, the message would never trigger in the program and this program would appear in the where-used list of that message.
相关文章推荐
- Installation failed with message...It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
- How to: Determine if a Package that is About to be Compiled is Being Used Currently (文档 ID 1054939.6
- Managed, Unmanaged, Native: What Kind of Code Is This?
- Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
- About Derby "ERROR 42X51: The class '***' does not exist or is inaccessible. This can hap pen if the class is not public."
- Neural Networks and Deep Learning(神经网络与深度学习)_What this book is about
- [转]Managed, Unmanaged, Native: What Kind of Code Is This?
- Managed(托管), Unmanaged(非托管), Native: What Kind of Code Is This?
- [转]Managed, Unmanaged, Native: What Kind of Code Is This?
- This event supports the .NET Framework infrastructure and is not intended to be used directly from your code?继承自VScrollbar的自定义winform控件,某些事件不触发的问题(Winform控件开发学习)
- This version of Android Studio is incompatible with the Gradle Plugin used.
- What Is Clean Code? – In Quotes
- Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try d
- This version of Android Studio is incompatible with the Gradle Plugin used. Try disabling Instant R
- This program is used to explain how PCA works and the idea behind the method.
- What Is a Glue Code?
- [原创]在Delphi7中实现What is this?!
- Android异常总结---type Status report message HTTP method GET is not supported by this URL
- Error running app: This version of Android Studio is incompatible with the Gradle Plugin used. Try d
- Delegate: What is this? ----什么是Delegate(委托)