Presentation is loading. Please wait.

Presentation is loading. Please wait.

In the next step you will enter some data records into the table. This can be done easily using the ‘Data Browser’. The data browser can be accessed via.

Similar presentations


Presentation on theme: "In the next step you will enter some data records into the table. This can be done easily using the ‘Data Browser’. The data browser can be accessed via."— Presentation transcript:

1 In the next step you will enter some data records into the table. This can be done easily using the ‘Data Browser’. The data browser can be accessed via the menu path – Utilities -> table Contents -> create Entries. To add a new entry into the table, type in the title field and then press the ‘Save’ button.

2  Now we want to create a new table named ‘ZY**_EMP’. The table will contain data about employees. We will integrate the previous generated table into the new table by using a foreign key.  Create the table using the following fields- empid, name, father_name, and title.  You can define your table fields using predefined data types or data elements.  The best way to define table fields is to define all fields using predefined data types at first and then define table fields using data elements.  Use Predefined Type/ Data Elements to switch the modus.

3  Now we want to define the foreign key connection between both tables whereas title field should be linked to ZY**_title table.  Select Title and press ‘Foreign Key’ button in the toolbar.  SAP system comes up with a pop-up and asks for the check table.  Select your table and press ‘Enter’.  Save and activate your new table after maintain the technical setting.

4  Dynpro = dynamic programs  Programs using dynpros can be accessed by transaction code only.  Programs using dynpros are so called module pools.  Every dynpro has a unique ID in a program.

5  Text - Display elements, which cannot be changed either by the user or by the ABAP program.  Input fields - Used to display data from the ABAP program or for entering data on the screen. Linked to screen fields.  Check Boxes - Special input/output fields which the user can select (value ‘X’) or deselect (value SPACE).  Radio Buttons - Special input/output fields that are combined into groups. Within a radio button group, only a single button can be selected at any one time. When the user selects one button, all of the others are automatically deselected.

6  Buttons - Elements on the screen that trigger the PAI event of the screen flow logic when chosen by the user. There is a function code attached to each pushbutton, which is passed to the ABAP program when it is chosen.  Tabs - Areas on the screen in which you can switch between various pages  Table controls - Tabular input/output fields

7  OK_Code - Every screen has a OK_CODE field (also known as the function code field), which is not displayed on the screen. User actions that trigger the PAI (Process After Input) event also place the corresponding function code into this field, from where it is passed to the ABAP program.

8 Include Programs  In contrast to all other program types, include programs do not represent stand-alone compilation units with a memory area of their own.  Include programs cannot be executed. They merely serve as a library for ABAP source code.  They are exclusively used to organize program texts into small editable units which can be inserted at any place in other ABAP programs using the INCLUDE statement.

9 Include Programs  Includes are more suitable for logical programming units, such as data declarations, or sets of similar processing blocks.  You can create your own include programs using the ABAP Editor.

10 Screens Each screen contains an input mask that you can use for data input and output. You can design the mask yourself. When the screen mask is displayed by the SAP GUI, two events are triggered: PBO and PAI. Before the screen is displayed, the PBO (Process Before Output) event is processed. When the user interacts with the screen, the PAI (Process After Input) event is processed. Each screen is linked to a single PBO processing block and a single PAI processing block of the screen flow logic which react to these events. The PAI of a screen and the PBO of the subsequent screen together form a dialog step in the application program.

11

12 Create a program using two dynpros –  Create a new program. Use ‘Top Include’.  Modify the name of your top.  In the next pop up, you see all the program attributes. You have to adjust these attributes. Select the status ‘Test Program’ and the application ‘Cross Application’.  Assign your new program to your existing package and your transport request.  Open the top include. In this step you have to define all global variables. Such variables are available in the entire program and every screen has access to them.  These variables are the table spfli, the system variable ok_code and the work area wa_flight

13 *&----------------------------------------------------------* *& Include ZY_100_DYNPRO_TOP Module Pool ZY_100_DYNPRO *& *&----------------------------------------------------------* PROGRAM ZY_100_DYNPRO. tables spfli. data: ok_code like sy-ucomm, wa_flight type spfli.

14  Next step is the creation of the first dynpro. Right click on your program name in the navigation tree and create a new dynpro with the screen number 100.  Now you have to specify the attributes of your new dynpro. Maintain the short text and fill in the dynpro 200 as the ‘Next Screen’. This will let the dynpro jump to the dynpro 200 after the module of dynpro 100 was processed.  Next step is the creation of the layout of your first dynpro. For this call the Graphical Screen Painter by pressing the Layout button.  Select the text field button and draw a text field on your new screen. Give a name to this text field.

15  The user of your new program should choose an airline and a flight number in this screen. This information is stored in the table spfli.  To create two input fields, press the button ‘Dictionary/ Program fields window’ in the toolbar.  Type in the name spfli and press the ‘get from Dictionary’, button. SAP system reads the information from the dictionary.  Select the ‘CARRID’ and ‘CONNID’ row from the pop- up and press enter.  In the last step, we need a button to go on to our second dynpro. So add a button to your screen and name it ‘btn-select’ and choose a button text. After your enter the information you will notice that the button is red. This means that SAP is missing information.

