Insert row and delete row in a table control

Hi Experts,
I am using a table control in module pool programming, How can I Insert row and delete row in a table control?
Thanks in Advance....

Santhosh,
Iam using this code..
FORM fcode_delete_row
              USING    p_tc_name           TYPE dynfnam
                       p_table_name
                       p_mark_name   .
-BEGIN OF LOCAL DATA----
  DATA l_table_name       LIKE feld-name.
data: p_mark_name type c.
  FIELD-SYMBOLS <tc>         TYPE cxtab_control.
  FIELD-SYMBOLS <table>      TYPE STANDARD TABLE.
  FIELD-SYMBOLS <wa>.
  FIELD-SYMBOLS <mark_field>.
-END OF LOCAL DATA----
  ASSIGN (p_tc_name) TO <tc>.
get the table, which belongs to the tc                               *
  CONCATENATE p_table_name '[]' INTO l_table_name. "table body
  ASSIGN (l_table_name) TO <table>.                "not headerline
delete marked lines                                                  *
  DESCRIBE TABLE <table> LINES <tc>-lines.
  LOOP AT <table> ASSIGNING <wa>.
  access to the component 'FLAG' of the table header                 *
    ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
if <MARK_FIELD> = 'X'.
    PERFORM f_save_confirmation_9101.
    IF gv_answer EQ '1'.
      DELETE <table> INDEX syst-tabix.
      IF sy-subrc = 0.
        <tc>-lines = <tc>-lines - 1.
      ENDIF.
      ELSE.
      ENDIF.
    ENDIF.
  ENDLOOP.
in this code   ASSIGN COMPONENT p_mark_name OF STRUCTURE <wa> TO <mark_field>.
if <MARK_FIELD> = 'X'.
this code is not working...

