POPUP_TO_CONFIRM

SAP obsolete functions (1) - POPUP_TO_CONFIRM

Posted by Ivan Femia in ABAP Development on Aug 28, 2008 12:28:38 AM

When you upgrade your SAP system some functions became obsolete.

 

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:

 

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM'  
  2. EXPORTING  
  3. *   TITLEBAR                    = ' '  
  4. *   DIAGNOSE_OBJECT             = ' '  
  5. TEXT_QUESTION               =  
  6. *   TEXT_BUTTON_1               = 'Ja'(001)  
  7. *   ICON_BUTTON_1               = ' '  
  8. *   TEXT_BUTTON_2               = 'Nein'(002)  
  9. *   ICON_BUTTON_2               = ' '  
  10. *   DEFAULT_BUTTON              = '1'  
  11. *   DISPLAY_CANCEL_BUTTON       = 'X'  
  12. *   USERDEFINED_F1_HELP         = ' '  
  13. *   START_COLUMN                = 25  
  14. *   START_ROW                   = 6  
  15. *   POPUP_TYPE                  =  
  16. *   IV_QUICKINFO_BUTTON_1       = ' '  
  17. *   IV_QUICKINFO_BUTTON_2       = ' '  
  18. * IMPORTING  
  19. *   ANSWER                      =  
  20. * TABLES  
  21. *   PARAMETER                   =  
  22. * EXCEPTIONS  
  23. *   TEXT_NOT_FOUND              = 1  
  24. *   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

 

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

 

 
  1. CALL FUNCTION 'POPUP_FOR_INFO'  
  2. EXPORTING  
  3. INFO1           = text-001  
  4. TEXTLINE1       = text-002  
  5. TITEL           = text-003.  

 

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

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM'  
  2. EXPORTING  
  3. TITLEBAR = text-003  
  4. TEXT_QUESTION = text-002  
  5. DISPLAY_CANCEL_BUTTON = ' '.  

 

POPUP_TO_INFO

 

 

2. POPUP_TO_CONFIRM_LOSS_OF_DATA


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

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA'  
  2. EXPORTING  
  3. TEXTLINE1 = text-001  
  4. *   TEXTLINE2 = ' '  
  5. TITEL = text-002  
  6. *   START_COLUMN = 25  
  7. *   START_ROW = 6  
  8. *   DEFAULTOPTION = 'N'  
  9. * IMPORTING  
  10. *   ANSWER =  
  11. .  

 

POPUP_TO_CONFIRM_LOSS_OF_DATA

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM'  
  2. EXPORTING  
  3. TITLEBAR = text-002  
  4. DIAGNOSE_OBJECT = 'CACS_CONFIRM_LOSS_OF_DATA'  
  5. TEXT_QUESTION = text-001  
  6. DISPLAY_CANCEL_BUTTON       = ' '  
  7. 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

 

 

3. POPUP_TO_CONFIRM_STEP


Creates an info popup with custom text.

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'  
  2. EXPORTING  
  3. *   DEFAULTOPTION = 'Y'  
  4. TEXTLINE1 = text-001  
  5. *   TEXTLINE2 = ' '  
  6. TITEL = text-002  
  7. *   START_COLUMN = 25  
  8. *   START_ROW = 6  
  9. *   CANCEL_DISPLAY = 'X'  
  10. * IMPORTING  
  11. *   ANSWER =  
  12. .  

 

POPUP_TO_CONFIRM_STEP

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM'  
  2. EXPORTING  
  3. TITLEBAR = text-002  
  4. TEXT_QUESTION = text-001.  

 

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

 

POPUP_TO_CONFIRM_STEP

 

 

4. POPUP_TO_CONFIRM_WITH_MESSAGE


Creates a simple popup with a message (diagnose text)

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_MESSAGE'  
  2. EXPORTING  
  3. *   DEFAULTOPTION        = 'Y'  
  4. DIAGNOSETEXT1        = text-004  
  5. *   DIAGNOSETEXT2        = ' '  
  6. *   DIAGNOSETEXT3        = ' '  
  7. TEXTLINE1            = text-002  
  8. *   TEXTLINE2            = ' '  
  9. TITEL                = text-001  
  10. *   START_COLUMN         = 25  
  11. *   START_ROW            = 6  
  12. *   CANCEL_DISPLAY       = 'X'  
  13. * IMPORTING  
  14. *   ANSWER               =  
  15. .  

 

POPUP_TO_CONFIRM_WITH_MESSAGE

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM'   
  2. EXPORTING  
  3. TITLEBAR = text-001  
  4. DIAGNOSE_OBJECT = 'Z_CONFIRM_WITH_MESSAGE'  
  5. 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

 

 

5. POPUP_TO_CONFIRM_WITH_VALUE


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.

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_VALUE'  
  2. EXPORTING  
  3. *   DEFAULTOPTION = 'Y'  
  4. OBJECTVALUE = lv_value  
  5. *   TEXT_AFTER = ' '  
  6. TEXT_BEFORE = text-001  
  7. TITEL = text-002  
  8. *   START_COLUMN = 25  
  9. *   START_ROW = 6  
  10. *   CANCEL_DISPLAY = 'X'  
  11. * IMPORTING  
  12. *   ANSWER =  
  13. * EXCEPTIONS  
  14. *   TEXT_TOO_LONG = 1  
  15. *   OTHERS = 2  
  16. .  

 

