cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid hard coding in webdynpro enhancement?

0 Kudos

Hi All,

My requirement is to send a mail by enhancing an existing webdynpro. Inorder to fill the mail body, lot of hard coded texts are needed (eg : "Note – This is a system generated mail. Please do not reply."). I do not want to hard code this as that is not the best practice in coding. I cannot use text symbols in Assistance class as well, because the assistance class is a standard class.

Please suggest a method to do this. I need to get the hard codes within the OnAction Method so that i can concatenate it with program data and fill up the mail body.

Thanks in advance. 🙂

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Kavya,

One option is to subclass the standard assistance class and create text symbols within your subclass. Another option is to create your texts as OTR (Online Text Repository) texts (transaction SOTR_EDIT) then read them in your code via class CL_WD_UTILITIES.

my_text = cl_wd_utilities=>get_otr_text_by_alias( 'MY_ALIAS' ).

A third option-- if they're longer texts-- is to use standard text objects which you can read via call to function READ_TEXT.

The best option of these three is the OTR texts. That's the sort of thing OTR texts are intended for and they can be internationalized for different languages if needed.

Cheers,

Amy

Answers (2)

Answers (2)

former_member221408
Participant

Hi,

Why not put in a table and than refer to it in the context of you WD Component and than call the required attributes when needed: Context in Detail?

kasralikarpratik
Explorer
0 Kudos

Create standard text using SO10 and read the same using READ_TEXT function module.