SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Popup Windows



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sat Sep 08, 2007 10:20 pm    Post subject: Popup Windows Reply with quote

MD_POPUP_SHOW_INTERNAL_TABLE - Pop up contents of internal table.
There must be at least two entries in the internal table before the popup displays any data.

Code:
REPORT ZEXAMPLE.
TABLES T001W.

DATA: BEGIN OF ITAB OCCURS 0,
WERKS LIKE T001W-WERKS,
NAME1 LIKE T001W-NAME1,
END OF ITAB.

DATA: BEGIN OF ICOLS OCCURS 0.
INCLUDE STRUCTURE HELP_VALUE.
DATA: END OF ICOLS.
DATA V_INDX LIKE SY-INDEX.

ICOLS-TABNAME = 'T001W'.
ICOLS-FIELDNAME = 'WERKS'.
ICOLS-SELECTFLAG = 'X'.
APPEND ICOLS.
ICOLS-TABNAME = 'T001W'.
ICOLS-FIELDNAME = 'NAME1'.
APPEND ICOLS.

SELECT-OPTIONS: S_WERKS FOR T001W-WERKS.

SELECT * FROM T001W WHERE WERKS IN S_WERKS.
  ITAB-WERKS = T001W-WERKS.
  ITAB-NAME1 = T001W-NAME1.
  APPEND ITAB.
ENDSELECT.

SORT ITAB BY WERKS.
CALL FUNCTION 'MD_POPUP_SHOW_INTERNAL_TABLE'
  EXPORTING
    TITLE = 'SELECT A VALUE'
  IMPORTING
    INDEX = V_INDX
  TABLES
    VALUES = ITAB
    COLUMNS = ICOLS
  EXCEPTIONS
    LEAVE = 1
    OTHERS = 2.

IF SY-SUBRC EQ 0.
  READ TABLE ITAB INDEX V_INDX.
  WRITE:/ ITAB-WERKS, ITAB-NAME1.
ENDIF.


POPUP_WITH_TABLE_DISPLAY -Popup to display internal table data

Displays an internal table and returns index of chosen line. Good also for F4 (on value-request) function.

HELP_VALUES_GET -Popup to display default F4 help values for a table field

Does the same as default F4 (on value-request) function. Can be used, for example, if selected value should be used for immediate update another screen fields.
Code:

tables tcurt.
DATA   DYFIELDS LIKE DYNPREAD OCCURS 1 WITH HEADER LINE.
PARAMETERS: P_WAERS LIKE TCURT-WAERS,        "Currency
            P_LTEXT LIKE TCURT-LTEXT,        "Long Text
            P_KTEXT LIKE TCURT-KTEXT.        "Short Text
*-----------------------------------------------------------------------
*--- Example of updating value of another field on the screen ----------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WAERS.
  CLEAR: DYFIELDS[], DYFIELDS.
*--- select currency
  CALL FUNCTION 'HELP_VALUES_GET'
       EXPORTING
            fieldname        =  'WAERS'
            tabname          =  'TCURT'
       IMPORTING
            SELECT_VALUE     =   P_WAERS.
*--- get long text for the selected currency
  SELECT SINGLE LTEXT FROM TCURT
    INTO DYFIELDS-FIELDVALUE
    WHERE SPRAS = SY-LANGU
    AND   WAERS = P_WAERS.
  IF SY-SUBRC <> 0.
    CLEAR DYFIELDS-FIELDVALUE.
  ENDIF.
*--- update another field
  DYFIELDS-FIELDNAME = 'P_LTEXT'.
  APPEND DYFIELDS.
  CALL FUNCTION 'DYNP_VALUES_UPDATE'
       EXPORTING
            DYNAME               = SY-CPROG
            DYNUMB               = SY-DYNNR
       tables
            dynpfields           = DYFIELDS .
*-----------------------------------------------------------------------
*--- Example of reading value of another field -------------------------
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_KTEXT.
*--- read another field
  CLEAR: DYFIELDS[], DYFIELDS.
  DYFIELDS-FIELDNAME = 'P_WAERS'.
  APPEND DYFIELDS.
  CALL FUNCTION 'DYNP_VALUES_READ'
       EXPORTING
            DYNAME                   = SY-CPROG
            DYNUMB                   = SY-DYNNR
       TABLES
            DYNPFIELDS               = DYFIELDS .
  READ TABLE DYFIELDS INDEX 1.
*--- get short text and update current field
  SELECT SINGLE KTEXT FROM TCURT
    INTO P_KTEXT
    WHERE SPRAS EQ SY-LANGU
    AND   WAERS EQ DYFIELDS-FIELDVALUE.


