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

Dynmaic text population using Read_text

VijayCR
Active Contributor
0 Likes
1,033

Hello Experts,

I am doing a report for mail functionality.I am getting my title and body from a standard text.But the title also contains some dynamic varibles like

Vendor name XXXXXXX  payment ID and Country XXXXX. I am using Read_text to get the standard text and the output varible is of type string.Please tell me know i can populate dynamic values.

Thanks ,

Vijay.

7 REPLIES 7
Read only

former_member585060
Active Contributor
0 Likes
954

Loop the entries returned in tables TLINES from FM READ_TEXT.

LOOP AT i_tlines INTO wa_tlines.

CONCATENATE v_string wa_tlines-tdline INTO v_string

                         SEPERATED BY space.

CLEAR : wa_lines.

ENDLOOP.

Just check where exactly you can fit the Vendor number and Country value in above loop.

Read only

0 Likes
954

Hello Bala Krishna,

     The value for the vendor number is populated from the report similarly for remaining dynmaic variables also like how we do &var& do we have any procision here?

Thank you,

Vijay.

Read only

0 Likes
954

It depends on the long text you are getting with the read_text and where exactly you want the vendor name and country name.

What you can do is, search for the word 'Vendor' in wa_tline-tdline before concatenate statement. you get the value, add the vendor number, to wa_tline-tdline.

Read only

0 Likes
954

i am maintaing Vendor name XXXXXXX  payment ID and Country XXXXX as a text in std text. I have three things to be populated on is vendor number payment id and country dynamically.

Read only

0 Likes
954

While maintaining the long text, use '&' after Vendor name and use '@' after Country.

so once the complete Long text is concatenated into v_string. Use REPLACE statement.

   REPLACE '&' WITH v_lifnr INTO v_string.

   REPLACE '@' WITH v_land1 INTO v_string.

Thanks & Regards

Bala Krishna

Read only

0 Likes
954

You should have a look into the function TEXT_SYMBOL_REPLACE. Call READ_TEXT first and then call the function like below

DESCRIBE TABLE tlines LINES lf_lines.

    CALL FUNCTION 'TEXT_SYMBOL_REPLACE'
         EXPORTING
              endline          = lf_lines
              header           = ls_header
          program          = lf_repid       "Program name that hold global variables
         TABLES
              lines            = tlines.

The tlines are the contents from READ_TEXT. The place holders in you text must be same as the global variables in your program for getting it replaced.

Read only

Private_Member_49934
Product and Topic Expert
Product and Topic Expert
0 Likes
954

I would never recommend a direct concatenation of tline i.e. long text line. You may loose any formatting. Rather use CONVERT_ITF_TO_STREAM_TEXT. It takes tline as input and gieve you string with all newlines , tabs etc.. After 'TEXT_SYMBOL_REPLACE' call the above FM .