Function modules: Messages and Pop-up Screens

 

Exampel 1: POPUP_TO_CONFIRM

data returncode(1) type c.

call function 'POPUP_TO_CONFIRM'
    exporting                                                     
        titlebar                = 'Delete selected lines'                        
        text_question   = 'Are you sure you want to delete ?' 
        text_button_1   = 'OK'                                

icon_button_1   = 'ICON_OKAY'                         
        text_button_2   = 'Cancel'                            
        icon_button_2    = 'ICON_CANCEL'                       
        default_button   = '2'                                 
        display_cancel_button  = ''                                 
    importing                                                     
         answer                = returkode.                          
                                                               

* Test the returnkode. If the first button is pushed the returncode is 1 and    if the second
* button is pushed the returncode is 2
if  returncode = 1.                                                
  perform delete.
endif.                                                  

 

 

Example 2: 'POPUP_WITH_TABLE_DISPLAY

This is a simple example of displaying possible choices for a user. The following code prompts the user
for a operating system/platform. Upon the user making a value request, a dialog screen pops up with
possible values listed. The user can then select from the dialog screen. Adjust to your own needs. Enjoy!

REPORT ZYREC100 MESSAGE-ID ZF.

TYPES: BEGIN OF T_PLATFORM,
                      DOMVALUE_L     LIKE DD07V-DOMVALUE_L,

                      SEPARATOR1(3),
                      DDTEXT         LIKE DD07V-DDTEXT,
             END OF T_PLATFORM.
 
 DATA: V_CHOICE LIKE SY-TABIX,
                V_LINES TYPE P,            " Number of lines in an internal table.
                DESTROW TYPE P.
 
  DATA: I_PLATFORM TYPE T_PLATFORM OCCURS 0 WITH HEADER LINE.
  PARAMETERS: SRCPLAT(4)         TYPE C LOWER CASE,    " Source Platform

*****************************************************

* POPUP Windows for custom dropdown boxes           *
*****************************************************
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SRCPLAT.  " Source Platform
        DESCRIBE TABLE I_SRCPLAT LINES V_LINES.
        DESTROW = V_LINES + 10.

        CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
            EXPORTING
                ENDPOS_COL   = 40
                ENDPOS_ROW   = DESTROW
                STARTPOS_COL =10
                STARTPOS_ROW = 10

                TITLETEXT    = 'Select A Source Platform'
            IMPORTING
                CHOISE        = V_CHOICE
            TABLES
                VALUETAB     = I_SRCPLAT
            EXCEPTIONS
                BREAK_OFF    =  1.
         IF SY-SUBRC = 1.
                MESSAGE I000.
        ENDIF.
 
        READ TABLE I_PLATFORM INDEX V_CHOICE.
             SRCPLAT = I_PLATFORM-DOMVALUE_L.
    INITIALIZATION.
 
     PERFORM F_CREATE_ITABS.
 
*---------------------------------------------------------------------*

*       FORM F_CREATE_ITABS                                *
*---------------------------------------------------------------------*
*   Create internal tables for popup windows         *
*---------------------------------------------------------------------*
FORM F_CREATE_ITABS.
    I_PLATFORM-DOMVALUE_L = 'mvs'.
    I_PLATFORM-DDTEXT = 'MVS - Mainframe'.
    APPEND I_PLATFORM.
    I_PLATFORM-DOMVALUE_L = 'unx'.
    I_PLATFORM-DDTEXT = 'Unix platform'.
    APPEND I_PLATFORM.

ENDFORM.
[Neer Razinzsky , posted to SAP listserver]

   
Assign content to a field structure by Uwe Erdelhoff 

The problem: You want to assign a special content to every field of a structure. What is the easiest routine to do that?

REPORT ZFTER910.

DATA I_BLFA1 LIKE BLFA1.
FIELD-SYMBOLS: <FS>.

DO.

 ASSIGN COMPONENT SY-INDEX OF STRUCTURE I_BLFA1 TO <FS>.
  IF SY-SUBRC <> 0.
   EXIT.
  ENDIF.
  
<FS> = '/'.

ENDDO.


A Simple F4 selection from an internal tables by Adi Kantipudi 

The problem: You want to select a value from an internal table within a popup like the F4-selection?

DATA: FIELDTAB LIKE HELP_VALUE OCCURS 2 WITH HEADER LINE,
  VALUETAB(40) OCCURS 200 WITH HEADER LINE.

FIELDTAB-TABNAME = 'AUSP'.
FIELDTAB-FIELDNAME = 'ATWRT'.
FIELDTAB-SELECTFLAG = 'X'.
APPEND FIELDTAB.

LOOP AT IT_TREE WHERE PPRICE NE SPACE.
  VALUETAB = IT_TREE-PPRICE.
  APPEND VALUETAB.
ENDLOOP.

CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
  EXPORTING

    TITEL  = 'Allowed Values'
  IMPORTING
    SELECT_VALUE = PVAR
    TABLES
    FIELDS = FIELDTAB
    VALUETAB = VALUETAB
  EXCEPTIONS
    FIELD_NOT_IN_DDIC = 1
    MORE_THEN_ONE_SELECTFIELD = 2
    NO_SELECTFIELD = 3
    OTHERS = 4.

 

 

Converted from CHM to HTML with chm2web Standard 2.7 (unicode)