Similar Messages

  • How can I insert, modify and delete entries on my table control?

    Hi,
    I already have build a table control. Now I want to make manipulations on it. Therefore I have created 3 buttons, insert, modify and delete. But how can I get actions on table control.
    This is my code for the internal table:
    BEGIN OF its OCCURS 0,
    mark TYPE C VALUE ' ',
    artikel_nr TYPE ZARTIKEL-ARTIKEL_NR,
    artikel_typ TYPE ZARTIKEL-TYPE,
    bezeichnung TYPE ZARTIKEL-BEZEICHNUNG,
    preis TYPE ZARTIKEL-PREIS,
    mwst TYPE ZARTIKEL-MWST,
    END OF its.
    and this is the code which i wanted to  delete a row in my table control:
    WHEN 'DELETE'.
    LOOP AT its WHERE mark EQ 'X'.
    DELETE its WHERE mark = 'X'.
    MOVE its TO ZARTIKEL.
    ENDLOOP.
    ENDCASE.
    ENDMODULE:
    and my PBO and PAI:
    PROCESS BEFORE OUTPUT.
    LOOP AT its INTO ZARTIKEL WITH CONTROL ARTIKEL.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE EXIT.
    LOOP AT its.
    MODULE V1.
    ENDLOOP.
    MODULE user_command_1060.
    But if I now open my table control and mark the line that I wanted to delete, nothing happens, not on my internal table and the data even not deleted on my table ZARTIKEL. Have you an idea what I did wrong??

    Hi,
    In the attributes of table control take the SELCOL as wa_zekpo-flag
    And in the internal table and work area add a field as flag(1) TYPE c
    Refer:
    At screen logic:-
    PROCESS BEFORE OUTPUT.
      MODULE status_8002.
      LOOP WITH CONTROL po_tab.
        MODULE pass_data.
      ENDLOOP.
    PROCESS AFTER INPUT.
      MODULE user_command_8002.
      LOOP WITH CONTROL po_tab.
        MODULE modify_data.
      ENDLOOP.
      MODULE function.
    In PBO,
    MODULE status_8002 OUTPUT.
      SET PF-STATUS 'ZTG_SELTB'.
      DATA : line_count TYPE i.
      DESCRIBE TABLE it_ekpo
      LINES line_count.
      po_tab-lines = line_count + 5.
    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
    In PAI,
    *&      Module  USER_COMMAND_8002  INPUT
    MODULE USER_COMMAND_8002 INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'BACK'.
          LEAVE TO SCREEN 8001.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_8002  INPUT
    *&      Module  MODIFY_DATA  INPUT
    MODULE DISPLAY_DATA INPUT.
      MODIFY IT_EKPO INDEX PO_TAB-CURRENT_LINE FROM WA_EKPO.
    ENDMODULE.                 " MODIFY_DATA  INPUT
    *&      Module  FUNCTION  INPUT
    MODULE FUNCTION INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'SELECT'. "<--select all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = 'X'.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DESEL'. "<--deselect all records
          LOOP AT IT_EKPO INTO WA_EKPO.
            WA_EKPO-FLAG = ' '.
            MODIFY IT_EKPO FROM WA_EKPO.
          ENDLOOP.
        WHEN 'DELETE'.
          DELETE FROM it_ekpo WHERE flag = 'X'.
      ENDCASE.
    ENDMODULE.                 " FUNCTION  INPUT
    Regards,
    Tarun

  • Insert,update and delete data in a table using webdynpro for abap

    Dear All,
    I have a requirement to create a table allowing the user to add rows in it and update a row as well as delete a row from that table.To do this I guess I have to make use of ALV.But using ALV I am not able to enter data to a table where as I can make a column editable delete a row etc. please guide me to perform these operations(insert,update and delete) on table.
    Thanks,
    Reddy.

    Hi Sridhar,
    By using ALV you can do all insert delete etc things. if you want to edit i mean you can yenter data in ALV.
    Check this...
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1
    Editing alv in web dynpro
    editing rows in alv reports
    Re: editing rows and columns in alv reports in webdynpro abap
    Cheers,
    Kris.

  • How to perform insert, update and delete in a table component

    hi all,
    i am using a table component in my page. I want to retreive data from multiple tables as well as perform insertion, updation and deletion operation.The changes should be affected in the corresponding tables. can anyone provide a solution for my problem.
    Thanks in advance
    regards,
    prasant

    There is a great tutorial for insert, update and delete records in a table.
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    Hope it helps.
    Thanks,
    Moumita

  • How to stop "Add Row" and "Delete" from committing.

    Hello, I am new to Application Express, and maybe someone can help me make this save like an Oracle Form.
    If you hit the "Add Row" button, enter data, then hit the "Add Row" button again, it commits the first row. If you check a value and hit the "Delete" button, it commits the delete. I would like the insertions and deletes to be handled like an update, that is with an explicit commit by hitting the "Apply Changes" button.
    Can I control this in Application Express, and how?
    Thank you,

    Kevin,
    1. instead of having a form on a table, you would create a form on a collection,
    2. collection is also a table but it is only of a temporary nature - it is valid with the corresponding session. Once the session is closed, you can't access the collection.
    3. to see how to create a collection and a tabular form use this example:
    http://htmldb.oracle.com/pls/otn/f?p=31517:176
    4. add row and delete will add / delete a copy of your table data. You can then create a process to save the data in your target table only if the button apply changes is clicked.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Adding and deleting "rows" in pdfs

    I need to know the best way to edit pdfs. What I have are files that resemble a table setup in Word. I would need to add and delete "rows" of information which are also set up in columns. I also may need to edit some of the text in a row.
    What is the best tool for me to use? Acrobat? Illustrator? We are currently using v.10 on Macs. Is there a fairly simple way to accomplish this?

    I don't think there is a good way to do this. Except for very simple edits, it's better to edit the source document and recreate the PDF. If there is no source document available, you can try exporting to Word from Acrobat and see if you get something usable.

  • How to find accurate number of Rows, and size of all the tables of a Schema

    HI,
    How to find the accurate number of Rows, and size of all the tables of a Schema ????
    Thanks.

    SELECT t.table_name AS "Table Name",
    t.num_rows AS "Rows",
    t.avg_row_len AS "Avg Row Len",
    Trunc((t.blocks * p.value)/1024) AS "Size KB",
    t.last_analyzed AS "Last Analyzed"
    FROM dba_tables t,
    v$parameter p
    WHERE t.owner = Decode(Upper('&1'), 'ALL', t.owner, Upper('&1'))
    AND p.name = 'db_block_size'
    ORDER by 4 desc nulls last;
    ## Gather schema stats
    begin
    dbms_stats.gather_schema_stats(ownname=>'SYSLOG');
    end;
    ## Gather a particular table stats of a schema
    begin
    DBMS_STATS.gather_table_stats(ownname=>'syslog',tabname=>'logs');
    end;
    http://www.oradev.com/create_statistics.jsp
    Hope this will work.
    Regards
    Asif Kabir
    -- Mark the answer as correct/helpful

  • Difference between current row and previous row in a table

    Hi All,
    I am having a problem with the query. Can some of please help me?
    I need to get difference between current row and previous row in a table. I have a table, which have data like bellow.
    TABLEX
    ================
    Name Date Items
    AAA 01-SEP-09 100
    BBB 02-SEP-09 101
    CCC 03-SEP-09 200
    DDD 04-SEP-09 200
    EEE 05-SEP-09 400
    Now I need to get output like bellow...
    Name Date Items Diff-Items
    AAA 01-SEP-09 100 0
    BBB 02-SEP-09 101 1
    CCC 03-SEP-09 200 99
    DDD 04-SEP-09 200 0
    EEE 05-SEP-09 400 200
    Can some one help me to write a query to get above results?
    Please let me know if you need more information.
    Thanks a lot in advance.
    We are using Oracle10G(10.2.0.1.0).
    Thanks
    Asif

         , nvl (items - lag (items) over (order by dt), 0)like in
    SQL> with test as
      2  (
      3  select 'AAA' name, to_date('01-SEP-09', 'dd-MON-rr') dt,  100 items from dual union all
      4  select 'BBB' name, to_date('02-SEP-09', 'dd-MON-rr') dt,  101 items from dual union all
      5  select 'CCC' name, to_date('03-SEP-09', 'dd-MON-rr') dt,  200 items from dual union all
      6  select 'DDD' name, to_date('04-SEP-09', 'dd-MON-rr') dt,  200 items from dual union all
      7  select 'EEE' name, to_date('05-SEP-09', 'dd-MON-rr') dt,  400 items from dual
      8  )
      9  select name
    10       , dt
    11       , items
    12       , nvl (items - lag (items) over (order by dt), 0)
    13    from test
    14  ;
    NAM DT             ITEMS NVL(ITEMS-LAG(ITEMS)OVER(ORDERBYDT),0)
    AAA 01-SEP-09        100                                      0
    BBB 02-SEP-09        101                                      1
    CCC 03-SEP-09        200                                     99
    DDD 04-SEP-09        200                                      0
    EEE 05-SEP-09        400                                    200
    SQL>

  • How can I select and delete rows based on the value in one column?

    I searched through the discussion board, and found a thread on deleting blank rows, but not sure how to modify it to work with my issue.
    I have put together a rather complicated spreadsheet for designing control systems, it calculates parts needed based on check boxes selected in a second spreadsheet.
    Since not all systems require all parts there are many rows that have a 0 quantity value, I would like to select these rows and delete them once I have gone through the design phase (checking off required features on a separate sheet).
    I like the way the other thread I found will gather all the blank rows at the bottom without changing the order of the rows with data in them.
    I don't understand exactly how the formula in the other thread works well enough to modify it to look for a certain column.
    I hope I made myself clear enough here, to recap, I would like to sort the rows based on a zero value in one (quantity) column, move them (the zero quantity rows) to the bottom of the sheet, and then delete the rows with a zero quantity (I can delete them manually, but would like to automate the sorting part).
    Thanks for any help anyone can provide here.
    Danny

    I apologize but, as far as I know, Numbers wasn't designed by Ian Flemming.
    There is no "this column will be auto-destructing after two minutes"
    You will have to use your fingers to delete it.
    I wish to add a last comment :
    if your boss has the bad habit to look over your shoulder, it's time to find an other one.
    As I am really pig headed, it's what I did. I became my own boss so nobody looked over my shoulder.
    Yvan KOENIG (VALLAURIS, France) mercredi 13 juillet 2011 20:30:25
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Monitor chained rows and migrated rows of tables

    hai all,
    How to monitor the chained rows and migrated rows of tables....I think some big tables have the chained rows or migrated rows..what is the benchmark for recreate the tables.? any script for identify chained rows and migrated rows?
    Please help?

    Sorry i forget to post the query and here there is
    select
    owner c1,
    table_name c2,
    pct_free c3,
    pct_used c4,
    avg_row_len c5,
    num_rows c6,
    chain_cnt c7,
    chain_cnt/num_rows c8
    from dba_tables
    where
    owner not in ('SYS','SYSTEM')
    and
    table_name not in
    (select table_name from dba_tab_columns
    where
    data_type in ('RAW','LONG RAW')
    and
    chain_cnt > 0
    order by chain_cnt desc
    Regards
    jafar

  • Urgent : Insert , save and Delete in the alv grid

    Hi Experts,
    I am having a alv grid and displaying data by fetching from backend.
    i added a toolbar buttons  "Insert " "Save"  and "Delete".
    when i click on "Insert " button the first row of the table should be empty with input fields. i want to insert data and when i click on "save"  button it should update at backend.kindly let me know how to insert empty row at starting of alv grid and also how to save and delete records..
    thanks in advance.

    Hi Bharath,
    Go through this hope u can understand.
    SEL_MODE. Selection mode, determines how rows can be selected. Can have the following values:
    A Multiple columns, multiple rows with selection buttons.
    B Simple selection, listbox, Single row/column
    C Multiple rows without buttons
    D Multiple rows with buttons and select all ICON
    Setting and getting selected rows (Columns) and read line contents
    You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similar methods for columns.
    Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows from the table. In the examples below the grid table is named gi_sflight.
    Data declaration:
    DATA:
    Internal table for indexes of selected rows
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    Example 1: Reading index of selected row(s) and using it to read the grid table
      CALL METHOD go_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a valid line'.
        EXIT.
      ENDIF.
      LOOP AT gi_index_rows INTO g_selected_row.
         READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
        ENDIF.
      ENDLOOP.
    Example 2: Set selected row(s).
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines > 0.
        CALL METHOD go_grid->set_selected_rows
            exporting
              it_index_rows = gi_index_rows.
      ENDIF.
    Reward points if helpful.
    Thanks
    Naveen khan

  • Capture insert, update and delete messages PlSql

    How can I capture insert, update and delete messages in PlSql, like
    '1 row inserted'.
    TIA, Leo

    You can check the following script --
    satyaki>
    satyaki>create table test_598703
      2   (
      3      Sno   number(5)
      4   );
    Table created.
    satyaki>
    satyaki>declare
      2    cnt  number(5);
      3  begin
      4    insert into test_598703
      5    select empno
      6    from emp;
      7   
      8    cnt := sql%rowcount;
      9   
    10    dbms_output.put_line(cnt||' Rows Inserted');
    11  exception
    12    when others then
    13      dbms_output.put_line(sqlerrm);
    14  end;
    15  /
    16 Rows Inserted
    PL/SQL procedure successfully completed.
    satyaki>
    satyaki>select * from test_598703;
           SNO
          7369
          7499
          7521
          7566
          7654
          7698
          7782
          7788
          7839
          7844
          7876
           SNO
          7900
          7902
          7934
          9898
          7006
    16 rows selected.Similar approach need to follows for other operations.
    Regards.
    Satyaki De.

  • Insert ,Change and Delete  records  in OO ALV

    Hi All,
    This is regarding the functionlaties  Insert ,Change and Delete records  in OO ALV ,
    I have gone through the threads posted here and checked the standard  program BCALV_EDIT_04,
    but still I am not able to capture the Deleted and Inserted records,
    as  I am new to OO ALV,can some one help me out pls.
    Thanks and regrds,
    Sree.

    Hi Sree,
    A lot of material is available on SDN.
    Please see this link. This link contains good example of insertr, delete records in OOPS ALV.
    [OOPS ALV.|Re: Insert ,Delete & Add a row in ALV;
    May it helps you.
    Regards.
    DS.

  • Matrix Add Row and Duplicate Row

    Hi All,
    Can anybody suggest me how to work on Add row and duplicate row in any document table.
    Lets take one example
    Sales order document
    In this doc we have table format where we specify item no, item description etc. In this table when we right click on particluar row we have option for add, delete, duplicate rows..etc.
    wht i would like to know is that when we click add row .....one row is added and number is incremented under # column.  Hw to perform and display this auto increment/ decrement of number for these rows under this # column
    thanks
    harish

    Hi,
    I tried following both code, but in that i am geting value. Means i am getting .Value  Why i not getting value.
      matrix.Columns.Item("V_-1").Cells.Item(pVal.Row).Specific.value = matrix.RowCount
    and i also tried for "AddRow",
    If pVal.BeforeAction = False Then
                    Select Case pVal.ItemUID
                        Case "AddRow"
                            matrix = form.Items.Item("mtr").Specific
                            If matrix.RowCount > 0 Then
                                If Trim(matrix.Columns.Item("V_-1").Cells.Item(matrix.RowCount).Specific.value) = "" Then
                                End If
                            End If
                    End Select
                End If
    In both example i not getting .Value.
    Plz tell y ?
    Thanks

  • Update Failed for Sum of previous row and current row

    Hi i need to update the column length of the previous row and current row so i followed this method but i'm unable to update what is problem in my syntax
    SQL> begin
    2 DECLARE Total number = 0;
    3 UPDATE StringOutput set Total = SumOfLength = Total + ColLength;
    4 end;
    5 /
    DECLARE Total number = 0;
    ERROR at line 2:
    ORA-06550: line 2, column 22:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    := . ( @ % ; not null range default character
    if i update without the variable total then my command is succeeded
    UPDATE StringOutput set SumOfLength = ColLength;
    but i need the previous row+current row count in SumOfLength
    Thanks!

    Getting this error now
    SQL> begin
    2 DECLARE Total number := 0;
    3 UPDATE StringOutput set Total = SumOfLength = Total + ColLength;
    4 end;
    5 /
    UPDATE StringOutput set Total = SumOfLength = Total + ColLength;
    ERROR at line 3:
    ORA-06550: line 3, column 1:
    PLS-00103: Encountered the symbol "UPDATE" when expecting one of the following:
    begin function pragma procedure subtype type <an identifier>
    <a double-quoted delimited-identifier> current cursor delete
    exists prior
    The symbol "begin" was substituted for "UPDATE" to continue.
    ORA-06550: line 3, column 46:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
    . ( , * @ % & - + ; / at mod remainder rem return returning
    <an exponent (**)> where || multiset
    The symbol ". was inserted before "=" to continue.
    ORA-06550: line 4, column 4:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the
    following:
    ( begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted

Maybe you are looking for

  • Problem: Scheduling Process Orders.

    Hi, I have a problem in PPPI with scheduling in Master recipe and with the process order in CM25. Can you help me? In Master Recipe: I create a capacity category 0025 to display for a resource the setup formula and Processing formula in the Schedulin

  • Set xml file name

    Dear, I want to set the name of the xml sended by mail. I use a botton for this, cane help me to set the name of this file before attachement ! Thanks

  • Semi-Conductor Routing

    Dear Semicon experts, Wafer fabrication routing is very complex with over 500 operatrion to make wafers from raw material. Do you really define all operation in routing if you are using SAP PP ? I would assume , routing will be at aggregate level & w

  • Sent email from gp workflow

    hi, I have a gp workflow in which there are 3 stages. The callable objects are created using (Form) webdyn pro form. End user submits a form(Webdynpro form) to his approver .When the approver rejctes the form can I automatically sent an email to the

  • Uninstalling Dreamweaver and Flash MX 2004!

    hello guys! i want to insntall studio 8 but before i do that i want to remove studio mx 2004 (flash, dreamweaver and extension manager) for Mac OSX, but there are NO information on this site! and i tried googling but found nothing! i could just trash