ABAP standard list and selection screen

Source: Internet
Author: User

Standard list Output
Report  ytest20160527.* definition structure data:begin of SCHOOL, City  TYPE ytjaycity-yct_name,  NO TYPE ytjayschool-ysh_id ,  NAME type ytjayschool-ysh_name,  ADDRESS type ytjayschool-ysh_addr,end of school.* workspace, data SCHOOL1 like SCHOOL. * Output table header Uline at/(93). WRITE:/Sy-vline, (15) ' City ', Sy-vline, (15) ' School Number ', Sy-vline, (15) ' School name ', Sy-vline, (35) ' address ', sy-vline. Uline at/(93). * Output Content Select Ytjaycity~yct_name ytjayschool~ysh_id ytjayschool~ysh_name ytjayschool~ysh_addr into School1from ytjayschoolinner JOIN ytjaycity on ytjayschool~yct_id = ytjaycity~yct_id.  WRITE:/Sy-vline, (School1-city, Sy-vline, () School1-no, Sy-vline, (+) School1-name, Sy-vline, (35) School1-address,sy-vline.  Uline at/(93). Endselect.

Output results

In the example above, the header is output, the data is read from the data table and output, and the line uses "Uline" and "Sy-vline".

The common system variables are as follows:


Output Unconditional page break

Output unconditional page break, using syntax: "New-page".
Page breaks and defines the length of the new page, using the syntax: "New-page line-count 20"

List color

Grammar:
FORMAT color<n> [on] intensified [on| OFF] Inverse [on| OFF]
COLOR parameter:
Col_background depends on GUI
Col_heading Grey Blue
Col_normal Grayish
Col_total Yellow
Col_key Yellow Green
Col_positive Green
Col_negative Red
Col_group Violet
Intensified parameters: Background color parameters
Inverse parameter: Whether the foreground color is affected

Report  ytest20160527.* Change the background color of format color col_heading. WRITE ' HELLO world '. WRITE ' welcome! '. * Change foreground color format color col_heading inverse on. WRITE/' HELLO world '. WRITE ' WELCOME '.

Output results


Report  ytest20160527.* definition structure data:begin of SCHOOL, City  TYPE ytjaycity-yct_name,  NO TYPE ytjayschool-ysh_id ,  NAME type ytjayschool-ysh_name,  ADDRESS type ytjayschool-ysh_addr,end of school.* workspace, data SCHOOL1 like SCHOOL. * Output table header, background Gray blue format COLOR col_heading. Uline at/(93). WRITE:/Sy-vline, (15) ' City ', Sy-vline, (15) ' School Number ', Sy-vline, (15) ' School name ', Sy-vline, (35) ' address ', sy-vline. Uline at/(93). FORMAT COLOR off.* Output * Output key value is ' Beijing ' for Red select Ytjaycity~yct_name ytjayschool~ysh_id ytjayschool~ysh_name ytjayschool~ Ysh_addr into School1from Ytjayschoolinner joins ytjaycity on ytjayschool~yct_id = ytjaycity~yct_id.    IF school1-city = ' Beijing '.    FORMAT COLOR col_negative.  ELSE.    FORMAT COLOR OFF.  ENDIF.  WRITE:/Sy-vline, (School1-city, Sy-vline, () School1-no, Sy-vline, (+) School1-name, Sy-vline, (35) School1-address,sy-vline.  Uline at/(93). Endselect.

Output results


Output hotspots
Report  YTEST20160527. Start-of-selection. WRITE ' please press '. FORMAT HOTSPOT on COLOR 6 inverse on. WRITE ' hot spot '. FORMAT HOTSPOT off COLOR off. At Line-selection.  WRITE ' welcome! '.


Output results

Click the "hotspot" character to output "welcome!"

Interactive list

Output second page when you click Output row

Report  YTEST20160527. Start-of-selection.  WRITE: ' Initial list, sy-lsind= ', Sy-lsind. At Line-selection.  IF sy-lsind = 1.    WRITE: ' Second list, sy-lsind= ', Sy-lsind.  ENDIF.

Output results

Click the output line to output the second line

Define toolbars and menus for a list

The Authoring toolbar button uses the ABAP menu editor, tcode:se41


After entering the status name, click the Create button

Continue after entering short text

In the App toolbar, click the button below to see the project information

After you enter the name of the button you want to create on the App toolbar, double-click it

Select static text

Continue after entering function text

Select the shortcut key button

Feature type selection blank for normal application functionality

The return button at the function key is set to valid, enter the name, save, activate

The program code called is as follows

Report  YTEST20160527. Start-of-selection.* set the Used status bar set  pf-status ' STA1 '.  WRITE: ' Test toolbar button '.  At user-command.* output case Sy-ucomm when the button is clicked  .    When ' Ownsel '.      WRITE: ' Selected! '.  Endcase.

Output results

When you click my button, the output is as follows


Display a list in a pop-up window

The status bar is displayed on the pop-up window, which is designed as follows

The program code is as follows

Report  YTEST20160527. Start-of-selection.* set the Used status bar set Pf-status ' STA1 '. WRITE: ' Test toolbar button '. At user-command.* output case Sy-ucomm when the button is clicked. When ' Ownsel '.  IF sy-lsind = 1.    SET pf-status ' STA6 '.    * Define Subwindow and Output    window starting at ten ending at.    WRITE ' Output in child window! '.    Write ' Please note! '.  ENDIF. Endcase.

Output results


Hide Field Technology

A hidden field is a field that can be read if the data exists in the list but not output.

Report  YTEST20160527. Tables:ytjaycity, Ytjayschool. Start-of-selection. skip.* output Uline at/(55). WRITE:/Sy-vline, (15) ' City number ', Sy-vline, (15) ' City name ', Sy-vline, (15) ' Country ', sy-vline.* output uline at/(55). SELECT * from Ytjaycity.  write:/ Sy-vline, (ytjaycity-yct_id),          sy-vline, Ytjaycity-yct_name,          sy-vline, and Ytjaycity-yct_country,          sy-vline.* Hidden Keywords  hide:ytjaycity-yct_id.  Uline at/(55). Endselect. At line-selection.* only outputs the first page  IF sy-lsind = 1.* output    uline at/(.).    WRITE:/Sy-vline, (15) ' School Number ', Sy-vline, (15) ' School name ', Sy-vline, (35) ' address ', Sy-vline.    Uline at/(75). * Read and print the city corresponding school table according to hidden fields    SELECT * from Ytjayschool      WHERE yct_id = ytjaycity-yct_id.      write:/ Sy-vline, (Ytjayschool-ysh_id,sy-vline), (Ytjayschool-ysh_name,sy-vline), (+) ytjayschool-ysh_addr,sy-vline.      Uline at/(+).    Endselect.  ENDIF.

Output results

Double-click a row of data in the city table to display all school information for that city

Select Screen Selection screen action

Take the table ytjaycity data query As an example, enter Tcode:se16, table name ytjaycity, the data Query screen is as follows

Maximum hit count refers to the maximum number of records returned.
As an example of the Yct_name field, two input boxes are the starting and ending values of the query data.
(1) If you do not enter a value, all data
(2) Enter only the start input box, indicating the Yct_name= input value
(3) Enter only the terminating input box, indicating the query data yct_name<= input value
For each input box, there are fuzzy matching functions, enter the input box, right-click menu, screen display selection, such as

Indicates that the current selection is excluded and the right side of the input box is prompted when the selection criteria is entered

button on the right to indicate single value and range selection

Select screen Program syntax

The selection screen has both a single field search (PARAMETERS) and a range filter (select-option).
Single-field search (PARAMETERS)
Grammar:
Parameters<p>[default <d>][lower case][obligatory][as Checkbox][radiobutton GROUP <RG>]
[Default <d>]: Defaults
[LOWER case]: Capitalization
[obligatory]: Must be entered
[As checkbox]: In the form of a check box
[RADIOBUTTON Group<rg>]: In the form of radio buttons

The following example selects the screen input value and outputs the value to the screen

Report  YTEST20160527. PARAMETERS:A1 (Ten) type C,            A2     type i.write:/ a1,/A2.

Output Result: Click the Execute button to output the value just entered



Range filtering

Using Select-options for multi-valued and multi-range retrieval

Report  YTEST20160527. DATA DATA1 () TYPE c.select-options D1 for DATA1. LOOP at D1.  WRITE:/' sign: ',    d1-sign,           ' OPTION: ',  d1-option,           ' Low: ',     d1-low,           ' High: ',    D1-high. Endloop.
Output: Click the Execute button to output the range value you just entered


Adjust input hints

When you have finished writing the program, the prompt for the query criteria is the variable name, which needs to be adjusted to Chinese hints, and the menu "go to"-"text element"-"Select text"


Tips for modifying parameter D1


Click the button to save, then click the button to activate, click the button to return to the previous screen, click the button test run, the results are as follows


Select screen instance design 1, define selection screen
Report  YTEST20160527. Selection-screen BEGIN of Screen 500.PARAMETERS DATA1 (a) TYPE c.selection-screen END of screen 500.CALL Selection-screen 500.
Output 2, define multiple input fields one line output
Report  YTEST20160527. Selection-screen BEGIN of line.* preset *selection-screen POSITION 28.selection-screen COMMENT 1 (Ten) S2. PARAMETERS:A1 (1) Type C,            A2 (4) Type C,            S3 (9) Type C.selection-screen END of line.* assign value to default INITIALIZATION.S2 = ' Test input '.
Output results
3. Radio Box
Report  YTEST20160527. Selection-screen BEGIN of BLOCK RDG1 with FRAME TITLE S2. PARAMETERS A1 RADIOBUTTON GROUP RG1. PARAMETERS A2 RADIOBUTTON GROUP RG1. PARAMETERS A3 RADIOBUTTON GROUP RG1. Selection-screen END of BLOCK RDG1. Initialization. S2 = ' Please select '.
Output 4, define a button for the selection window and ring The example is a more complex program, including window, button definition, event-driven content
Report  YTEST20160527. TABLES Sscrfields. DATA done (2) TYPE c.selection-screen:begin of "screen" TITLE tit, BEGIN of line  ,    pushbutton 2 (Ten) S1 User-comman D C1,    pushbutton (Ten) S2 User-command C2, END of line,end of screen  500.AT Selection-screen.  Case Sscrfields-ucomm.    When ' C1 '.      Done = ' C1 '.    When ' C2 '.      Done = ' C2 '.  Endcase.  LEAVE to screen 0.start-of-selection.  Call screen.  WRITE: ' You pressed: ', done. Initialization.  S1 = ' button 1 '.  S2 = ' button 2 '.  Tit = ' Define the button for the selection window and respond '.
Output results when you click button 2, the output is as follows
5. Selection-screen Sub-window
This example uses the screen technology content
Enter Tcode:se51, enter the screen design, enter the program name, screen number 120, click the Create button to enter a description, click the Save button, and then click the toolbar's Format button to add a "child screen range" control on the screen, add "Subwindow 1", "Child windows 2", "Exit" button, and define the name, text, function code and other attributes


Click the toolbar's Logical Flow button logic Flow program
PROCESS before OUTPUT.  Call Subscreen A1 including Sy-repid NUM1. PROCESS after INPUT.  Call Subscreen A1.  MODULE user_command-0100.
Add return code "Ok_code"

After saving and activating, edit the program in SE38 YTEST20160527
  The report ytest20160527.* child defines the true child window 120* the child window 800selection-screen the BEGIN of screen, as Subscreen.  PARAMETERS:A1 (+) Type C,              A2 (Ten) Type C,              A3 (Ten) type C.selection-screen END of screen 800.* define child windows 900SELECTION-SCR EEN BEGIN of screen, as Subscreen.  PARAMETERS:B1 (Ten) Type C,              B2 (Ten) Type C,              B3 (Ten) type C.selection-screen END of screen 900.* return code Data:ok_code TYPE Sy-ucomm,      save_ok type sy-ucomm.* initial window is 800DATA:NUM1 (4) Type N VALUE ' 800 '. * Start 120 window start-of-selection.  Call screen 120.* handles button event module user_command-0100 INPUT.  SAVE_OK = Ok_code.  Case save_ok.* Each button calls the 800 window when    ' S1 '.      NUM1 = 800.* Each of the three buttons calls the 900 window when    ' S2 '.      NUM1 =.    When ' EXIT '.      LEAVE program.  Endcase. Endmodule.
The output is as follows when you click on the "Subwindow 2" button, the sub-window has been switched, the output is as follows click the "Exit" button, then exit the program

ABAP standard list and selection screen

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.