POPUP_TO_CONFIRM_WITH_VALUE

 

 
  1. DATA: TEXT_QUESTION(256) TYPE C,  
  2. TEXT_BEFORE(256) TYPE C,  
  3. TEXT_AFTER(256) TYPE C,  
  4. VALUE(256) TYPE C.  
  5.   
  6. VALUE = lv_value.  
  7. TEXT_BEFORE = text-001.  
  8. TEXT_AFTER = text-003.  
  9.   
  10. CONCATENATE TEXT_BEFORE VALUE TEXT_AFTER INTO TEXT_QUESTION SEPARATED BY SPACE.  
  11.   
  12. IF SY-SUBRC = 4.  
  13. *     TO DO: text too long  
  14. ENDIF.  
  15.   
  16. CALL FUNCTION 'POPUP_TO_CONFIRM'  
  17. EXPORTING  
  18. TITLEBAR = text-002  
  19. TEXT_QUESTION = TEXT_QUESTION.  

 

POPUP_TO_CONFIRM_WITH_VALUE

 

An other better solution is to use parametric diagnose text.

 

 
  1. DATA: PARAMETERS LIKE SPAR OCCURS 0 WITH HEADER LINE.  
  2.   
  3. MOVE lv_value TO PARAMETERS-VALUE.  
  4. MOVE 'VALUE' TO PARAMETERS-PARAM. 'PARAM must have the same name of the symbol in the dialog text  
  5. APPEND PARAMETERS.  
  6.   
  7. CALL FUNCTION 'POPUP_TO_CONFIRM'  
  8. EXPORTING  
  9. TITLEBAR = text-002  
  10. DIAGNOSE_OBJECT = 'Z_CONFIRM_WITH_VALUE'  
  11. TEXT_QUESTION = ''  
  12. TABLES  
  13. PARAMETER = PARAMETERS.  

 

Z_CONFIRM_WITH_VALUE is a dialog text created with SE61 with a symbol named &VALUE&.

 

POPUP_TO_CONFIRM_WITH_VALUE

 

 

6. POPUP_TO_CONFIRM_WITH_VALUE_2


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.

 

 

7. POPUP_TO_DECIDE


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

 

 
  1. CALL FUNCTION 'POPUP_TO_DECIDE'  
  2. EXPORTING  
  3. *   DEFAULTOPTION           = '1'  
  4. TEXTLINE1               = text-001  
  5. *   TEXTLINE2               = ' '  
  6. *   TEXTLINE3               = ' '  
  7. TEXT_OPTION1            = 'TEXT_OPTION1'  
  8. TEXT_OPTION2            = 'TEXT_OPTION2'  
  9. *   ICON_TEXT_OPTION1       = ' '  
  10. *   ICON_TEXT_OPTION2       = ' '  
  11. TITEL                   = text-002  
  12. *   START_COLUMN            = 25  
  13. *   START_ROW               = 6  
  14. *   CANCEL_DISPLAY          = 'X'  
  15. * IMPORTING  
  16. *   ANSWER                  =  
  17. .  

 

POPUP_TO_DECIDE

 

 
  1. CALL FUNCTION 'POPUP_TO_CONFIRM'  
  2. EXPORTING  
  3. TITLEBAR = text-002  
  4. TEXT_QUESTION = text-001  
  5. TEXT_BUTTON_1 = 'TEXT_OPTION1'  
  6. TEXT_BUTTON_2 = 'TEXT_OPTION2'.  

 

 

POPUP_TO_DECIDE

 

 

 

8. POPUP_TO_DECIDE_WITH_MESSAGE


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

 

 
  1. CALL FUNCTION 'POPUP_TO_DECIDE_WITH_MESSAGE'  
  2. EXPORTING  
  3. *   DEFAULTOPTION           = '1'  
  4. DIAGNOSETEXT1           =  
  5. *   DIAGNOSETEXT2           = ' '  
  6. *   DIAGNOSETEXT3           = ' '  
  7. TEXTLINE1               =  
  8. *   TEXTLINE2               = ' '  
  9. *   TEXTLINE3               = ' '  
  10. TEXT_OPTION1            =  
  11. TEXT_OPTION2            =  
  12. *   ICON_TEXT_OPTION1       =  
  13. *   ICON_TEXT_OPTION2       =  
  14. TITEL                   =  
  15. *   START_COLUMN            = 25  
  16. *   START_ROW               = 6  
  17. *   CANCEL_DISPLAY          = 'X'  
  18. * IMPORTING  
  19. *   ANSWER                  =  
  20. .  

 

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.

 

转自:

http://scn.sap.com/community/abap/blog/2008/08/28/sap-obsolete-functions-1--popuptoconfirm

posted @ 2012-06-28 17:43  VerySky  阅读(2224)  评论(0)    收藏  举报