‎2007 Oct 24 11:13 AM
‎2007 Oct 24 11:17 AM
Hi Shankar,
The syntax of loop with control in table control is as follows :
Please reward points if helpful.
LOOP [AT itab [INTO wa] [CURSOR top_line] [FROM n1] [TO n2]]
WITH CONTROL contrl.
...
ENDLOOP.
Also check out transaction 'ABAPDOCU' for more information on table contol.
‎2007 Oct 24 11:38 AM
Hi,
Table Control is used in Module Pool Programming.
Table Control is used to display data of any internal table of ur program or the data from dictionary table directly ino a table format. Using table control with the help of screen painter, data can be easily displayed.It can be created manually through coding or using Table Control Wizard given in the sreen painter.
Table Controls are labeled screen elements to display and process table-type data on dynpros. In a table control, a maximum of 255 screen elements is summarized in a table control row, which can be repeated multiple times within the table control on the screen. The fields of a row have to be created only once as dynpro fields in the dynpro and as global data objects in the ABAP program. Table controls provide an area on the screen for editing the displayed table control rows which offers column headers, marking of rows and columns, horizontal and vertical scrolling with scroll bars, the definition of lead columns and saving of the current settings (see DEMO_DYNPRO). Parts of the user actions in table controls are processed on the presentation server. Vertical scrolling, saving of settings, and changes of screen size (if the resizing properties have been set accordingly when defining the table controls) trigger the event PAI.
A column of the table controls can be defined as marking column , in which the screen element is displayed like a pushbutton and treated like a checkbox (see the first column of the table control in DEMO_DYNPRO). A checked selection key sets the content of the assigned dynpro-field to "X", an unchecked key sets the content to " ". The state of the selection key is transported at the event PAI to a data object of the same name in the ABAP-program and at PBO, you can set the marker via the content of the data object.
Table Controls encapsulate step loops and make their independent use obsolete. The processing of table controls in the dynpro flow logic accordingly bases on the step loop technique using the statement LOOP. In contrary to the processing of independent step loops, the loops of the dynpro flow logic are linked with the addition WITH CONTROL with the table controls of the dynpros during the processing of table controls.
In the ABAP-program, table controls must be declared with the statement CONTROLS, whereat a special structure for handling of table controls is created.
<b>PROGRAM ZTABLECON.</b>
TABLES: LFA1, EKKO.
DATA: OKCODE1 LIKE SY-UCOMM,
OKCODE2 LIKE SY-UCOMM.
CONTROLS TABC TYPE TABLEVIEW USING SCREEN 1001.
DATA: BEGIN OF ITAB OCCURS 0,
MANDT LIKE EKKO-MANDT,
EBELN LIKE EKKO-EBELN,
BSTYP LIKE EKKO-BSTYP,
BSART LIKE EKKO-BSART,
END OF ITAB.
MODULE USER_COMMAND_1000 INPUT.
CASE OKCODE1.
WHEN 'BACK'.
SET SCREEN 0.
WHEN 'NEXT'.
SET SCREEN 1001.
SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE ITAB WHERE
LIFNR = LFA1-LIFNR.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 INPUT
MODULE MOVE_DATA OUTPUT.
EKKO-MANDT = ITAB-MANDT.
EKKO-EBELN = ITAB-EBELN.
EKKO-BSTYP = ITAB-BSTYP.
EKKO-BSART = ITAB-BSART.
ENDMODULE. " MOVE_DATA OUTPUT
MODULE USER_COMMAND_1001 INPUT.
CASE OKCODE2.
WHEN 'BACK'.
SET SCREEN 1000.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 OUTPUT
MODULE STATUS_1001 OUTPUT.
SET PF-STATUS 'MENU'.
SET TITLEBAR 'TIT'.
ENDMODULE. " STATUS_1001 OUTPUT
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'DMENU'.
SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_1000 OUTPUT
FORM ON_CTMENU_FORM1 USING CMENU TYPE REF TO CL_CTMENU.
CALL METHOD CMENU->LOAD_GUI_STATUS
EXPORTING
PROGRAM = ' ZBHTCTRL'
STATUS = 'CMENU'
MENU = CMENU.
CALL METHOD CMENU->ADD_FUNCTION
EXPORTING
FCODE = 'RX'
TEXT = 'RECIEVE'.
ENDFORM.
FLOW LOGIC:
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
PROCESS BEFORE OUTPUT.
MODULE STATUS_1001.
LOOP AT ITAB WITH CONTROL TABC CURSOR TABC-TOP_LINE.
MODULE MOVE_DATA.
ENDLOOP.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1001.
LOOP AT ITAB.
ENDLOOP.
Useful Sites
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_45b/helpdata/en/d1/801bdf454211d189710000e8322d00/content.htm
http://www.sapmaterial.com/tablecontrol_sap.html
<b>
REWARD POINTS IF USEFUL</b>
Regards
Gokul
<b>Close the Thread if your question is answered</b>
‎2007 Oct 24 12:14 PM
Hi
Table control used in module pool program
This syntax is:
CONTROLS: <in screen designing you can declare the control name (that name you can declare here> TYPE TABLEVIEW USING SCREEN <screen number>.
for example: in screen designing I can declare that VCONTROL So I can use that name here.
CONTROLS : VCONTROL TYPE TABLEVIEW USING SCREEN 100.
This is the main loginc in table control
‎2007 Oct 24 2:06 PM
in main program declare
CONTROLS: table control name TYPE TABLEVIEW USING SCREEN (screen no).
In PBO you have to write::
LOOP AT Internal table WITH CONTROL Table control name
CURSOR Table control name-current_line.
MODULE zz_split_code_move
ENDLOOP.
double click on this module::
MOVE-CORRESPONDING internal table name TO screen field name.
In PAI you must have to write
LOOP
ENDLOOP.