<?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 Baffling Table Control in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/baffling-table-control/m-p/834953#M43781</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;Currently using SAP 4.7 SAPKB62011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The need was to develop a program, which based on a selection-criteria displays a table(editable) and some changes will be done in the table and data should get saved. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best approach I assumed was to &lt;/P&gt;&lt;P&gt;a) Create a report, define the selection screen parameters&lt;/P&gt;&lt;P&gt;b) Do validation in at selection-screen&lt;/P&gt;&lt;P&gt;c) If all validations are proper, select values to be shown in table control&lt;/P&gt;&lt;P&gt;d) call screen 9000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything is working perfectly, except for adding new lines in table control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I execute select query in AT SELECTION-SCREEN event before calling the screen 9000, then I am not able to add values to table control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I put the select query in the PBO of screen 9000, I am able to add new values. Only those values which are already present in table control can be changed. I am not able to add any new entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my opinion, there should not be a select query in PBO, because that query would hit the database in all possible events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any particular reason, why.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;AT SELECTION-SCREEN code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
AT SELECTION-SCREEN.

  CASE sy-ucomm.
    WHEN 'ONLI'.

      lv_pernr = p_pernr.
      lv_lifnr = p_lifnr.

*      SELECT *
*        FROM zpersoninfo
*        INTO TABLE lt_zpersoninfo
*       WHERE personno = lv_pernr.
*
*      IF sy-subrc &amp;lt;&amp;gt; 0.
*      ENDIF.
*      APPEND INITIAL LINE TO LT_ZPERSONINFO.


      CALL SCREEN 9000.

  ENDCASE.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Dynpro code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PROCESS BEFORE OUTPUT.
  MODULE pbo_9000.
LOOP AT lt_zpersoninfo INTO zpersoninfo WITH CONTROL tablecontrol CURSOR
 tablecontrol-current_line.
    MODULE pbo_tc_9000.
  ENDLOOP.

PROCESS AFTER INPUT.

  LOOP.
    MODULE pai_tc_9000.
  ENDLOOP.

  MODULE pai_9000.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;PBO_9000&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
MODULE pbo_9000 OUTPUT.

  SET PF-STATUS lv_pfstatus.
  pa0315-pernr = lv_pernr.
  SELECT *
    FROM zpersoninfo
    INTO TABLE lt_zpersoninfo
   WHERE personno = lv_pernr.

  IF sy-subrc &amp;lt;&amp;gt; 0.
  ENDIF.

  APPEND INITIAL LINE TO LT_ZPERSONINFO.

ENDMODULE.                 " PBO_9000  OUTPUT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;b&amp;gt;PBO 9000 - Table Control Code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
MODULE pbo_tc_9000 OUTPUT.
  LOOP AT SCREEN.
    IF lv_pfstatus = 'DISPLAY'.
      CASE screen-name.
        WHEN 'ZPERSONINFO-SERVICENO'.
          screen-input = '1'.
          screen-active = '1'.

        WHEN 'ZPERSONINFO-MANDATORY'.
          screen-input = '1'.
          screen-active = '1'.
      ENDCASE.
    ELSEIF lv_pfstatus = 'CHANGE'.
      CASE screen-name.
        WHEN 'ZPERSONINFO-SERVICENO'.
          screen-input = '0'.
        WHEN 'ZPERSONINFO-MANDATORY'.
          screen-input = '0'.
      ENDCASE.
    ENDIF.

    MODIFY SCREEN.
  ENDLOOP.
ENDMODULE. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if I have skipped some information, which you may find it useful to find the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Nov 2004 08:09:28 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2004-11-17T08:09:28Z</dc:date>
    <item>
      <title>Baffling Table Control</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/baffling-table-control/m-p/834953#M43781</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;Currently using SAP 4.7 SAPKB62011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The need was to develop a program, which based on a selection-criteria displays a table(editable) and some changes will be done in the table and data should get saved. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The best approach I assumed was to &lt;/P&gt;&lt;P&gt;a) Create a report, define the selection screen parameters&lt;/P&gt;&lt;P&gt;b) Do validation in at selection-screen&lt;/P&gt;&lt;P&gt;c) If all validations are proper, select values to be shown in table control&lt;/P&gt;&lt;P&gt;d) call screen 9000&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Everything is working perfectly, except for adding new lines in table control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I execute select query in AT SELECTION-SCREEN event before calling the screen 9000, then I am not able to add values to table control.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if I put the select query in the PBO of screen 9000, I am able to add new values. Only those values which are already present in table control can be changed. I am not able to add any new entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my opinion, there should not be a select query in PBO, because that query would hit the database in all possible events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any particular reason, why.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;AT SELECTION-SCREEN code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
AT SELECTION-SCREEN.

  CASE sy-ucomm.
    WHEN 'ONLI'.

      lv_pernr = p_pernr.
      lv_lifnr = p_lifnr.

*      SELECT *
*        FROM zpersoninfo
*        INTO TABLE lt_zpersoninfo
*       WHERE personno = lv_pernr.
*
*      IF sy-subrc &amp;lt;&amp;gt; 0.
*      ENDIF.
*      APPEND INITIAL LINE TO LT_ZPERSONINFO.


      CALL SCREEN 9000.

  ENDCASE.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Dynpro code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PROCESS BEFORE OUTPUT.
  MODULE pbo_9000.
LOOP AT lt_zpersoninfo INTO zpersoninfo WITH CONTROL tablecontrol CURSOR
 tablecontrol-current_line.
    MODULE pbo_tc_9000.
  ENDLOOP.

PROCESS AFTER INPUT.

  LOOP.
    MODULE pai_tc_9000.
  ENDLOOP.

  MODULE pai_9000.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;PBO_9000&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
MODULE pbo_9000 OUTPUT.

  SET PF-STATUS lv_pfstatus.
  pa0315-pernr = lv_pernr.
  SELECT *
    FROM zpersoninfo
    INTO TABLE lt_zpersoninfo
   WHERE personno = lv_pernr.

  IF sy-subrc &amp;lt;&amp;gt; 0.
  ENDIF.

  APPEND INITIAL LINE TO LT_ZPERSONINFO.

ENDMODULE.                 " PBO_9000  OUTPUT
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;b&amp;gt;PBO 9000 - Table Control Code&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
MODULE pbo_tc_9000 OUTPUT.
  LOOP AT SCREEN.
    IF lv_pfstatus = 'DISPLAY'.
      CASE screen-name.
        WHEN 'ZPERSONINFO-SERVICENO'.
          screen-input = '1'.
          screen-active = '1'.

        WHEN 'ZPERSONINFO-MANDATORY'.
          screen-input = '1'.
          screen-active = '1'.
      ENDCASE.
    ELSEIF lv_pfstatus = 'CHANGE'.
      CASE screen-name.
        WHEN 'ZPERSONINFO-SERVICENO'.
          screen-input = '0'.
        WHEN 'ZPERSONINFO-MANDATORY'.
          screen-input = '0'.
      ENDCASE.
    ENDIF.

    MODIFY SCREEN.
  ENDLOOP.
ENDMODULE. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if I have skipped some information, which you may find it useful to find the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Nov 2004 08:09:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/baffling-table-control/m-p/834953#M43781</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-11-17T08:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Baffling Table Control</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/baffling-table-control/m-p/834954#M43782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is because I didn't upate the 'LINES' field in tablecontrol. How silly !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian V.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Nov 2004 08:31:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/baffling-table-control/m-p/834954#M43782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2004-11-17T08:31:59Z</dc:date>
    </item>
  </channel>
</rss>

