The Geek House

SAP obsolete functions (1) – POPUP_TO_CONFIRM

by
1 Comment

Posted in Abap

When you upgrade your SAP system some functions became obsolete. (List of Obsolete Function Modules in ECC 6.0)

In this first part I would like to analyze one of the most used function module in SAP: POPUP_TO_CONFIRM

This is its signature with all the possible parameters:

CALL FUNCTION ‘POPUP_TO_CONFIRM’
EXPORTING
*   TITLEBAR                    = ‘ ‘
*   DIAGNOSE_OBJECT             = ‘ ‘

TEXT_QUESTION               =
*   TEXT_BUTTON_1               = ‘Ja’(001)
*   ICON_BUTTON_1               = ‘ ‘
*   TEXT_BUTTON_2               = ‘Nein’(002)
*   ICON_BUTTON_2               = ‘ ‘
*   DEFAULT_BUTTON              = ’1′
*   DISPLAY_CANCEL_BUTTON       = ‘X’
*   USERDEFINED_F1_HELP         = ‘ ‘
*   START_COLUMN                = 25
*   START_ROW                   = 6
*   POPUP_TYPE                  =
*   IV_QUICKINFO_BUTTON_1       = ‘ ‘
*   IV_QUICKINFO_BUTTON_2       = ‘ ‘
* IMPORTING
*   ANSWER                      =
* TABLES
*   PARAMETER                   =
* EXCEPTIONS
*   TEXT_NOT_FOUND              = 1
*   OTHERS                      = 2

.

POPUP_TO_CONFIRM in ECC600 have to be used instead of the obsolete function module:

  • POPUP_FOR_INFO
  • POPUP_TO_CONFIRM_LOSS_OF_DATA
  • POPUP_TO_CONFIRM_STEP
  • POPUP_TO_CONFIRM_WITH_MESSAGE
  • POPUP_TO_CONFIRM_WITH_VALUE
  • POPUP_TO_CONFIRM_WITH_VALUE_2
  • POPUP_TO_DECIDE
  • POPUP_TO_DECIDE_WITH_MESSAGE

