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.
CALL FUNCTION 'TERM_CONTROL_EDIT'
EXPORTING
titel = 'Descriptive Title'
langu = sy-langu
TABLES
textlines = lt_text
EXCEPTIONS
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.
RETURN.
ENDIF.