SAP AG 2005, Title of Presentation / Speaker Name / 1
Introduction to internationalization
Online Text Repository
Message handling
Contents:
Online Text Repository (OTR) and Messages
SAP AG 2005, Title of Presentation / Speaker Name / 2
After completing this unit, you will be able to:
Understand ABAP WD support for Online Text Repository
Report messages to the user using the IF_WD_MESSAGE_MANAGER interface
Messages and Error Handling: Unit Objectives
SAP AG 2005, Title of Presentation / Speaker Name / 3
Internationalization
The process by which language specific text is detached from the program code that uses it is known as “Internationalization”.
This allows the same program to operate in multiple languages without needing different versions of the code for each language.
SAP AG 2005, Title of Presentation / Speaker Name / 4
Internationalization (I18N) Support
During runtime UI elements bound to an context node/attribute which is based on a DDIC table/structure/type will get the text in appropriate language.
Text properties of UI elements can be bound directly to DDIC text.
Is a text literal entered in a text fields of UI elements a corresponding OTR text will be created.
Existing OTR texts (alias) can be assigned to a properties of a UI element.
List of existing OTR texts
Enter a text or assign an existing OTR text
SAP AG 2005, Title of Presentation / Speaker Name / 5
Using the Online Text Repository
The class CL_WD_UTILITIES provide the method GET_OTR_TEXT_BY_ALIAS to get text from OTR.
Use the WD code wizard to selectthe proper OTR text and generatethe coding.
data: ... ... OTR_text type string.
OTR_text = CL_WD_UTILITIES=>GET_OTR_TEXT_BY_ALIAS( 'SOTR_VOCABULARY_BASIC/MATERIAL_MASTER' ). ... ...
* set single attribute Elem_Lable_Text->set_Attribute( exporting Name = `TF_LABLE_3` Value = OTR_TEXT ). coding snippet
SAP AG 2005, Title of Presentation / Speaker Name / 6
Using the Component Assistence Class
A comonent assistence class can be associated to every WD component
Attribute wd_Assist is available in every controller of the component for accessing texts with method get_text
SAP AG 2005, Title of Presentation / Speaker Name / 7
Web Dynpro Messages and Error Handling
All messages will be displayed in a dedicated message area.
By default the message area appears at the top of the page.
The message are can be moved like a UI element in a view. You find a UI element (Message Area) in the UI library Pattern. Messages will be placed in this area, if it is available.
Messages can be displayed in a dedicated message area
By default messages will be displayed at the top of page
Message area can be moved
* Note: feature released with SP1
SAP AG 2005, Title of Presentation / Speaker Name / 8
Handling of Message
The handling of messages can be controlled in the WD application
Messages area only visible if a message thrown
Messages area always visible
Messages NOT listed in the message area “box” - Messages are listed in a sequence
Note: feature released with SP1
SAP AG 2005, Title of Presentation / Speaker Name / 9
coding snippet
Parameter
Categories of Messages
Text
EXCEPTION
T100
ATTRIBUTE
Example* report messageCALL METHOD l_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE EXPORTING MESSAGE_TEXT = '&V2 is not a valid date' ELEMENT = Elem_Flights ATTRIBUTE_NAME = 'FLDATE' PARAMS = lt_messages.
Arbitrary text can be used as a
message text
ABAP OO exceptions can be
used
Reuse of existing T100 message ID,
No.
Dedicated field will be marked in red color
Parameters can be
assigned to the message
SAP AG 2005, Title of Presentation / Speaker Name / 10
Kind of Messages
REPORT_ATTRIBUTE_ERROR_MESSAGE Reports a WD Exception for a Context Attribute
REPORT_SUCCESS Reports a Success Message
REPORT_WARNING Reports a Warning
REPORT_ERROR_MESSAGE Reports a Web Dynpro Message with Optional Parameters
REPORT_FATAL_ERROR_MESSAGE Reports a Fatal Web Dynpro Message with Optional Parameters
REPORT_ATTRIBUTE_EXCEPTION Reports a WD Exception for a Context Attribute
REPORT_EXCEPTION Reports a Web Dynpro Exception (May Return)
REPORT_FATAL_EXCEPTION Reports a Fatal Web Dynpro Message
REPORT_T100_MESSAGE Reports a Message Using a T100 Entry
REPORT_ATTRIBUTE_T100_MESSAGE Reports a WD Exception for a Context Attribute
T100
EXCEPTION
Text
SAP AG 2005, Title of Presentation / Speaker Name / 11
Create a message
* get message managerdata: l_current_controller type ref to if_wd_controller, l_message_manager type ref to if_wd_message_manager.
l_current_controller ?= wd_This->Wd_Get_Api( ).
CALL METHOD l_current_controller->GET_MESSAGE_MANAGER RECEIVING MESSAGE_MANAGER = l_message_manager
* report messageCALL METHOD l_message_manager->REPORT_ATTRIBUTE_ERROR_MESSAGE EXPORTING MESSAGE_TEXT = 'REPORT_ATTRIBUTE_ERROR_MESSAGE' ELEMENT = Elem_Flights ATTRIBUTE_NAME = 'CITYFROM'.
coding snippet
Use the WD code wizard to create the required coding to report a message.
SAP AG 2005, Title of Presentation / Speaker Name / 12
Create a ‘T100’ message
* get message managerdata: l_current_controller type ref to if_wd_controller, l_message_manager type ref to if_wd_message_manager.
l_current_controller ?= wd_This->Wd_Get_Api( ).
CALL METHOD l_current_controller->GET_MESSAGE_MANAGER RECEIVING MESSAGE_MANAGER = l_message_manager
* report messageCALL METHOD l_message_manager->REPORT_T100_MESSAGE EXPORTING MSGID = 'E1' MSGNO = '360' MSGTY = 'S' P1 = ' -> REPORT_T100_MESSAGE'.
coding snippet
Existing message classes can be reused to create messages
Use the WD code wizard to create the required coding to report a ‘T100’ message.
SAP AG 2005, Title of Presentation / Speaker Name / 13
Standard Hook Method – View controller
Only a view controller has these hook methods.
The method WDDOBEFOREACTION before an action performed, can be used for data validation.
SAP AG 2005, Title of Presentation / Speaker Name / 14
You should now be able to:
Understand ABAP WD support for Online Text Repository
Report messages to the user using the IF_WD_MESSAGE_MANAGER interface
Messages and Error Handling: Unit Summary
Top Related