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

Replace variables in a documentation text

Former Member
0 Likes
3,402

Hi,

I've read posts to allow use of REPLACE_TEXTSYMBOL but I couldn't get it to work. It seems that calling this function by virtue of ABAP necessarily takes you into another memory area.

We are formatting email messages which are a couple of paragraphs in length. We want to substitute values into variables populated in the texts such as &SY-DATUM& or &VBAK-VBELN&.

To do this, I chose to use documentation objects in transaction SE61 rather than standard texts. (Reason being that standard texts would need to be created in each environment.)

I call READ_TEXT but when I debug in REPLACE_TEXTSYMBOL, the variables are all blank and don't exist. Obviously because I am in a different main program. Are there precursor function modules I'm supposed to call to permit my global data to be "visible" in REPLACE_TEXTSYMBOL?

Please help because otherwise I'm going to have to code this thing using field symbols and SCAN and I really don't want to do it that way if there is something simple I'm missing.

Thanks for any suggestions you may have,

Ray


  DATA:
    LV_ENDLINE TYPE SYTABIX,
    LS_TLINE TYPE TLINE,
    LT_TLINE TYPE TLINETAB.

  CALL FUNCTION 'READ_TEXT'
    EXPORTING
*   CLIENT                        = SY-MANDT
      ID                            = 'ST'
      LANGUAGE                      = SY-LANGU
      NAME                          = P_TDNAME
      OBJECT                        = 'TEXT'
    TABLES
      LINES                         = LT_TLINE.             "#EC *
*- Let it abend if this fails.

  DESCRIBE TABLE LT_TLINE LINES LV_ENDLINE.

*
  CALL FUNCTION 'REPLACE_TEXTSYMBOL'
    EXPORTING
      ENDLINE                = LV_ENDLINE
*   FORMATWIDTH            = 72
*   LANGUAGE               = SY-LANGU
*   LINEWIDTH              = 132
*   OPTION_DIALOG          = ' '
*   REPLACE_PROGRAM        = 'X'
*   REPLACE_STANDARD       = 'X'
*   REPLACE_SYSTEM         = 'X'
*   REPLACE_TEXT           = 'X'
      STARTLINE              = 1
* IMPORTING
*   CHANGED                =
    TABLES
      LINES                  = lT_TLINE.

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
1,908

> To do this, I chose to use documentation objects in transaction SE61 rather than standard texts. (Reason being that standard texts would need to be created in each environment.)

standard texts can be created in lower region and get transported using program RSTXTRAN, then you can make use of function module TEXT_SYMBOL_REPLACE

May this will help you,

a®

2 REPLIES 2
Read only

former_member194669
Active Contributor
0 Likes
1,909

> To do this, I chose to use documentation objects in transaction SE61 rather than standard texts. (Reason being that standard texts would need to be created in each environment.)

standard texts can be created in lower region and get transported using program RSTXTRAN, then you can make use of function module TEXT_SYMBOL_REPLACE

May this will help you,

a®

Read only

Former Member
0 Likes
1,908

Thank you. Although I had tried this before without success, your post encouraged me to try again. This time I noticed a different icon in the text editor for entering a program symbol. Previously, I used the "insert command" button. By using the "program symbol" button, I was able to register the main program as a source for the global data/ddic table area.

Not sure if there was another error I had previously, but now it is working thanks to you. I didn't have to use open_form or anything else to prepare the data area either.

Best regards,

Ray