2013 Jan 23 5:10 PM
Hi,
in product master, for any product/service we have a set type: texts. under this, we have text category basic text.
This text may have variables like: %product_end_date%.
how to fill such variables in abap code when we read this text?
2013 Jan 23 5:18 PM
Use REPLACE statement.
For example
DATA:
l_text TYPE string,
l_product_end_date TYPE c " Program Variable containing value
.
REPLACE ALL OCCURRENCES OF '%product_end_date%' IN l_text WITH l_product_end_date .
You may need to do some explicit type conversions if the variable's data is in a type other then character.
2013 Jan 23 5:18 PM
Use REPLACE statement.
For example
DATA:
l_text TYPE string,
l_product_end_date TYPE c " Program Variable containing value
.
REPLACE ALL OCCURRENCES OF '%product_end_date%' IN l_text WITH l_product_end_date .
You may need to do some explicit type conversions if the variable's data is in a type other then character.
2013 Jan 23 5:30 PM
2013 Jan 23 6:25 PM
Replace is the standard way to replace one character string with another from with in a character string; if you want to view standard code that does something similar, look at Function MESSAGE_TEXT_BUILD. It is slightly different because it does not use named variable place holders and instead just uses & symbols to indicate variables; however, it should illustrate replacing variables in a text string.