Can not insert or update [TABLE] from internal table in method

I've faced a problem with OO abap. I've tried to insert into [ TABLE ] from internal table, but i've got error msg after i compiled.
"An explicit work area is necessary in the OO context. Use "INSERT wa INTO [TABLE] itab""
After  i changed to loop in work area and INSERT INTO  [TABLE] VALUES gw_data., everything is fine, can compile and run.
This is error code.
  METHOD set_data_to_table.
    REFRESH gi_data.
    CLEAR gi_data.
    IF gi_file[] IS NOT INITIAL.
* Set data for modify table
      LOOP AT gi_file INTO gw_file.
        MOVE-CORRESPONDING gw_file TO gw_data.
        me->conversion_input( EXPORTING im_vendor = gw_data-vendor
                              CHANGING  ch_vendor = gw_data-vendor ).
        APPEND gw_data TO gi_data.
      ENDLOOP.
      INSERT [TABLE] FROM TABLE gi_data.
*      LOOP AT gi_data INTO gw_data.
*        INSERT INTO  [TABLE] VALUES gw_data.
*        IF sy-subrc = 0.
*          COMMIT WORK.
*        ELSE.
*          ROLLBACK WORK.
*        ENDIF.
*      ENDLOOP.
    ELSE.
      MESSAGE 'No data found' TYPE 'I'.
    ENDIF.
  ENDMETHOD.                    "set_data_to_table

