<?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 Re: table control query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345722#M1034937</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;Check the below code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Module pool       Z_TABLE_CONTROL_TEST                              *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                                                                     *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*

PROGRAM  z_table_control_test                    .

DATA: BEGIN OF lt_vbak OCCURS 0,
      flag TYPE c,
      vbeln TYPE vbak-vbeln,
      ernam TYPE vbak-ernam,
      kunnr TYPE vbak-kunnr,
      END OF lt_vbak.

DATA: sfkunnr TYPE kunnr,
      tw_vbak TYPE vbak.

CONTROLS: tabctrl TYPE TABLEVIEW USING SCREEN '9000'.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_9000  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
  SET PF-STATUS 'S9000'.
  SET TITLEBAR 'T9000'.

ENDMODULE.                 " STATUS_9000  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_9000  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9000 INPUT.

  CASE sy-ucomm.
    WHEN 'DISP'.
      SELECT vbeln ernam kunnr FROM vbak
      INTO CORRESPONDING FIELDS OF table lt_vbak
      WHERE kunnr = sfkunnr.
      WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
        LEAVE PROGRAM.
      WHEN 'REFR'.
        REFRESH lt_vbak[].
    ENDCASE.
  ENDMODULE.                 " USER_COMMAND_9000  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  assign_data  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module assign_data output.
tw_vbak-vbeln = lt_vbak-vbeln.
tw_vbak-ernam = lt_vbak-ernam.
tw_vbak-kunnr = lt_vbak-kunnr.

endmodule.                 " assign_data  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  delete_rows  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module delete_rows input.
case sy-ucomm.
when 'DELE'.
if lt_vbak-flag eq 'X'.
tw_vbak-vbeln = lt_vbak-vbeln.
tw_vbak-ernam = lt_vbak-ernam.
tw_vbak-kunnr = lt_vbak-kunnr.

delete lt_vbak where vbeln eq tw_vbak-vbeln.
endif.
endcase.
endmodule.                 " delete_rows  INPUT



************************************************************************
                  SE51 CODE
************************************************************************

PROCESS BEFORE OUTPUT.
* Set the Status of the screen 9000.
  MODULE STATUS_9000.
* The LOOP statement ,LOOP AT lt_vbak WITH CONTROL tcontrol starts a
* loop through the screen table, and reads the line of the internal
* table corresponding to the current line of the screen table and
* populate the Table Control.
  LOOP AT LT_VBAK WITH CONTROL TCONTROL CURSOR TCONTROL-TOP_LINE.
    MODULE ASSIGN_DATA.
  ENDLOOP.

PROCESS AFTER INPUT.
*The PAI processing block is triggered when you scroll vertically in
*the table control or save the user configuration.
  MODULE USER_COMMAND_9000.
  LOOP AT LT_VBAK.
* Delete the selected rows from the Table Control
    MODULE DELETE_ROWS.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;padma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Aug 2008 07:06:23 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-08-28T07:06:23Z</dc:date>
    <item>
      <title>table control query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345718#M1034933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want a sample code for to display the data into table control &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from internal table , please help me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 05:59:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345718#M1034933</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T05:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: table control query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345719#M1034934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;1. Define a table control.&lt;/P&gt;&lt;P&gt;2. In PBO write select query.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select * from &amp;lt;dbtable&amp;gt; into corresponding fields of &amp;lt;itab&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;3.And give the table control field names as internal table fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sathish reddy.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 06:10:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345719#M1034934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T06:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: table control query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345720#M1034935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PROCESS BEFORE OUTPUT.&lt;/P&gt;&lt;P&gt;  MODULE STATUS_0300.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT I_BGDET WITH CONTROL D_TABLECONTROL.&lt;/P&gt;&lt;P&gt;    MODULE FILL_TABLE_CONTROL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;PROCESS AFTER INPUT.&lt;/P&gt;&lt;P&gt;  LOOP AT I_BGDET.&lt;/P&gt;&lt;P&gt;    module save_line.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;module fill table control&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;MODULE fill_table_control OUTPUT.&lt;/P&gt;&lt;P&gt;  DESCRIBE TABLE i_bgdet LINES d_tablecontrol-lines.&lt;/P&gt;&lt;P&gt;ENDMODULE.                 " FILL_TABLE_CONTROL  OUTPUT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;save line&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;MODULE SAVE_LINE INPUT.&lt;/P&gt;&lt;P&gt;  MODIFY I_BGDET  INDEX D_TABLECONTROL-CURRENT_LINE.&lt;/P&gt;&lt;P&gt;ENDMODULE.                 " save_line  INPUT&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 06:51:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345720#M1034935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T06:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: table control query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345721#M1034936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a sample code which you can write in the flowlogic of your screen..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS BEFORE OUTPUT.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Module for displaying the table control...&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  MODULE status_0101.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This is to change the displaying way of the table control like editable,non-editable etc.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  LOOP AT it_create INTO wa_create&lt;/P&gt;&lt;P&gt;    WITH CONTROL acm_create.&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;&lt;/P&gt;&lt;P&gt;  LOOP AT it_create.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;For validation of the table control contents.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    CHAIN.&lt;/P&gt;&lt;P&gt;      FIELD wa_create-userid.&lt;/P&gt;&lt;P&gt;      FIELD wa_create-custno.&lt;/P&gt;&lt;P&gt;      FIELD wa_create-partfun.&lt;/P&gt;&lt;P&gt;      FIELD wa_create-category.&lt;/P&gt;&lt;P&gt;      MODULE validate_screen ON CHAIN-REQUEST.&lt;/P&gt;&lt;P&gt;    ENDCHAIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Module which updates the internal table(table control output table) with all the&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;dynamic screen modifications done by the user.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    MODULE update_create_table.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Module to handle all the exit commands..&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  MODULE exit_command_0101 AT EXIT-COMMAND.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Module to handle all the user commands.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  MODULE user_command_0101.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROCESS ON VALUE-REQUEST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;This provides the F4 help for the fields-&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  FIELD wa_create-partfun  MODULE f4help_partfun.&lt;/P&gt;&lt;P&gt;  FIELD wa_create-category MODULE f4help_category.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 06:59:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345721#M1034936</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T06:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: table control query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345722#M1034937</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;Check the below code &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Module pool       Z_TABLE_CONTROL_TEST                              *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;                                                                     *