F4IF_INT_TABLE_VALUE_REQUEST - F4 help also returning the value to be displayed in internal table
Code:
data: begin of inttab occurs 10,
          bukrs like t001-bukrs,
          butxt like t001-butxt,
          ort01 like t001-ort01,
      end of inttab,
      ret_tab like DDSHRETVAL occurs 0 with header line.

start-of-selection.
  select bukrs butxt ort01 from t001 into table inttab.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
*     DDIC_STRUCTURE         = ' '
      RETFIELD               = 'BUKRS'
*     PVALKEY                = ' '
*     DYNPPROG               = ' '
*     DYNPNR                 = ' '
*     DYNPROFIELD            = ' '
*     STEPL                  = 0
      WINDOW_TITLE           = 'Select Company Code'
      VALUE                  = 'S*'
      VALUE_ORG              = 'S'
*     MULTIPLE_CHOICE        = ' '
*     DISPLAY                = ' '
*     CALLBACK_PROGRAM       = ' '
*     CALLBACK_FORM          = ' '
    TABLES
      VALUE_TAB              = inttab
*     FIELD_TAB              =
      RETURN_TAB             = ret_tab
*     DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
      OTHERS                 = 3.
  IF SY-SUBRC <> 0.
    write: / 'Error =', sy-subrc.
  else.
    loop at ret_tab.
      write ret_tab-fieldval.
    endloop.
  ENDIF.


F4IF_FIELD_VALUE_REQUEST -F4 help for fields that are only known at runtime.
Standard F4 help for a Data Dictionary help

POPUP_TO_CONFIRM_STEP - Popup a question (two lines of text) with buttons Yes, No [,Cancel]
Returns 'J' for Yes, 'N' for No, 'A' for Cancel.

POPUP_TO_CONFIRM_WITH_MESSAGE - Popup a diagnostic message (two lines of text) and a question (two lines of text) with buttons Yes, No [,Cancel]
Returns 'J' for Yes, 'N' for No, 'A' for Cancel.

POPUP_TO_CONFIRM - Popup a question with two customized buttons (e.g. Yes, No) and [Cancel]
Returns '1' and '2' for 1st and 2nd buttons, 'A' for Cancel.
Code:
DATA: w_answer TYPE c.
CALL FUNCTION 'POPUP_TO_CONFIRM'
     EXPORTING
          titlebar      = 'Confirm'(001)
          text_question = 'Are you sure?'(002)
     IMPORTING
          answer        = w_answer.
* when yes is clicked.
IF w_answer = '1'.
* w_answer is 2 when no is clicked.
ELSEIF w_answer = '2'.
* w_answer is a when cancel is clicked.
ELSE.
*...
ENDIF.


Code:
DATA: w_answer TYPE c.
CALL FUNCTION 'POPUP_TO_CONFIRM'
  EXPORTING
    titlebar      = 'Confirm'(001)
    text_question = 'Are you sure?'(002)
    TEXT_BUTTON_1 = 'yes'
*icon_button_1 = ' '
    TEXT_BUTTON_2 = 'No'
*icon_button_2 = ' '
    default_button = '1'
    DISPLAY_CANCEL_BUTTON = ''
  IMPORTING
    answer = w_answer
  EXCEPTIONS
    text_not_found = 1
    OTHERS = 2.


POPUP_TO_CONFIRM_LOSS_OF_DATA - Popup a 'Data will be lost' and question (two lines of text) with buttons Yes and No

Returns 'J' or 'N'.

POPUP_TO_CONFIRM_DATA_LOSS - Calls POPUP_TO_CONFIRM_STEP with 'Changed data will be lost. Save?'

POPUP_TO_DECIDE_INFO - Popup a question (two lines of text).
Returns Answer='J'(Yes) and 'A'(Cancel).

POPUP_TO_DECIDE - Popup a question (three lines of text) with two customized buttons and [Cancel]
Returns '1' and '2' for 1st and 2nd buttons, 'A' for Cancel.

POPUP_TO_DECIDE_WITH_MESSAGE - Popup a message (three lines of text) and a question (three lines of text) with two customized buttons and [Cancel]
Returns '1' and '2' for 1st and 2nd buttons, 'A' for Cancel.

POPUP_TO_GET_VALUE - Popup to request for a field of the given dictionary table.
Returns Answer=' ' if the value changed, 'C' if not.

POPUP_TO_GET_ONE_VALUE - Popup to request for a string value.
Returns Answer='J' if the value entered, 'A' if not.


POPUP_GET_VALUES - Dialog box for the display and request of values, without check One or more DB table/view fields (Medium field label for data element used as prompt text). Returncode=' ' if the value entered, 'A' if cancel.

