dptc1.pdf
-
Upload
mpsinghrathour -
Category
Documents
-
view
220 -
download
0
Transcript of dptc1.pdf
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 1/31
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 2/31
In this exercise we see how to use table controls in screen painter.
We will look into two situations :
1. We will create a screen and use the table control object in that screen to display the data.2. We will design two screens – First screen will have two input fields and the second screen
will display the data in the table control object.
First create a program with the name convention SAPMZ<Intials> E.g. SAPMZTC7.
Click on the Save icon and Come out by clicking the Back icon.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 3/31
Now create a screen
Click on the Screen Radio button and enter the screen number in the corresponding field.
Click on the Enter icon.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 4/31
Enter a meaningful description for the screen and also select the type of screens (in this case Normal) you are going to design.
Click on the SAVE icon to save the entries.
Click the Back icon to come back to the initial screen.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 5/31
Select the program name and click on the Change icon.
Double click on Include MZ<INI TIAL >TOP.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 6/31
Declare the global variables in this include section.
Click on SAVE icon to save your code.
Click the back icon twice to come out.
Select the screen (in our case 1000) and click on Change icon or double click on it
Click on the FULLSCREEN button on the application toolbar to design the screen.
You can get the fields / data from dictionary table as well as the internal table. In our example wewill get the fields / data from the internal table.
Click on the Dict/Prog fields button on the application toolbar to include the fields on the screenfrom the dictionary tables or internal tables declared in the program.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 7/31
Enter the internal table name or the table name and click on the Get from program button
Select the fields whose data you want to display and click on the Enter icon.
Drag the selected fields on to the screen.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 8/31
Add the GUI objects that you would want on the screen.
We will create this screen with a Text Object and a Table Control object. So click on thecorresponding icon on the object bar on the right and drag and place the object on the screen.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 9/31
Now drag the fields one by one and place them in the Table control object.
Now you need to put the labels for each of the fields that you included in the Table Controlobject.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 10/31
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 11/31
Now you need to assign a table control name to the table control object. The name can be givenin the attribute of the object and also in the program.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 12/31
Select the Table control object and click on the Attributes button on the application toolbar.
Here we have assigned the name TAB_CNTRL to the table control. We have to declare this namein the controls statement in the data declaration section of your main program.
Now click the SAVE icon.
Now get into the flow logic of the screen.
Follow the menu path Goto à Flow logic
Double click on MODULE STATUS_<SCREEN NUMBER> .
Click the Enter icon till you get into the ABAP/4 Editor (Module Pool)
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 13/31
Now write the code to retrieve the data and populate the internal table (if you have declared aninternal table).
Click on the Save icon to save the code.
Click on the BACK icon to come out.
Remove the comment mark on MODULE STATUS_<SCREEN NUMBER> line.
Click on the Save icon to save the code.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 14/31
And write the following code in on screen.
Under process before output.
loop at itabna with control tab_cntrl cursor tab_cntrl-current_line.endloop.
Note : The above code wil l work only with internal table.
Under process after input .
loop.endloop.
Click on the Field List button and include the field FCODE in the field list.
Click on the SAVE icon to save the code.
Click on the Generate icon to generate the code.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 15/31
Click on the Back icon to come out to the initial screen.
Now create a transaction code for your dialog program.
Select the program and click on the create icon
Select the Transaction radiobutton and enter a four-character code (eg. ZTC7 ) and click on thecreate icon.
Select Dialog transaction radiobutton and click on the Enter icon
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 16/31
Enter the information in the fields and click the Save icon.
Click on the BACK icon to come out to the initial screen.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 17/31
Now select the transaction code and execute it.
You should get output in the table control object.
Now we will do another example by including one more screen which we will use to select
the data i.e. we will do a selective display of data.
Select the program (SAPMZTC7) and create another screen with input fields.
Select the program and click on the create icon
Select the Screen radiobutton and enter the screen number (in our example 900) in thecorresponding field.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 18/31
Click on the Create icon.
Enter the meaningful description for the screen. And also select screen type (in this case Normal).
Click on the Save icon.
Click on the FULLSCREEN button on the application toolbar to design the input screen.
Place the input fields from tables or the internal tables on the screen.
Click on the Dict/Prog fields button the application tool bar
Enter the table name (Eg. TABNA) and click on the Get From Dict. Button.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 19/31
You will get the list of fields of the table TABNA.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 20/31
Select the fields, which will form the select criteria and drag them on the screen.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 21/31
Now follow the menu path Gotoà Flow Logic to write the flow logic for the screen.
Double click on MODULE USER_COMMAND_<SCREEN NUMBER> ( in our exampleMODULE USER_COMMAND_0900).
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 22/31
Get into the ABAP/4 editor .
Enter the following code
select * fr om tabna i nto itabna where id = tabna-id and countr y = tabna-countr y.
if tabna-id ne ' ' and tabna-country ne ' ' .
call screen '901' .endif .
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 23/31
Click on the Save icon.
Click on the Back icon to come out.
Remove comment sign on the MODULE USER_COMMAND_<SCREEN NUMBER> (Eg.MODULE USER_COMMAND_0900) line.
And Save and generate the code.
Click on the Back icon to come out.
Now let us create another screenwith table control object.
Follow the usual procedure to create the screen.
Create this screen as MODAL DIALOG BOX type.
Click on the Save icon.
Click on the FULLSCREEN button to design the screen.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 24/31
Place the required objects on the screen and also select the fields for the output from thedictionary table or the internal table.
Now you need to give a name to the table control.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 25/31
Select the table control and click on the Attribute button on the toolbar.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 26/31
Also place a command button on the screen and give a Function Code in the FctCode field of the button.
Now you need to write the flow logic for this screen.
Follow the menu path Goto à Flow Logic
Double click on theMODULE USER_COMMAND_<SCREEN NUMBER>
(Eg. MODULEUSER_COMMAND_0901).
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 27/31
And get into the ABAP/4 editor.
And write the following code
CASE FCODE.WHEN 'BACK'.
SET SCREEN ‘ 900’ .
ENDCASE.
As part of the module user_command_0901 input section.
Save the code.
Remove the comment on line containing MODULE USER_COMMAND_0901.
Now once again Save the code.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 28/31
Click on the Field List button on the application toolbar and include the field FCODE in the fieldslist.
Click on Save and Generate icons.
Click on the BACK icon to come back to the initial screen.
Now create a transaction code in the usual manner for this example.
Enter the necessary information and click on the Save icon.
Click on the Back icon to come back to the initial screen.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 29/31
Now select the transaction code that you created and execute it.
You will get the first screen i.e. screen 900.
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 30/31
7/27/2019 dptc1.pdf
http://slidepdf.com/reader/full/dptc1pdf 31/31
Now if you click on the BACK button on screen. You should get back to screen 900.