Creation of Copy and insert in Table

Hi guys,
           I am new to Web Dynpro.I have created one table from SAP by calling of RFC Adaptive method. Now i want to create copy the table single or multiple rows and paste in same table.
            Could anyone please send me that exact documentation for creation of copy and paste button.
Regards
Velu.

Hi Kulanthaivelu,
There is no such exact documentation. But you can implement that using the code. You have to keep few things in mind for this particular code:
1) There should be one empty row where you want to paste the selected row.
2) You cannot copy a selected row on a row already having some data. If you want to do that you have to modify the code.
3) This code is not for multiple copy & paste. For doing that you can modify the code.
<b>Steps for Copy:</b>
1) Create a button and create a action for that say Copy
2) Write this code for implementation of this function:
public void onActionCopy(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    //@@begin onActionCopy(ServerEvent)
       int currentIndex = wdContext.node<having_the_attributes_for_column>().getLeadSelection();
       IWDNodeElement ne1 = wdContext.node<having_the_attributes_for_column>().createElement();
       WDCopyService.copyCorresponding(wdContext.node<having_the_attributes_for_column>().getElementAt(currentIndex),ne1);
       ne = ne1;
    //@@end
<b>Steps for Paste:</b>
1) Create a button and create a action for that say Paste.
2) Write this code for implementation of this function:
public void onActionPaste(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    //@@begin onActionPaste(ServerEvent)
       int currentIndex = wdContext.node<having_the_attributes_for_column>().getLeadSelection();
       IWDNodeElement tempElement = wdContext.node<having_the_attributes_for_column>().getElementAt(currentIndex);
       if(!isRowBlank(tempElement)){
            wdThis.wdGetAPI().getComponent().getMessageManager().reportException("You can paste elements only in a blank row");
       else{
              WDCopyService.copyCorresponding(ne,wdContext.node<having_the_attributes_for_column>().getElementAt(currentIndex));
    //@@end
<b>isRowBlank Funtion:</b>
public boolean isRowBlank( com.sap.tc.webdynpro.progmodel.api.IWDNodeElement nodeElement )  {
    //@@begin isRowBlank()
       IWDNode node = nodeElement.node();
       Iterator itr = node.getNodeInfo().iterateAttributes();
       while(itr.hasNext()){
            IWDAttributeInfo info = (IWDAttributeInfo)itr.next();
            if(nodeElement.getAttributeValue(info.getName())!= null){
                 return false;
       return true;
    //@@end
I hope this helps you!!
Regards
Pravesh
PS: Please consider rewarding points for helpful answers.

Similar Messages

  • Problem with reading data from screen and inserting in table

    hi ther,
    im new to abap-webdyn pro. can anyone suggest how to read data from screen and insert into table when press 'ADD' button.
    i done screen gui , table creation but problems with action. what the content of acton add.
    is ther any link that helps me or tut??
    thankx in advance!
    regards

    Hi,
    Create a context node for the screen fields for which you want to enter the values with cardinality 1.1.....
    Now in the layout of your view bind the screen input fields to that context node(attributes) to the value property of the input fields...
    Now in the action of ADD button....
    --> go the wizard and select the read node button and select the node which you have created it generates the auto code for you.....
    for example if the node is contains aone attribute like MATNR
    reading the node from wizard will generate the code as....
    DATA lo_nd_matnr TYPE REF TO if_wd_context_node.
      DATA lo_el_matnr TYPE REF TO if_wd_context_element.
      DATA ls_matnr TYPE wd_this->element_matnr.
      DATA lv_matnr TYPE wd_this->element_matnr-matnr.
    * navigate from <CONTEXT> to <MATNR> via lead selection
      lo_nd_matnr = wd_context->get_child_node( name = wd_this->wdctx_matnr ).
    * @TODO handle non existant child
    * IF lo_nd_matnr IS INITIAL.
    * ENDIF.
    * get element via lead selection
      lo_el_matnr = lo_nd_matnr->get_element( ).
    * @TODO handle not set lead selection
      IF lo_el_matnr IS INITIAL.
      ENDIF.
    * get single attribute
      lo_el_matnr->get_attribute(
        EXPORTING
          name =  `MATNR`
        IMPORTING
          value = lv_matnr ).
    here the variable lv_matnr will contain the entered value......
    now you can use this value for further process.
    Thanks,
    Shailaja Ainala.

  • Using Pages, I have created a document and inserted a Table for use in logging an inventaory. When I came to print this off however the lines for the table were missing but the text was in the Table format, weird! How do I print the Table?

    Using Pages, I have created a document and inserted a Table for use logging an inventory. When I came to print this document the lines and boarders of the Table feature did not print however the text did print in the table format. How do I get the lines and boarders to print also?

    Using Pages, I have created a document and inserted a Table for use logging an inventory. When I came to print this document the lines and boarders of the Table feature did not print however the text did print in the table format. How do I get the lines and boarders to print also?

  • Cannot copy and paste a table

    The Thunderbird text editor does not consistently allow copying and paste a table from Word. More generally, its text editor is full of bugs and anomalies, such as arbitrarily setting text to a different font.

    As recently as December 30, 2013, I was able to copy LibreOffice calc data and paste it w/o problems into Tbird messages. Formatting, merged cells, all came across perfectly. I've been doing this for a long time (over a year at the least) without problems.
    Now when I copy and try pasting nothing at all happens ... as in literally nothing changes in the email.
    It's really frustrating when something this basic gets broken. If you know what version I'd have to revert to until it's fixed (and where to get the download), that would be great.
    Don't know if it helps having the following, but just in case:
    * Win 7 Pro 64-bit SP1
    * Tbird 24.3.0
    * LibreOffice 4.2.0.4

  • Can't copy and paste from table to table

    Just upgraded all my clients to CS 6.5 and now no one can copy and paste from table to table.  It locks up every time.  I have already dumped the program preferences and still can't do it.  This is a HUGE problem with my users.  Any help would be appreciated.  I have a wild mix of users - Mac, Windows XP and Windows 7.  Please help if you can!

    Hi Lisa,
    Thank you for contacting Adobe Support.
    The only possible workaround is that you can select (n-1) cell from a particular row where n are the total number of cells in a particular row.
    Ex- If i have a row with 3 cells so i can only select 2 cells at a time and paste it to the location where i wanted to paste and then manually select the last cell and copy paste the content where required.
    Please let us know in case of any concern.
    Thanks and Regards
    Loveesh Kumar

  • Reg: read excel column and insert into table.

    hi Friends,
          i wanted to read the data from Excel and insert into in my oracle tables.
          can you provide the link or example script.
        how to read the column value from excel and insert into table.
      please help.

    < unnecessary reference to personal blog removed by moderator >
    Here are the steps:
    1) First create a directory and grant read , write , execute to the user from where you want to access the flat files and load it.
    2) Write a generic function to load PIPE delimited flat files:
    CREATE OR REPLACE FUNCTION TABLE_LOAD ( p_table in varchar2,
    p_dir in varchar2 DEFAULT ‘YOUR_DIRECTORY_NAME’,
    P_FILENAME in varchar2,
    p_ignore_headerlines IN INTEGER DEFAULT 1,
    p_delimiter in varchar2 default ‘|’,
    p_optional_enclosed in varchar2 default ‘”‘ )
    return number
    is
    – FUNCTION TABLE_LOAD
    – PURPOSE: Load the flat files i.e. only text files to Oracle
    – tables.
    – This is a generic function which can be used for
    – importing any text flat files to oracle database.
    – PARAMETERS:
    – P_TABLE
    – Pass name of the table for which import has to be done.
    – P_DIR
    – Name of the directory where the file is been placed.
    – Note: The grant has to be given for the user to the directory
    – before executing the function
    – P_FILENAME
    – The name of the flat file(a text file)
    – P_IGNORE_HEADERLINES
    – By default we are passing 1 to skip the first line of the file
    – which are headers on the Flat files.
    – P_DELIMITER
    – Dafault “|” pipe is been passed.
    – P_OPTIONAL_ENCLOSED
    – Optionally enclosed by ‘ ” ‘ are been ignored.
    – AUTHOR:
    – Slobaray
    l_input utl_file.file_type;
    l_theCursor integer default dbms_sql.open_cursor;
    l_lastLine varchar2(4000);
    l_cnames varchar2(4000);
    l_bindvars varchar2(4000);
    l_status integer;
    l_cnt number default 0;
    l_rowCount number default 0;
    l_sep char(1) default NULL;
    L_ERRMSG varchar2(4000);
    V_EOF BOOLEAN := false;
    begin
    l_cnt := 1;
    for TAB_COLUMNS in (
    select column_name, data_type from user_tab_columns where table_name=p_table order by column_id
    ) loop
    l_cnames := l_cnames || tab_columns.column_name || ‘,’;
    l_bindvars := l_bindvars || case when tab_columns.data_type in (‘DATE’, ‘TIMESTAMP(6)’) then ‘to_date(:b’ || l_cnt || ‘,”YYYY-MM-DD HH24:MI:SS”),’ else ‘:b’|| l_cnt || ‘,’ end;
    l_cnt := l_cnt + 1;
    end loop;
    l_cnames := rtrim(l_cnames,’,');
    L_BINDVARS := RTRIM(L_BINDVARS,’,');
    L_INPUT := UTL_FILE.FOPEN( P_DIR, P_FILENAME, ‘r’ );
    IF p_ignore_headerlines > 0
    THEN
    BEGIN
    FOR i IN 1 .. p_ignore_headerlines
    LOOP
    UTL_FILE.get_line(l_input, l_lastLine);
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    v_eof := TRUE;
    end;
    END IF;
    if not v_eof then
    dbms_sql.parse( l_theCursor, ‘insert into ‘ || p_table || ‘(‘ || l_cnames || ‘) values (‘ || l_bindvars || ‘)’, dbms_sql.native );
    loop
    begin
    utl_file.get_line( l_input, l_lastLine );
    exception
    when NO_DATA_FOUND then
    exit;
    end;
    if length(l_lastLine) > 0 then
    for i in 1 .. l_cnt-1
    LOOP
    dbms_sql.bind_variable( l_theCursor, ‘:b’||i,
    ltrim(rtrim(rtrim(
    regexp_substr(l_lastLine,’([^|]*)(\||$)’,1,i),p_delimiter),p_optional_enclosed),p_optional_enclosed));
    end loop;
    begin
    l_status := dbms_sql.execute(l_theCursor);
    l_rowCount := l_rowCount + 1;
    exception
    when OTHERS then
    L_ERRMSG := SQLERRM;
    insert into BADLOG ( TABLE_NAME, ERRM, data, ERROR_DATE )
    values ( P_TABLE,l_errmsg, l_lastLine ,systimestamp );
    end;
    end if;
    end loop;
    dbms_sql.close_cursor(l_theCursor);
    utl_file.fclose( l_input );
    commit;
    end if;
    insert into IMPORT_HIST (FILENAME,TABLE_NAME,NUM_OF_REC,IMPORT_DATE)
    values ( P_FILENAME, P_TABLE,l_rowCount,sysdate );
    UTL_FILE.FRENAME(
    P_DIR,
    P_FILENAME,
    P_DIR,
    REPLACE(P_FILENAME,
    ‘.txt’,
    ‘_’ || TO_CHAR(SYSDATE, ‘DD_MON_RRRR_HH24_MI_SS_AM’) || ‘.txt’
    commit;
    RETURN L_ROWCOUNT;
    end TABLE_LOAD;
    Note: when you run the function then it will also modify the source flat file with timestamp , so that we can have the track like which file was loaded .
    3) Check if the user is having UTL_FILE privileges or not :
    SQL> SELECT OWNER,
    OBJECT_TYPE
    FROM ALL_OBJECTS
    WHERE OBJECT_NAME = ‘UTL_FILE’
    AND OWNER =<>;
    If the user is not having the privileges then grant “UTL_FILE” to user from SYS user:
    SQL> GRANT EXECUTE ON UTL_FILE TO <>;
    4) In the function I have used two tables like:
    import_hist table and badlog table to track the history of the load and another to check the bad log if it occurs while doing the load .
    Under the same user create an error log table to log the error out records while doing the import:
    SQL> CREATE TABLE badlog
    errm VARCHAR2(4000),
    data VARCHAR2(4000) ,
    error_date TIMESTAMP
    Under the same user create Load history table to log the details of the file and tables that are imported with a track of records loaded:
    SQL> create table IMPORT_HIST
    FILENAME varchar2(200),
    TABLE_NAME varchar2(200),
    NUM_OF_REC number,
    IMPORT_DATE DATE
    5) Finally run the PLSQL block and check if it is loading properly or not if not then check the badlog:
    Execute the PLSQL block to import the data from the USER:
    SQL> declare
    P_TABLE varchar2(200):=<>;
    P_DIR varchar2(200):=<>;
    P_FILENAME VARCHAR2(200):=<>;
    v_Return NUMBER;
    BEGIN
    v_Return := TABLE_LOAD(
    P_TABLE => P_TABLE,
    P_DIR => P_DIR,
    P_FILENAME => P_FILENAME,
    P_IGNORE_HEADERLINES => P_IGNORE_HEADERLINES,
    P_DELIMITER => P_DELIMITER,
    P_OPTIONAL_ENCLOSED => P_OPTIONAL_ENCLOSED
    DBMS_OUTPUT.PUT_LINE(‘v_Return = ‘ || v_Return);
    end;
    6) Once the PLSQL block is been executed then check for any error log table and also the target table if the records are been successfully imported or not.

  • Is there a way to copy and paste excel table contents to a pdf table form?

    Is there a way to copy and paste excel table contents to a pdf table form?

    It's not something I have tried before.  Have you tried it, and what's happened?
    Basically, copy/pasting tables is a bit of a problem - anywhere.  Table formats are different in different circumstances - Excel, HTML, PDF, ...
    If you copy a HTML table and paste it into an Excel sheet, the entire table will go into one single cell.
    So most likely what you are trying to achieve will not work.

  • RE: Pbm in alv for copying and inserting the record....

    Hi,
       I am developing alv gird  report...............what my issue is:
      while selecting a record...........he should copy the record and insert a new record
      below on which he selected....
      Regarding this if anybody helps me that will be appreciable...
    Regards,
    Naveen M.

    hai Do like This:
    at user command
    FORM PICK USING COMMAND LIKE SY-UCOMM SELFIELD TYPE SLIS_SELFIELD. "Pick is name  given in REUSE_ALV_GRID
    READ TABLE idata INTO wa_data INDEX SELFIELD-TABINDEX.
    CASE COMMAND.
    WHEN '&IC1'.
    Select second data according to your requirement in Another internal  table.
    newdata[] = idata[]. "Move ur first table display data to one new internal tabe.
    clear idata[].
    append wa_data to idata.
    now move data which was selected in select statement to idata table and append data. "it will add new data in idata table
    after this get previous data in idata
    READ TABLE newdata INTO wa_data INDEX SELFIELD-TABINDEX.
    clear wa_data.
    modify newdata index sy-tabix.
    delete newdata where "it is initial.
    loop at newdata.
    idata = newdata.
    append idata.
    endloop.
    after this call reuse_alv_grid_display.
    endcase
    endform.

  • How to copy and paste a table and pictures from pdf files to word using MacBook pro 10.5.8

    Hi Guys,
    I want to copy tables out of a PDF document onto a word document. I only get the text and not the table when I copy and paste. I would also like to know how I can do the same with pictures or diagrams in PDF to word.
    Regards,
    Craig

    You can take picture of anyhting from any document using Command + Shift + 4. Hold all three at the same time and your mouse will turn into a little plus sign where you can then drag across anything you'd like to take picture of it. The picture will be placed on your desktop.
    See if that works for you.

  • Copy and paste a Table from a web Page

    I want to copy this Table at the link below into a Pages Document so I have these shortcuts/key combos nearby in case of disaster (For example, I did not know that you boot off a CD by holding the C key upon restart.
    http://docs.info.apple.com/article.html?artnum=75459
    How do I do this and retain the Table Format?
    (New to the Mac and Pages)
    Thanks

    That web page has several tables so you'll need to do this for each one. First, don't use Safari, use Firefox or Camino. Safari doesn't "see" the tabs in the tables. Select the text of the first table & copy. Now, go to your Pages document & create a 2-column table with a header row. Click in the first cell & paste. In previous versions of Pages you had to create the table with the exact number of columns or the pasted table filled rows across before pasting in the next row. I tried this without a header row & everything pasted in the first cell. Adding the header row, everything pasted nicely.

  • Search and insert from table with RichTextInsertBehavior

    Hi OTN,
    I have a Rich Text Editor which is used to edit CLOB content.
    Near RTE I should have controls to insert special macros with a following scenario:
    I click "Insert Person Link" button - a popup with search through Employees by name appears.
    I choose a person, click OK and a macro like "\[A_PERSON(123)\]" is inserted into RTE field, where 123 is a Metaterm field of selected employee.
    Please, advise me how should I organize this kind of search and insertion? What's the best way, what components should I use?
    Right now I'm using Query with table component.
    But I'm a little stuck with Value field of RichTextEditorInsertBehavior. It should be like "\[A_PERSON(<table.selectedRow.metatermField>)\]"
    How do I choose it? Or is there a totally better way with, say, InputListOfValue component or smth.
    JDev 11.1.1.1.0
    Thanks.
    Edited by: ILya Cyclone on Oct 5, 2009 11:46 PM
    I should have used af:query.

    Hi,
    You can use a traditional exp - imp
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/exp_imp.htm
    or new expdp - impdp
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_overview.htm#i1009203
    depends on yuor Oracle version.. !!!

  • Procedure with multiple Loops and Insert into table

    Hello All,
    I am trying to create the Procedure to create a new table for our DWH.
    In this Case, I have 2 tables and I need to create Loop for each value from one table and get the respective data from second table based on first table data.
    Please find the below example:
    First table: TABLE_A
    X             Y              Z
    1              a              10
    1              b             abc
    1              c              xy
    1              e             $
    2              a              11
    2              c              asf
    2              d             tal
    2              f              ghs
    Second Table: TABLE_B
    A             B             C             D             E              F
    10           abc         xy           sd           ew          100
    10           jhy          xy           sd           ew          100
    11           ght         asf          tal           ss            ghs
    11           ght         afr          tal           ss            ghs
    O/P Table from Procedure: OUTPUT_TABLE
    A             B             C             D             E              F              X
    10           abc         xy           sd           ew          100         1
    11           ght         asf          tal           ss            ghs         2
    Business Logic In the Procedure:
    CREATE OR REPLACE PROCEDURE OP_TAB_PROCEDURE IS
    BEGIN
                    -- First get the DISTINCT values from the TABLE_A to generate the Loop
                    FOR ID (SEELCT DISTINCT X FROM TABLE_A_
                    LOOP
                                    -- For Each ID get the Y ,Z values from TABLE_A other than $ in Z
                                                    TEMP:
                                                    SELECT Y, Z FROM TABLE_A WHERE X = ID.X AND Z <> '$' ;
                                                    Based on above SELECT statement, I need to construct dynamic SQL query to get the data from TABLE_B
                                                    OP_EACH_ID:
                                                    SELECT * , ID.X AS X FROM TABLE_A WHERE [In this place I need generate sql cond dynamically. For Example, For X=1 in TABLE_A , the where cond must A=10 AND B='abc' AND C='xy'
                                                                                                                                                                                                                     For X=2 , the Where cond must be WHERE A=11 AND C='asf' AND D='tal' AND F='ghs']
                                                    -- I need to INSERT all the values from OP_EACH_ID into OUT_PUT_TABLE
                    END LOOP ;
    END;
    I am new to PL/SQL , so please help me on the above case.

    duplicate post

  • Retrieve data from a text file and insert in table

    hi,
    i am writing an application which when executes would creates a user table and populates it with the data i.e. username and passwords taking it from a text file.
    i would like to know if anybody can help as to how can i retreive the user name and password for every insert statement that will be fired to populate the user table.
    thanks in advance for the help

    for csv try a little search:
    http://search.java.sun.com/Search/java?col=javafrm&qp=%2Bforum%3A31&qt=csv+import
    search for ini files:
    http://search.java.sun.com/Search/java?qt=ini+file&col=javafrm&rf=0&qp=%2Bforum%3A31
    hope this helps
    tobias

  • Create and insert into table from Oracle to MS SQL server.

    Hello,
    Oracle Database 11g and Red hat 5
    I have a very different kind of issue. I am handling the ORACLE db(remote db with all the important data). On the other side their is a MS SQL server db(local db with some testing data in it). All the users will access the ORACLE db for the actual processing but for sometime they need to apply some of their own concepts. So they will transfer the data from ORACLE to MS sql server.
    I want to create a code in ORACLE db like a procedure , which will create a table in MS sql server , insert data into it,Also create some metadata table to keep some of my table's info on MS SQL serve db,If the table is present it should append the data, .... like many things ...
    Overall my question is , how can i write a code to make these operation on a remote db, that to these operations are DDL and on MS SQL Server(Non-Oracle) ???
    Please guide me with some ideas or solutions ...
    Also provide if you have some good links to study ...
    thanks in advance.

    I'm not sure why you never visit http://tahiti.oracle.com prior to asking any question. Is it forbidden in your locale? Are you afraid of it? Will your salary be decreased when you visit the documentation?
    http://www.oracle.com/pls/db111/search?word=sql+server&partno=
    should provide sufficient information.
    Your doc question must be considered a violation of Forum Etiquette and an abuse of this forum.
    Sybrand Bakker
    Senior Oracle DBA

  • Could anyone tell me how to read 4 lines altogether and insert into table

    Hi ,
    I want to load the below data into table by using sql loader.
    First 4 lines should insert in one single row in table and again it should from '01' load the next 4 lines in another row.
    01suresh
    02works
    03in
    04bankok
    01kumar
    02works
    03in
    04abudabi
    01Raju
    02works
    03in
    04france
    Could you please give me some suggestion how i can accomplish it.
    Thanks in advance.
    Regards,
    Vino

    user1142030 wrote:
    First 4 lines should insert in one single row in table and again it should from '01' load the next 4 lines in another row.Not a problem, use CONTINUEIF. Control file:
    LOAD DATA
    INFILE *
    REPLACE
    CONTINUEIF NEXT PRESERVE(1:2) != "01"
    INTO TABLE continueif
    TRAILING NULLCOLS
    DUMMY FILLER POSITION(1:2),
    COL1 TERMINATED BY '02',
    COL2 TERMINATED BY '03',
    COL3 TERMINATED BY '04',
    COL4 TERMINATED BY '01'
    BEGINDATA
    01suresh
    02works
    03in
    04bankok
    01kumar
    02works
    03in
    04abudabi
    01Raju
    02works
    03in
    04france Now:
    SQL> create table continueif(
      2                          col1 varchar2(10),
      3                          col2 varchar2(10),
      4                          col3 varchar2(10),
      5                          col4 varchar2(10)
      6                         )
      7  /
    Table created.
    SQL> host sqlldr scott@orcl/tiger control=c:\temp\continueif.ctl log=c:\temp\continueif.log
    SQL> select * from continueif
      2  /
    COL1       COL2       COL3       COL4
    suresh     works      in         bankok
    kumar      works      in         abudabi
    Raju       works      in         france
    3 rows selected.
    SQL> SY.

Maybe you are looking for

  • Problem with v and w in a cube

    Hi, I have problem with 'v' and 'w' in an Analysis Services cube (SQL Server 2008R2). The example is employee number 'frvi' and 'frwi'. The cube summarize both employee's measures to employee number 'frvi'. And does not show the employee number 'frwi

  • How to automatically close PR ?

    Hi all, PR item has an indicator : CLOSED . It is said: Purchase Requisition Closed Flags a purchase requisition as closed, that means that no further purchase orders are to be created for this purchase requisition. Use You can: Set this indicator ma

  • Ip4 loosing internet connection

    my phone keeps dropping my internet connection even when i have full wifi strength, it has only been doing this since i upgraded to 4.3.1. It's not my router or modem as I have the same problem at work on another wireless link. What's going on??

  • The query contains a formula with the operator SUMCT

    I m trying to get query ready for Webi, getting the error as 'The query contains a formula with the operator %RT. Therefore, the query cannot be released for OLE DB for OLAP' I have not used any kind of s %GT, %RT, %CT, SUMGT, SUMRT, SUMCT and LEAF,

  • Speed - your having a laugh!

    I have to write this as I think it's disgraceful and shoddy. Before I start though, I know the service is an "upto" one in terms of speed but this takes the biscuit. Joined BT in May 2012 on infinity 2 and re contracted 12 months later. Upon joining,