POPUP_GET_VALUES_DB_CHECKED - Dialog box for requesting values, check against the DB table/view

POPUP_GET_VALUES_USER_CHECKED - Dialog box for requesting values, check by user exit (import parameters FORMNAME and PROGRAMNAME)

POPUP_GET_VALUES_USER_HELP - Dialog box for requesting values, call of user exits (import parameters FORMNAME and PROGRAMNAME) and help (import parameters F1_FORMNAME and F1_PROGRAMNAME, F4_FORMNAME and F4_PROGRAMNAME)
Code:

* dummy code to display table of fields
  define display_values.
    data: w_fields like sval occurs 0 with header line,
          w_msg(200).
    w_fields[] = p_fields[].
    w_msg = &1.
    loop at w_fields.
      concatenate w_msg w_fields-tabname '-' w_fields-fieldname '='
                  w_fields-value ','
                  into w_msg.
    endloop.
    message i398(00) with w_msg+0(50)   w_msg+50(50)
                          w_msg+100(50) w_msg+150(50).
  end-of-definition.

  parameter p_matnr like mara-matnr.
  data: w_fields like sval occurs 0 with header line,
        w_rc(1).

end-of-selection.
  w_fields-tabname   = 'MARA'.
  w_fields-fieldname = 'MATNR'.
  w_fields-value     = p_matnr.
  append w_fields.

  CALL FUNCTION 'POPUP_GET_VALUES_USER_CHECKED'
    EXPORTING
      FORMNAME                        = 'USER_FORM2'
      POPUP_TITLE                     = 'GET VALUES USER CHECKED'
      PROGRAMNAME                     = 'ZVV_POPUP'
*     START_COLUMN                    = '5'
*     START_ROW                       = '5'
*     NO_CHECK_FOR_FIXED_VALUES       = ' '
    IMPORTING
      RETURNCODE                      = w_rc
    TABLES
      FIELDS                          = w_fields
    EXCEPTIONS
      ERROR_IN_FIELDS                 = 1
      OTHERS                          = 2.
  IF SY-SUBRC <> 0 or not w_rc = space.
    write: / 'GET VALUES USER CHECKED failed'.
  ENDIF.

  CALL FUNCTION 'POPUP_GET_VALUES_USER_HELP'
    EXPORTING
      F1_FORMNAME                     = 'F1_FORM'
      F1_PROGRAMNAME                  = 'ZVV_POPUP'
      F4_FORMNAME                     = 'F4_FORM'
      F4_PROGRAMNAME                  = 'ZVV_POPUP'
      FORMNAME                        = 'USER_FORM2'
      POPUP_TITLE                     = 'GET VALUES USER HELP'
      PROGRAMNAME                     = 'ZVV_POPUP'
*     START_COLUMN                    = '5'
*     START_ROW                       = '5'
*     NO_CHECK_FOR_FIXED_VALUES       = ' '
    IMPORTING
      RETURNCODE                      = w_rc
    TABLES
      FIELDS                          = w_fields
    EXCEPTIONS
      ERROR_IN_FIELDS                 = 1
      OTHERS                          = 2.
  IF SY-SUBRC <> 0 or not w_rc = space.
    write: / 'GET VALUES USER HELP failed'.
  ENDIF.

  CALL FUNCTION 'POPUP_GET_VALUES_USER_BUTTONS'
    EXPORTING
      F1_FORMNAME                     = 'F1_FORM'
      F1_PROGRAMNAME                  = 'ZVV_POPUP'
      F4_FORMNAME                     = 'F4_FORM'
      F4_PROGRAMNAME                  = 'ZVV_POPUP'
      FORMNAME                        = 'USER_FORM'
      PROGRAMNAME                     = 'ZVV_POPUP'
      POPUP_TITLE                     = 'GET VALUES USER BUTTONS'
      OK_PUSHBUTTONTEXT               = 'Ok'
      ICON_OK_PUSH                    = '@0V@'      "ICON_OKAY
      QUICKINFO_OK_PUSH               = 'Done'
      FIRST_PUSHBUTTON                = 'Check 1'
      ICON_BUTTON_1                   = '@38@'      "ICON_CHECK
      QUICKINFO_BUTTON_1              = 'Check 1'
      SECOND_PUSHBUTTON               = 'Check 2'
      ICON_BUTTON_2                   = '@46@'      "ICON_COMPARE
      QUICKINFO_BUTTON_2              = 'Check 2'