Even if most of these function modules are obsolete also in SAP 4.7, I would like to analyze it because are largely used. Below for each obsolete function module I give the new coding (default use) through POPUP_TO_CONFIRM.

  1. POPUP_FOR_INFO
  2. Obsolete since: ECC 6 (to be verified)

    No action is performed, all code is commented since version 4.7.

    CALL FUNCTION ‘POPUP_FOR_INFO’
    EXPORTING
    INFO1 = text-001
    TEXTLINE1 = text-002
    TITEL = text-003.

    No info have been found about INFO1 parameter, maybe it is the same of DIAGNOSE_OBJECT in POPUP_TO_CONFIRM.

    CALL FUNCTION ‘POPUP_TO_CONFIRM’
    EXPORTING
    TITLEBAR = text-003
    TEXT_QUESTION = text-002
    DISPLAY_CANCEL_BUTTON = ‘ ‘.

    POPUP_TO_INFO

  3. POPUP_TO_CONFIRM_LOSS_OF_DATA
  4. Obsolete since: ERP 4.7 (to be verified)

    Creates a warning popup that advice you that data could be lost.

    CALL FUNCTION ‘POPUP_TO_CONFIRM_LOSS_OF_DATA’
    EXPORTING
    TEXTLINE1 = text-001
    *   TEXTLINE2 = ‘ ‘
    TITEL = text-002
    *   START_COLUMN = 25
    *   START_ROW = 6
    *   DEFAULTOPTION = ‘N’
    * IMPORTING
    *   ANSWER =

    .

    POPUP_TO_CONFIRM_LOSS_OF_DATA

    CALL FUNCTION ‘POPUP_TO_CONFIRM’
    EXPORTING
    TITLEBAR = text-002
    DIAGNOSE_OBJECT = ‘CACS_CONFIRM_LOSS_OF_DATA’
    TEXT_QUESTION = text-001
    DISPLAY_CANCEL_BUTTON       = ‘ ‘
    POPUP_TYPE                  = ‘ICON_MESSAGE_WARNING’.

    Some optional parameters are used in order to generate a more similar popup:

    DIAGNOSE_OBJECT => “The diagnosis text must be created as a ‘Text in Dialog’ in the maintenance transaction SE61. This ensures translation. There is only limited support of formatting (headings, paragraphs and lists). Links are not supported. The document name is transferred in the interface of the function module. Line feed is performed by the function module. If the stored text cannot be found in English or German, the exception TEXT_NOT_FOUND is triggered.” (SAP online help)

    In this case a standard diagnose text CACS_CONFIRM_LOSS_OF_DATA, that generates the same message “Data will be lost.”, could be used.

    POPUP_TO_CONFIRM_LOSS_OF_DATA

  5. POPUP_TO_CONFIRM_STEP
  6. Obsolete since: ERP 4.7 (to be verified)

    Creates an info popup with custom text.

    CALL FUNCTION ‘POPUP_TO_CONFIRM_STEP’
    EXPORTING
    *   DEFAULTOPTION = ‘Y’
    TEXTLINE1 = text-001
    *   TEXTLINE2 = ‘ ‘
    TITEL = text-002
    *   START_COLUMN = 25
    *   START_ROW = 6
    *   CANCEL_DISPLAY = ‘X’
    * IMPORTING
    *   ANSWER =

    .

    POPUP_TO_CONFIRM_STEP

    CALL FUNCTION ‘POPUP_TO_CONFIRM’
    EXPORTING
    TITLEBAR = text-002
    TEXT_QUESTION = text-001.

    This is one of most simple implementation of old POPUPs with POPUP_TO_CONFIRM.

    POPUP_TO_CONFIRM_STEP

  7. POPUP_TO_CONFIRM_WITH_MESSAGE
  8. Obsolete since: ERP 4.7 (to be verified)

    Creates a simple popup with a message (diagnose text)

    CALL FUNCTION ‘POPUP_TO_CONFIRM_WITH_MESSAGE’
    EXPORTING
    * DEFAULTOPTION = ‘Y’
    DIAGNOSETEXT1 = text-004
    * DIAGNOSETEXT2 = ‘ ‘
    * DIAGNOSETEXT3 = ‘ ‘

    TEXTLINE1 = text-002
    * TEXTLINE2 = ‘ ‘
    TITEL = text-001
    * START_COLUMN = 25
    * START_ROW = 6
    * CANCEL_DISPLAY = ‘X’
    * IMPORTING
    * ANSWER =

    .

    POPUP_TO_CONFIRM_WITH_MESSAGE

    CALL FUNCTION ‘POPUP_TO_CONFIRM’
    EXPORTING
    TITLEBAR = text-001
    DIAGNOSE_OBJECT = ‘Z_CONFIRM_WITH_MESSAGE’
    TEXT_QUESTION = text-002.

    POPUP_TO_CONFIRM_WITH_MESSAGE

    Z_CONFIRM_WITH_MESSAGE should be created as shown in image below from Transaction SE61

    POPUP_TO_CONFIRM_WITH_MESSAGE

  9. POPUP_TO_CONFIRM_WITH_VALUE
  10. Obsolete since: ERP 4.7 (to be verified)

    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

    .

    POPUP_TO_CONFIRM_WITH_VALUE

    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.

    POPUP_TO_CONFIRM_WITH_VALUE

    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&.

    POPUP_TO_CONFIRM_WITH_VALUE

  11. POPUP_TO_CONFIRM_WITH_VALUE_2
  12. Obsolete since: ERP 4.7 (to be verified)

    This function is very similar to POPUP_TO_CONFIRM_WITH_VALUE but it uses only one parameter to generate test before and test after value. Separating char is ‘&’.

    In ECC6 this function module is no longer usable because it generates a dump.

    See POPUP_TO_CONFIRM_WITH_VALUE.

  13. POPUP_TO_DECIDE
  14. Obsolete since: ERP 4.7 (to be verified)

    This function creates a popup with customizable button. This function is a default in the new POPUP_TO_CONFIRM.

    CALL FUNCTION ‘POPUP_TO_DECIDE’
    EXPORTING
    *   DEFAULTOPTION           = ’1′
    TEXTLINE1               = text-001
    *   TEXTLINE2               = ‘ ‘
    *   TEXTLINE3               = ‘ ‘

    TEXT_OPTION1            = ‘TEXT_OPTION1′
    TEXT_OPTION2            = ‘TEXT_OPTION2′
    *   ICON_TEXT_OPTION1       = ‘ ‘
    *   ICON_TEXT_OPTION2       = ‘ ‘

    TITEL                   = text-002
    *   START_COLUMN            = 25
    *   START_ROW               = 6
    *   CANCEL_DISPLAY          = ‘X’
    * IMPORTING
    *   ANSWER                  =

    .

    POPUP_TO_DECIDE

    CALL FUNCTION ‘POPUP_TO_CONFIRM’
    EXPORTING
    TITLEBAR = text-002
    TEXT_QUESTION = text-001
    TEXT_BUTTON_1 = ‘TEXT_OPTION1′
    TEXT_BUTTON_2 = ‘TEXT_OPTION2′.

    POPUP_TO_DECIDE

  15. POPUP_TO_DECIDE_WITH_MESSAGE
  16. Obsolete since: ERP 4.7 (to be verified)

    This function is the same as POPUP_TO_DECIDE, but with a DIAGNOSE TEXT.

    CALL FUNCTION ‘POPUP_TO_DECIDE_WITH_MESSAGE’
    EXPORTING
    *   DEFAULTOPTION           = ’1′
    DIAGNOSETEXT1           =
    *   DIAGNOSETEXT2           = ‘ ‘
    *   DIAGNOSETEXT3           = ‘ ‘

    TEXTLINE1               =
    *   TEXTLINE2               = ‘ ‘
    *   TEXTLINE3               = ‘ ‘

    TEXT_OPTION1            =
    TEXT_OPTION2            =
    *   ICON_TEXT_OPTION1       =
    *   ICON_TEXT_OPTION2       =

    TITEL                   =
    *   START_COLUMN            = 25
    *   START_ROW               = 6
    *   CANCEL_DISPLAY          = ‘X’
    * IMPORTING
    *   ANSWER                  =

    .
    See POPUP_TO_DECIDE and POPUP_TO_CONFIRM_WITH_MESSAGE.

Finally it’s very important to know how to manage the answer. In the old popup answer is a char with 3 possible value: ‘J’ (Yes), ‘N’ (No) and ‘A’ (Abort); in the function module POPUP_TO_CONFIRM the output answer could be: 1 (Yes), 2 (No) and ‘A’ (Abort), so pay much attention when you make the substitution of obsolete function with the new one.

Suggestions and critics are welcome.

In the next article I would like to analyze the class CL_GUI_FRONTEND_SERVICES.

Also available on SDN

One Response

  1. Anonymous says:

    Very Nice Site! Thanx!

Leave a Reply

%d bloggers like this: