Posted: Sat Sep 08, 2007 10:20 pm Post subject: Popup Windows
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.
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.
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.
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.
Code:
DATA: t_fields LIKE sval OCCURS 0 WITH HEADER LINE.
START-OF-SELECTION.
*— Prepare Parameters for FM ————-*
t_fields-tabname = ’BKPF’.
t_fields-fieldname = ’BUDAT’.
APPEND t_fields.
*—- Function Module Call —————–*
CALL FUNCTION ’POPUP_GET_VALUES’
EXPORTING
* NO_VALUE_CHECK = ’ ’
popup_title = ’Test Popup’
* START_COLUMN = ’5’
* START_ROW = ’5’
* IMPORTING
* RETURNCODE =
TABLES
fields = t_fields
EXCEPTIONS
error_in_fields = 1
OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*— Display Report —————-*
LOOP AT t_fields.
WRITE:/ t_fields-value.
ENDLOOP.
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).
*==============================================================
* 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.
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.
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.