SlideShare a Scribd company logo
1 of 38
ITB258 ABAP Programming Lecture 11 Using Tables in Transactions
Objectives ,[object Object],[object Object],[object Object]
Using Tables in a Screen ,[object Object],[object Object],[object Object]
Table Control
Table Controls ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Creating a Table Control ,[object Object],CONTROLS  ctrl  TYPE TABLEVIEW  USING SCREEN  scr . ,[object Object],[object Object],[object Object]
CXTAB_CONTROL
Adding a Table Control to a Screen In the Graphical Fullscreen Editor choose the  Table Control  element button. Use the left mouse button to position  and size the control on the screen.
Adding a Table Control to a Screen Enter a Name for the Table Control
Adding Fields to a Table Control Press Dict/program fields pushbutton
Adding Fields to a Table Control Enter database table name Select Get From Dictionary
Adding Fields to a Table Control Enter internal table name Select Get From program
Adding Fields to a Table Control Mark the fields to be added to the table control Then click on Copy to select the fields
Adding Fields to a Table Control Drag the selected fields into the table control,  then release the mouse button.
Adding Fields to a Table Control The label for each column is a text field, created by clicking on the text field icon and then dragging the new text field onto the header of the column before typing in the label Text field icon
Table Control Principles Database Table Internal Table (Buffer) 1. Internal Table filled with selected data
Table Control Principles Internal Table (Buffer) 2. Table Control contents filled from internal table Table Control
Table Control Principles Internal Table (Buffer) Table Control 3. Changes to Table Control contents copied to internal table
Table Control Principles Database Table Internal Table (Buffer) 4. When screen is closed, internal table contents copied back to database
Table Control Principles PBO PAI Select rows from the database into an internal table Screen 1 PBO PAI Screen 2 ( with table control ) LOOP ... read internal table into  table control line by line ENDLOOP. LOOP ... update internal table from table control line by line ENDLOOP.
Table Control Principles ,[object Object],[object Object],LOOP start LOOP end transport ABAP table control fields to screen fields transport remaining ABAP fields to screen fields PROCESS BEFORE OUTPUT
Table Control Principles ,[object Object],[object Object],[object Object],LOOP start LOOP end transport screen table control fields to ABAP module pool fields transport all fields from the screen to ABAP fields excluding table control fields PROCESS AFTER INPUT
Updating Data in Table Controls ,[object Object],[object Object],[object Object],[object Object]
Table Controls in the Flow Logic ,[object Object],PROCESS BEFORE OUTPUT. LOOP AT ITAB WITH CONTROL FLIGHTS CURSOR FLIGHTS-CURRENT_LINE. ENDLOOP. PROCESS AFTER INPUT. LOOP AT ITAB. MODULE MODIFY_ITAB.  ENDLOOP. MODULE MODIFY_ITAB INPUT. MODIFY ITAB INDEX FLIGHTS-CURRENT_LINE. ENDMODULE.
Table Controls in the Flow Logic ,[object Object],PROCESS BEFORE OUTPUT. LOOP WITH CONTROL FLIGHTS. MODULE READ_ITAB. ENDLOOP. PROCESS AFTER INPUT. LOOP WITH CONTROL FLIGHTS. MODULE MODIFY_ITAB.  ENDLOOP. MODULE READ_ITAB OUTPUT. READ TABLE ITAB INDEX  FLIGHTS-CURRENT_LINE. IF SY-SUBRC EQ 0. MOVE-CORRESPONDING ITAB TO SFLIGHT. ELSE. EXIT FROM STEP-LOOP. ENDIF. ENDMODULE. MODULE MODIFY_ITAB INPUT. MOVE-CORRESPONDING SFLIGHT TO ITAB. MODIFY ITAB INDEX  FLIGHTS-CURRENT_LINE. ENDMODULE.
Table Controls in the Flow Logic PROCESS BEFORE OUTPUT. LOOP WITH CONTROL FLIGHTS. MODULE READ_ITAB. ENDLOOP. PROCESS AFTER INPUT. LOOP WITH CONTROL FLIGHTS. CHAIN. FIELD: SFLIGHT-PRICE, SFLIGHT-FLDATE. MODULE MODIFY_ITAB  ON CHAIN-REQUEST. ENDCHAIN. ENDLOOP. MODULE READ_ITAB OUTPUT. READ TABLE ITAB INDEX  FLIGHTS-CURRENT_LINE. IF SY-SUBRC EQ 0. MOVE-CORRESPONDING ITAB TO SFLIGHT. ELSE. EXIT FROM STEP-LOOP. ENDIF. ENDMODULE. MODULE MODIFY_ITAB INPUT. MOVE-CORRESPONDING SFLIGHT TO ITAB. MODIFY ITAB INDEX  FLIGHTS-CURRENT_LINE. ENDMODULE. ,[object Object]
Table Control Attributes data: begin of cxtab_control, ... cols type  cxtab_column  occurs 10, end of cxtab_control. data: begin of cxtab_column, ... selected, screen like  screen , end of cxtab_column. SCREEN FIELDS: name length active ...
Sorting a Table Control by a Selected Field ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 
Sample Fields List  Output only fields Table Control
Handling Line Selection PROCESS AFTER INPUT. LOOP AT ITAB. FIELD ITAB-MARK   MODULE MODIFY_ITAB ON REQUEST. ENDLOOP. MODULE MODIFY_ITAB INPUT. MODIFY ITAB INDEX  FLIGHTS-CURRENT_LINE. ENDMODULE.
Updating the Internal Table PROCESS AFTER INPUT. LOOP WITH CONTROL FLIGHTS. CHAIN. FIELD: SFLIGHT-PRICE, SFLIGHT-FLDATE. MODULE MODIFY_ITAB  ON CHAIN-REQUEST. ENDCHAIN. ENDLOOP. Method 1 Method 2 PROCESS AFTER INPUT. LOOP AT ITAB. CHAIN. FIELD: SFLIGHT-PRICE, SFLIGHT-FLDATE. MODULE MODIFY_ITAB  ON CHAIN-REQUEST. ENDCHAIN. ENDLOOP. MODULE MODIFY_ITAB INPUT. ITAB-MARK = 'X'. MODIFY ITAB INDEX  FLIGHTS-CURRENT_LINE. ENDMODULE. MODULE MODIFY_ITAB INPUT. MOVE-CORRESPONDING SFLIGHT TO ITAB. ITAB-MARK = 'X'. MODIFY ITAB INDEX  FLIGHTS-CURRENT_LINE. ENDMODULE.
Updating the Database Saving the Updated Data (both methods) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Updating the database ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Updating the database ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Conclusion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Related Reading ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Next Week ,[object Object],[object Object]

