<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic table control code... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-code/m-p/3460335#M831430</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have 2 screens  .. screen 1 -- company code.&lt;/P&gt;&lt;P&gt;                                             plant, year, posting period.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                            screen 2 --  contains a table control &lt;/P&gt;&lt;P&gt;                                              with fields invoice number,&lt;/P&gt;&lt;P&gt;                                               cheque no., check date ,&lt;/P&gt;&lt;P&gt;                                                amount.&lt;/P&gt;&lt;P&gt;I have to update all these values into a ztable . and also &lt;/P&gt;&lt;P&gt;modify , delete and retrieve the data from ztable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please send me the complete coding,, &lt;/P&gt;&lt;P&gt;its very urgent,,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will be rewarded,,,,,,,,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Mar 2008 09:57:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-03T09:57:13Z</dc:date>
    <item>
      <title>table control code...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-code/m-p/3460335#M831430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have 2 screens  .. screen 1 -- company code.&lt;/P&gt;&lt;P&gt;                                             plant, year, posting period.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                            screen 2 --  contains a table control &lt;/P&gt;&lt;P&gt;                                              with fields invoice number,&lt;/P&gt;&lt;P&gt;                                               cheque no., check date ,&lt;/P&gt;&lt;P&gt;                                                amount.&lt;/P&gt;&lt;P&gt;I have to update all these values into a ztable . and also &lt;/P&gt;&lt;P&gt;modify , delete and retrieve the data from ztable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please send me the complete coding,, &lt;/P&gt;&lt;P&gt;its very urgent,,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;will be rewarded,,,,,,,,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2008 09:57:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-code/m-p/3460335#M831430</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-03T09:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: table control code...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-code/m-p/3460336#M831431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This uploads table control with the data.u have to write this in pbo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select * from zcust_master2 into table wi_cust1.    "This uploads the table control with data from customer master&lt;/P&gt;&lt;P&gt;  tb-lines = sy-dbcnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To save, create a module in PAI and write the following code.&lt;/P&gt;&lt;P&gt;ex:&lt;/P&gt;&lt;P&gt; case sy-ucomm.&lt;/P&gt;&lt;P&gt;    when 'SAVE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         modify wi_cust1 index tb-current_line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;          modify zcust_master2 from table wi_cust1.&lt;/P&gt;&lt;P&gt;          message s005(zmsgbanks1).&lt;/P&gt;&lt;P&gt;        else.&lt;/P&gt;&lt;P&gt;          message e006(zmsgbanks1).&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;To delete,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Case sy-ucomm.&lt;/P&gt;&lt;P&gt;when 'DELETE'.&lt;/P&gt;&lt;P&gt;Write the code as per ur requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAMPLE CODE:&lt;/P&gt;&lt;P&gt;In the flow logic of the screen 9000, write the following code.&lt;/P&gt;&lt;P&gt;PROCESS BEFORE OUTPUT.&lt;/P&gt;&lt;P&gt;MODULE set_status.&lt;/P&gt;&lt;P&gt;MODULE get_t_ctrl_lines.&lt;/P&gt;&lt;P&gt;LOOP AT i_makt WITH CONTROL t_ctrl CURSOR t_ctrl-current_line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynamic screen modifications &lt;/P&gt;&lt;P&gt;MODULE set_screen_fields.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt;LOOP AT i_makt.&lt;/P&gt;&lt;P&gt;FIELD i_makt-pick MODULE check.&lt;/P&gt;&lt;P&gt;FIELD i_makt-zmatnr MODULE zmatnr .&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;MODULE user_command_9000.&lt;/P&gt;&lt;P&gt;In the program, write the following code.&lt;/P&gt;&lt;P&gt;PROGRAM SAPMZTC MESSAGE-ID zz.&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tables Declaration &lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;TABLES: zzz_makt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Internal table Declaration &lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;DATA : i_makt TYPE STANDARD TABLE OF zzz_makt WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table control Declaration &lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;CONTROLS: t_ctrl TYPE TABLEVIEW USING SCREEN '9000'.&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Variable Declaration &lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;DATA : flg, "Flag to set the change mode&lt;/P&gt;&lt;P&gt;ln TYPE i. "No. of records&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Module get_T_CTRL_lines OUTPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Populating data &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;MODULE get_t_ctrl_lines OUTPUT.&lt;/P&gt;&lt;P&gt;SELECT zmatnr zmaktx&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE i_makt&lt;/P&gt;&lt;P&gt;FROM zzz_makt.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE i_makt LINES ln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To make the vertical scroll bar to come on runtime &lt;/P&gt;&lt;P&gt;t_ctrl-lines = ln + 100.&lt;/P&gt;&lt;P&gt;ENDMODULE. " get_T_CTRL_lines OUTPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Module USER_COMMAND_9000 INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Triggering event according to the user command &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;MODULE user_command_9000 INPUT.&lt;/P&gt;&lt;P&gt;DATA :lv_fcode LIKE sy-ucomm, "Function Code&lt;/P&gt;&lt;P&gt;lv_answer(1) type c. "Storing the answer&lt;/P&gt;&lt;P&gt;lv_fcode = sy-ucomm.&lt;/P&gt;&lt;P&gt;CASE lv_fcode.&lt;/P&gt;&lt;P&gt;WHEN 'CHANGE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting the flag to make the table control in editable mode[excluding &lt;/P&gt;&lt;P&gt;primary key]. &lt;/P&gt;&lt;P&gt;flg = 'Y'.&lt;/P&gt;&lt;P&gt;WHEN 'DELETE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting the flag to make the table control in editable mode after &lt;/P&gt;&lt;P&gt;deleting the selected line &lt;/P&gt;&lt;P&gt;flg = 'Y'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Confirmation of delete &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'POPUP_TO_CONFIRM'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;TITLEBAR = 'Confirm'&lt;/P&gt;&lt;P&gt;text_question = 'Are you sure to delete from database?'&lt;/P&gt;&lt;P&gt;TEXT_BUTTON_1 = 'Yes'(001)&lt;/P&gt;&lt;P&gt;TEXT_BUTTON_2 = 'No'(002)&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;ANSWER = lv_answer.&lt;/P&gt;&lt;P&gt;if lv_answer eq '1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Updating the database table from the internal table &lt;/P&gt;&lt;P&gt;UPDATE zzz_makt FROM TABLE i_makt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Deleting the selected row from the internal table &lt;/P&gt;&lt;P&gt;DELETE i_makt WHERE pick = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Deleting the selected row from the database table &lt;/P&gt;&lt;P&gt;DELETE FROM zzz_makt WHERE pick = 'X'.&lt;/P&gt;&lt;P&gt;MESSAGE s005 WITH 'Deleted Successfull&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;WHEN 'SAVE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inserting new record or updating existing record in database table &lt;/P&gt;&lt;P&gt;from the internal table &lt;/P&gt;&lt;P&gt;MODIFY zzz_makt FROM TABLE i_makt.&lt;/P&gt;&lt;P&gt;MESSAGE s005 WITH 'Saved Successfully'.&lt;/P&gt;&lt;P&gt;WHEN 'BACK'.&lt;/P&gt;&lt;P&gt;SET SCREEN '0'.&lt;/P&gt;&lt;P&gt;WHEN 'EXIT' OR 'CANCEL'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Leaving the program &lt;/P&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMODULE. " USER_COMMAND_9000 INPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Module set_screen_fields OUTPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting the screen fields &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;MODULE set_screen_fields OUTPUT.&lt;/P&gt;&lt;P&gt;LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;IF flg IS INITIAL.&lt;/P&gt;&lt;P&gt;screen-input = 0.&lt;/P&gt;&lt;P&gt;ELSEIF ( flg EQ 'Y' ).&lt;/P&gt;&lt;P&gt;IF ( ( screen-name = 'I_MAKT-ZMAKTX'&lt;/P&gt;&lt;P&gt;OR screen-name = 'I_MAKT-CHECK1' )&lt;/P&gt;&lt;P&gt;AND t_ctrl-current_line LE ln ) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Making the screen fields as editable &lt;/P&gt;&lt;P&gt;screen-input = 1.&lt;/P&gt;&lt;P&gt;ELSEIF ( ( screen-name = 'I_MAKT-ZMATNR' )&lt;/P&gt;&lt;P&gt;AND t_ctrl-current_line LE ln ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Making the screen field as uneditable &lt;/P&gt;&lt;P&gt;screen-input = 0.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modifying the screen after making changes &lt;/P&gt;&lt;P&gt;MODIFY SCREEN.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDMODULE. " set_screen_fields OUTPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Module zmatnr INPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appending records to the internal table &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;MODULE zmatnr INPUT.&lt;/P&gt;&lt;P&gt;MODIFY i_makt INDEX t_ctrl-current_line.&lt;/P&gt;&lt;P&gt;IF t_ctrl-current_line GT ln.&lt;/P&gt;&lt;P&gt;READ TABLE i_makt WITH KEY zmatnr = i_makt-zmatnr.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inserting record if it does not exist in database &lt;/P&gt;&lt;P&gt;APPEND i_makt.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;MESSAGE i005 WITH 'Material Number' i_makt-zmatnr 'already exists'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDMODULE. " zmatnr INPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Module set_status OUTPUT&lt;/P&gt;&lt;P&gt;&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting the GUI status &lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------------" /&gt;&lt;P&gt;MODULE set_status OUTPUT.&lt;/P&gt;&lt;P&gt;SET PF-STATUS 'ZSTATUS'.&lt;/P&gt;&lt;P&gt;SET TITLEBAR 'ZTITLE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMODULE. " set_status OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Module CHECK INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Modify the internal table using the current line in table control &lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;MODULE check INPUT.&lt;/P&gt;&lt;P&gt;MODIFY i_makt INDEX t_ctrl-current_line.&lt;/P&gt;&lt;P&gt;ENDMODULE. " CHECK INPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk this link too, i got the above sample code from this link..&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="765278"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arunsri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2008 10:26:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-code/m-p/3460336#M831431</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-03T10:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: table control code...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-code/m-p/3460337#M831432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;/BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hello Everyone,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; i have 2 screens  .. screen 1 -- company code.&lt;/P&gt;&lt;P&gt;&amp;gt;                                              plant, year, posting period.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;                             screen 2 --  contains a table control &lt;/P&gt;&lt;P&gt;&amp;gt;                                               with fields invoice number,&lt;/P&gt;&lt;P&gt;&amp;gt;                                                cheque no., check date ,&lt;/P&gt;&lt;P&gt;&amp;gt;                                                 amount.&lt;/P&gt;&lt;P&gt;&amp;gt; I have to update all these values into a ztable . and also &lt;/P&gt;&lt;P&gt;&amp;gt; modify , delete and retrieve the data from ztable.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; please send me the complete coding,, &lt;/P&gt;&lt;P&gt;&amp;gt; its very urgent,,,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; will be rewarded,,,,,,,,&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 1&lt;/P&gt;&lt;P&gt;Applies To:&lt;/P&gt;&lt;P&gt;Usage of Table Control in ABAP&lt;/P&gt;&lt;P&gt;Summary&lt;/P&gt;&lt;P&gt;Normally we use wizard if we are working with table control. This document helps us how to create a table&lt;/P&gt;&lt;P&gt;control without using a wizard and how to manipulate the database based on the records in the table control.&lt;/P&gt;&lt;P&gt;All the fields in the screen should be disabled .After clicking that &amp;#145;Change&amp;#146; button, we should be able to insert&lt;/P&gt;&lt;P&gt;new records and update existing records &lt;A href="Except primary key"&gt;&lt;/A&gt;. Save in the standard toolbar will be used to&lt;/P&gt;&lt;P&gt;save the changes made. &amp;#145;Delete&amp;#146; button should be used to delete the rows selected from the database.&lt;/P&gt;&lt;P&gt;A custom table zzz_makt with the following fields is used in this program.&lt;/P&gt;&lt;P&gt;Fields FieldType&lt;/P&gt;&lt;P&gt;ZMANDT MANDT&lt;/P&gt;&lt;P&gt;ZMATNR MATNR(Key field)&lt;/P&gt;&lt;P&gt;ZMAKTX MAKTX&lt;/P&gt;&lt;P&gt;PICK CHAR1&lt;/P&gt;&lt;P&gt;Company and Title: Project Engineer in Wipro Technologies&lt;/P&gt;&lt;P&gt;Date: 08 March 2005&lt;/P&gt;&lt;P&gt;Table of Contents&lt;/P&gt;&lt;P&gt;Applies To:.......................................................................................................................................1&lt;/P&gt;&lt;P&gt;Summary .........................................................................................................................................1&lt;/P&gt;&lt;P&gt;Table of Contents .............................................................................................................................1&lt;/P&gt;&lt;P&gt;Procedure &amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;&amp;#133;..2&lt;/P&gt;&lt;P&gt;Code....................................................................................... Error! Bookmark not defined.0&lt;/P&gt;&lt;P&gt;Output Screens ...................................................................... Error! Bookmark not defined.7&lt;/P&gt;&lt;P&gt;Disclaimer &amp;amp; Liability Notice.........................................................................................................201&lt;/P&gt;&lt;P&gt;Author Bio....................................................................................................................................212&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 2&lt;/P&gt;&lt;P&gt;Procedure&lt;/P&gt;&lt;P&gt;Go to SE38 -&amp;gt; Create a program with executable type as &amp;#145;Module Pool&amp;#146;.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 3&lt;/P&gt;&lt;P&gt;After saving this, click display object list.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 4&lt;/P&gt;&lt;P&gt;Right click the program name on the left side. Click Create-&amp;gt; Screen. Then give screen no. &lt;A href="as 9000"&gt;&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Then fill the attributes of the screen as follows.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 5&lt;/P&gt;&lt;P&gt;Click the layout button. Drag the table control from the controls and place it on screen.&lt;/P&gt;&lt;P&gt;Set the properties of table control as follows.&lt;/P&gt;&lt;P&gt;In the properties,&lt;/P&gt;&lt;P&gt;(1) The separators checkboxes need to be checked.&lt;/P&gt;&lt;P&gt;(2) The W/Selcolumn should be given a name which is having char1 in the database table so that the&lt;/P&gt;&lt;P&gt;selection column is visible in the table control.&lt;/P&gt;&lt;P&gt;(3) In order to view the horizontal scrollbar at runtime, choose the option none in Column sel.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 6&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 7&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 8&lt;/P&gt;&lt;P&gt;Create the status by right clicking create -&amp;gt;GUI Status in the object display.&lt;/P&gt;&lt;P&gt;Similarly create title.&lt;/P&gt;&lt;P&gt;Set the SAVE , BACK, EXIT, CANCEL in standard toolbar and activate it.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 9&lt;/P&gt;&lt;P&gt;Create a transaction by right clicking create -&amp;gt;Transaction in the object display. Enter required fields.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 10&lt;/P&gt;&lt;P&gt;Code&lt;/P&gt;&lt;P&gt;In the flow logic of the screen 9000, write the following code.&lt;/P&gt;&lt;P&gt;PROCESS BEFORE OUTPUT.&lt;/P&gt;&lt;P&gt;MODULE set_status.&lt;/P&gt;&lt;P&gt;MODULE get_t_ctrl_lines.&lt;/P&gt;&lt;P&gt;LOOP AT i_makt WITH CONTROL t_ctrl CURSOR t_ctrl-current_line.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Dynamic screen modifications&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;MODULE set_screen_fields.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt;LOOP AT i_makt.&lt;/P&gt;&lt;P&gt;FIELD i_makt-pick MODULE check.&lt;/P&gt;&lt;P&gt;FIELD i_makt-zmatnr MODULE zmatnr .&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;MODULE user_command_9000.&lt;/P&gt;&lt;P&gt;In the program, write the following code.&lt;/P&gt;&lt;P&gt;PROGRAM SAPMZTC MESSAGE-ID zz.&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Tables Declaration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;TABLES: zzz_makt.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 11&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal table Declaration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;DATA : i_makt TYPE STANDARD TABLE OF zzz_makt WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Table control Declaration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;CONTROLS: t_ctrl TYPE TABLEVIEW USING SCREEN '9000'.&lt;/P&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Variable Declaration&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;***********************************************************************&lt;/P&gt;&lt;P&gt;DATA : flg, "Flag to set the change mode&lt;/P&gt;&lt;P&gt;ln TYPE i. "No. of records&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Module get_T_CTRL_lines OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Populating data&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE get_t_ctrl_lines OUTPUT.&lt;/P&gt;&lt;P&gt;SELECT zmatnr zmaktx&lt;/P&gt;&lt;P&gt;INTO CORRESPONDING FIELDS OF TABLE i_makt&lt;/P&gt;&lt;P&gt;FROM zzz_makt.&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE i_makt LINES ln.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To make the vertical scroll bar to come on runtime&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;t_ctrl-lines = ln + 100.&lt;/P&gt;&lt;P&gt;ENDMODULE. " get_T_CTRL_lines OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Module USER_COMMAND_9000 INPUT&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 12&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Triggering event according to the user command&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE user_command_9000 INPUT.&lt;/P&gt;&lt;P&gt;DATA :lv_fcode LIKE sy-ucomm, "Function Code&lt;/P&gt;&lt;P&gt;lv_answer(1) type c. "Storing the answer&lt;/P&gt;&lt;P&gt;lv_fcode = sy-ucomm.&lt;/P&gt;&lt;P&gt;CASE lv_fcode.&lt;/P&gt;&lt;P&gt;WHEN 'CHANGE'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setting the flag to make the table control in editable mode[excluding&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;primary key].&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;flg = 'Y'.&lt;/P&gt;&lt;P&gt;WHEN 'DELETE'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setting the flag to make the table control in editable mode after&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;deleting the selected line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;flg = 'Y'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Confirmation of delete&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;CALL FUNCTION 'POPUP_TO_CONFIRM'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;TITLEBAR = 'Confirm'&lt;/P&gt;&lt;P&gt;text_question = 'Are you sure to delete from database?'&lt;/P&gt;&lt;P&gt;TEXT_BUTTON_1 = 'Yes'(001)&lt;/P&gt;&lt;P&gt;TEXT_BUTTON_2 = 'No'(002)&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;ANSWER = lv_answer.&lt;/P&gt;&lt;P&gt;if lv_answer eq '1'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Updating the database table from the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;UPDATE zzz_makt FROM TABLE i_makt.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Deleting the selected row from the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DELETE i_makt WHERE pick = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Deleting the selected row from the database table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DELETE FROM zzz_makt WHERE pick = 'X'.&lt;/P&gt;&lt;P&gt;MESSAGE s005 WITH 'Deleted Successfully'.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 13&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;WHEN 'SAVE'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Inserting new record or updating existing record in database table&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;from the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;MODIFY zzz_makt FROM TABLE i_makt.&lt;/P&gt;&lt;P&gt;MESSAGE s005 WITH 'Saved Successfully'.&lt;/P&gt;&lt;P&gt;WHEN 'BACK'.&lt;/P&gt;&lt;P&gt;SET SCREEN '0'.&lt;/P&gt;&lt;P&gt;WHEN 'EXIT' OR 'CANCEL'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Leaving the program&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;LEAVE PROGRAM.&lt;/P&gt;&lt;P&gt;ENDCASE.&lt;/P&gt;&lt;P&gt;ENDMODULE. " USER_COMMAND_9000 INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Module set_screen_fields OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setting the screen fields&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE set_screen_fields OUTPUT.&lt;/P&gt;&lt;P&gt;LOOP AT SCREEN.&lt;/P&gt;&lt;P&gt;IF flg IS INITIAL.&lt;/P&gt;&lt;P&gt;screen-input = 0.&lt;/P&gt;&lt;P&gt;ELSEIF ( flg EQ 'Y' ).&lt;/P&gt;&lt;P&gt;IF ( ( screen-name = 'I_MAKT-ZMAKTX'&lt;/P&gt;&lt;P&gt;OR screen-name = 'I_MAKT-CHECK1' )&lt;/P&gt;&lt;P&gt;AND t_ctrl-current_line LE ln ) .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Making the screen fields as editable&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;screen-input = 1.&lt;/P&gt;&lt;P&gt;ELSEIF ( ( screen-name = 'I_MAKT-ZMATNR' )&lt;/P&gt;&lt;P&gt;AND t_ctrl-current_line LE ln ).&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Making the screen field as uneditable&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;screen-input = 0.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 14&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Modifying the screen after making changes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;MODIFY SCREEN.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDMODULE. " set_screen_fields OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Module zmatnr INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Appending records to the internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE zmatnr INPUT.&lt;/P&gt;&lt;P&gt;MODIFY i_makt INDEX t_ctrl-current_line.&lt;/P&gt;&lt;P&gt;IF t_ctrl-current_line GT ln.&lt;/P&gt;&lt;P&gt;READ TABLE i_makt WITH KEY zmatnr = i_makt-zmatnr.&lt;/P&gt;&lt;P&gt;IF sy-subrc NE 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Inserting record if it does not exist in database&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;APPEND i_makt.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;MESSAGE i005 WITH 'Material Number' i_makt-zmatnr 'already exists'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDMODULE. " zmatnr INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;*&amp;amp; Module set_status OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Setting the GUI status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;MODULE set_status OUTPUT.&lt;/P&gt;&lt;P&gt;SET PF-STATUS 'ZSTATUS'.&lt;/P&gt;&lt;P&gt;SET TITLEBAR 'ZTITLE'.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 15&lt;/P&gt;&lt;P&gt;ENDMODULE. " set_status OUTPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;P&gt;*&amp;amp; Module CHECK INPUT&lt;/P&gt;&lt;P&gt;*&amp;amp;----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="---------------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Modify the internal table using the current line in table control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;MODULE check INPUT.&lt;/P&gt;&lt;P&gt;MODIFY i_makt INDEX t_ctrl-current_line.&lt;/P&gt;&lt;P&gt;ENDMODULE. " CHECK INPUT&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;© 2005 SAP AG 16&lt;/P&gt;&lt;P&gt;Output Screens&lt;/P&gt;&lt;P&gt;Enter the transaction code ZTC.&lt;/P&gt;&lt;P&gt;Table Control&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Reward point if usefull&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Mar 2008 10:31:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-code/m-p/3460337#M831432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-03T10:31:11Z</dc:date>
    </item>
  </channel>
</rss>

