BC ABAP Programming PHẦN 6 pot

153 343 0
BC ABAP Programming PHẦN 6 pot

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

BC - ABAP Programming SAP AG Processing Radio Buttons 768 December 1999 Processing Radio Buttons In the PAI event of the selection screen, the event AT SELECTION-SCREEN ON RADIOBUTTON GROUP <radi> is triggered when the contents of all of the fields in a radio button group are passed from the selection screen to the ABAP program. To define a radio button group <radi>, use the addition RADIOBUTTON GROUP <radi> in the corresponding PARAMETERS statements. This event block allows you to check the whole group. If an error message occurs within this event block, the radio button group is made ready for input again on the selection screen. The individual fields of radio button groups do not trigger the event AT SELECTION-SCREEN ON <field>. REPORT EVENT_DEMO. SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME. PARAMETERS: R1 RADIOBUTTON GROUP RAD1 DEFAULT 'X', R2 RADIOBUTTON GROUP RAD1, R3 RADIOBUTTON GROUP RAD1. SELECTION-SCREEN END OF BLOCK B1. SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME. PARAMETERS: R4 RADIOBUTTON GROUP RAD2 DEFAULT 'X', R5 RADIOBUTTON GROUP RAD2, R6 RADIOBUTTON GROUP RAD2. SELECTION-SCREEN END OF BLOCK B2. AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD1. IF R1 = 'X'. MESSAGE W040(HB). ENDIF. AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD2. IF R4 = 'X'. MESSAGE W040(HB). ENDIF. If the user does not change one of the radio button groups, a warning is displayed. R1 R2 W: This is the default setting! R3 R4 R5 R6 SAP AG BC - ABAP Programming Processing Radio Buttons December 1999 769 BC - ABAP Programming SAP AG Processing Multiple Selections 770 December 1999 Processing Multiple Selections If the user opens the Multiple selections dialog box for a selection option, the same events are triggered in the PAI of the selection screen as if the user had chosen Execute. The user can then enter the required multiple selections. In the Multiple selections dialog box, user actions either lead to input help or trigger the PAI event of the dialog box. At first, the AT SELECTION-SCREEN ON <seltab> event is triggered for the current line of the selection table. It can then be processed like a single field [Page 765]. Next, the AT SELECTION-SCREEN ON END OF <seltab> event is triggered. This event block allows you to check the whole selection table <seltab>. Warning messages are displayed as dialog boxes, not in the status line. The program below is connected to the logical database F1S: REPORT EVENT_DEMO. NODES SPFLI. AT SELECTION-SCREEN ON END OF CARRID. LOOP AT CARRID. IF CARRID-HIGH NE ' '. IF CARRID-LOW IS INITIAL. MESSAGE W050(HB). ENDIF. ENDIF. ENDLOOP. If the user chooses the multiple selection button ( ) on the selection screen, and then enters upper limits without lower limits in an interval field, a dialog box appears with a warning: SAP AG BC - ABAP Programming Processing Multiple Selections December 1999 771 Multiple Selection for SEL_OPT1 Single vals Intervals IntervalsSingle vals X To To To To To AF LH NW Warning Lower limit missing Reenter BC - ABAP Programming SAP AG Defining Field Help 772 December 1999 Defining Field Help If the data type of an input field declared in an executable program is defined in the ABAP Dictionary, the documentation of the underlying data element is automatically displayed if the user positions the cursor in that field and presses F1. To create help for input fields that have no Dictionary reference, or to override the help normally linked to the field, you can create an event block for the event AT SELECTION-SCREEN ON HELP-REQUEST FOR <field> The event is triggered when the user calls the F1 help for the field <field>. If no corresponding event block has been defined, the help from the ABAP Dictionary is displayed, or none at all if the field has no Dictionary reference. If a corresponding event block exists, it takes precedence over the default help mechanism. It is then up to the programmer to ensure that appropriate help is displayed. You cannot declare the event block AT SELECTION-SCREEN ON HELP-REQUEST for input fields on the selection screen that are declared within a logical database. You cannot override the help mechanism of a logical database within the program. You can define separate help within the logical database program using the HELP-REQUEST option in the PARAMETERS and SELECT-OPTIONS statements. REPORT SELECTION_SCREEN_F1_DEMO. PARAMETERS: P_CARR_1 TYPE S_CARR_ID, P_CARR_2 TYPE S_CARR_ID. AT SELECTION-SCREEN ON HELP-REQUEST FOR P_CARR_2. CALL SCREEN 100 STARTING AT 10 5 ENDING AT 60 10. This program declares a selection screen with two parameters that both refer to the data element S_CARR_ID in the ABAP Dictionary. The documentation from the ABAP Dictionary is used for P_CARR_1, and a help screen 100 is called for P_CARR_2. The help screen is defined in the Screen Painter as a modal dialog box with next screen 0. It contains the help text defined as help texts. The screen does not require any flow logic. SAP AG BC - ABAP Programming Defining Field Help December 1999 773 P_CARR_1 P_CARR_2 Airline code This field contains the code of the airline The field contains the code of an airline that collaborates with other airlines ABAP- Dictionary BC - ABAP Programming SAP AG Defining Input Help 774 December 1999 Defining Input Help Suchhilfe für Parameter [Page 709] If a field in an executable program is defined with reference to an ABAP Dictionary field for which possible entries help is defined, the values from the ABAP Dictionary help are automatically displayed when the user calls the F4 help for that field. To create possible values help for input fields that have no Dictionary reference, or to override the help normally linked to the field, you can create an event block for the event AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field> The event is triggered when the user calls the F4 help for the field <field>. If no corresponding event block has been defined, the possible values help from the ABAP Dictionary is displayed, or none at all if the field has no Dictionary reference. If a corresponding event block exists, it takes precedence over the default possible values help mechanism. It is then up to the programmer to ensure that an appropriate list of values is displayed, and that the user can choose a value from it. You cannot declare the event block AT SELECTION-SCREEN ON VALUE-REQUEST for input fields on the selection screen that are declared within a logical database. You cannot override the possible values help mechanism of a logical database within the program. You can define separate help within the logical database program using the VALUE-REQUEST option in the PARAMETERS and SELECT-OPTIONS statements. REPORT SELECTION_SCREEN_F4_DEMO. PARAMETERS: P_CARR_1 TYPE SPFLI-CARRID, P_CARR_2 TYPE SPFLI-CARRID. AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_CARR_2. CALL SCREEN 100 STARTING AT 10 5 ENDING AT 50 10. MODULE VALUE_LIST OUTPUT. SUPPRESS DIALOG. LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0. SET PF-STATUS SPACE. NEW-PAGE NO-TITLE. WRITE 'Star Alliance' COLOR COL_HEADING. ULINE. P_CARR_2 = 'AC '. WRITE: / P_CARR_2 COLOR COL_KEY, 'Air Canada'. HIDE P_CARR_2. P_CARR_2 = 'LH '. WRITE: / P_CARR_2 COLOR COL_KEY, 'Lufthansa'. HIDE P_CARR_2. P_CARR_2 = 'SAS'. WRITE: / P_CARR_2 COLOR COL_KEY, 'SAS'. HIDE P_CARR_2. SAP AG BC - ABAP Programming Defining Input Help December 1999 775 P_CARR_2 = 'THA'. 4 WRITE: / P_CARR_2 COLOR COL_KEY, 'Thai International'. HIDE P_CARR_2. P_CARR_2 = 'UA '. WRITE: / P_CARR_2 COLOR COL_KEY, 'United Airlines'. HIDE P_CARR_2. CLEAR P_CARR_2. ENDMODULE. AT LINE-SELECTION. CHECK NOT P_CARR_2 IS INITIAL. LEAVE TO SCREEN 0. This program defines a selection screen with two parameters, both of which refer to the column CARRID in the database table SPFLI. The possible entries help from the ABAP Dictionary is used for P_CARR_1, and a separate possible entries help is programmed for P_CARR_2. Screen 100 is used for the possible entries help. The dialog module VALUE_LIST is started in its PBO event. The actual screen mask is not used, and there are no dialog modules used in the PAI. PROCESS BEFORE OUTPUT. MODULE VALUE_LIST. PROCESS AFTER INPUT. The dialog module VALUE_LIST suppresses the dialog of screen 100 and switches to list processing. The list contains values for the parameter P_CARR_2. These values are also placed in the HIDE area. When the user selects a line from the value list, the AT LINE-SELECTION event is triggered, and the selected value is transferred from the HIDE area into the field P_CARR_2. If the user selects a valid line, the system switches directly from the event block AT LINE-SELECTION back to the selection screen, and fills the corresponding input field. BC - ABAP Programming SAP AG Defining Input Help 776 December 1999 P_CARR_1 P_CARR_2 Airline code ABAP Dictionary AA AC AF AZ BA BL CO American Airlines Air Canada Air France Alitalia British Airways Pacific Airlines Continental Arlines Star Alliance AC LH SAS THA UA Air Canada Lufthansa SAS Thai International United Airlines User-Defined Value Help SAP AG BC - ABAP Programming Subscreens and Tabstrip Controls on Selection Screens December 1999 777 Subscreens and Tabstrip Controls on Selection Screens Some of the complex screen elements [Page 641] that you can create in the Screen Painter for screens can also be defined in ABAP programs for selection screens. For example, you can now use tabstrip controls on selection screens. Since you need subscreens to work with tabstrip controls, you can also now define selection screens as subscreens. Selection Screens as Subscreens [Page 778] Tabstrip Controls on Selection Screens [Page 783] Subscreens on Selection Screens [Page 787] [...]... fields as follows: 794 December 1999 SAP AG BC - ABAP Programming Selection Tables in GET Events Connections Airline carrier AA to UA Dep airport Frankfurt Dest airport Berlin Departure date 1998/01/01 to 1998/08/31 MAX 200 to 300 OCC 10 to 30 The list output appears as follows: CHECK in GET events LH LH LH LH LH LH LH LH 2402 2402 2402 24 36 24 36 2 462 2 462 2 462 220 10 220 21 The system reads all rows... SEATSOCC onto the screen December 1999 795 BC - ABAP Programming SAP AG Selection Tables in GET Events 7 96 December 1999 SAP AG BC - ABAP Programming Lists Lists Selection screens are one of the three types of screen in the R/3 System, along with dialog screens and lists They are used to display data, and also allow user interaction You create lists using ABAP statements They can be output to the screen,... Lists [Page 942] 798 December 1999 SAP AG BC - ABAP Programming Creating Lists Creating Lists The following sections describe how to create lists in ABAP Lists are always displayed using the automatic list display functions in executable programs Creating Simple Lists with the WRITE Statement [Page 800] Creating Complex Lists [Page 817] December 1999 799 BC - ABAP Programming SAP AG Creating Simple Lists.. .BC - ABAP Programming SAP AG Selection Screens as Subscreens Selection Screens as Subscreens In the same way that you can define a screen as a subscreen [Page 65 3] in the Screen Painter, it is now possible to define selection screens as subscreens in an ABAP program: SELECTION-SCREEN BEGIN OF SCREEN AS SUBSCREEN [NO INTERVALS]... sy-ucomm WHEN 'PUSH1' mytab-dynnr = 100 mytab-activetab = 'BUTTON1' WHEN 'PUSH2' 784 December 1999 SAP AG BC - ABAP Programming Tabstrip Controls on Selection Screens mytab-dynnr = 200 mytab-activetab = 'BUTTON2' ENDCASE WHEN 100 MESSAGE s888(sabapdocu) WITH text-040 sy-dynnr WHEN 200 MESSAGE s888(sabapdocu) WITH text-040 sy-dynnr ENDCASE MODULE init_0100 OUTPUT LOOP AT SCREEN IF screen-group1 = 'MOD'... fill the input fields as follows: 792 December 1999 SAP AG BC - ABAP Programming Selection Tables in Logical Expressions to Airline carrier AA Depart city FRANKFURT to Arrival city BERLIN Flight number UA LONDON NEW YORK to 100 to 2500 The list then appears as follows: Selection tables in logical expressions LH LH LH LH LH 0400 0402 2402 24 36 2 462 FRANKFURT FRANKFURT FRANKFURT FRANKFURT FRANKFURT NEW... list to the screen using the LEAVE TO LISTPROCESSING statement ABAP allows you to generate more complex and effective output lists, both on the screen and on paper, than that covered here The following sections are based on this introduction 800 December 1999 SAP AG BC - ABAP Programming The WRITE Statement The WRITE Statement The basic ABAP statement for displaying data on the screen is WRITE Syntax... specified in the user’s master record (for example, DD/MM/YYYY or MM/DD/YYYY) PROGRAM sapmtest DATA number TYPE p VALUE '-1234 567 .89' DECIMALS 2 WRITE: 'Number', number, 'is packed' The output appears as follows: Number 802 1,234, 567 .89- is packed December 1999 SAP AG BC - ABAP Programming The WRITE Statement The field NUMBER has a total length of 13, made up of 9 digits, decimal point, minus sign, and... tables can be addressed as a whole in certain ABAP statements In these statements, complex selections are analyzed in a selection table The programmer does not have to deal with their logic Selection Tables in the WHERE Clause [Page 790] Selection Tables in Logical Expressions [Page 791] Selection Tables in GET Events [Page 794] December 1999 789 BC - ABAP Programming SAP AG Selection Tables in the WHERE... rows for all airlines between DL and UA except LH are read 790 December 1999 SAP AG BC - ABAP Programming Selection Tables in Logical Expressions Selection Tables in Logical Expressions To check if the value of a field meets the conditions in a selection table, you can use the following special logical expression [Page 2 26] : IN This logical expression is true if the contents of field . displayed. R1 R2 W: This is the default setting! R3 R4 R5 R6 SAP AG BC - ABAP Programming Processing Radio Buttons December 1999 769 BC - ABAP Programming SAP AG Processing Multiple Selections 770. screen, and fills the corresponding input field. BC - ABAP Programming SAP AG Defining Input Help 7 76 December 1999 P_CARR_1 P_CARR_2 Airline code ABAP Dictionary AA AC AF AZ BA BL CO American. SAP AG BC - ABAP Programming Tabstrip Controls on Selection Screens December 1999 783 Tabstrip Controls on Selection Screens As with screens, you can now use tabstrip controls [Page 66 0] on selection

Ngày đăng: 09/08/2014, 14:20

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan