How to insert a specific record into alv

Hi everyone,
  here is my problem:
    I put an ALV GRID control in my screen , it display some records.
    and I create a new button on the toolbar, and in the "handle user command class" , I need to
select a record from DB table into a work area.
    after I select the record I need, here is the key question:
      *I want to insert the record into the ALV at a specific row position which the user decided,
what should I do?*
  METHOD HANDLE_ON_USER_COMMAND.
    CASE E_UCOMM.
      WHEN CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      WHEN 'FC_ASSIGN'.
***I do some selection here  
        select %%%$$%%%^&&** into GS_HOLIDAYS.
*** after the selection, what should I do then????
*** I want to insert the work area GS_HOLIDAYS into ALV at a specific position
*** e.g.  into the 3rd row.
*** how can I achieve that????
***call a method or something??????I don't know    
      WHEN 'FC_DELETE'.
      WHEN OTHERS.
    ENDCASE.
  ENDMETHOD.
pls don't let me go through the programs in package "SLIS",because I have already done that and
I haven't solved my problems yet.
Thanks for your help.

All u need to do is on user command for inserting new records u just insert a blank record in your internal table that u are displaying with required style informaion for making it editable and then refresh alv display by method REFRESH_TABLE_DISPLAY.
Thanks & Regards,
Vivek Gaur