16  The needed information is the function code. Double click on your button. This opens the attributes view and enter the function ‘SELECT’ in the red input field and press enter.  Later in your program pressing this button should automatically assign the value ‘SELECT’ to your variable ok_code. But still, the link between the function code and ok_code is missing.  To establish the link click on the ‘Element List’ button in the toolbar. This will open a new window with all the elements from your current screen.  Once again you see a red field indicating that there is still something missing.

17  Next to the red field there is a little OK- symbol which represents the variable ok_code. Please type in ok_code which will enable the link to the global variable ok_code.  Please save your new dynpro and return to the Object Navigator.  Now create a transaction code. For this, right click on your program in the navigation tree and choose the menu point ‘create -> Transaction’.  Specify the transaction code, program name and screen number.  Check and save your transaction and activate it.

18  To test your new transaction code and new program, create a new session and call the program using transaction code. (system -> create session)

19  Go back to your dynpro program and switch to the ‘Flow Logic’ tab. The flow logic of the program is divided into two parts process before output (PBO) process after input (PAI)  Insert the following source code after the process after input line PROCESS AFTER INPUT. FIELD spfli-connid select * from spfli where carrid = spfli-carrid and connid = spfli-connid.

20  Before completion of flow logic, we shall focus on the status bar and the title of new program now. Therefore uncomment the MODULE STATUS_0100 line in the flow logic by removing the * and double clicking on ‘status_0100’. You will be asked if you want to create the new module. Select yes and go on with the creation.  The system automatically proposes a name for your new status module. The name of your new PBO module is fine, but the name for PBO module include is not. Change the name and add a zy_ at the beginning of the include name.  After you hit enter, the system comes up with a short message telling you that an additional include- statement is inserted into your program.

21  Double click on the new module STATUS_0100 to navigate forward to the source code of the module.  Uncomment both SET lines and replace the placeholder ‘XXX’ with the number 100.  Now you can set the statue bar and title bar for your screen. This is done by double clicking on the ‘100’ after PF-STATUS. You are asked if you want to create the status. Answer yes and maintain the short text in the next pop up.  In this pop up you can create, edit and delete the status bar for your screen. Maintain the code for the back button by adding ‘BACK’. Save your status bar and return to the program code of your module.  Double click on the ‘100’ after ‘TITLEBAR’.

22  Maintain the title of your new title bar. Save, and activate all of your new objects.  Go to screen ‘100’ and switch to the tab ‘Flow Logic’. Uncomment the line ‘USER_COMMAND_0100’ and double click on it. You are asked by the system if you want to create the object. Answer yes and add zy_ with the name of include.  In the next step, you have to add the flow logic to your new module. The flow logic has to handle the ok_code in your program. Depending on the value of ok_code the program either should leave the execution (‘BACK’) or read some data from table spfli. Insert a case instruction:

23 MODULE USER_COMMAND_0100 INPUT. case ok_code. when 'LEAVE'. LEAVE PROGRAM. WHEN 'SELECT'. SELECT * FROM SPFLI INTO WA_FLIGHT WHERE CARRID = SPFLI-CARRID AND CONNID = SPLFI- CONNID. endcase. clear ok_code. ENDMODULE. " USER_COMMAND_0200 INPUT

24  Save, check and activate all of your objects.  Note that case instruction is case sensitive. This means that it makes a difference if you use ‘back’ or ‘BACK’ in you case statement.

25 Creation of Next Screen  Create a new screen in your program with the number ‘200’. Use screen ‘100’ as the next screen.  Switch to the layout in the Graphical Screen Painter to add some input fields to your screen as you want to display the connection details.  You want to ensure nobody makes any changes to the airline and flight number. This can be done easily by changing the attributes of these input fields. Double click on these input fields and change the input attribute to ‘not possible’.

26 Creation of Next Screen – cuntinued  Next step is to assign the OK_CODE element to the variable ok_code.  Save and activate your new screen.  Go back to the flow logic now and uncomment the ‘MODULE STATUS_0200’. Double click on the ‘STATUS_0200’ to create the new status bar. Do not forget to change the include name.  Uncomment the lines ‘PF_STATUS’ and ‘TITLEBAR’ in your module and replace the placeholder with ‘200’. Then double click on the first ‘200’ to create the status bar.  Similarly you can create the title bar.

27 MODULE status_0200 output. set PF-STATUS ‘200’. SET TITLEBAR ‘200’. spfli = wa_flight. ENDMODULE. Now save, check and activate your new screen and go back to the flow logic of your screen 200.

28 MODULE USER_COMMAND_0200 INPUT. case ok_code. when 'LEAVE'. LEAVE PROGRAM. WHEN 'BACK'. WHEN 'SAVE'. IF spfli <> wa_flight. modify spfli from spfli. endif. endcase. clear ok_code. ENDMODULE. " USER_COMMAND_0200 INPUT


Download ppt "In the next step you will enter some data records into the table. This can be done easily using the ‘Data Browser’. The data browser can be accessed via."

Similar presentations


Ads by Google