Hi Matthew,
I think there is no difference in database insert between OO and non-OO.
The correct syntax according to ECC600 online documentation is
[Inserting Several Lines|http://help.sap.com/saphelp_erp2005vp/helpdata/en/fc/eb3a6d358411d1829f0000e829fbfe/content.htm]
To insert several lines into a database table, use the following:
INSERT target FROM TABLE itab \[ACCEPTING DUPLICATE KEYS].
This writes all lines of the internal table itabto the database table in one single operation. If one or more lines cannot be inserted because the database already contains a line with the same primary key, a runtime error occurs. You can prevent the runtime error occurring by using the addition ACCEPTING DUPLICATE KEYS.
Whenever you want to insert more than one line into a database table, it is more efficient to work with an internal table than to insert the lines one by one.
I think the syntax
INSERT my_dbtable FROM TABLE gi_data.
should work, your suggestion may lead to syntax error.
Regards,
Clemens

Similar Messages

  • Update databse from internal table statement not using index

    Hi Guys,
    We are updating a databse table from a file. The file has a couple of fields which have data different from what the database has (non-primary fields :). We upload the file data into an internal table and then update the database table from internal table. At a time, internal table is supposed to have 10,000 records. I did SQL trace and found that the update statement is not making use of the databse index.
    Should not the update statement here be using the table index (for primary key)?
    Regards,
    Munish

    ... as often there are recommendations in this forum which makes me wonder, how people overestimate their knowledge!!!
    Updates and Deletes do of course use indexes, as can be seen in the SQL Trace (use explain).
    Inserts don't use indexes, because in many databases inserts are just done somewhere, But also with the INSERT, the primary key is the constraint for the uniqueness condition, duplicate keys are not allowed.
    Coming to the original question, what is you actually coding for the update?
    What is the table, which fields are in the internal table and what are the indexes?
    Siegfried

  • Updating database table from internal table

    I am updating the database table from internal table for this is have used the following syntax
    Update kna1 from table itab.
    And it is giving error message as the work are itab is not long enough.
    Please help me.

    Hi,
       Refer this code
    *&      Form  SUB_READ_UPDATE_BSEG
          text
    FORM sub_read_update_bseg.
      IF NOT it_final[] IS INITIAL.
        LOOP AT it_final INTO wa_final.
          UPDATE bseg SET zuonr = wa_final-ccnum
                      WHERE bukrs EQ wa_final-bukrs
                      AND   belnr EQ wa_final-vbeln
                      AND   rfzei EQ wa_final-rfzei
                      AND   saknr NE ' '.
        ENDLOOP.
    *--Message data updated successfully
        MESSAGE i888 WITH text-002.
        LEAVE LIST-PROCESSING.
      ELSE.
    *--Message No data found
        MESSAGE i888 WITH text-003.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " SUB_READ_UPDATE_BSEG
    Regards,
    PRashant

  • How to update Records from Internal table to u2018Zu2019 table?

    Hi Friends,
    How to update Records from Internal table to u2018Zu2019 table.
    I have records in Internal table , that records want to update on u2018Zmarau2019 Table.
    ( my internal table & u2018 Zu2019 table structures are same.)
    Thanking you.
    Regards,
    Subash

    Hi,
    loop at internal table.
    modify <Z- table > from values < internal table Workarea>.
    if sy-subrc = 0.
      COMMIT work.
    else.
      ROLLBACK waork.
    endif.
    endloop.
    or
    UPDATE <Z- table > from table < internal table Workarea>.
    if sy-subrc = 0.
      COMMIT work.
    else.
      ROLLBACK waork.
    endif.
    Prabhudas

  • HT5622 hi,my name is kutan.since i updated ios7 on my ipad;internet got very slow,i can not open facetime no more,i can not download or update anything from apple store! so this is just redicilous! please any help?

    hi,my name is kutan.since i updated ios7 on my ipad;internet got very slow,i can not open facetime no more,i can not download or update anything from apple store! so this is just redicilous! please any help?

    It is hardly Apple's fault that Epson can't/won't update their driver, but at least Epson suggest that you use the Gutenprint driver, which in any case is far better that what Epson offer.
    You can get it here:
    http://gimp-print.sourceforge.net/
    You can download the latest version from here:
    http://sourceforge.net/projects/gimp-print/
    Have you downloaded the recent Apple update to Epson drivers?
    http://support.apple.com/kb/DL1398

  • Modify database table from internal table

    Hi All,
    I need to update database table from internal table which is having around 30000 records.
    I am using MODIFY tabname FROM TABLE int_tabname...
    Using this statement, I can modify the databse records very well. But user has some additional requirement.
    He wants that the table should be modified from the internal table and after modification we should have the erroneous records to be displayed if any.
    e.g. if 1500 records out of 30000 are erroneous then only 28500 records should be updated and 1500 records should be displayed as erroneous records so that the user can correct them and use them again for executing the program.
    Is there any FM which imports the database table name and internal table, modifies the database and exports an internal tanle with erroneous records?
    Any help will be appriciated,
    Regards,
    Neha

    Hi
    modifying datbase table useing internal table
    <b>advises</b> before updating this datbase table plz lock that table to avoid incosistency
    write the logic for modifying
    Modify the database table as per new dunning procedure
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    and finally unlock the table
    <b>example</b>
    *To lock table for further operations
      constants: lc_tabname TYPE  rstable-tabname  VALUE 'FKKVKP'  . "FKKVKP
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = lc_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc EQ 0.
      To fetch all the contract accounts for customers of the segment
      Households/SME.
        PERFORM fetch_contract_accounts using lc_tabname .
      ENDIF.                    " IF sy-subrc EQ 0.
    *wrote the logic
    Modify the database table as per new dunning procedure from internal table
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    *unlock the tbale
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
         TABNAME   =  uc_tabname .
    <b>Reward if usefull</b>

  • Fill database table from internal table

    I made one table ZDISP_CHDOC_CC and want to fill that table from internal table.and i got runtime error. that duplicate entry
    and two entry are like 10 200000    likhp 10
                                        10 200000    likp   10
    DESCRIBE TABLE IT_CHDOC .
        LOOP AT IT_CHDOC.
        INSERT ZDISP_CHDOC_CC FROM  IT_CHDOC.
        endloop.
        IF SY-SUBRC = 0.
          COMMIT WORK.
        ELSE.
    and when i used following then only one entry is insreted.
    DESCRIBE TABLE IT_CHDOC .
        LOOP AT IT_CHDOC.
        INSERT ZDISP_CHDOC_CC FROM  IT_CHDOC.
        IF SY-SUBRC = 0.
          COMMIT WORK.
    endloop.
        ELSE.

    Hi,
    Replace your current code
    DESCRIBE TABLE IT_CHDOC .
    LOOP AT IT_CHDOC.
    INSERT ZDISP_CHDOC_CC FROM IT_CHDOC.
    endloop.
    IF SY-SUBRC = 0.
    COMMIT WORK.
    ELSE.
    WITH THE ONE GIVEN BELOW
    DESCRIBE TABLE IT_CHDOC .
    INSERT ZDISP_CHDOC_CC FROM TABLE IT_CHDOC ACCEPTING DUPLICATE KEYS.
    IF SY-SUBRC = 0.
    COMMIT WORK.
    ELSE.
    Regards,
    Siddarth

  • Update ztable from internal table

    I want to update the Ztable from internal table datas.
    what is the syntax to update.
    Its urgent send with coding example is better

    Hi
    PARAMETERS: p_carrid TYPE sflight-carrid,
                percent(1) TYPE p DECIMALS 0.
    DATA sflight_tab TYPE TABLE OF sflight.
    FIELD-SYMBOLS <sflight> TYPE sflight.
    SELECT *
           FROM sflight
           INTO TABLE sflight_tab
           WHERE carrid = p_carrid AND
                 fldate = sy-datum.
    IF sy-subrc = 0.
      LOOP AT sflight_tab ASSIGNING <sflight>.
        <sflight>-price =
          <sflight>-price * ( 1 - percent / 100 ).
      ENDLOOP.
    ENDIF.
    <b>UPDATE sflight FROM TABLE sflight_tab.</b>
    Thanks
    Vijay
    PLZ reward points if helpful

  • Problem while creating MS-ACCESS tables from Internal tables

    Hi All,
    I need to create Access tables from the Internal tables of an ABAP program.
    I am using RIACCESS program to create Access table and  FM TABLE_EXPORT_TO_MSACCESS for populating the records into Access table.
    Internal table name is ITAB1. I have created Z table with the same number of fields of ITAB1.
    Key fields of Ztable is MANDT and Project ID.
    I have two problems.
    1. When I am trying to create access table from RIACCESS, the Access table is not having the MANDT and Project ID as key fields. Is there any way to pass the Internal table with key fields to the selection parameter of RIACCESS?
    2. How to avoid the MANDT field from the Access table.
    Please help me.
    Thanks,
    Prabhakar

    select * from tablo@aaa;
    ERROR at line 1:
    ORA-02085: database link AAA.US.ORACLE.COM connects to HO.WORLD
    Why is it unsuccessful?
    02085, 00000, "database link %s connects to %s"
    // *Cause: a database link connected to a database with a different name.
    //  The connection is rejected.
    // *Action: create a database link with the same name as the database it
    //  connects to, or set global_names=false.
    //Maybe a configuration mismatch somewhere? What's your global_names setting?
    you should look in the trace files, enable listenner logging and tracing to get more clues about EOF error.
    Yoann.

  • How to update database table from Internal Table

    hi experts,
        Can anyone please assist me in inserting records to a database table from an Internal Table
    whose structures are identical.
    Thanks in Advance,
    Sudhaa............

    Hi Sudha,
    Here are some example of update and insert:
    UPDATE SFLIGHT SET PLANETYPE = 'A310'
    PRICE = PRICE - '100.00'
    WHERE CARRID = 'LH' AND CONNID = '0402'.
    This example overwrites the contents of the PLANETYPE column with A310 and decreases the value of the PRICE column by 100 for each entry in SFLIGHT where CARRID contains u2018LHu2019 and CONNID contains u2018402u2019.
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    MOVE 'AA' TO WA-CARRID.
    MOVE '0064' TO WA-CONNID.
    MOVE 'WASHINGTON' TO WA-CITYFROM.
    UPDATE SPFLI FROM WA.
    MOVE 'LH' TO SPFLI-CARRID.
    MOVE '0017' TO SPFLI-CONNID.
    MOVE 'BERLIN' TO SPFLI-CITYFROM.
    UPDATE SPFLI.
    CARRID and CONNID are the primary key fields of table SPFLI. All fields of those lines where the primary key fields are "AA" and "0064", or "LH" and "0017", are replaced by the values in the corresponding fields of the work area WA or the table work area SPFLI.
    DATA: ITAB TYPE HASHED TABLE OF SPFLI
    WITH UNIQUE KEY CARRID CONNID,
    WA LIKE LINE OF ITAB.
    WA-CARRID = 'UA'. WA-CONNID = '0011'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'LH'. WA-CONNID = '1245'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'AA'. WA-CONNID = '4574'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    UPDATE SPFLI FROM TABLE ITAB.
    This example fills a hashed table ITAB and then overwrites the lines in SPFLI that have the same primary key (CARRID and CONNID) as a line in the internal table.
    Insert statement :
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    WA-CARRID = 'LH'.
    WA-CITYFROM = 'WASHINGTON'.
    INSERT INTO SPFLI VALUES WA.
    WA-CARRID = 'UA'.
    WA-CITYFROM = 'LONDON'.
    INSERT SPFLI FROM WA.
    SPFLI-CARRID = 'LH'.
    SPFLI-CITYFROM = 'BERLIN'.
    INSERT SPFLI.
    If the database table does not already contain a line with the same primary key as specified in the work area, the operation is completed successfully and SY-SUBRC is set to 0. Otherwise, the line is not inserted, and SY-SUBRC is set to 4.
    Regards,
    Premraj kaushik

  • How can i insert new updated values in a table??

    Hi ,
    Can any one suggest me is there any way to insert the recently added data from one table to another table where both the tables have the same structure.
    Suppose i have 10 rows in both table T1 and T2 and now if we add another 4 new rows in the table T2 .Can i update my table T2 w.r.t. T1 with these new row values.
    Remember both the 10 rows in the tables T1 and T2 are the same and the strucuture of the tables are also the same.
    please advice the way to achieve this and if then explain me how to achieve it?Looking forward for the response
    B.r
    debashis

    Hi shailendra and all experts,
    I thought of a more simple approach instead of going to the concept of stored procedure.But i am unable to do it on a scheduled basis like if i want this query to be run on a periodic basis i need to implement this sql query using a job.
    can u suggest how to do it..As far as i know we can include the sql query inside a job to be scheduled on a weekly basis.
    And also have a look at the sql i have written below it will insert all the extra row values of t2 into t1.please help me in scheduling it on a periodic basis .
    Looking forward for ur response .I am almost near the goal i need ur help ..
    reg
    debashis
    insert into t1 select distinct t2.apinumber,t2.wellname from t1,t2 where t2.apinumber NOT IN (select t1.apinumber from t1);

  • Insert or Modify statement from internal table to database table

    Hi All,
    I have three tables wakh, wrf and wakp. I have an internal table with 5 columns col1, col2, col3, col4 and col5.
    The value in Col1 is my article no and the articleno. is in the table wakh. The value in col2 is my ccode and it is in the table wrf. The rest three columns col3, col4 and col5 are unit, qty and price and they are in the wakp table. Now when my articleno is equal to ccode I need to update the col3, col4 and col5 values  in the wakp. wakp has around 20 columns.
    Can anyone of you guys please give me the code for this issue. Your help is highly appreciated and thanks for all for your time.
    Cheers,
    Cheng

    Hi Rob,
    let me explain you the whole process what i am trying to do. I have a screen where there are 3 fields. In my first field I have a promoiton no. As soon as the user enters the promotion no. its description will be populated in my second field. If the promotion is not maintained then it will throw an error. In my third field User will upload an excel sheet which has 5 columns articleno, colorcode, salesunit, qty, mdprice. Here articleno is coming from wakh and colorcode is in wrf_charval table and the rest three fields are coming from wakp table. So for the article no. which is in col1. and for its corresponding colorcode which is in col3 i need to update col3, col4, col5 values.
    With my below code I am able to upload the excel into internal table and display it. So instead of displaying I need to update in the database. Can you please let me know how I need to attach the function module within my code and update accordingly.
    REPORT  ZTest.
    tables : wakh, wakt.
    Parameter: PromoID type wakh-aktnr, PromoDec type wakt-aktkt, p_file LIKE rlgrap-filename
                   DEFAULT 'c:\test.xls' OBLIGATORY.   " File Name
    *FileName type string.
    *file_nm type localfile.
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '2',
           gd_ecol   TYPE i VALUE '5',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    AT selection-screen on PromoID.
    select single * from wakh where aktnr = PromoID.
      if sy-subrc EQ 0.
    select aktkt from wakt into PromoDec where aktnr eq PromoID.
    endselect.
    else.
    message A000(ZI) with 'Promotion ID is not Maintained.'.
    endif.
    *Title : Excel Uploading
    *Selection screen definition
    *SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    *PARAMETERS:  p_file LIKE rlgrap-filename
                  DEFAULT 'c:\test.xls' OBLIGATORY.   " File Name
    *SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
       so_fpath-sign = 'I'.
       so_fpath-option = 'EQ'.
       append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
          upload excel spreadsheet into internal table
         -->P_TABLE    Table to return excel data into
         -->P_FILE     file name and path
         -->P_SCOL     start column
         -->P_SROW     start row
         -->P_ECOL     end column
         -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    Has the following format:
                Row number   | Colum Number   |   Value
         i.e.     1                 1             Name1
                  2                 1             Joe
      DATA : ld_index TYPE i.
    Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
        MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
      ENDFORM.
    Thanks for your valuable time.
    Cheng

  • How can I get Number of Lines from internal table?

    Hello at all,
    i have in my Report a internal Table, which have many KUNNR.
    For example the internal Table:
    MANDT.......KUNNR......NAME.........FIRSTNAME........CITY
    ...040..........12345.........Owen............Michael........Liverpool
    ...040..........12345.........Owen............Michael........Liverpool
    ...040..........99999.......Johnson.......... Jeffrey........London
    ...040..........12345.........Owen............Michael........Liverpool
    ...040..........55555.......Hardley.......... Kingston.......Birmingham
    I want to know, how many same KUNNR are existing in the internal Table?
    In my example i need the result 3, because their is existing 3 times the Kunnr 12345 in the internal Table.
    Have anyone an idea, how can I resolve this problem?
    Edited by: Thomas Zloch on Jun 21, 2010 2:55 PM - one question mark at a time is sufficient

    Hi,
    1.Create two internal tables of same type and sort according to Kunnr then Delete the
    adjusent duplicates by comparing KUNNR
    2.Sort the table by KUNNR and use ON change of Concept in that Just increment the counter.
    I am writing the sample logic here.
    tables kna1.
    data: t_kna1 type table of kna1,
             w_kunnr type kna1-kunnr,
             counter type i," Holds No.of KUNNRs in the T_kna1
             t_kna2 type table of kna1.
    select * from kna1 into table kna1 up to 100 rows.
    t_kna2[] = t_kna1[].
    delete t_kna2 by kunnr.
    delete adjusent duplicates from t_kna2 by comparing kunnr."1st Method
    read table t_kna2 transporting no-fields.
    counter = sy-tfill."1st Method
    loop at t_kna1 into kna1."2nd Method
    at first.
    w_kunnr = kna1-kunnr .
    counter = 1.
    endat.
    if w_kunnr ne kna1-kunnr.
    counter = counter + 1.
    endif.
    endloop.
    Note : Here I used a sample table KNA1 in this there are no Duplicates of KUNNR .

  • Update value from internal table into table control

    hi friends,
    i have two text field and a button in a screen.if give the value and click the button it should get updated in the table control which is in the next screen.plz
    help me with some sample coding.

    hi Karthik ,
    Here you go with the sample coding of moving internal table values to table control on module pool programs :
    in screen painter flow-logic ............
    process before output.
    module status_3000.
    loop at g_tab_con_01_itab
         into g_tab_con_01_wa
         with control tab_con
         cursor tab_con-current_line.
    module tab_con_move.
    endloop.
    process after input.
    module exit at exit-command.
    module user_command_3000.
    module clear_ok_code.
    loop at g_tab_con_01_itab.
    module read_tab_con.
    endloop.
    in your program .............
    include z_tab_ctrl_top                          .    " global Data
    program  z_tab_ctrl.
    tables : sflight,sbook,zsflight.
    types:begin of t_tab_con_01 ,
            carrid like sflight-carrid,
            connid like sflight-connid,
            sel type c,
           end of t_tab_con_01.
    data: g_tab_con_01_itab type  t_tab_con_01 occurs 0 with header line,
          g_tab_con_01_wa type t_tab_con_01,
          g_tab_con_01_copied ,
          g_tab_con_01_lines like sy-loopc,
          ok_code like sy-ucomm,
          lines type i,
          init ,
          fill type i.
    controls: tab_con type tableview using screen 3000.
    module status_3000 output.
      set pf-status 'ST100'.
      set titlebar 'T100'.
    endmodule. 
    module update_table_control input.
      describe table g_tab_con_01_itab lines tab_con-lines.
    endmodule.  
    module exit input.
      ok_code = sy-ucomm.
      if ok_code eq 'BACK' or ok_code eq 'EXIT' or ok_code eq 'CANCEL'.
        leave program .
      endif.
    endmodule.        
    module clear_ok_code input.
    clear ok_code.
    endmodule.      
    module fill_tab_con output.
    read table g_tab_con_01_itab into zsflight index tab_con-current_line.
    endmodule.                 " fill_tab_con  OUTPUT
    module read_tab_con input.
    *lines = sy-loopc.
    read table g_tab_con_01_itab into g_tab_con_01_wa index tab_con-current_line.
    if sy-subrc eq 0.
    move-corresponding sflight to g_tab_con_01_wa.
    modify g_tab_con_01_itab from g_tab_con_01_wa index tab_con-current_line.
    else.
    move-corresponding sflight to g_tab_con_01_wa.
    append g_tab_con_01_wa to g_tab_con_01_itab.
    endif.
    module tab_con_move output.
    move-corresponding g_tab_con_01_wa to sflight.
    endmodule.                 " tab_con_move  OUTPUT
    module tab_con_get_lines output.
    g_tab_con_01_lines = sy-loopc.
    endmodule.                 " tab_con_get_lines  OUTPUT
    module tab_con_modify input.
    move-corresponding sflight to g_tab_con_01_wa.
      modify g_tab_con_01_itab
          from g_tab_con_01_wa
          index tab_con-current_line.
    endmodule.                 " tab_con_modify  INPUT
    module populate_tab_ctrl input.
    if sy-subrc eq 0.
    endif.
    endmodule.
    Look at the following modules in the above program ....
    fill_tab_con
    tab_con_modify
    tab_con_get_lines
    update_table_control
    This will definately solve your problem or give an idea for solution ....
    reward if helpful,
    Regards,
    Ranjita

  • Add records to the physical table from Internal table

    Hello,
    I am trying to insert the records from IT table to physical table. But, its not inserting. Please let me know how do I add the records to the table zebp_iv_cf_log.
    I have used only few fields for example *
    After looping I get about 800 records in it_non_ebp tab *
    loop at non_ebp_inv.
        it_non_ebp-zspgrv = non_ebp_inv-spgrv.
        it_non_ebp-zspgrq = non_ebp_inv-spgrq.
        it_non_ebp-zspgrs = non_ebp_inv-spgrs.
        it_non_ebp-inv_ref_num = non_ebp_inv-xblnr.
        it_non_ebp-zspgrc = non_ebp_inv-spgrc.
        it_non_ebp-zlifnr = non_ebp_inv-lifnr.
        append it_non_ebp.
        endloop.
        insert   zebp_iv_cf_log from table it_non_ebp[] accepting duplicate keys .
    I also tried inserting one by one by putting insert syntex within a loop but, it takes keeps processing.
    Shall appreciate the response.
    Thks & Rgds,
    Hemal
    Edited by: hemalgandhi on Jun 12, 2009 6:27 PM

    Hi,
    for the internal table you are using for appending , you must declare it with the header line option
    as
    data it_non_ebp type table of zebp_iv_cf_log with HEADER LINE.
    or else you can have a separate workarea of type zebp_iv_cf_log
    as
    data wa_zebp_iv_cf_log type zebp_iv_cf_log.
    then the code should be like :
    loop at non_ebp_inv.
    wa_zebp_iv_cf_log -zspgrv = non_ebp_inv-spgrv.
    wa_zebp_iv_cf_log -zspgrq = non_ebp_inv-spgrq.
    wa_zebp_iv_cf_log -zspgrs = non_ebp_inv-spgrs.
    wa_zebp_iv_cf_log -inv_ref_num = non_ebp_inv-xblnr.
    wa_zebp_iv_cf_log -zspgrc = non_ebp_inv-spgrc.
    wa_zebp_iv_cf_log -zlifnr = non_ebp_inv-lifnr.
    append wa_zebp_iv_cf_log to it_non_ebp.
    clear wa_zebp_iv_cf_log .
    endloop.
    and use 
       modify zebp_iv_cf_log from table it_non_ebp accepting duplicate keys .
    instead of
       insert zebp_iv_cf_log from table it_non_ebp[] accepting duplicate keys .
    Please try out and let me know of you face any problem

Maybe you are looking for

  • Obtaining HTML page by issuing a call from a PL/SQL procedure

    Is there any possibility to obtain HTMLDB -> HTML page from a user defined PL/SQL procedure ? For example I build an procedure which calls directly flows_010500.wwv_flow.show(null,p_flow_step_id=>'2',p_flow_id=>'104') and i try to read the result fro

  • Using a upgrade phone

    If I upgraded someone else's line and received the phone, could that phone be activated on another line? Without ever being activated on the "intended" line instead of transferring upgrades, and would the old phone on that line still be able to be us

  • "no email program" – didn't ask to send a mail!

    Opening .pdfs with Reader XI (11.04) on Windows 7 keeps stalling; after a bit of checking and exploring, I found this is because of an alert box that is not showing up on top of the main Acrobat window. That's bad enough, but the alert itself doesn't

  • Endless reboot after 1.1.3 ... works fine when plugged in.

    Hi - I updated to 1.1.3. Ever since, my phone reboots a short while after I unplug it (from a computer or a wall charger). It reboots endlessly until I plug it in. It seems to work fine when I'm using it, but as soon as it's idle and unplugged for a

  • Fico cash journal spl gl indicator possible

    Hey SAP Gurus, I want to show in cash journal , any payment made to an employee as a staff advance earlier, an indication, when another advance is made to the same employee (just like down payment made). By using spl gl indicator anand