Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to fill variable in product basic text?

Former Member
0 Likes
715

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?

1 ACCEPTED SOLUTION
Read only

former_member16322
Participant
0 Likes
666

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.

3 REPLIES 3
Read only

former_member16322
Participant
0 Likes
667

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.

Read only

0 Likes
666

Hi Steve,

Is this the standard way to fill such variables?

Read only

0 Likes
666

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.