This function creates a popup with a dynamic text with this pattern <TEXT_BEFORE><OBJECTVALUE><TEXT_AFTER>.
OBJECTVALUE could be any type of parameter that could be implicitly converted to a sequence of chars.
CALL FUNCTION ?POPUP_TO_CONFIRM_WITH_VALUE?
EXPORTING
* DEFAULTOPTION = ?Y?
OBJECTVALUE = lv_value
* TEXT_AFTER = ? ?
TEXT_BEFORE = text-001
TITEL = text-002
* START_COLUMN = 25
* START_ROW = 6
* CANCEL_DISPLAY = ?X?
* IMPORTING
* ANSWER =
* EXCEPTIONS
* TEXT_TOO_LONG = 1
* OTHERS = 2
.
DATA: TEXT_QUESTION(256) TYPE C,
TEXT_BEFORE(256) TYPE C,
TEXT_AFTER(256) TYPE C,
VALUE(256) TYPE C.
VALUE = lv_value.
TEXT_BEFORE = text-001.
TEXT_AFTER = text-003.
CONCATENATE TEXT_BEFORE VALUE TEXT_AFTER INTO TEXT_QUESTION SEPARATED BY SPACE.
IF SY-SUBRC = 4.
* TO DO: text too long
ENDIF.
CALL FUNCTION ?POPUP_TO_CONFIRM?
EXPORTING
TITLEBAR = text-002
TEXT_QUESTION = TEXT_QUESTION.
An other better solution is to use parametric diagnose text.
DATA: PARAMETERS LIKE SPAR OCCURS 0 WITH HEADER LINE.
MOVE lv_value TO PARAMETERS-VALUE.
MOVE ?VALUE? TO PARAMETERS-PARAM. ?PARAM must have the same name of the symbol in the dialog text
APPEND PARAMETERS.
CALL FUNCTION ?POPUP_TO_CONFIRM?
EXPORTING
TITLEBAR = text-002
DIAGNOSE_OBJECT = ?Z_CONFIRM_WITH_VALUE?
TEXT_QUESTION = ?
TABLES
PARAMETER = PARAMETERS.
Z_CONFIRM_WITH_VALUE is a dialog text created with SE61 with a symbol named &VALUE&.