More Related Content

Similar to 258lec11

Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007paulguerin
 
Sql Queries
Sql QueriesSql Queries
Sql Querieswebicon
 
222066369 clad-study-guide
222066369 clad-study-guide222066369 clad-study-guide
222066369 clad-study-guidehomeworkping9
 
Complete list of all sap abap keywords
Complete list of all sap abap keywordsComplete list of all sap abap keywords
Complete list of all sap abap keywordsPrakash Thirumoorthy
 
9 - Advanced Functions in MS Excel.pptx
9 - Advanced Functions in MS Excel.pptx9 - Advanced Functions in MS Excel.pptx
9 - Advanced Functions in MS Excel.pptxSheryldeVilla2
 
Excel useful tips
Excel useful tipsExcel useful tips
Excel useful tipsMohsin Azad
 
Complete reference to_abap_basics
Complete reference to_abap_basicsComplete reference to_abap_basics
Complete reference to_abap_basicsAbhishek Dixit
 
Lecture02 abap on line
Lecture02 abap on lineLecture02 abap on line
Lecture02 abap on lineMilind Patil
 
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptxV.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptxEmmanuelAzuela3
 
0104 abap dictionary
0104 abap dictionary0104 abap dictionary
0104 abap dictionaryvkyecc1
 

Similar to 258lec11 (20)

Abap slide class3
Abap slide class3Abap slide class3
Abap slide class3
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
 
Interview Preparation
Interview PreparationInterview Preparation
Interview Preparation
 
Abap reports
Abap reportsAbap reports
Abap reports
 
Sql Queries
Sql QueriesSql Queries
Sql Queries
 
222066369 clad-study-guide
222066369 clad-study-guide222066369 clad-study-guide
222066369 clad-study-guide
 
Excel Tips
Excel TipsExcel Tips
Excel Tips
 
Complete list of all sap abap keywords
Complete list of all sap abap keywordsComplete list of all sap abap keywords
Complete list of all sap abap keywords
 
9 - Advanced Functions in MS Excel.pptx
9 - Advanced Functions in MS Excel.pptx9 - Advanced Functions in MS Excel.pptx
9 - Advanced Functions in MS Excel.pptx
 
Excel useful tips
Excel useful tipsExcel useful tips
Excel useful tips
 
Excel tips
Excel tipsExcel tips
Excel tips
 
Excel tips
Excel tipsExcel tips
Excel tips
 
Excel Useful Tips
Excel Useful TipsExcel Useful Tips
Excel Useful Tips
 
35 Useful Excel Tips
35 Useful Excel Tips35 Useful Excel Tips
35 Useful Excel Tips
 
Excel useful tips
Excel useful tipsExcel useful tips
Excel useful tips
 
Excel useful tips
Excel useful tipsExcel useful tips
Excel useful tips
 
