Skip to Content
0
Former Member
Dec 02, 2008 at 04:57 PM

Replace variables in a documentation text

1493 Views

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.