SAP的标准对话框函数
在用戶設(shè)計sap的程序時,經(jīng)常需要一些對話框,用戶可以自己編寫,但使用SAP系統(tǒng)中提供了的對話框函數(shù)將減少許多開發(fā)工作。
1、sap的函數(shù)組列表和用途說明
| 適用情況 | Function group |
| 提示用戶將可能丟失數(shù)據(jù) | SPO1 |
| 提示用戶對某個問題選擇Yes或者No? | SPO1 |
| 提示用戶將可能丟失數(shù)據(jù), 并詢問用戶是否繼續(xù)操作 | SPO1 |
| 提示用戶在多個操作中選擇一個操作 | SPO2 |
| 提示用戶是繼續(xù)當(dāng)前操作或者取消當(dāng)前操作 | SPO2 |
| 提示用戶輸入數(shù)據(jù) (可以根據(jù)一個表檢查或者不檢查輸入值) | SPO4 |
| 將數(shù)據(jù)顯示給用戶 | SPO4 |
| 將詳細(xì)數(shù)據(jù)顯示給用戶 | SPO6 |
| 從列表中選擇數(shù)據(jù) | SP05 |
| 用可滾動的對話框顯示數(shù)據(jù)給用戶 | STAB |
| 從視圖或者數(shù)據(jù)表中打印數(shù)據(jù) | STPR |
2、函數(shù)列表和說明
2.1 SPO1的函數(shù)
- POPUP_TO_CONFIRM_STEP
用此函數(shù)可以建立一個對話框用于詢問用戶是否執(zhí)行某步操作,用戶可以選擇Yes No或者Cancel。該函數(shù)可以傳入一個標(biāo)題和兩行的文本(提示問題)。系統(tǒng)在窗口上顯示一個綠色問號圖標(biāo)。
可以設(shè)置某個按鈕作為默認(rèn)按鈕。
???? CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
????????? EXPORTING TITEL??????? =?'確認(rèn)提示測試'
??????????????????? TEXTLINE1??? =??'確實要執(zhí)行'
??????????????????? TEXTLINE2??? =?'測試?'
??????????????????? CANCEL_DISPLAY = SPACE? "不顯示CANCEL按鈕
????????? IMPORTING ANSWER?????? = ANSWER.
- POPUP_TO_CONFIRM_WITH_MESSAGE
類似POPUP_TO_CONFIRM_STEP,只是多三行的文本錯誤診斷提示。 系統(tǒng)在窗口上顯示一個綠色問號圖標(biāo)。
???? call function 'POPUP_TO_CONFIRM_WITH_MESSAGE'
????????? exporting titel???????? =?'確認(rèn)提示測試'
??????????????????? textline1???? =? '確實要執(zhí)行???????????????????????? ;;'
??????????????????? textline2???? = spop-textline2
??????????????????? diagnosetext1 = spop-diagnose1
??????????????????? diagnosetext2 = spop-diagnose2
??????????????????? diagnosetext3 = spop-diagnose3
????????? importing answer??????? = answer.
- POPUP_TO_CONFIRM_WITH_VALUE
用此函數(shù)可以建立一個對話框用于詢問用戶是否執(zhí)行某步操作,該操作可能會丟失數(shù)據(jù),用戶可以選擇Yes No或者Cancel。該函數(shù)可以傳入一個標(biāo)題,兩行的文本(提示問題)和一個對象值(對象值將會插入在提示問題文本的兩部分之間)。系統(tǒng)在窗口上顯示一個綠色問號圖標(biāo)。
可以設(shè)置某個按鈕作為默認(rèn)按鈕。
???? CALL FUNCTION 'POPUP_TO_CONFIRM_WITH_VALUE'
????????? EXPORTING TITEL??????? = TITEL
??????????????????? TEXT_BEFORE? = '確實要執(zhí)行'
??????????????????? OBJECTVALUE? = 'TEST'
??????????????????? TEXT_AFTER?? =?'?'
????????? IMPORTING ANSWER?????? = ANSWER. - POPUP_TO_CONFIRM_LOSS_OF_DATA
用此函數(shù)可以建立一個對話框用于詢問用戶是否執(zhí)行某步操作,該操作可能會丟失數(shù)據(jù),用戶可以選擇Yes No或者Cancel。該函數(shù)可以傳入一個標(biāo)題和一個兩行的文本(提示問題)。 系統(tǒng)在窗口上顯示一個黃色!圖標(biāo)和一行“數(shù)據(jù)將丟失。”。
可以設(shè)置某個按鈕作為默認(rèn)按鈕。
???? CALL FUNCTION 'POPUP_TO_CONFIRM_LOSS_OF_DATA'
????????? EXPORTING TITEL??????? = TITEL
??????????????????? TEXTLINE1??? = SPOP-TEXTLINE1
??????????????????? TEXTLINE2??? = SPOP-TEXTLINE2
????????? IMPORTING ANSWER?????? = ANSWER.
- POPUP_TO_CONFIRM
該函數(shù)是POPUP函數(shù)的增強(qiáng)版,可以自定義按鈕文本和圖標(biāo)。
2.2、Function group SPO2
- POPUP_TO_DECIDE
顯示一個對話框,用戶可以兩個操作中的一個或者取消。可以傳入三行提示文本。
- POPUP_TO_DECIDE_WITH_MESSAGE
類同POPUP_TO_DECIDE,程序員可以多傳入With this function module you create a dialog box in which you inform the user about a specific decision point via a diagnosis text, during an action. He or she can choose one of two alternative actions offered or cancel the action.
The action, the diagnosis text, the question and the alternative actions are passed as parameters.
The user action (Alternative 1, Alternative 2, or Cancel) is returned in a parameter.
2.3、Function group SPO4
- POPUP_GET_VALUES
This function module sends a dialog box for data display and input.
The input fields are passed in a structure and must be defined in the Dictionary. You can also specify individual field display attributes and a field text, if the key word from the Dictionary is not to be displayed as field text in the dialog box, in the structure.
The standard help functionality (F1, F4) is supported.
- POPUP_GET_VALUES_DB_CHECKED
This function module sends a dialog box for data to be input und checked against the database.
The input fields are passed in a structure and must be defined in the Dictionary. You can also specify individual field display attributes and a field text in the structure, if the key word from the Dictionary is not to be displayed as field text in the dialog box.
A comparison operator for checking the input data in the database is passed. You can specify whether the check is for the existence or absence of an object. A foreign key relationship check is supported.
The standard help functionality (F1, F4) is supported.
The user action is returned in a parameter.
- POPUP_GET_VALUES_USER_CHECKED
This function module sends a dialog box for data to be input and checked in an external sub-routine (user exit). The input fields are passed in a structure and must be defined in the dictionary. You can also specify individual field display attributes and a field text in the structure, if the key word from the Dictionary is not to be displayed as field text in the dialog box.
The Data input by the user in the dialog box are passed to the sub-routine specified in the interface for checking. Errors found by the check are entered in an error structure and are evaluated on return from the sub-routine by the function module.
The standard help functionality (F1, F4) is supported.
The user action (Continue or Cancel) is returned in a parameter.
- POPUP_GET_VALUES_USER_HELP
This function module sends a dialog box for data to be input with the possibility of a check in an external sub-routine (user exit) and branching in a user F1 or F4 help.
The input fields are passed in a structure and must be defined in the Dictionary. You can also specify individual field display attributes and a field text in the structure, if the key word from the Dictionary is not to be displayed as field text in the dialog box.
You can pass the data which are entered by the user in a dialog box to a sub-routine which must be specified in the interface for checking. Errors occurring in the check are stored in an error structure and are analyzed by the function module upon return from the sub-routine. The data, and an error message, if appropriate, are displayed again.
The standard help functionality (F1, F4) is supported.
User exits for a user F1 or F4 help can also be specified.
The user action (Continue or Cancel) is returned in a parameter.
- POPUP_GET_VALUES_USER_BUTTONS
This function module is like the previous function module POPUP_GET_VALUES_USER_HELP, with the additional possibility of passing one or two additional pushbuttons and a standard pushbutton, which the user can name.
- POPUP_GET_VALUES_SET_MAX_FIELD
With this function module you can specify the maximum number of fields which can be displayed in dialog boxes for this function group (SPO4). The specified value is stored in the function group local memory and applies for the rest of the application. Dialog boxes which display more then this number of fields are displayed with a scroll bar.
2.4、Function group SPO6
- POPUP_DISPLAY_TEXT
With this function module you display a text which exists in the system in a dialog box.
- POPUP_DISPLAY_TEXT_WITH_PARAMS
With this function module you display a text which exists in the system with parameters in a dialog box. The parameter values are passed in a table. The use of numbered texts is recommended, to make the parameter values translatable.
The parameter names must be passed in upper-case letters.
2.5、Function group SPO5?
- POPUP_TO_DECIDE_LIST
從列表中選擇數(shù)據(jù),樣例程序
report? rsspo500.
data:?? selectlist like spopli occurs 5 with header line.
data:?? antwort?? type c.
while antwort ne 2.
clear?? selectlist.
refresh selectlist.
selectlist-varoption = 顯示含有單選按鈕的彈出框'.
append selectlist.
selectlist-varoption = '顯示含有復(fù)選框的彈出框'.
selectlist-selflag?? = 'X'.
append selectlist.
call function 'POPUP_TO_DECIDE_LIST'
???? exporting
*???????? CURSORLINE???????? = 1
*???????? MARK_FLAG????????? = ' '
????????? mark_max?????????? = 1
????????? start_col????????? = 10
????????? start_row????????? = 10
????????? textline1????????? = 'Text1'
????????? textline2????????? = 'POPUP_TO_DECIDE_LIST'
????????? textline3????????? = 'TEXT3'
????????? titel????????????? = 'TITLE '
???? importing
????????? answer???????????? =? antwort
???? tables
????????? t_spopli?????????? =? selectlist
???? exceptions
????????? not_enough_answers = 1
????????? too_much_answers?? = 2
????????? too_much_marks???? = 3
????????? others???????????? = 4.
? if antwort eq 'A'.
??? exit.
? endif.
endwhile.
if antwort ne 'A'.
? clear?? selectlist.
? refresh selectlist.
? selectlist-varoption =?'最多 15 個選項'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption = '含有復(fù)選框'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption =?'或單選按鈕'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption = '典型的列表功能:'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption = '* 選擇'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption = '* 選擇全部'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption = ' 取消全部選擇'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption = '3 70字符/選項'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption = '65 字符/選項'.
? selectlist-selflag?? = 'X'.
? append selectlist.
? selectlist-varoption =? '激活/不激活可選行'.
? selectlist-selflag?? = 'X'.
? selectlist-inactive? = 'X'.
? append selectlist.
* 2. Aufruf **********************************************************
? call function 'POPUP_TO_DECIDE_LIST'
?????? exporting
*???????? CURSORLINE???????? = 1
??????????? mark_flag????????? = 'X'
??????????? mark_max?????????? = 0
????????? start_col????????? = 15
????????? start_row????????? = 15
??????????? textline1????????? = 'Das POPUP bietet'(c01)
??????????? textline2????????? = 'folgende Funktionalit鋞:'(c02)
??????????? titel????????????? = 'Das Beispiel 2'(b02)
?????? importing
??????????? answer???????????? =? antwort
?????? tables
??????????? t_spopli?????????? =? selectlist
?????? exceptions
??????????? not_enough_answers = 1
??????????? too_much_answers?? = 2
??????????? too_much_marks???? = 3
??????????? others???????????? = 4.
總結(jié)
以上是生活随笔為你收集整理的SAP的标准对话框函数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Funtion:POPUP_TO_DEC
- 下一篇: SAP 报表程序的一些标准功能码