How to Enter Text In ABAP Via Editor With FM TERM_CONTROL_EDIT

Sometimes, users needs to enter some text directly (decisions, explanations, comments), for example, during the running of a module pool program. There is an easy way where the user can perform this action. Via MF TERM_CONTROL_EDIT. This MF shows a POP-UP with a text editor screen that is very simple and where the user can enter texts or perform the action of importing/exporting files.

This MF is very intuitive and contains two import parameters:
Titel: Title for the editor window.
Langu: Language.

After executing the FM, a POP UP is displayed where the user will find an intuitive text editor.

When the user confirm the operation, the FM returns a table with the entered text.

If the user decides to cancel the operation, the exception USER_CANCELLED will be triggered. For that reason, is always necessary to use the EXCEPTION clause and check the value of sy-subrc in order to include this situation in the ABAP program.

    titel = 'Descriptive Title'
    langu = sy-langu
    textlines = lt_text
    user_cancelled = 1
    others = 2.

IF sy-subrc EQ 0.
  lw_text = 'User decided to not specify a reason'.
  APPEND lw_text TO lt_text.

Author: Pablo Scigliotti


Pablo has 8+ years of experience working with SAP. 7 years as an ABAP developer and 1 year as a BW analyst. He has worked with many well known companies including Accenture, TCS and Kimberly-Clark. 

Modules: ABAP, Basis