Complete reference to_abap_basics
Complete reference to_abap_basicsComplete reference to_abap_basics
Complete reference to_abap_basics
 
Lecture02 abap on line
Lecture02 abap on lineLecture02 abap on line
Lecture02 abap on line
 
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptxV.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
 
0104 abap dictionary
0104 abap dictionary0104 abap dictionary
0104 abap dictionary
 

Recently uploaded

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Recently uploaded (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 

258lec11

  • 1. ITB258 ABAP Programming Lecture 11 Using Tables in Transactions
  • 2.
  • 3.
  • 5.
  • 6.
  • 8. Adding a Table Control to a Screen In the Graphical Fullscreen Editor choose the Table Control element button. Use the left mouse button to position and size the control on the screen.
  • 9. Adding a Table Control to a Screen Enter a Name for the Table Control
  • 10. Adding Fields to a Table Control Press Dict/program fields pushbutton
  • 11. Adding Fields to a Table Control Enter database table name Select Get From Dictionary
  • 12. Adding Fields to a Table Control Enter internal table name Select Get From program
  • 13. Adding Fields to a Table Control Mark the fields to be added to the table control Then click on Copy to select the fields
  • 14. Adding Fields to a Table Control Drag the selected fields into the table control, then release the mouse button.
  • 15. Adding Fields to a Table Control The label for each column is a text field, created by clicking on the text field icon and then dragging the new text field onto the header of the column before typing in the label Text field icon
  • 16. Table Control Principles Database Table Internal Table (Buffer) 1. Internal Table filled with selected data
  • 17. Table Control Principles Internal Table (Buffer) 2. Table Control contents filled from internal table Table Control
  • 18. Table Control Principles Internal Table (Buffer) Table Control 3. Changes to Table Control contents copied to internal table
  • 19. Table Control Principles Database Table Internal Table (Buffer) 4. When screen is closed, internal table contents copied back to database
  • 20. Table Control Principles PBO PAI Select rows from the database into an internal table Screen 1 PBO PAI Screen 2 ( with table control ) LOOP ... read internal table into table control line by line ENDLOOP. LOOP ... update internal table from table control line by line ENDLOOP.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. Table Control Attributes data: begin of cxtab_control, ... cols type cxtab_column occurs 10, end of cxtab_control. data: begin of cxtab_column, ... selected, screen like screen , end of cxtab_column. SCREEN FIELDS: name length active ...
  • 28.
  • 29.  
  • 30. Sample Fields List Output only fields Table Control
  • 31. Handling Line Selection PROCESS AFTER INPUT. LOOP AT ITAB. FIELD ITAB-MARK MODULE MODIFY_ITAB ON REQUEST. ENDLOOP. MODULE MODIFY_ITAB INPUT. MODIFY ITAB INDEX FLIGHTS-CURRENT_LINE. ENDMODULE.
  • 32. Updating the Internal Table PROCESS AFTER INPUT. LOOP WITH CONTROL FLIGHTS. CHAIN. FIELD: SFLIGHT-PRICE, SFLIGHT-FLDATE. MODULE MODIFY_ITAB ON CHAIN-REQUEST. ENDCHAIN. ENDLOOP. Method 1 Method 2 PROCESS AFTER INPUT. LOOP AT ITAB. CHAIN. FIELD: SFLIGHT-PRICE, SFLIGHT-FLDATE. MODULE MODIFY_ITAB ON CHAIN-REQUEST. ENDCHAIN. ENDLOOP. MODULE MODIFY_ITAB INPUT. ITAB-MARK = 'X'. MODIFY ITAB INDEX FLIGHTS-CURRENT_LINE. ENDMODULE. MODULE MODIFY_ITAB INPUT. MOVE-CORRESPONDING SFLIGHT TO ITAB. ITAB-MARK = 'X'. MODIFY ITAB INDEX FLIGHTS-CURRENT_LINE. ENDMODULE.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.

Editor's Notes

  1. Very often it is desirable to be able to represent a one-to-many relationship on the screen. For instance, given an airline carrier and a flight code show all the scheduled flights. (Or given an order number show all the ordered products.) ABAP provides the ‘table control’ as a graphical element on a screen that is capable of holding and displaying multiple rows of a table in a ‘spreadsheet’ format.
  2. This slide illustrates a table control object in a screen.
  3. The table control object has many features built in to enhance screen display and usability. They include the ability to scroll through records (horizontally and vertically) and inside a field if the field width is greater than the table control’s column width. Table controls also allow the user to dynamically resize column widths, reorder columns, and select columns and rows for subsequent processing.
  4. As well as drawing the table control on the screen it is necessary to declare the table control as a data item (in the TOP include program for the transaction).
  5. To view the structure of the cxtab-control object use the Repository Browser and choose Dictionary Objects…Choose the Type Group radiobutton and enter CXTAB…Press the Display icon on the application toolbar. Note that a component of the object is an internal table, cols. Each displayed field of the table control will have a row in the cols internal table which describes various attributes of the field.
  6. There are a set of programming principles that should be adhered to when using table controls and step loops. Data from the database should be initially loaded into an internal table. (This means that the database is accessed for read purposes only once in the transaction.) Next the rows of the internal table are loaded into the table control Any changes that are made to the data are then saved back to the internal table. At the end of the transaction, the contents of the internal table can be written back to the database, again to minimise database I/O.
  7. There are a set of programming principles that should be adhered to when using table controls and step loops. Data from the database should be initially loaded into an internal table. (This means that the database is accessed for read purposes only once in the transaction.) Next the rows of the internal table are loaded into the table control Any changes that are made to the data are then saved back to the internal table. At the end of the transaction, the contents of the internal table can be written back to the database, again to minimise database I/O.
  8. There are a set of programming principles that should be adhered to when using table controls and step loops. Data from the database should be initially loaded into an internal table. (This means that the database is accessed for read purposes only once in the transaction.) Next the rows of the internal table are loaded into the table control Any changes that are made to the data are then saved back to the internal table. At the end of the transaction, the contents of the internal table can be written back to the database, again to minimise database I/O.
  9. There are a set of programming principles that should be adhered to when using table controls and step loops. Data from the database should be initially loaded into an internal table. (This means that the database is accessed for read purposes only once in the transaction.) Next the rows of the internal table are loaded into the table control Any changes that are made to the data are then saved back to the internal table. At the end of the transaction, the contents of the internal table can be written back to the database, again to minimise database I/O.
  10. PAI logic for screen 1 loads the internal table with data from the database according to the entries supplied by the user. PBO logic for screen 2 populates the table control from the internal table (buffer). User action in screen 2 triggers the PAI logic. PAI logic updates the internal table with new values entered (into the table control screen fields) by the user. PAI logic is triggered by actions such as scrolling down a single row as well as actions such as BACK, EXIT, etc. Unless the user action causes the transaction to leave the current screen, after the PAI modules have been executed, the PBO modules for the screen are executed again. Thus the table control fields are updated/refreshed after every user action.
  11. In PBO processing fields are transported from the module pool to the screen in a predefined order. 1. The table control step loop is processed row by row. Fields with corresponding names are transported from the module pool to the screen. 2. After the step loop has been processed all remaining module pool fields are transported to the screen.
  12. The ABAP language provides two mechanisms for loading the table control with data from the internal table and then storing the altered rows of the table control back to the internal table.
  13. In the flow logic you can read an internal table using the LOOP statement. You define the reference to the relevant able control by specifying WITH CONTROL <ctrl> You determine which table entry is to be read by specifying CURSOR <ctrl>-CURRENT_LINE. After the read operation the field contents are placed in the header line of the internal table. If the fields in the table control have the same name as the internal they will be filled automatically. (Otherwise you need to write a module to transfer the internal table fields to the screen fields.) You must reflect any changes the user makes to the fields of the table control in the internal table otherwise they will not appear when the screen is redisplayed after PBO processing, (eg, after the user presses Enter or scrolls) However, this processing should be performed only if changes have actually been made to the screen fields of the table control (hence the use of the ON REQUEST)
  14. If you use a LOOP statement without an internal table in the flow logic, you must read the data in a PBO module which is called each time the loop is processed. Since, in this case, the system cannot determine the number of internal table entries itself, you must use the EXIT FROM STEP-LOOP statement to ensure that no blank lines are displayed in the table control if there are no more corresponding entries in the internal table.
  15. If you use a LOOP statement without an internal table in the flow logic, you must read the data in a PBO module which is called each time the loop is processed. Since, in this case, the system cannot determine the number of internal table entries itself, you must use the EXIT FROM STEP-LOOP statement to ensure that no blank lines are displayed in the table control if there are no more corresponding entries in the internal table.
  16. Sorting the display by a selected column is very simple to implement using the table control attributes <ctrl>-SELECTED and <ctrl>-SCREEN-NAME. Here we assume that the table control displays the fields of an internal table (ITAB) as per Option 1 discussed previously. WA-SCREEN-NAME refers to the name of the selected column of the table control. The expression (WA-SCREEN-NAME+5) refers to the contents of the variable offset 5 characters from the left. In this example WA-SCREEN-NAME will have a value like ITAB-PRICE. The expression (WA-SCREEN-NAME+5) will have the value PRICE. SORT ITAB BY (WA-SCREEN-NAME+5) will resolve to SORT ITAB BY PRICE. To adjust this code for use in your own program substitute the name of the control used in your program and calculate the offset required to trim the structure name from the selected SCREEN-NAME.
  17. This slide illustrates a table control object in a screen.