Create 'Standard Text' and use it in ABAP Program

Standard Text documents can be created in SAP system using transaction SO10. To know more about Standard Text, please follow the link. They can be used by ABAP programs, for example, to include text in the body of the email notification to be sent or to print documents. I have discussed below the steps involved in creating and using Standard Text:

1- Using TCode SO10 (Standard Text: Request), create a standard text:

         Text Name : P_COBRA
         Text ID : ST
         Language : EN
     (Note: The italicized entries above are user-entered values. You can fill values of your choice in the above fields replacing these.)

2- In the ABAP Program, where the standard text is required, call the following F/M:

                  id = 'ST'
                  language = sy-langu
                  name = 'P_COBRA'
                  object = 'TEXT'
                    header = wa_header
                    lines = output_text
                    id = 1
                    language = 2
                    name = 3
                   not_found = 4
                    object = 5
                    reference_check = 6
                    wrong_access_to_archive = 7
               OTHERS = 8.

3- Initialize all internal tables and variables used by the  F/M 'TEXT_SYMBOL_REPLACE' before calling it.

               program = lw_program_name.

4- Replace text symbols with the actual values stored as global variables

               endline = lw_line_count
               header = wa_header
               program = lw_program_name
               lines = output_text.

Thats all and your standard text is ready to be used for the desired purpose in your ABAP program. To see how a standard text is created in the SAP editor and get the code to send mail with its body from the standard text, plz refer this SCN link.

Featured Post

Top 5 Reasons you should be on Google+: [3] Communities

Updated on August 5, 2017 : I had to update this article due to drastic changes in appearance and navigation in Google+ among other things...