How to display data in Table control?

Hi Experts,
Can anyone please explain me how to display the data from two different tables(those two table is related with 1 field) into a single table control?
For Example: T1 has fields (F1,F2) and
                     T2 has fields (F3,F4) --> here F3 is foreign key for F1
I need to display the data F1,F2,F3,F4 into the table control.
Can anyone explain me?
Thanks in Advance,
Regards,
Raghu

Hi,
If F3 is foreign key for F1, then both fields will have same values.  Then why do you need to display both F1 and F3?  Either one of them is enough.  Try the following code.
types: begin of t_table,
             F1 type T1-F1,
             F2 type T1-F2,
             F4 type T2-F4,
          end of t_table.
data: i_table type standard table of t_table with header line.
select F1 F2 F4 into table i_table from T1 inner join T2 on T1F1 = T2F3.
You should create three columns in the table control with names i_table-F1, i_table-F2, i_table-F3.
After populating the internal table, refresh the control with the following statement.
REFRESH CONTROL <NAME> FROM SCREEN <SCREEN_NO>.
All the above statements should be in your PBO Module.
Regards,
Hema
Message was edited by:
Sorry, Declarations can be in the common include.  Select statement and refresh statement should be in PBO.
        Hema Nagarajan

Similar Messages

  • How to populate data in table control  .

    hi all,
    i put matnr no. in screen no. 103
    validation is done at that screen only.
    now when i want to modify dat record
    when i put matnr no. at screen 103
    so how i will get all  data of dat number to table control screen.

    Hi Darshan,
       Here is a detailed description of how to update data in table controll.
      Updating data in table control
    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.
    Method 1: Read the internal table into the Table Control in the screenu2019s flow logic.  Used when the names of the Table Control fields are based on fields of the internal table.
    Method 2: Read the internal table into the Table Control in the module pool code. Used when the names of the Table Control fields are based on fields of the database table.
    Method 1 (table control fields = itab fields)
    In the flow logic we can read an internal table using the LOOP statement. Define the reference to the relevant able control by specifying WITH CONTROL <ctrl>
    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 we need to write a module to transfer the internal table fields to the screen fields.
    We 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)
    PROCESS BEFORE OUTPUT.
    LOOP AT ITAB_REG WITH CONTROL TCREG
    CURSOR TCREG-CURRENT_LINE.
    ENDLOOP.
    PROCESS AFTER INPUT.
    LOOP AT ITAB_REG.
    MODULE MODIFY_ITAB_REG.
    ENDLOOP.
    MODULE MODIFY_ITAB_REG INPUT.
    MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
    ENDMODULE.
    Method 2 (table control fields = dict. fields)
    If using a LOOP statement without an internal table in the flow logic, we 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, we 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.
    PROCESS BEFORE OUTPUT.
    LOOP WITH CONTROL TCREG.
    MODULE READ_ITAB_REG.
    ENDLOOP.
    PROCESS AFTER INPUT.
    LOOP WITH CONTROL TCREG.
    CHAIN.
    FIELD: ITAB_REG-REG,
    ITAB_REG-DESC.
    MODULE MODIFY_ITAB_REG
    ON CHAIN-REQUEST.
    ENDCHAIN.
    ENDLOOP.
    MODULE READ_ITAB_REG OUTPUT.
    READ TABLE ITAB_REG INDEX TCREG-CURRENT_LINE.
    IF SY-SUBRC EQ 0.
    MOVE-CORRESPONDING ITAB_REREG TO TCREG.
    ELSE.
    EXIT FROM STEP-LOOP.
    ENDIF.
    ENDMODULE.
    MODULE MODIFY_ITAB_REG INPUT.
    MOVE-CORRESPONDING TCREG TO ITAB_REG.
    MODIFY ITAB_REG INDEX
    TCREG-CURRENT_LINE.
    ENDMODULE.
    Updating the internal table
    Method 1
    PROCESS AFTER INPUT.
    LOOP AT ITAB_REG.
    CHAIN.
    FIELD: ITAB_REG-REG,
    ITAB_REG-DESC.
    MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
    ENDCHAIN.
    ENDLOOP.
    MODULE MODIFY_ITAB_REG INPUT.
    ITAB_REG-MARK = u2018Xu2019.
    MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
    ENDMODULE.
    Method 2
    PROCESS AFTER INPUT.
    LOOP WITH CONTROL TCREG.
    CHAIN.
    FIELD: TCREG-REG,
    TCREG-DESC.
    MODULE MODIFY_ITAB_REG ON CHAIN-REQUEST.
    ENDCHAIN.
    ENDLOOP.
    MODULE MODIFY_ITAB_REG INPUT.
    MOVE-CORRESPONDING TCREG TO ITAB_REG.
    ITAB_REG-MARK = u2018Xu2019.
    MODIFY ITAB_REG INDEX TCREG-CURRENT_LINE.
    ENDMODULE.
    Updating the database
    MODULE USER_COMMAND_100.
    CASE OK_CODE.
    WHEN u2018SAVEu2019.
    LOOP AT ITAB-REG.
    CHECK ITAB_REG-MARK = u2018Xu2019.
    MOVE-CORRESPONDING ITAB_REG TO TCREG.
    UPDATE TCREG.
    ENDLOOP.
    WHEN u2026
    u2026
    ENDCASE.
    ENDMODULE.
    Hope this will solve your problem.
    Regards,
    Pavan.
    Edited by: PAVAN CHANDRASEKHAR GANTI on Aug 3, 2009 12:48 PM

  • How to modify data in table control

    hi
    i have created table control where i have displayed  data into table control
    logic used
    screen 200
    PROCESS BEFORE OUTPUT.
    MODULE SELECT_RECORD.
    *&SPWIZARD: PBO FLOW LOGIC FOR TABLECONTROL 'TBC_200'
      MODULE TBC_200_CHANGE_TC_ATTR.
    *&SPWIZARD: MODULE TBC_200_CHANGE_COL_ATTR.
      LOOP AT   IT_MARA
           INTO WA_MARA
           WITH CONTROL TBC_200
           CURSOR TBC_200-CURRENT_LINE.
        MODULE TBC_200_GET_LINES.
    *&SPWIZARD:   MODULE TBC_200_CHANGE_FIELD_ATTR
      ENDLOOP.
    MODULE STATUS_0200.
    PROCESS AFTER INPUT.
    *&SPWIZARD: PAI FLOW LOGIC FOR TABLECONTROL 'TBC_200'
      LOOP AT IT_MARA.
        CHAIN.
          FIELD WA_MARA-MATNR.
          FIELD WA_MARA-ERSDA.
          FIELD WA_MARA-ERNAM.
          MODULE TBC_200_MODIFY ON CHAIN-REQUEST.
        ENDCHAIN.
        FIELD WA_MARA-MARK
          MODULE TBC_200_MARK ON REQUEST.
      ENDLOOP.
      MODULE TBC_200_USER_COMMAND.
    *&SPWIZARD: MODULE TBC_200_CHANGE_TC_ATTR.
    *&SPWIZARD: MODULE TBC_200_CHANGE_COL_ATTR.
    module -
    MODULE SELECT_RECORD.
    MODULE SELECT_RECORD OUTPUT.
    SELECT MATNR ERSDA ERNAM
            FROM MARA
            INTO CORRESPONDING FIELDS OF TABLE it_mara.
    ENDMODULE.                 " SELECT_RECORD  OUTPUT
    and
    another thing
    i have made  field  MARA-ERSDA. and  FIELD WA_MARA-ERNAM editable by
    input possible using layout
    so
    now those 2 fields contents  are editable
    i want to know how to edit and save the data
    some body guide.
    and i want to put the lock so that i can update
    can tell how to implement lock.
    Thanks
    Edited by: viju bangalore on Jan 27, 2011 10:40 AM

    Hi Viju,
    In PAI do something like this
    LOOP AT itab.
        MODULE mod_table_control.
    ENDLOOP.
    MODULE user_command_0100.
    at module mod_table_control put this
    MODULE mod_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
      if sy-subrc ne 0.
           insert itab.
      endif.
    ENDMODULE.
    for saving you can create at custom gui status with a save button, and at MODULE user_command_0100 save the data.

  • How to transfer data in table control in bdc

    hi
    how to transfer data in table control in bdc . I need the theory regarding this
    bye

    Hi,
    just check in the forum , there is many threads available to ur questions.
    Table control in BDC
    http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm
    You can even refer to these related threads
    bdc table control
    Re: table control in bdc
    table control in BDC
    Reward if helpful.
    Thanks
    Naveen khan

  • How to insert data into table control

    hi experts,,
           i have inserted data into data base table through table control .
    now i want to insert data into table control through database table.
      how to delete data from table control for selected row

    Hi
    go through this link.
    http://www.****************/Tutorials/ABAP/TableControl/Demo.htm

  • How to clear data in Table Control.

    hi! all
    How to clear the data in table control.
    i have a Table control which displays column A data from the previous screen and allows to enter column B and column C and i have a button CLEAR, when i click CLEAR button the Data displaying in table control has to be cleared. how to do it.
    Regards,
    Nagulan

    Hi,
    Loop over the internal table of table control & clear data from table control.
    loop at tctab.
    clear tctab.
    modify tctab.
    endloop.
    Best regards,
    Prashant

  • How to show data through table control

    Hi Experts,
    I have created an table control through wizard using table EKKO.
    I have to populate one internal table( type ekko ), and then show it in output  through table control.
    Please advise, how to do that and in where i have to write the codes.
    I will reward points for every suggestion
    Thanks in advance.
    regards

    hi saubrab,
                    This is kiran kumar.G.I am sending some sample code to populate data into table control check it once.
    i will give input in 100 screen. and display table control in 200 screen.check it once once ..ok....
    SE38 :(CODE)
    *& Module pool       YMODULEPOOL_TABLECONTROL1                         *
    *& DEVELOPER   : KIRAN KUMAR.G                                         *
    *& PURPOSE     : TABLE CONTROL DEMO                                    *
    *& CREATION DT : 17/12/2007                                            *
    *& T.CODE      : YMODTABLECONTROL1                                     *
    *& REQUEST     : ERPK900035                                            *
    PROGRAM  ymodulepool_tablecontrol1.
    Tables
    TABLES: yvbap,  "Sales Document: Item Data
            vbak.   "Sales Document: Header Data
    Controls
    CONTROLS: my_table TYPE TABLEVIEW USING SCREEN 200.
    Global Variables
    DATA: gv_lines    TYPE i,
          gv_lines1   type i,
          gv_temp     type i,
          gv_flag(20) TYPE c VALUE 'DISP',
          gv_mode1    TYPE c,
          gv_mode     TYPE c VALUE 'C'. " C: Change, D :Display
    Internal Table
    DATA: BEGIN OF gt_item OCCURS 0,
            vbeln LIKE vbap-vbeln,  "Sales Document Number
            posnr LIKE vbap-posnr,  "Sales Document Item
            matnr LIKE vbap-matnr,  "Material Number
            matkl LIKE vbap-matkl,  "Material Group
            arktx LIKE vbap-arktx,  "Short Text for Sales Order Item
            cflag,                  "Deletion Indicator
          END OF gt_item.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZTABLECONTROL' OF PROGRAM 'YMODULEPOOL_TABLECONTROL'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'DISP'.
          SELECT single vbeln
                        erdat
                        angdt
                        bnddt
                   FROM vbak
                  INTO (vbak-vbeln,vbak-erdat,
                        vbak-angdt,vbak-bnddt)
                  WHERE vbeln = vbak-vbeln.
            IF sy-subrc EQ 0.
    *Fetch the table control data and place them in Internal Table
              SELECT vbeln
                     posnr
                     matnr
                     matkl
                     arktx
                FROM yvbap
                INTO TABLE gt_item
                WHERE vbeln = vbak-vbeln.
              IF sy-subrc EQ 0.
    *NO OF line in the Internal Table
                DESCRIBE TABLE gt_item LINES gv_lines.
                my_table-lines = gv_lines + 20.
              ENDIF.
            ENDIF.
    *Call Screen 200.
            SET SCREEN 200.
          WHEN  'EXIT' OR 'BACK' OR 'CANCEL'.
    *Exit from the Program
            CALL TRANSACTION 'SESSION_MANAGER'.
        ENDCASE.
      ENDMODULE.                 " USER_COMMAND_0100  INPUT
    module STATUS_0200 output.
    SET PF-STATUS 'ZTABLECONTROL1'.
    endmodule.                 " STATUS_0200  OUTPU
    *&      Module  copy_data  OUTPUT
          text
    module copy_data output.
    *Fetch the current line data from the Table control
    read table gt_item index my_table-current_line.
    if sy-subrc eq 0.
    *Populating data into screen fields
    gt_item-vbeln = gt_item-vbeln.
    gt_item-posnr = gt_item-posnr.
    gt_item-matnr = gt_item-matnr.
    gt_item-matkl = gt_item-matkl.
    gt_item-arktx = gt_item-arktx.
    endif.
    SE51:CODE (SCREEN 100)
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    SE51 :CODE (SCREEN 200)
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0200.
    loop at gt_item with control my_table cursor my_table-current_line.
    module copy_data.
    endloop.
    PROCESS AFTER INPUT.
    loop at gt_item.
    MODULE USER_COMMAND_0200.
    endloop.
                             HAVE A NICE DAY..
    Award points if helpful,kiran kumar.G

  • How to display data in table

    Hi all,
    can any one tell me how to display data in a table when user click on a button. i have created a node with a set of fields from different tables now how to write the logic to display data in that table.
    Thanks & Regards,
    Naveen

    DATA lo_nd_professionaltable TYPE REF TO if_wd_context_node.
      DATA lo_el_professionaltable TYPE REF TO if_wd_context_element.
      DATA ls_professionaltable TYPE wd_this->ElementS_professionaltable. "internaltable
    TYPES: BEGIN OF TY_PFTAB,
           RATEGROUP TYPE /BIC/OIWRATEGRP,
           LEVEL TYPE /BIC/OIWPCSLEVEL,
           FROMDATE TYPE /BI0/OIDATEFROM,
           FROMTO TYPE /BI0/OIDATETO,
           STANDARD TYPE /BIC/OIWSTRATE,
           OVERHEAD1 TYPE /BIC/OIWOHRTE1,
           OVERHEAD2 TYPE /BIC/OIWOHRTE2,
           OVERHEAD3 TYPE /BIC/OIWOHRTE3,
           EXCEPTIONFLAG TYPE /BIC/OIMSECFILER,
           END OF TY_PFTAB.
    DATA : IT_PFTABLE TYPE STANDARD TABLE OF TY_PFTAB,
           WA_PFTAB TYPE TY_PFTAB.
    SELECT /BIC/WRATEGRP /BIC/WPCSLEVEL DATEFROM DATETO /BIC/WSTRATE /BIC/WOHRTE1 /BIC/WOHRTE2 /BIC/WOHRTE3
    FROM /BIC/AGLDCPRTS00 INTO TABLE IT_PFTABLE.
    *TYPES : BEGIN OF TY_EXCEPTION,
           EXCEPTIONFLAG TYPE /BIC/OIMSECFILER,
           END OF TY_EXCEPTION.
    *DATA : IT_EXTABLE TYPE STANDARD TABLE OF TY_EXCEPTION,
          WA_EXTABLE TYPE IT_EXTABLE.
    *SELECT /BIC/MSECFILER FROM /BIC/AGLDCLMLT00 INTO TABLE IT_EXTABLE.
    navigate from <CONTEXT> to <PROFESSIONALTABLE> via lead selection
      lo_nd_professionaltable = wd_context->get_child_node( name = wd_this->wdctx_professionaltable ).
    get element via lead selection
      lo_el_professionaltable = lo_nd_professionaltable->get_element( ).
    @TODO handle not set lead selection
    IF lo_el_professionaltable IS INITIAL.
    ENDIF.
    get all declared attributes
    lo_el_professionaltable->get_static_attributes(
       IMPORTING
         static_attributes = ls_professionaltable ).
    lo_nd_professionaltable->bind_table( new_items = IT_PFTABLE set_initial_elements = abap_false ).

  • How to delete data in table control

    Hi,
    I am doing module pool programming. After the user enters the data in table control after saving the data. if the user wants to  remove the line item the line item shd be removed from the screen and data base.
    Please Give me vaulable Suggestions
    Regards

    Hi,
    Screen 8002 (with table control) --> select records --> press delete button --> delete selected records
    Now you wan to delete those records selected by the user at runtime when DELETE button is clicked.
    Take another internal table and work area same as the initial internal table and work area used in screen 8002 which is to be used to delete the selected data.
    Take the names of the input/output fields as work_area-field_name and select column in table control as work_area-flag.
    Also take a flag field of size 1 datatype character as the last field in the internal table and work area while declaration.
    You must have passed a code in PBO of the screen for reading internal table into the table control.
    So it reads the internal table into the table control whenever you perform any action on use command.
    All you need to do is to write a code to modify the internal table form the table control while performing any user action.
    Remember to change the LINE SEL option in attributes of table control as MULTIPLE.
    At screen logic,
    PROCESS BEFORE OUTPUT.
      MODULE status_8002. "for pf-status
      LOOP WITH CONTROL po_tab. "po_tab is table control
        MODULE pass_data. "to pass data into table control from internal table
      ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE user_command_8002. "for user command(back and exit)
      LOOP WITH CONTROL po_tab.
        MODULE modify_data. "to modify data from table control into table control
      ENDLOOP.
      MODULE delete. "to delete the selected records
    In PBO,
    *&      Module  STATUS_8002 OUTPUT
    MODULE status_8002 OUTPUT.
      SET pf-status 'ZAB_PFSTA'. " pf-status
      DATA : line_count TYPE i.
      DESCIRBE TABLE it_ekpo
      LINES line_count.
      po_tab-lines = line_count + 10.
      " to make table control scrollable
    ENDMODULE.                 " STATUS_8002  OUTPUT
    *&      Module  PASS_DATA  OUTPUT
    MODULE pass_data OUTPUT.
      READ TABLE it_ekpo into wa_ekpo INDEX po_tab-current_line.
    ENDMODULE.                 " PASS_DATA  OUTPUT
    "it_ekpo is internal table and wa_ekpo is the work area
    In PAI,
    *&      Module  MODIFY_DATA  INPUT
    MODULE MODIFY_DATA INPUT.
      MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
      "modify records from table control into the internal table
    ENDMODULE.                 " MODIFY_DATA  INPUT
    *&      Module  DELETE  INPUT
    MODULE DELETE INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'DELETE'. "when delete button is clicked
          SORT IT_EKPO BY FLAG DESCENDING. "sort by flag(selection column value)
          CLEAR WA_EKPO1.
          CLEAR WA_EKPO.
          REFRESH IT_EKPO1.
          LOOP AT IT_EKPO INTO WA_EKPO WHERE FLAG = 'X'.
            DATA : J TYPE I.
            CLEAR J.
            J = SY-TABIX. "assign index value if a record is selected
            MOVE-CORRESPONDING WA_EKPO TO WA_EKPO1. "append selected records to another
            "work area and append to another internal table to delete
            APPEND WA_EKPO1 TO IT_EKPO1.
            DELETE IT_EKPO. "delete the selected records from initial internal table
            " to reflect the changes on the table control
          ENDLOOP.
          IF J = 0.
            MESSAGE I006. "if no record selected
          ELSE. "if some records are selected
            DELETE ZEKPO FROM TABLE IT_EKPO1. "delete from database table
            COMMIT WORK.
            IF SY-SUBRC = 0.
              MESSAGE S007. "success message (records deleted)
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " DELETE  INPUT
    Now at PAI, you have delete records and these changes are reflected back to the internal table.
    Now when PBO is executed it will again read the initial internal table and will not show the deleted records.
    Hope this solves your problem.
    Thanks & Regards,
    Tarun Gambhir

  • How to display data in table with specified format?

    Hi,
    Jdev 11.1.1.4, ADF BC and ADF Faces
    In my application I have created a EO based view object which will return data as below.
    Deptid       Loc          seq
       1            Loc1         1
       1            Loc2         2
       2            Loc1         3
       2            Loc2         4
       3            Loc1         5
       3            Loc2         6Now I have to display the data in table like below
                     Loc1
       1                              1st row
                     Loc2                  Loc1
       2                              2nd row
                     Loc2                  Loc1
       3                             3rdrow
                     Loc2 How can I do that? Any help will be appreciated.
    ~Abhijit
    Edited by: Abhijit Dutta on Nov 5, 2011 6:18 PM

    check this thread...
    display the data in chart format

  • How to maintain data in table control

    plz send a detail description of how to create table control and maintain data in that table control.

    Hello Narendar,
    Check the following link:
    http://help.sap.com/saphelp_erp2005/helpdata/en/45/adee2396f711d1b46b0000e8a52bed/frameset.htm
    Also, a table control wizard in Screen Painter(SE51) exists, which takes you step by step through the Table Control generation and also creates code, so you can start using the Table Control right away.
    You can either specify a database table, or use an internal table from program.
    If you want to use internal table, it needs to be predefined in your program, before you start creating the table control.
    Reward if helpful.

  • How to display data in table region

    HI All,
    I have a requirement to display data from a VO to a table region after clicking the GO button please help me on this.
    Thanks
    Deb

    Hi Deb,
    In the controller's processFormRequest(), check for the GO button click, then execute the VO's query via vo.executeQuery().
    Something like:
    if(oapagecontext.getParameter("Go") != null)
    am.invokeMethod("initTableQuery");
    Regards,
    LC

  • How to display data in table with dynamic rows, section wise in a page.

    Hello all,
    I work on report creation in BI Publisher where I need to display data from xml in a table in pdf format.The output page is divided into two vertical sections , containing tables, with exactly same columns on left and right sections. The number of rows in table depends on the output of the fetching query. The page is to be populated in such a way that, at first, the left table is populated, then the next rows fill up the table on the right section of the page, if more rows are left, they fill up the tables on next page[first the left table, and then the right one, in a similar fashion as in page 1]
    On a bird's eye view, the data needs to be simply mapped to a table, with dynamic number of rows, and so can span number of pages depending on size of data. On a implementation level, I am stuck in getting the left section of the page populated first, then the right section[in place of the right page], and then the next page.
    Please guide me if someone has any idea in getting this achieved.
    Thanks in advance.

    Thanks for the response...
    I am able to get the desired functionality. I just need the tables to be inside a bigger table, that also has a dividing line between the two columns. This is was is intended in the req. provided to me. The column formatting option provides me a line ,but that is not further modifiable .Please help me in getting a perpendicular line between the two columns, which I need to be of a specified width and color.

  • How to clear data from Table-Control

    Hi all,
    I am working on table control. I have some data on the table control.
    When I press the 'Cancel' button, I require that the table-control should be cleared.
    I tried using REFRESH CONTROL TC01 USING SCREEN 1001. But, the data doesn't get cleared.
    Please advise.
    Regards,
    Saurabh Buksh.

    hi
    good
    try this example
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA: cols LIKE LINE OF flights-cols,
          lines TYPE i.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
          TABLES demo_conn.
    SELECT * FROM spfli INTO CORRESPONDING FIELDS OF TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
      DESCRIBE TABLE itab LINES lines.
      flights-lines = lines.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
            ENDIF.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols
                                  WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
            ENDLOOP.
          ENDIF.
      ENDCASE.
    ENDMODULE.
    thanks
    mrutyun^

  • How to retrieve data from Table Control

    Hi,
    I am a Beginner to ABAP. I want to know how to fetch the selected rows from Screen table control.
    Here is my scenario:
    I am having one table control with selection field. Once i select some rows means the selected rows are going to be stored in one Internal Table.
    If any body knows the thing means please reply me the logic as well as giving me some code sample.
    Thankyou.

    Hi Mithun,
    Try to implement this code in your requirement.
    There will be some button on your screen and after selecting some or all the records from the table control you must be pressing some button for collecting the selected rows from the table control too your internal table.
    Put Fcode of that button in WHEN condition in this CASE.
    CONSTANTS: kc_sel_flag TYPE char01    VALUE 'X'.
      CASE sy-ucomm.
        WHEN kc_sel.
          PERFORM f_sel_desel USING kc_sel_flag.
      ENDCASE.
    FORM f_sel_desel
         USING    p_sel_desel TYPE c.
    Set the value
      wa_cond_type-z_sel = p_sel_desel.
    Update the Itab.
      MODIFY it_cond_type
             FROM wa_cond_type
             TRANSPORTING z_sel
             WHERE mandt EQ sy-mandt. "Where cond is only to specify all
    ENDFORM.                    " f_sel_desel
    After that all the selected records will be having 'X' in the internal table.
    Regards,
    Mueksh Kumar

Maybe you are looking for