Similar Messages

  • How we can select two records in alv report

    how we can select two records in alv report

    Hello,
    You can use the method <b>get_selected_rows</b>.
         CALL METHOD gv_alv->get_selected_rows
            IMPORTING
          ET_INDEX_ROWS =
            et_row_no     = lt_selected_rows.
    READ TABLE lt_selected_rows INTO ls_selected_row INDEX 1 .
    The table <b>lt_selected_rows</b> will contain all the selected rows.
    Regards,
    Beejal
    **reward if this helps

  • How to insert blank lines in the ALV output.

    Hi Friends,
    Could any body help me out How to insert blank lines in the ALV output.?? Any Code pls...
    Thank you,
    Vikram.C

    hi vikram
    do like this
    In the fieldcatalog table all the fields should be in editable mode
    ie lw_fcat-edit = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    i_callback_pf_status_set = 'SET_PF_STATUS'
    i_callback_user_command = 'USER_COMMAND'
    is_layout = lv_layout
    it_fieldcat = lt_fcat[]
    i_save = 'A'
    is_variant = lv_variant
    TABLES
    t_outtab = lt_license[]
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    ENDFORM. " display_data
    *& Form user_command
    FORM user_command USING r_ucomm TYPE sy-ucomm
    rs_selfield TYPE slis_selfield.
    CASE r_ucomm.
    WHEN 'ADD'. "
    data: lv_ind type i.
    data: lv_line type i.
    describe table lt_license lines lv_line.
    loop at lt_license into lw_license.
    lv_ind = sy-tabix.
    if lv_ind = lv_line.
    append initial line to lt_license.
    endif.
    endloop.
    ENDCASE.
    ENDFORM. "user_command
    reward points if useful
    Rohan

  • How to do choose one record in alv screen from dyn_table ?

    Experts:  How to do choose one record in alv screen from <dyn_table> ?
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    DATA: V_COUNT TYPE I.
    CLEAR: V_COUNT,<dyn_wa>.
    LOOP AT <dyn_table> INTO <dyn_wa>. "WHERE <?????> = 'X'.  I should how to do write ?
            V_COUNT = V_COUNT + 1.
    ENDLOOP.
      if not rs_selfield-tabindex eq 0 AND V_COUNT NE 0.
        IF R_UCOMM = '&CHANGE'.
          IF sy-subrc = 0.
            IF V_COUNT = 1.
              CALL SCREEN 100.
              perform dny_field_value_update.
              rs_selfield-refresh = 'X'.
            ENDIF.
          ENDIF.
        endif.
      endif.
    ENDFORM. "USER_COMMAND

    Anyways which version of SAP are you using ? As of SAPNW 7.0 Release 2 you can specify dynamic tokens with LOOP ... WHERE statement.
    My sap product is ecc5.0. Still thanks!
    Now I have solved it.
    FORM USER_COMMAND  USING R_UCOMM LIKE SY-UCOMM
                             RS_SELFIELD TYPE SLIS_SELFIELD.
      DATA: V_COUNT TYPE I.
      CLEAR:  V_COUNT,<dyn_wa>,IT_TOTAL.
      SY-INDEX = rs_selfield-tabindex.   
    READ TABLE <dyn_table> INTO <dyn_wa> INDEX SY-INDEX.
    ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <DYN_WA> TO <dyn_field>.
      CONDENSE <DYN_FIELD> NO-GAPS.
      IT_TOTAL-KUNNR = <DYN_FIELD>.
      ASSIGN COMPONENT 'PLANTNO' OF STRUCTURE <DYN_WA> TO <dyn_field>.
      CONDENSE <DYN_FIELD> NO-GAPS.
      IT_TOTAL-MATNR = <DYN_FIELD>.
      ASSIGN COMPONENT 'CUSTOMERNO' OF STRUCTURE <DYN_WA> TO <dyn_field>.
       CONDENSE <DYN_FIELD> NO-GAPS.
      IT_TOTAL-CUSTOMERNO = <DYN_FIELD>.
      ASSIGN COMPONENT 'ZPERSON' OF STRUCTURE <DYN_WA> TO <dyn_field>.
      CONDENSE <DYN_FIELD> NO-GAPS.
      IT_TOTAL-ZPERSON = <DYN_FIELD>.
      IF SY-SUBRC = 0.
        "CHECK  <dyn_field> = 'X'.
        V_COUNT = V_COUNT + 1.
      ENDIF.
      if not rs_selfield-tabindex eq 0 AND V_COUNT NE 0.
        IF R_UCOMM = '&CHANGE'.
          IF sy-subrc = 0.
            IF V_COUNT = 1.
              CALL SCREEN 100.
              perform dny_field_value_update.
              rs_selfield-refresh = 'X'.
              "exit.
            ENDIF.
          ENDIF.
        endif.
      endif.
    Edited by: andy1982999 on Apr 2, 2010 8:42 AM

  • Best way to insert millions of records into the table

    Hi,
    Performance point of view, I am looking for the suggestion to choose best way to insert millions of records into the table.
    Also guide me How to implement in easier way to make better performance.
    Thanks,
    Orahar.

    Orahar wrote:
    Its Distributed data. No. of clients and N no. of Transaction data fetching from the database based on the different conditions and insert into another transaction table which is like batch process.Sounds contradictory.
    If the source data is already in the database, it is centralised.
    In that case you ideally do not want the overhead of shipping that data to a client, the client processing it, and the client shipping the results back to the database to be stored (inserted).
    It is must faster and more scalable for the client to instruct the database (via a stored proc or package) what to do, and that code (running on the database) to process the data.
    For a stored proc, the same principle applies. It is faster for it to instruct the SQL engine what to do (via an INSERT..SELECT statement), then pulling the data from the SQL engine using a cursor fetch loop, and then pushing that data again to the SQL engine using an insert statement.
    An INSERT..SELECT can also be done as a direct path insert. This introduces some limitations, but is faster than a normal insert.
    If the data processing is too complex for an INSERT..SELECT, then pulling the data into PL/SQL, processing it there, and pushing it back into the database is the next best option. This should be done using bulk processing though in order to optimise the data transfer process between the PL/SQL and SQL engines.
    Other performance considerations are the constraints on the insert table, the triggers, the indexes and so on. Make sure that data integrity is guaranteed (e.g. via PKs and FKs), and optimal (e.g. FKs should be indexes on the referenced table). Using triggers - well, that may not be the best approach (like for exampling using a trigger to assign a sequence value when it can be faster done in the insert SQL itself). Personally, I avoid using triggers - I rather have that code residing in a PL/SQL API for manipulating data in that table.
    The type of table also plays a role. Make sure that the decision about the table structure, hashed, indexed, partitioned, etc, is the optimal one for the data structure that is to reside in that table.

  • How to insert a image file into oracle database

    hi all
    can anyone guide me how to insert a image file into oracle database now
    i have created table using
    create table imagestore(image blob);
    but when inserting i totally lost don't know what to do how to write query to insert image file

    Hi I don't have time to explain really, I did have to do this a while ago though so I will post a code snippet. This is using the commons file upload framework.
    Firstly you need a multi part form data (if you are using a web page). If you are not using a web page ignore this bit.
    out.println("<form name=\"imgFrm\" method=\"post\" enctype=\"multipart/form-data\" action=\"FileUploadServlet?thisPageAction=reloaded\" onSubmit=\"return submitForm();\"><input type=\"FILE\" name=\"imgSource\" size='60' class='smalltext' onKeyPress='return stopUserInput();' onKeyUp='stopUserInput();' onKeyDown='stopUserInput();' onMouseDown='noMouseDown(event);'>");
    out.println("   <input type='submit' name='submit' value='Submit' class='smalltext'>");
    out.println("</form>"); Import this once you have the jar file:
    import org.apache.commons.fileupload.*;Now a method I wrote to upload the file. I am not saying that this is correct, or its the best way to do this. I am just saying it works for me.
    private boolean uploadFile(HttpServletRequest request, HttpSession session) throws Exception {
            boolean result = true;
            String fileName = null;
            byte fileData[] = null;
            String fileUploadError = null;
            String imageType = "";
            String error = "";
            DiskFileUpload fb = new DiskFileUpload();
            List fileItems = fb.parseRequest(request);
            Iterator it = fileItems.iterator();
            while(it.hasNext()){
                FileItem fileItem = (FileItem)it.next();
                if (!fileItem.isFormField()) {
                    fileName = fileItem.getName();
                    fileData = fileItem.get();
                    // Get the imageType from the filename extension
                    if (fileName != null) {
                        int dotPos = fileName.indexOf('.');
                        if (dotPos >= 0 && dotPos != fileName.length()-1) {
                            imageType = fileName.substring(dotPos+1).toLowerCase();
                            if (imageType.equals("jpg")) {
                                imageType = "jpeg";
            String filePath = request.getParameter("FILE_PATH");
            session.setAttribute("filePath", filePath);
            session.setAttribute("fileData", fileData);
            session.setAttribute("fileName", fileName);
            session.setAttribute("imageType", imageType);
            return result;  
         } And now finally the method to actually write the file to the database:
    private int writeImageFile(byte[] fileData, String fileName, String imageType, String mode, Integer signatureIDIn, HttpServletRequest request) throws Exception {
            //If the previous code found a file that can be uploaded then
            //save it into the database via a pstmt
            String sql = "";
            UtilDBquery udbq = getUser(request).connectToDatabase();
            Connection con = null;
            int signatureID = 0;
            PreparedStatement pstmt = null;
            try {
                udbq.setUsePreparedStatements(true);
                con = udbq.getPooledConnection();
                con.setAutoCommit(false);
                if((!mode.equals("U")) || (mode.equals("U") && signatureIDIn == 0)) {
                    sql = "SELECT SEQ_SIGNATURE_ID.nextval FROM DUAL";
                    pstmt = con.prepareStatement(sql);
                    ResultSet rs = pstmt.executeQuery();
                    while(rs.next()) {
                       signatureID = rs.getInt(1);
                    if (fileName != null && imageType != null) {
                        sql = "INSERT INTO T_SIGNATURE (SIGNATURE_ID, SIGNATURE) values (?,?)";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setInt(1, signatureID);
                        pstmt.setBinaryStream(2, is2, (int)(fileData.length));
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
                if(mode.equals("U") && signatureIDIn != 0) {
                    signatureID = signatureIDIn.intValue();
                    if (fileName != null && imageType != null) {
                        sql = "UPDATE T_SIGNATURE SET SIGNATURE = ? WHERE SIGNATURE_ID = ?";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setBinaryStream(1, is2, (int)(fileData.length));
                        pstmt.setInt(2, signatureID);
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
            } catch (Exception e) {
                con = null;
                throw new Exception(e.toString());
            return signatureID;
       }

  • How to insert a tumbler blog into muse web site?

    Hey I was wondering if you know how to insert a tumbler blog into adobe muse? I have a tumbler account but would like to use it in adobe muse. how can I add it to my blog page in muse for desktop?

    Goto your Tumblr account and then view it when you're logged out ... the URL link should look something like this?:
    http://my-tumblr-blog.tumblr.com
    Now copy & paste that URL link and insert it into this code snippet:
    <iframe src="http://my-tumblr-blog.tumblr.com" onLoad="calcHeight();" scrolling="YES" frameborder="0" width="660" height="950" name="resize" id="resize"></iframe>
    Now copy and paste this edited snippet into the Muse page where you want your Blog ... set the correct width and height in the code (see above) to fit your page ...
    Cutomize it:
    I would suggest customizing your Blog with the built-in customize HTML section to tweak the embedded Blog page ... i.e. turn off some of the Tumblr sections like Header, Description, etc, if you don't want them ...
    Better still go over to this Tumblr Theme site and create a nice custom theme where you can do it all yourself ...
    Then after that still use the snippet code above once you have copied & pasted the new customised Tumblr HTML into you Tumblr Blog:
    http://www.totallylayouts.com/tumblr-generator/
    The art is to streamline your Blog as much as possible so you get the most screen estate shown in Muse, because as an inserted iFrame widget you do lose a bit ...
    cheers,
    Gem

  • How to insert a sound recording and save it to iTunes?

    How to insert a sound recording and save it to iTunes?
    I have 5 voice recording on my iPhone, but the fifth was not detected on iTunes.So i can't sync

     
    Hi,
    According to my analysis, for Digital Signatures: Adobe has changed the behavior around digital signatures and SharePoint-hosted PDF files. Now, when digitally signing a SharePoint-hosted PDF file, it will be saved directly to SharePoint if that PDF file
    is already checked out. If not, the user will be prompted to check it out. When digitally signing a SharePoint-hosted PDF file in Acrobat X, Version 10.0, the user would be prompted to save that file locally and would then need to upload it separately to SharePoint
    as a new version.
    I suggest that you use Acrobat X, then check the result. For more information about Acrobat X, please refer to
    http://blogs.adobe.com/pdfitmatters/2011/06/whats-new-in-acrobat-x-version-10-1.html
    In addition, you can also consider the following third-party tool:
    http://www.arx.com/digital-signature/sharepoint
    Thanks,
    Rock Wang

  • How to Insert a Landscape Page Into a Portrait Document?

    How to Insert a Landscape Page Into a Portrait Document?
    i use pages 5.2
    thanks

    You can't.  But you could add a text box and rotate it (select the box, click arrange, rotate).

  • How to insert a gif file into a table?

    Hi,
    I need to insert a gif file into a table. Can anyone tell me where I can find the information on how to create this kind of table, how to insert a gif file into a table and how to select?
    Thanks,
    Helen

    Hi Helen,
    You could read about that in the documentation which is available online.
    For a starter: BLOB. And I bet there are many examples to be found on the web.
    Good luck. :)
    Regards,
    Guido

  • Can any one out there tell me how to insert a zoom tool into my slide show in dreamweaver CS5.5

    Hi there
    Can any one out there tell me how to insert a zoom tool into my slide show in dreamweaver CS5.5
    My slide show consists of lots of thumb nails of paintings under a large painting.
    When the small painting thumb nail is clicked the large painting appears.
    I would like to be able to enlarge all areas of the large painting when a zoom tool is placed over areas of the large painting.
    Really appreciate any one help.

    Here's the Dreamweaver forum...
    http://forums.adobe.com/community/dreamweaver/dreamweaver_general

  • How to retrive one table records into another table by multiple records

    how to retrive table X records into another table Y by multiple records (means at once i want display 10 records) in form 6i .
    when i am written cursor it is ftching only one record.But i want to display all records at once.
    Declare
    Cursor cur_name is
    select PROTOCOL_NO,DOCNUM,SUBSETSN,REPEATSN,AESEQ,AETERM from coding_ae WHERE PROTOCOL_NO='KP229';
    Begin
    open cur_name;
    loop
    fetch cur_name into :PROTOCOL_NO,:DOCNUM,:SUBSETSN,:REPEATSN,:AESEQ,:AETERM;
    exit when cur_name%notfound;
    next_record;
    end loop;
    close cur_name;
    End;

    Hi,
    Make sure the cursor is in the detailed block. For that use 8GO_BLOCK* built-in. So the code will be
    Declare
    Cursor cur_name is
    select PROTOCOL_NO,DOCNUM,SUBSETSN,REPEATSN,AESEQ,AETERM from coding_ae;
    Begin
    GO_BLOCK('<detailed_block_name>');
    open cur_name;
    loop
    fetch cur_name into :PROTOCOL_NO,:DOCNUM,:SUBSETSN,:REPEATSN,:AESEQ,:AETERM;
    exit when cur_name%notfound;
    next_record;
    end loop;
    close cur_name;
    End;Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • How  to  copy  the  table1selected  records into table 2 in webdynpro java.

    Hi 
           how  to  copy  the  table1selected  records into table 2 in webdynpro java.
    venkat
    Edited by: venkatpvr on Sep 23, 2011 11:53 AM

    Hi Venkat,
    You have 2 Value Nodes one for Table1 and second for Table2.
    Table1 node having one more Value Attribute i.e check Box data type is Boolean. Now you are requirement are select records from Table1 Node and click on One Method that records will moves to Second Table2 Node.
    Create One Method for getting the Records from 1-Table to 2-Table
    CopytoTable2 ()
    In this method you have to write code like this
    If (wdContext.nodeTable1.Checkbox(true))
    If(1. Check the Table1 Value Node Size()>0)
    Get the Table1 records and set to table2 Value node.
    Else
    Please select check box// Error message
    Hope this helps!!
    Regards
    Vijay K

  • How to extract 250,000 Records into excel

    Hi Friends In sql server My table has 250,000 records . How can I import these records into excel?
    If not  which file type I can use for it. Thanks for advance friends

    There are many solutions. I say two solution here:
    using "extract" by right click on database in ssms like bellow screens shots
    using "get external data" from data tab in excel
    more info: http://office.microsoft.com/en-001/excel-help/connect-to-import-sql-server-data-HA010217956.aspx
    sqldevelop.wordpress.com

  • How to insert one table data into multiple tables by using procedure?

    How to insert one table data into multiple tables by using procedure?

    Below is the simple procedure. Try the below
    CREATE OR REPLACE PROCEDURE test_proc
    AS
    BEGIN
    INSERT ALL
      INTO emp_test1
      INTO emp_test2
      SELECT * FROM emp;
    END;
    If you want more examples you can refer below link
    multi-table inserts in oracle 9i
    Message was edited by: 000000

Maybe you are looking for

  • RMAN issue - any feedback would be appreciated

    Guys, Sorry, i shouldn't have posted it here.. We currently use the following script to take backup of our database on production. But this morning i've noticed that the RETENTION POLICY was set to redundancy 1 and it was deleting all backup prior to

  • Syncing iPad to Mac with multiple accounts

    I'm considering getting our CEO an iPad, he currently has a MacBook which is fine but I think an iPad will suit him much better. If I do get him an iPad I'll take his MacBook from him and pass it to another member of staff. My Question is. Would I be

  • Issue with UTL FILE use

    Hi Guys (5)     Write a stored procedure that creates a comma separated flat file called 'GradChallenge' followed by today's date formatted 'yyyymmdd' and add the extension '.txt'. The file will contain the ID, LOGINNAME, FORENAME and SURNAME of the

  • JdbcPersonalizationKeyManager error

    i am getting the following error and not quite sure why. i was revisiting code that was funtional and now this error is popping up when i submit to an input processor, which returns succes, and then returns to rebuild the page based on a property set

  • Getting manager hierarchy using LDAP

    I have a set of oracle email ids. I would like to get their manager hierarchy as well as Job title. Is this possible using LDAP. If so can someone please explain with a code snippet. Thanks.