*     START_COLUMN                    = '5'
*     START_ROW                       = '5'
*     NO_CHECK_FOR_FIXED_VALUES       = ' '
    IMPORTING
      RETURNCODE                      = w_rc
    TABLES
      FIELDS                          = w_fields
    EXCEPTIONS
      ERROR_IN_FIELDS                 = 1
      OTHERS                          = 2.
  IF SY-SUBRC <> 0 or not w_rc = space.
    write: / 'GET VALUES USER BUTTONS failed'.
  ENDIF.

*==============================================================
*  Checking form 1
form user_form tables p_fields
               using  p_ok_code_save
                      p_error
                      p_h_show_popup.
  display_values 'Checking:'.
  message i398(00) with 'sy-ucomm =' sy-ucomm.
* ....
* continue procesing
  case sy-ucomm.
    when 'FURT'.  p_h_show_popup = space.  "OK button
    when 'COD1'.  p_h_show_popup = 'X'.    "button 1
    when 'COD2'.  p_h_show_popup = 'X'.    "button 2
  endcase.
* ....
* check successful
  clear p_error.
endform.

*==============================================================
*  Checking form 2
form user_form2 tables p_fields
                using  p_error.
  display_values 'Checking:'.
* ....
* check successful
  clear p_error.
endform.

*==============================================================
*  Help form
form f1_form using  p_table
                    p_field.
  message i398(00) with 'Help for:' p_table '-' p_field.
endform.

*==============================================================
*  F4 form
form f4_form using  p_table
                    p_field
                    p_flag
                    p_retruncode
                    p_value.
  message i398(00) with 'F4 for:' p_table p_field p_value.
  p_value = '4444'.
endform.


POPUP_GET_VALUES_USER_BUTTONS - Dialog box for requesting values and offering user pushbuttons

POPUP_TO_MODIFY_TEXT - Text field has length 45. Returns Answer='J' if modified, 'A' if not (and empty field).

POPUP_CONTINUE_YES_NO - Returns 'J' or 'N'.

LC_POPUP_RADIO_5 - Returns No of line or 'A' if cancelled.

POPUP_TO_DECIDE_LIST - Displays internal table as radiobuttons or checkbox.
Returns No of line or 'A' if cancelled.
Code:
  DATA : l_answer.
  DATA : lt_spopli TYPE spopli OCCURS 0 WITH HEADER LINE.

    REFRESH lt_spopli.
    lt_spopli-selflag = space.
    lt_spopli-varoption = 'Standart output'(100).
    APPEND lt_spopli.

    lt_spopli-selflag = space.
    lt_spopli-varoption = 'Output to Excel'(101).
    APPEND lt_spopli.

    CALL FUNCTION 'POPUP_TO_DECIDE_LIST'
      EXPORTING
        mark_flag          = ''   "radio, 'X' -checkbox
        mark_max           = 1
        start_col          = 15
        start_row          = 10
        textline1          = 'Choose output'(102)
        titel              = 'Output select'(103)
      IMPORTING
        answer             = l_answer
      TABLES
        t_spopli           = lt_spopli
      EXCEPTIONS
        not_enough_answers = 1
        too_much_answers   = 2
        too_much_marks     = 3
        OTHERS             = 4.

    CLEAR lt_spopli.
    IF NOT sy-subrc IS INITIAL.
      CLEAR l_answer.
    ENDIF.
  IF l_answer = '2'.
    PERFORM excel_open.
  ELSE.
    PERFORM form_open USING proc_screen vbdkr-land1.
  ENDIF.

POPUP_TO_DISPLAY_TEXT - Displays two lines of text like (I) message.

POPUP_TO_INFORM - Displays four long lines of text.

POPUP_DISPLAY_MESSAGE - Displays 'Action not possible' string and formatted message (input: Message Id, Number and parameters).

COMPLEX_SELECTIONS_DIALOG - External Call 'Multiple Selection' Displays standard 'Multiple Selection' window for a range or select-option (table parameter RANGE).

POPUP_TO_CONFIRM_WITH_VALUE - Create a dialog box in which you make a question whether the user wishes to perform a processing step with a particular object.

POPUP_TO_SELECT_MONTH - Popup to choose a month

K_KKB_POPUP_RADIO2 - Popup with 2 radio buttons

Code:
      DATA: l_answer.
      CALL FUNCTION 'K_KKB_POPUP_RADIO2'
        EXPORTING
          i_title   = 'Select Banks output format'
          i_text1   = 'Public version'
          i_text2   = 'ROSBANK'
          i_default = 1
        IMPORTING
          i_result  = l_answer
        EXCEPTIONS
          cancel    = 1
          OTHERS    = 2.

    IF sy-subrc = 1.
      MESSAGE 'User cancelled the action' TYPE 'S'.
    ENDIF.



K_KKB_POPUP_RADIO3 - Popup with 3 radio buttons
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Function Modules | Функциональные модули All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.