*&amp;amp;                                                                     *
*&amp;amp;---------------------------------------------------------------------*

PROGRAM  z_table_control_test                    .

DATA: BEGIN OF lt_vbak OCCURS 0,
      flag TYPE c,
      vbeln TYPE vbak-vbeln,
      ernam TYPE vbak-ernam,
      kunnr TYPE vbak-kunnr,
      END OF lt_vbak.

DATA: sfkunnr TYPE kunnr,
      tw_vbak TYPE vbak.

CONTROLS: tabctrl TYPE TABLEVIEW USING SCREEN '9000'.


*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  STATUS_9000  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE status_9000 OUTPUT.
  SET PF-STATUS 'S9000'.
  SET TITLEBAR 'T9000'.

ENDMODULE.                 " STATUS_9000  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  USER_COMMAND_9000  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_9000 INPUT.

  CASE sy-ucomm.
    WHEN 'DISP'.
      SELECT vbeln ernam kunnr FROM vbak
      INTO CORRESPONDING FIELDS OF table lt_vbak
      WHERE kunnr = sfkunnr.
      WHEN 'BACK' OR 'CANCEL' OR 'EXIT'.
        LEAVE PROGRAM.
      WHEN 'REFR'.
        REFRESH lt_vbak[].
    ENDCASE.
  ENDMODULE.                 " USER_COMMAND_9000  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  assign_data  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module assign_data output.
tw_vbak-vbeln = lt_vbak-vbeln.
tw_vbak-ernam = lt_vbak-ernam.
tw_vbak-kunnr = lt_vbak-kunnr.

endmodule.                 " assign_data  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  delete_rows  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module delete_rows input.
case sy-ucomm.
when 'DELE'.
if lt_vbak-flag eq 'X'.
tw_vbak-vbeln = lt_vbak-vbeln.
tw_vbak-ernam = lt_vbak-ernam.
tw_vbak-kunnr = lt_vbak-kunnr.

delete lt_vbak where vbeln eq tw_vbak-vbeln.
endif.
endcase.
endmodule.                 " delete_rows  INPUT



************************************************************************
                  SE51 CODE
************************************************************************

PROCESS BEFORE OUTPUT.
* Set the Status of the screen 9000.
  MODULE STATUS_9000.
* The LOOP statement ,LOOP AT lt_vbak WITH CONTROL tcontrol starts a
* loop through the screen table, and reads the line of the internal
* table corresponding to the current line of the screen table and
* populate the Table Control.
  LOOP AT LT_VBAK WITH CONTROL TCONTROL CURSOR TCONTROL-TOP_LINE.
    MODULE ASSIGN_DATA.
  ENDLOOP.

PROCESS AFTER INPUT.
*The PAI processing block is triggered when you scroll vertically in
*the table control or save the user configuration.
  MODULE USER_COMMAND_9000.
  LOOP AT LT_VBAK.
* Delete the selected rows from the Table Control
    MODULE DELETE_ROWS.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;padma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2008 07:06:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/table-control-query/m-p/4345722#M1034937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-08-28T07:06:23Z</dc:date>
    </item>
  </channel>
</rss>

