Skip to Content
author's profile photo Former Member
Former Member

use standard text (SO10) in report(SE38) to compose the body of email

hello experts,

here i wanna create the body of email with a format, hence i decide to use Standard Text. in this Standard Text, i also maintain some variable such &p_name&( i remember it works in forms,such script and ssf), while i define p_name as 'demo' in the program and try to transfer p_name to standard text, it fails. while i check the output of standard text, it show &p_name& instead of demo.

could anyone tell me how to realize this function?

Thanks in advance.

Desmond

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2011 at 01:38 PM

    Hi,

    try this,

    data:w_field(10) type c VALUE '1234'.

    DATA:wa_head TYPE THEAD.

    data:it_final TYPE TABLE OF tline.

    wa_head-tdname = 'Z_SAMPLE'. u201CStandard text,refer screen shot

    wa_head-tdid = 'ST'.

    wa_head-tdobject = 'TEXT'.

    wa_head-tdspras = 'EN'.

    CALL FUNCTION 'READ_TEXT'

    EXPORTING

    • CLIENT = SY-MANDT

    id = wa_head-tdid

    language = wa_head-tdspras

    name = wa_head-tdname

    object = wa_head-tdobject

    • ARCHIVE_HANDLE = 0

    • LOCAL_CAT = ' '

    • IMPORTING

    • HEADER = HEADER

    TABLES

    lines = it_final

    • EXCEPTIONS

    • ID = 1

    • LANGUAGE = 2

    • NAME = 3

    • NOT_FOUND = 4

    • OBJECT = 5

    • REFERENCE_CHECK = 6

    • WRONG_ACCESS_TO_ARCHIVE = 7

    • OTHERS = 8

    .

    IF sy-subrc <> 0.

    • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    CALL FUNCTION 'REPLACE_TEXTSYMBOL'

    EXPORTING

    endline = 10

    • 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 = CHANGED

    TABLES

    lines = it_final

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 28, 2011 at 04:20 AM

    Hello Desmond,

    When you read the Standard text, you must be using the FM : READ_TEXT.

    Variables as in the case of SSF and SAPScripts can not be used in Standard text.

    Hence,write a :

    REPLACE ALL OCCURANCES of '&p_name&' WITH 'demo'

    statement.

    Hope this works.

    Cheers,

    Remi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2011 at 08:54 PM

    I use SAP best practice and insert place-holders as &1, &2, etc.... I read the text into a table with read_text fm, loop through the lines and concatenate all text values into a string maintaining single space between (condense), then I replace &1, &2, etc with correct values. After that, I call FM RKD_WORD_WRAP (broken in EhP4 but fixed in a support package(7?)) to put the expanded text back into a table with breaking lines on spaces at or near specific line lengths, and I then send that table into routine to send mail.

    The makes the replacement values "look" correct, no bad spacing, no line breaks in wrong place, etc. Use of Standard Texts is an excellent way to allow maintenance of messages for send to users/customers without programming changes, unless you need to add additional variable place-holders, of course.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 01, 2011 at 03:16 PM

    Hi,

    For these follow the link,

    To compose the body of email. What ever, you have to do those related types and adjust the font size

    and adjust the paragraph all the things are in follow link.

    http://www.erpgenie.com/sap-technical/sapscript-smartforms/sapscript-commands

    You would get a clear picture. I hope it would helpful for you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 15, 2011 at 11:03 AM

    hi

    desmondyoung

    could you write down whole of your standart text.I have the same problem and i haven't solve it yet.maybe your standart text will help me in this case

    Sincerely

    Garayev

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.