JSF - Problem in Retrieving selected record from datatable

I am new to JSF and in the process of developing a new web application using JSF.
I have problem in retrieving the selected record from a datatable. I am using h:datatable tag and h:commandlink in a column for selecting a particular row on the datatable.
I have populated the data to the datatable by binding a bean and its property.
When I retrieve also I am binding to a bean in the action attribute of the h:commandlink tag in h:column of that datatable.But when I try to bind the bindign attribute of the h:datatable tag to the datatable instance in my Bean , my JSF File gets corrupted..
How to implement this without any issue??plz help me regarding this.

HI
Try the below code
DATA lo_nd_del TYPE REF TO if_wd_context_node.
DATA lo_el_del TYPE REF TO if_wd_context_element.
DATA ls_del TYPE wd_this->Element_del.
DATA lo_nd_et_postab_1 TYPE REF TO if_wd_context_node.
DATA lo_el_et_postab_1 TYPE REF TO if_wd_context_element.
DATA ls_et_postab_1 TYPE wd_this->Element_del.
DATA lt_et_postab_1 TYPE wd_this->Elements_del.
DATA: wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
* navigate from <CONTEXT> to <ET_POSTAB_1> via lead selection
lo_nd_et_postab_1 = wd_context->path_get_node( path = `ZSHP_EXTENDED_DUE_LI.CHANGING_3.ET_POSTAB_1` ).
CALL METHOD lo_nd_et_postab_1->get_selected_elements
RECEIVING
set = lt_temp.
* navigate from <CONTEXT> to <DEL> via lead selection
lo_nd_et_postab_1 = wd_context->get_child_node( name = wd_this->wdctx_del ).
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_et_postab_1.
ls_et_postab_1-vbeln = del. // adding new attribute value.
APPEND ls_et_postab_1 TO lt_et_postab_1.
CLEAR ls_et_postab_1.
ENDLOOP.
lo_nd_et_postab_1->bind_table( new_items = lt_et_postab_1 ).

Similar Messages

  • Performance problem with selecting records from BSEG and KONV

    Hi,
    I am having performance problem while  selecting records from BSEG and KONV table. As these two tables have large amount of data , they are taking lot of time . Can anyone help me in improving the performance . Thanks in advance .
    Regards,
    Prashant

    Hi,
    Some steps to improve performance
    SOME STEPS USED TO IMPROVE UR PERFORMANCE:
    1. Avoid using SELECT...ENDSELECT... construct and use SELECT ... INTO TABLE.
    2. Use WHERE clause in your SELECT statement to restrict the volume of data retrieved.
    3. Design your Query to Use as much index fields as possible from left to right in your WHERE statement
    4. Use FOR ALL ENTRIES in your SELECT statement to retrieve the matching records at one shot.
    5. Avoid using nested SELECT statement SELECT within LOOPs.
    6. Avoid using INTO CORRESPONDING FIELDS OF TABLE. Instead use INTO TABLE.
    7. Avoid using SELECT * and Select only the required fields from the table.
    8. Avoid nested loops when working with large internal tables.
    9. Use assign instead of into in LOOPs for table types with large work areas
    10. When in doubt call transaction SE30 and use the examples and check your code
    11. Whenever using READ TABLE use BINARY SEARCH addition to speed up the search. Be sure to sort the internal table before binary search. This is a general thumb rule but typically if you are sure that the data in internal table is less than 200 entries you need not do SORT and use BINARY SEARCH since this is an overhead in performance.
    12. Use "CHECK" instead of IF/ENDIF whenever possible.
    13. Use "CASE" instead of IF/ENDIF whenever possible.
    14. Use "MOVE" with individual variable/field moves instead of "MOVE-
    CORRESPONDING" creates more coding but is more effcient.

  • Selecting record from cdpos

    Hi SAP team,
    How to select record from CDPOS when value_old field is initial. For currency field .
    Thanks & Rgds,
    Santhosh Kumar.
    Moderator message: please search for information and try yourself before asking.
    Edited by: Thomas Zloch on Mar 9, 2011 3:52 PM

    Since the problem is related to a custom IDoc, it is the process code of said IDoc where you will have to look. Depending on how the condition records are updated, this will be responsible for writing correct change documents.
    If the process code uses a standard BAPI, then change documents should be written correctly. Otherwise, the code should take care of writing the correct change documents after updating the condition records.
    Often it is possible to update a business object with calling a standard function module, but change documents will not always be written since that is done separately in the usual update process. For instance, you can update a delivery by using RV_DELIVERIES_UPDATE but that won't write change documents by itself at all. So take a look at the process code and investigate how the condition records are updated. Then you'll see the way the change documents are handled.

  • Download only selected record from ALV

    Hi
      I want to download only selected records from ALV output with button.
    i hav to fix the button on ALV screen using &ZDL whenever user presses the button record should be downloaded.
    Pl with coding
    its very very urgent.

    Hi ,
    i dont have the exact code which suits to your requirement
    but declare the internal table
    like
    data: begin of itab occurs 0,
      check type c,
    fields
    end of itab.
    while filling the field catalog
    fieldcatalog-checkbox = 'X'
    for this check field.
    and display the grid
    now write this subroutine
    *&      Form  USER_COMMAND
          Called from within the ALV processes. Currently, '&IC1' is used
          to process the hotspot and display the document 'picked' by the
          user.
          PV_UCOMM    contains the sy-ucomm from ALV
          SELFIELD is a structure that contains all the data required to
                   process a user selection. The following is an example
                   of the SELFIELD structure and sample values:
    FORM USER_COMMAND USING PV_UCOMM LIKE SY-UCOMM
                            SELFIELD TYPE SLIS_SELFIELD.
      CASE PV_UCOMM.
        WHEN '&IC1'.
          loop at itab where check = 'X'.
    append all these records to another internal table itab1
         endloop.
    call function gui_download.
    pass the internal table itab1 in the tables statement
    and also you have to give the file path that may be static or dynamic
    if dynamic you have to call the function module
    f4_filename
    and get the filename and pass the same value to gui_download
    that will be download to the above said path
    endcase.
    end form.
    reward points if helpful,
    thanks & regards,
    venkatesh

  • Select records from one database and insert it into another database

    Hi
    I need to write a statement to select records from one database which is on machine 1 and insert these records on a table in another database which is on machine 2. Following is what I did:
    1. I created the following script on machine 2
    sqlplus remedy_intf/test@sptd @load_hrdata.sql
    2. I created the following sql statements in file called load_hrdata.sql:
    rem This script will perform the following steps
    rem 1. Delete previous HR data/table to start w/ clean import tables
    rem 2. Create database link to HR database, and
    rem 3. Create User Data import table taking info from HR
    rem 4. Drop HRP link before exiting
    SET COPYCOMMIT 100
    delete from remedy.remedy_feed;
    commit;
    COPY FROM nav/donnelley@hrp -
    INSERT INTO remedy.remedy_feed -
    (EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
    RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR) -
    USING SELECT EMPLID, FIRST_NAME, MI, LAST_NAME, BUSINESS_TITLE, WORK_PHONE, -
    RRD_INTRNT_EMAIL, LOCATION, RRD_OFFICE_MAIL, RRD_BUS_UNIT_DESCR -
    FROM ps_rrd_intf_medium -
    where empl_status IN ('A', 'L', 'P', 'S', 'X')
    COMMIT;
    EXIT;
    However, whenever I run the statement I keep getting the following error:
    SP2-0498: missing parenthetical column list or USING keyword
    Do you have any suggestions on how I can fix this or what am I doing wrong?
    Thanks
    Ali

    This doesn't seem to relate to Adobe Reader. Please let us know the product you are using so we may redirect you or refer to the list of forums at http://forums.adobe.com/

  • How to write jsp select record from Oracle  divide per page , about 50 reco

    Dear Expert,
    How to write jsp select record from Oracle divide per page , about 50 record per page.
    Thank you very much.

    I wish I could, but there is no single sign on module available for Fusion, also, so called Fusion is yet another Word With Big Letters, behind it there is yet another OC4J ( now Oracle switched to Weblogic though) container with bunsh of Oracle apps residing in it.
    Generally speaking, neither Fusion nor Oracle Apps user database does not have any single authentication module available out of the box to integrate user database.
    It's a long sad story running straight from Oracle Apps 11.0.5.
    That's why I've created JAAS single sign on login module and used it ever since at OC4J 10.2 and onwards at OC4J 10.3
    Back to the topic: to develop Apps and test them externally using the session bean I've isted above, one need to copy certain libraries from Oracle Apps server, then add them as libraries for JDeveloper project.
    Here is the complete list:
    oracle.apps.fnd.cache
    oracle.apps.fnd.cache
    oracle.apps.fnd.common
    oracle.apps.fnd.functionSecurity
    oracle.apps.fnd.metadata
    oracle.apps.fnd.security
    oracle.apps.fnd.util
    oracle.apps.jtf.cache
    oracle.apps.jtf.security
    Edited by: Faceless on Nov 26, 2009 3:04 AM

  • Selecting Records from 125 million record table to insert into smaller table

    Oracle 11g
    I have a large table of 125 million records - t3_universe.  This table never gets updated or altered once loaded,  but holds data that we receive from a lead company.
    I need to select records from this large table that fit certain demographic criteria and insert those into a smaller table - T3_Leads -  that will be updated with regard to when the lead is mailed and for other relevant information.
    My question is what is the best (fastest) approach to select records from this 125 million record table to insert into the smaller table.  I have tried a variety of things - views, materialized views, direct insert into smaller table...I think I am probably missing other approaches.
    My current attempt has been to create a View using the query that selects the records as shown below.  Then use a second query that inserts into T3_Leads from this View V_Market.  This is very slow. Can I just use an Insert Into T3_Leads with this query - it did not seem to work with the WITH clause?    My Index on the large table is t3_universe_composite and includes zip_code, address_key, household_key. 
    CREATE VIEW V_Market  as
    WITH got_pairs    AS  
         SELECT /*+ INDEX_FFS(t3_universe t3_universe_composite) */  l.zip_code, l.zip_plus_4, l.p1_givenname, l.surname, l.address, l.city, l.state, l.household_key, l.hh_type as l_hh_type, l.address_key, l.narrowband_income, l.p1_ms, l.p1_gender, l.p1_exact_age, l.p1_personkey, e.hh_type as filler_data, 1.p1_seq_no, l.p2_seq_no 
         ,      ROW_NUMBER () OVER ( PARTITION BY  l.address_key 
                                      ORDER BY      l.hh_verification_date  DESC 
                      ) AS r_num   
         FROM   t3_universe  e   
         JOIN   t3_universe  l  ON   
                l.address_key  = e.address_key
                AND l.zip_code = e.zip_code
              AND   l.p1_gender != e.p1_gender
                 AND   l.household_key != e.household_key         
                 AND  l.hh_verification_date  >= e.hh_verification_date 
      SELECT  * 
      FROM  got_pairs
      where l_hh_type !=1 and l_hh_type !=2 and filler_data != 1 and filler_data != 2 and zip_code in (select * from M_mansfield_02048) and p1_exact_age BETWEEN 25 and 70 and narrowband_income >= '8' and r_num = 1
    Then
    INSERT INTO T3_leads(zip, zip4, firstname, lastname, address, city, state, household_key, hh_type, address_key, income, relationship_status, gender, age, person_key, filler_data, p1_seq_no, p2_seq_no)
    select zip_code, zip_plus_4, p1_givenname, surname, address, city, state, household_key, l_hh_type, address_key, narrowband_income, p1_ms, p1_gender, p1_exact_age, p1_personkey, filler_data, p1_seq_no, p2_seq_no
    from V_Market;

    I had no trouble creating the view exactly as you posted it.  However, be careful here:
    and zip_code in (select * from M_mansfield_02048)
    You should name the column explicitly rather than select *.  (do you really have separate tables for different zip codes?)
    About the performance, it's hard to tell because you haven't posted anything we can use, like explain plans or traces but simply encapsulating your query into a view is not likely to make it any faster.
    Depending on the size of the subset of rows you're selecting, the /*+ INDEX hint may be doing your more harm than good.

  • JSF: how to add new record in datatable from same page

    Jdeveloper : 11.1.2.2.0
    using ADF i want to create a page that contains a datatable, input text field and a command button.
    when i press the command button i want the text in the input text field to be inserted as a new record in datatable.
    what is the best practice for that ? how to get the value of the input text field and insert it?
    thanks in advance :)

    thanks so much that really helped :)
    the solution is to do it programatically in a managed bean :)

  • How to get selected values from datatable with paging

    hi all
    here is my problem
    I have a datatable with paging size of 2 and first column as checkbox.
    now i have total record of 5 data,2 row on each page.
    Now i m selecting 1-1 row from each page.
    When i m clicking Command button to display all the selected row from different page ,i m only able to display values selected from last page.
    Through debug i can see that only last page value is set to TRUE OR FALSE and every other value is neither true nor false.
    any help???
    thanks

    <f:facet name="footer">
    <h:panelGroup binding="#{Page1.groupPanel1}" id="groupPanel1"
    style="display: block; text-align: center" styleClass="list-paging-footer">
    <h:commandButton action="#{Page1.dataTable1_firstPageAction}" binding="#{Page1.dataTable1FooterFirstButton}" id="dataTable1FooterFirstButton" image="resources/paging_first.gif" immediate="true"/>
    <h:commandButton action="# Page1.dataTable1_previousPageAction}" binding="#{Page1.dataTable1FooterPreviousButton}"
    id="dataTable1FooterPreviousButton" image="resources/paging_previous.gif" immediate="true"/>
    <h:commandButton action="#{Page1.dataTable1_nextPageAction}" binding="#{Page1.dataTable1FooterNextButton}"
    id="dataTable1FooterNextButton" image="resources/paging_next.gif" immediate="true"/>
    <h:commandButton action="#{Page1.dataTable1_lastPageAction}" binding="#{Page1.dataTable1FooterLastButton}"
    id="dataTable1FooterLastButton" image="resources/paging_last.gif" immediate="true"/>
    </h:panelGroup>
    </f:facet>
    Above is the code which i m using for paging which is command button
    Any problem with it.???
    thanks

  • BPM - DB Adapter retrieves the record from DB but says modelling error

    We are trying to read a record from a view ( The View is a join of two tables ) . And the join condition is on a column called CUSTID ( whose values is also there ) . Looks like the query is executed and the values are retrieved but we get an exception saying "This exception is considered not retriable, likely due to a modelling mistake. " and "Primary keys must not contain null. ".
    I am doing a transformation after the results are fetched . I am mapping the values directly to a payload xml . Is there any problem ?
    Not sure what the problem is . Please help ! .
    TIA
    Stack Trace :
    Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'QuoteDetailsSelect' failed due to: DBReadInteractionSpec Execute Failed Exception. Query name: [QuoteDetailsSelect], Descriptor name: [QuoteDetails.Quotesummary]. Caused by Exception [EclipseLink-6044] (Eclipse Persistence Services - 2.1.2.v20101206-r8635): org.eclipse.persistence.exceptions.QueryException Exception Description: The primary key read from the row [DatabaseRecord( QUOTESUMMARY.CUSTID => 1000 QUOTESUMMARY.GENDER => Female QUOTESUMMARY.FIRSTNAME => Remya QUOTESUMMARY.SURNAME => namboothiri QUOTESUMMARY.TELEPHONE => 9999 QUOTESUMMARY.DOB => 1970-01-01 00:00:00.0 QUOTESUMMARY.EMAIL => [email protected] QUOTESUMMARY.PWD => welcome1 QUOTESUMMARY.SORTCODE => 000 QUOTESUMMARY.ACCOUNTNUMBER => 111 QUOTESUMMARY.ACCOUNTNAME => remya QUOTESUMMARY.DDDATE => 2011-07-13 14:33:37.0 QUOTESUMMARY.MONTHLYBENEFIT => 2000 QUOTESUMMARY.RESIDENCE => Res QUOTESUMMARY.CONTEMPLOYMENT => null QUOTESUMMARY.REDUNDANCIES => null QUOTESUMMARY.EMPLOYMENTSTATUS => permanent QUOTESUMMARY.EMPSTARTDATE => 2011-07-13 14:33:37.0 QUOTESUMMARY.GROSSSAL => 40000 QUOTESUMMARY.BUSINESSTYPE => fulltime QUOTESUMMARY.BUSINESSROLE => manager QUOTESUMMARY.MORTAGE => 111 QUOTESUMMARY.LOAN => 2000 QUOTESUMMARY.CREDITCARDS => xxxx QUOTESUMMARY.USEDTOB_NICO => xxx QUOTESUMMARY.MEDICALCOVERED => yes QUOTESUMMARY.QUOTEID => 2000 QUOTESUMMARY.STATUS => initiated QUOTESUMMARY.AMOUNT => 400000 QUOTESUMMARY.POLICYTYPE => lifestyle QUOTESUMMARY.POLICYSUBTYPE => lf QUOTESUMMARY.MONTHLY_BENEFIT => 200 QUOTESUMMARY.COVERPERIOD => 2 QUOTESUMMARY.WAITPERIOD => 1 QUOTESUMMARY.COVERSTARTDATE => 2011-07-13 14:35:23.0)] during the execution of the query was detected to be null. Primary keys must not contain null. Query: ReadAllQuery(name="QuoteDetailsSelect" referenceClass=Quotesummary sql="SELECT CUSTID, GENDER, FIRSTNAME, SURNAME, TELEPHONE, DOB, EMAIL, PWD, SORTCODE, ACCOUNTNUMBER, ACCOUNTNAME, DDDATE, MONTHLYBENEFIT, RESIDENCE, CONTEMPLOYMENT, REDUNDANCIES, EMPLOYMENTSTATUS, EMPSTARTDATE, GROSSSAL, BUSINESSTYPE, BUSINESSROLE, MORTAGE, LOAN, CREDITCARDS, USEDTOB_NICO, MEDICALCOVERED, QUOTEID, STATUS, AMOUNT, POLICYTYPE, POLICYSUBTYPE, MONTHLY_BENEFIT, COVERPERIOD, WAITPERIOD, COVERSTARTDATE FROM QUOTESUMMARY WHERE QUOTEID = (?)"). See root exception for the specific exception. This exception is considered not retriable, likely due to a modelling mistake. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
    Edited by: user13123387 on Jul 13, 2011 3:07 AM
    Edited by: user13123387 on Jul 13, 2011 3:31 AM

    I have seen that problem several times. It means you'll have to set your tuning parms. Have a look: http://www.it-eye.nl/weblog/2006/09/18/bpel-tuning-or-why-threads-matter/

  • Callprocedure which contain dynamic sql that retrieve multiple records from VB

    hi dear i have problem with using dynamic sql to retrieve multipule records
    and access them from visual basic
    first i use Oracle8 Enterprise Edition Release 8.0.4.0.0
    and odbc microsoft odbc for oracle version 2.573.4403.00
    these are the whole processes to do that
    please check the steps and if u find any error say to me....
    1-table description
    Name Null? Type
    PORT_KEY NOT NULL VARCHAR2(4)
    CITY_KEY NOT NULL VARCHAR2(4)
    and port_key is primary key
    2- package declaration
    create or replace package ww1
    as
    procedure bound_type
    (v_origin in varchar2,v_flag in varchar2
    ,city_key out dbms_sql.varchar2_table
    end ;
    3- package body
    create or replace package body ww1
    as
    procedure bound_type
    (v_origin in varchar2,v_flag in varchar2
    ,city_key out dbms_sql.varchar2_table
    is
    str varchar2(1000);
    cur_hdl integer :=dbms_sql.open_cursor;
    rows_processed integer;
    indx integer :=1;
    begin
    str:='select ltrim(rtrim(city_key)) from special_airport ';
    if ltrim(rtrim(upper(v_flag))) = upper('c')
    then
    str:=str &#0124; &#0124; ' where city_key=ltrim(rtrim(upper('&#0124; &#0124;''''&#0124; &#0124;v_origin&#0124; &#0124;''''&#0124; &#0124;')))';
    elsif ltrim(rtrim(upper(v_flag))) = upper('a') then
    str:= str &#0124; &#0124;' where port_key=ltrim(rtrim(upper('&#0124; &#0124;''''&#0124; &#0124;v_origin&#0124; &#0124;''''&#0124; &#0124;')))';
    end if;
    dbms_sql.parse(cur_hdl,str, dbms_sql.native );
    dbms_sql.define_array(cur_hdl,1,city_key,10,indx);
    rows_processed:=dbms_sql.execute(cur_hdl);
    loop
    rows_processed:=dbms_sql.fetch_rows(cur_hdl);
    dbms_sql.column_value(cur_hdl,1,city_key);
    exit when rows_processed != 10;
    end loop;
    dbms_sql.close_cursor(cur_hdl);
    end bound_type;
    end ww1;
    4- code for calling stored procedure from visual basic
    dim c As New ADODB.Connection
    Dim cmd As New ADODB.Command
    Dim rs As New ADODB.Recordset
    c.Open "dsn=dsnName;uid=uidValue;pwd=pwdValue"
    With cmd
    Set .ActiveConnection = c
    .CommandType = adCmdText
    '---------(call bound_type stored procedure)--------------
    .Parameters.Append .CreateParameter(, adBSTR, adParamInput, , "bwi")
    .Parameters.Append .CreateParameter(, adBSTR, adParamInput, , "a")
    .CommandText = "{call fares_procedures.bound_type (?,?,{resultset 10, city_key }) }"
    End With
    Set rs.Source = cmd
    rs.Open
    While Not rs.EOF
    z = rs.Fields("city_key")
    rs.MoveNext
    Wend
    Set cmd = Nothing
    rs.Close
    Set rs = Nothing
    c.Close
    Set c = Nothing
    ***********result get error*************
    please check the code and steps and if u find any error contact me
    thanks any way
    null

    hi every one i got a simple solusion and its faster than dbms_sql package by 1.5 to 3 times...but it works only for oracle 8i or higher......
    after concatenat the string of dynamic sql
    but it in a ref cursor and loop on it
    TYPE VAR_TABLE IS TABLE OF VARCHAR2(40)
    INDEX BY BINARY_INTEGER;
    procedure bound_type
    (v_origin in varchar2,v_flag in varchar2
    ,city_key out var_table )
    is
    str varchar2(1000);
    type curtype is ref cursor;
    sa_cur curtype;
    i integer default 1;
    begin
    str:='select ltrim(rtrim(city_key)) from special_airport ';
    if ltrim(rtrim(upper(v_flag))) = upper('c')
    then
    str:=str &#0124; &#0124; ' where city_key=ltrim(rtrim(upper('&#0124; &#0124;''''&#0124; &#0124;v_origin&#0124; &#0124;''''&#0124; &#0124;')))';
    elsif ltrim(rtrim(upper(v_flag))) = upper('a') then
    str:= str &#0124; &#0124;' where port_key=ltrim(rtrim(upper('&#0124; &#0124;''''&#0124; &#0124;v_origin&#0124; &#0124;''''&#0124; &#0124;')))';
    end if;
    open sa_cur for str;
    loop
    fetch sa_cur into city_key(i);
    exit when sa_cur%notfound;
    i:=i+1;
    end loop;
    close sa_cur;
    end bound_type;
    null

  • How to save the selected records from Table control in dialog programming

    Hiiiiiiii Every1
    Actually the problem is like this:-
    I have to select some records from table control and then want to save the selected records in DB table.
    Example
    I have some rows having inforamtion bout employees...
    Now what i want is that when i click on 'SAVE' button then these selected rows should be moved into DB table.
    Sachin Dhingra

    see below example, I have added INSERT option after DELETE option.
    REPORT demo_dynpro_tabcont_loop_at.
    CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
    DATA cols LIKE LINE OF flights-cols.
    DATA: ok_code TYPE sy-ucomm,
          save_ok TYPE sy-ucomm.
    DATA: itab TYPE TABLE OF demo_conn.
    TABLES demo_conn.
    SELECT * FROM spfli INTO TABLE itab.
    LOOP AT flights-cols INTO cols WHERE index GT 2.
      cols-screen-input = '0'.
      MODIFY flights-cols FROM cols INDEX sy-tabix.
    ENDLOOP.
    CALL SCREEN 100.
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SCREEN_100'.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE read_table_control INPUT.
      MODIFY itab FROM demo_conn INDEX flights-current_line.
    ENDMODULE.
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CLEAR ok_code.
      CASE save_ok.
        WHEN 'TOGGLE'.
          LOOP AT flights-cols INTO cols WHERE index GT 2.
            IF  cols-screen-input = '0'.
              cols-screen-input = '1'.
            ELSEIF  cols-screen-input = '1'.
              cols-screen-input = '0'.
            ENDIF.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDLOOP.
        WHEN 'SORT_UP'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) ASCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'SORT_DOWN'.
          READ TABLE flights-cols INTO cols WITH KEY selected = 'X'.
          IF sy-subrc = 0.
            SORT itab STABLE BY (cols-screen-name+10) DESCENDING.
            cols-selected = ' '.
            MODIFY flights-cols FROM cols INDEX sy-tabix.
          ENDIF.
        WHEN 'DELETE'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              DELETE itab.
            ENDLOOP.
          ENDIF.
        WHEN 'INSERT'.
          READ TABLE flights-cols INTO cols WITH KEY screen-input = '1'.
          IF sy-subrc = 0.
            LOOP AT itab INTO demo_conn WHERE mark = 'X'.
              itab1 = itab.
              modify itab1.
            ENDLOOP.
          ENDIF.
          if not itab1 is initial.
            INSERT dbtab FROM TABLE itab1.
          endif.
      ENDCASE.
    ENDMODULE.

  • Urgent: Problem in Fetching the records from ITAB3

    hi,
    here's d code,and the bold is dere where i am facing the problem i.e. whne i append lines of ITAB2 to ITAB3 it takes 32,234 records but in reality in ITAB2 there are 39 records,ITFINAL contains 45 records which is displaying the coreect data.
    But why ITAB3 conatins 32,234 records in it.
    it might hit th eperformance of the report.
    TABLES: RSEG.
    ***********DECLARATION OF TABLES*************
    ************TABLE BKPF - ACCOUNTING HEADER ***********
    DATA: BEGIN OF ITBKPF OCCURS 0,
    BUKRS LIKE BKPF-BUKRS,
    BELNR LIKE BKPF-BELNR,
    GJAHR LIKE BKPF-GJAHR,
    AWKEY LIKE BKPF-AWKEY,
    BUDAT LIKE BKPF-BUDAT,
    XBLNR LIKE BKPF-XBLNR,
    AWTYP LIKE BKPF-AWTYP,
    END OF ITBKPF.
    *********TABLE BSIK - ACCOUNTING OPEN ITEMS********
    DATA: BEGIN OF ITAB2 OCCURS 0,
    LFBNR LIKE RSEG-LFBNR,
    BUKRS LIKE BSIK-BUKRS,
    GJAHR LIKE BSIK-GJAHR,
    BELNR LIKE BSIK-BELNR,
    AWKEY LIKE BKPF-AWKEY,
    WRBTR LIKE BSIK-WRBTR,
    LIFNR LIKE BSIK-LIFNR,
    AUGBL LIKE BSAK-AUGBL,
    AUGDT LIKE BSAK-AUGDT,
    END OF ITAB2.
    **********TABLE BSAK - ACCOUNTING CLEAR ITEMS*******
    DATA: BEGIN OF ITAB3 OCCURS 0,
    LFBNR LIKE RSEG-LFBNR,
    BUKRS LIKE BSAK-BUKRS,
    GJAHR LIKE BSAK-GJAHR,
    BELNR LIKE BSAK-BELNR,
    AWKEY LIKE BKPF-AWKEY,
    WRBTR LIKE BSIK-WRBTR,
    LIFNR LIKE BSIK-LIFNR,
    AUGBL LIKE BSAK-AUGBL,
    AUGDT LIKE BSAK-AUGDT,
    END OF ITAB3.
    DATA: BEGIN OF ITDEMO OCCURS 0,
    BELNR LIKE RSEG-BELNR,
    GJAHR LIKE RSEG-GJAHR,
    LFBNR LIKE RSEG-LFBNR,
    XBLNR LIKE RSEG-XBLNR,
    END OF ITDEMO.
    *****FINAL TABLE TO GATHER N DISPLAY OUTPUT*****
    DATA: BEGIN OF ITFINAL OCCURS 0,
    LFBNR LIKE RSEG-LFBNR,
    BUKRS LIKE BKPF-BUKRS,
    GJAHR LIKE BKPF-GJAHR,
    BELNR LIKE BKPF-BELNR,
    AWKEY LIKE BKPF-AWKEY,
    WRBTR LIKE BSIK-WRBTR,
    LIFNR LIKE BSIK-LIFNR,
    AUGBL LIKE BSAK-AUGBL,
    AUGDT LIKE BSAK-AUGDT,
    END OF ITFINAL.
    **********END OF DECLARATIONS*************
    SELECT-OPTIONS: P_LFBNR FOR RSEG-LFBNR.
    *************FETCHING OF THE DATA*************
    START-OF-SELECTION.
    BKPF
    SELECT BUKRS BELNR GJAHR AWKEY BUDAT XBLNR AWTYP
    FROM BKPF
    INTO (ITBKPF-BUKRS,ITBKPF-BELNR,ITBKPF-GJAHR,
    ITBKPF-AWKEY,ITBKPF-BUDAT,ITBKPF-XBLNR,ITBKPF-AWTYP)
    WHERE AWTYP EQ 'MKPF' OR AWTYP EQ 'RMRP'.
              o
                    + MKPF*
    ************BEGIN OF TRY CODE FOR A MATERIAL DOCUMENT************
    ITDEMO-BELNR = ITBKPF-AWKEY(10).
    ITDEMO-GJAHR = ITBKPF-AWKEY+10(4).
    ITDEMO-XBLNR = ITBKPF-XBLNR.
    SELECT LFBNR FROM RSEG INTO
    (ITDEMO-LFBNR) WHERE
    BELNR EQ ITBKPF-AWKEY(10) AND
    GJAHR EQ ITBKPF-AWKEY+10(4) AND
    XBLNR EQ ITBKPF-XBLNR AND LFBNR > 0.
    CHECK SY-SUBRC EQ 0 AND ITDEMO-LFBNR IN P_LFBNR.
    ************END OF TRY CODE FOR A MATERIAL DOCUMENT***************
    ITAB2-BUKRS = ITBKPF-BUKRS.
    ITAB2-GJAHR = ITBKPF-GJAHR.
    ITAB2-BELNR = ITBKPF-BELNR.
    ITAB3-BUKRS = ITBKPF-BUKRS.
    ITAB3-GJAHR = ITBKPF-GJAHR.
    ITAB3-BELNR = ITBKPF-BELNR.
              o
                    + BSIK*
    SELECT WRBTR LIFNR FROM BSIK
    INTO (ITAB2-WRBTR, ITAB2-LIFNR)
    WHERE BUKRS EQ ITBKPF-BUKRS
    AND GJAHR EQ ITBKPF-GJAHR
    AND BELNR EQ ITBKPF-BELNR.
    APPEND ITAB2.
    EXIT.
    ENDSELECT.
              o
                    +
    BSAK*
    SELECT WRBTR LIFNR AUGBL AUGDT
    FROM BSAK
    INTO (ITAB3-WRBTR,ITAB3-LIFNR,ITAB3-AUGBL,ITAB3-AUGDT)
    WHERE BUKRS EQ ITBKPF-BUKRS
    AND GJAHR EQ ITBKPF-GJAHR
    AND BELNR EQ ITBKPF-BELNR.
    APPEND ITAB3.
    EXIT.
    ENDSELECT.
    APPEND ITDEMO.
    EXIT.
    ENDSELECT.
    APPEND ITBKPF.
    ENDSELECT.
    Fields Found?
    READ TABLE ITBKPF TRANSPORTING NO FIELDS INDEX 1.
    IF sy-subrc NE 0.
    MESSAGE i000(zmm1) WITH 'No documents found!'.
    ENDIF.
    Prepare Output
    LOOP AT ITBKPF.
    CLEAR ITAB2.
    READ TABLE ITAB2
    WITH KEY BUKRS = ITBKPF-BUKRS
    BELNR = ITBKPF-BELNR
    GJAHR = ITBKPF-GJAHR.
    CHECK sy-subrc EQ 0?
    CLEAR ITAB3.
    READ TABLE ITAB3
    WITH KEY BUKRS = ITBKPF-BUKRS
    BELNR = ITBKPF-BELNR
    GJAHR = ITBKPF-GJAHR. .
    CHECK sy-subrc EQ 0?
    READ TABLE ITDEMO
    WITH KEY BELNR = ITBKPF-AWKEY(10).
    CHECK sy-subrc EQ 0?
    APPEND LINES OF ITAB2 TO ITAB3.
    CHECK sy-subrc EQ 0?
    ITFINAL-LFBNR = ITDEMO-LFBNR.
    ITFINAL-BUKRS = ITBKPF-BUKRS.
    ITFINAL-BELNR = ITBKPF-BELNR.
    ITFINAL-GJAHR = ITBKPF-GJAHR.
    ITFINAL-AWKEY = ITBKPF-AWKEY.
    ITFINAL-WRBTR = ITAB3-WRBTR.
    ITFINAL-LIFNR = ITAB3-LIFNR.
    ITFINAL-AUGBL = ITAB3-AUGBL.
    ITFINAL-AUGDT = ITAB3-AUGDT.
    DELETE ITFINAL WHERE WRBTR = 0.
    APPEND ITFINAL.
    CLEAR ITFINAL.
    ENDLOOP.
    SORT ITFINAL BY AUGBL AUGDT .
    END-OF-SELECTION
    END-OF-SELECTION.
    Output
    LOOP AT ITFINAL.
    WRITE: / ITFINAL-LFBNR,ITFINAL-BELNR, ITFINAL-GJAHR,ITFINAL-AWKEY, ITFINAL-WRBTR, ITFINAL-LIFNR,ITFINAL-AUGBL,ITFINAL-AUGDT.
    ENDLOOP.

    hi,
    actually i have to display the open n clear items with respect to the MATERIAL DOCUMENT.
    try to execute the code which i am displaying below:-
    TABLES: RSEG.
    **********DECLARATION OF TABLES************
    ***********TABLE BKPF  - ACCOUNTING HEADER **********
    DATA: BEGIN OF ITBKPF OCCURS 0,
          BUKRS LIKE BKPF-BUKRS,
          BELNR LIKE BKPF-BELNR,
          GJAHR LIKE BKPF-GJAHR,
          AWKEY LIKE BKPF-AWKEY,
          BUDAT LIKE BKPF-BUDAT,
          XBLNR LIKE BKPF-XBLNR,
          AWTYP LIKE BKPF-AWTYP,
          END OF ITBKPF.
    ********TABLE BSIK - ACCOUNTING OPEN ITEMS*******
    DATA: BEGIN OF ITAB2 OCCURS 0,
          LFBNR LIKE RSEG-LFBNR,
          BUKRS LIKE BSIK-BUKRS,
          GJAHR LIKE BSIK-GJAHR,
          BELNR LIKE BSIK-BELNR,
          AWKEY LIKE BKPF-AWKEY,
          WRBTR LIKE BSIK-WRBTR,
          LIFNR LIKE BSIK-LIFNR,
          AUGBL LIKE BSAK-AUGBL,
          AUGDT LIKE BSAK-AUGDT,
          END OF ITAB2.
    *********TABLE  BSAK - ACCOUNTING CLEAR ITEMS******
    DATA: BEGIN OF ITAB3 OCCURS 0,
          LFBNR LIKE RSEG-LFBNR,
          BUKRS LIKE BSAK-BUKRS,
          GJAHR LIKE BSAK-GJAHR,
          BELNR LIKE BSAK-BELNR,
          AWKEY LIKE BKPF-AWKEY,
          WRBTR LIKE BSIK-WRBTR,
          LIFNR LIKE BSIK-LIFNR,
          AUGBL LIKE BSAK-AUGBL,
          AUGDT LIKE BSAK-AUGDT,
          END OF ITAB3.
    *********TABLE BSIS - MIRO NOT PERFORMED*******
    DATA: BEGIN OF ITAB4 OCCURS 0,
          LFBNR LIKE RSEG-LFBNR,
          BUKRS LIKE BSIS-BUKRS,
          GJAHR LIKE BSIS-GJAHR,
          BELNR LIKE BSIS-BELNR,
          AWKEY LIKE BKPF-AWKEY,
          WRBTR LIKE BSIK-WRBTR,
          LIFNR LIKE BSIK-LIFNR,
          AUGBL LIKE BSAK-AUGBL,
          AUGDT LIKE BSAK-AUGDT,
          END OF ITAB4.
    **********TABLE RSEG - FOR MATERIAL DOCUMENT********
    DATA: BEGIN OF ITDEMO OCCURS 0,
          BELNR LIKE RSEG-BELNR,
          GJAHR LIKE RSEG-GJAHR,
          LFBNR LIKE RSEG-LFBNR,
          XBLNR LIKE RSEG-XBLNR,
          END OF ITDEMO.
    ****FINAL TABLE TO GATHER N DISPLAY OUTPUT****
    DATA: BEGIN OF ITFINAL OCCURS 0,
          LFBNR LIKE RSEG-LFBNR,
          BUKRS LIKE BKPF-BUKRS,
          GJAHR LIKE BKPF-GJAHR,
          BELNR LIKE BKPF-BELNR,
          AWKEY LIKE BKPF-AWKEY,
          WRBTR LIKE BSIK-WRBTR,
          LIFNR LIKE BSIK-LIFNR,
          AUGBL LIKE BSAK-AUGBL,
          AUGDT LIKE BSAK-AUGDT,
          END OF ITFINAL.
    *********END OF DECLARATIONS************
    SELECT-OPTIONS: P_LFBNR FOR RSEG-LFBNR.
    ************FETCHING OF THE DATA************
    START-OF-SELECTION.
    BKPF
        SELECT BUKRS BELNR GJAHR AWKEY BUDAT XBLNR AWTYP
        FROM BKPF
        INTO (ITBKPF-BUKRS,ITBKPF-BELNR,ITBKPF-GJAHR,
             ITBKPF-AWKEY,ITBKPF-BUDAT,ITBKPF-XBLNR,ITBKPF-AWTYP)
        WHERE AWTYP EQ 'MKPF' OR AWTYP EQ 'RMRP'.
    MKPF
    ***********BEGIN OF TRY CODE FOR A MATERIAL DOCUMENT***********
        ITDEMO-BELNR = ITBKPF-AWKEY(10).
        ITDEMO-GJAHR = ITBKPF-AWKEY+10(4).
        ITDEMO-XBLNR = ITBKPF-XBLNR.
        SELECT LFBNR FROM RSEG INTO
        (ITDEMO-LFBNR) WHERE
        BELNR EQ ITBKPF-AWKEY(10) AND
        GJAHR EQ ITBKPF-AWKEY+10(4) AND
        XBLNR EQ ITBKPF-XBLNR AND LFBNR  > 0.
    CHECK SY-SUBRC EQ 0 AND ITDEMO-LFBNR IN P_LFBNR.
    ***********END OF TRY CODE FOR A MATERIAL DOCUMENT**************
        ITAB2-BUKRS = ITBKPF-BUKRS.
        ITAB2-GJAHR = ITBKPF-GJAHR.
        ITAB2-BELNR = ITBKPF-BELNR.
        ITAB3-BUKRS = ITBKPF-BUKRS.
        ITAB3-GJAHR = ITBKPF-GJAHR.
        ITAB3-BELNR = ITBKPF-BELNR.
    BSIK
        SELECT WRBTR LIFNR FROM BSIK
        INTO (ITAB2-WRBTR, ITAB2-LIFNR)
        WHERE BUKRS EQ ITBKPF-BUKRS
          AND GJAHR EQ ITBKPF-GJAHR
          AND BELNR EQ ITBKPF-BELNR.
        APPEND ITAB2.
        EXIT.
        ENDSELECT.
    BSAK
        SELECT WRBTR LIFNR AUGBL AUGDT
        FROM BSAK
        INTO (ITAB3-WRBTR,ITAB3-LIFNR,ITAB3-AUGBL,ITAB3-AUGDT)
        WHERE BUKRS EQ ITBKPF-BUKRS
          AND GJAHR EQ ITBKPF-GJAHR
          AND BELNR EQ ITBKPF-BELNR.
        APPEND ITAB3.
        EXIT.
        ENDSELECT.
    BSIS
       SELECT WRBTR XREF3 FROM BSIS
       INTO (ITAB1-WRBTR, ITAB1-XREF3)
       WHERE BUKRS EQ ITBKPF-BUKRS
         AND GJAHR EQ ITBKPF-GJAHR
         AND BELNR EQ ITBKPF-BELNR.
       APPEND ITAB1.
       EXIT.
       ENDSELECT.
      CHECK sy-subrc EQ 0?
        APPEND ITDEMO.
        EXIT.
        ENDSELECT.
        APPEND ITBKPF.
        ENDSELECT.
    Fields Found?
      READ TABLE ITBKPF TRANSPORTING NO FIELDS INDEX 1.
      IF sy-subrc NE 0.
        MESSAGE i000(zmm1) WITH 'No documents found!'.
      ENDIF.
    Prepare Output
      LOOP AT ITBKPF.
        CLEAR ITAB2.
        READ TABLE ITAB2
        WITH KEY   BUKRS = ITBKPF-BUKRS
                   BELNR = ITBKPF-BELNR
                   GJAHR = ITBKPF-GJAHR." BINARY SEARCH..
      CHECK sy-subrc EQ 0?
        CLEAR ITAB3.
        READ TABLE ITAB3
        WITH KEY   BUKRS = ITBKPF-BUKRS
                   BELNR = ITBKPF-BELNR
                   GJAHR = ITBKPF-GJAHR." BINARY SEARCH.              .
      CHECK sy-subrc EQ 0?
        READ TABLE ITDEMO
        WITH KEY BELNR = ITBKPF-AWKEY(10).
      CHECK sy-subrc EQ 0?
        APPEND LINES OF ITAB2 TO ITAB3.
      CHECK sy-subrc EQ 0?
        ITFINAL-LFBNR = ITDEMO-LFBNR.
        ITFINAL-BUKRS = ITBKPF-BUKRS.
        ITFINAL-BELNR = ITBKPF-BELNR.
        ITFINAL-GJAHR = ITBKPF-GJAHR.
        ITFINAL-AWKEY = ITBKPF-AWKEY.
        ITFINAL-WRBTR = ITAB3-WRBTR.
        ITFINAL-LIFNR = ITAB3-LIFNR.
        ITFINAL-AUGBL = ITAB3-AUGBL.
        ITFINAL-AUGDT = ITAB3-AUGDT.
        DELETE ITFINAL WHERE WRBTR = 0.
        APPEND ITFINAL.
        CLEAR  ITFINAL.
        ENDLOOP.
        SORT ITFINAL BY  AUGBL AUGDT .
    END-OF-SELECTION
    END-OF-SELECTION.
    Output
    WRITE: /'                     OPEN ITEMS ->  PAYMENTS ARE NOT DONE'.
      ULINE.
      WRITE: / 'MAT.DOC.   A/C DOC.   YEAR    REF.KEY                  AMOUNT    VENDOR     CLR.DOC.    CLR.DATE' .
      ULINE.
      LOOP AT ITFINAL.
        WRITE: / ITFINAL-LFBNR,ITFINAL-BELNR, ITFINAL-GJAHR,ITFINAL-AWKEY, ITFINAL-WRBTR, ITFINAL-LIFNR,ITFINAL-AUGBL,ITFINAL-AUGDT.
      ENDLOOP.

  • I am using the database connectivity toolkit to retrieve data using a SQL query. The database has 1 million records, I am retrieving 4000 records from the database and the results are taking too long to get, is there any way of speeding it up?

    I am using the "fetch all" vi to do this, but it is retrieving one record at a time, (if you examine the block diagram) How can i retrieve all records in a faster more efficient manner?

    If this isn't faster than your previous method, then I think you found the wrong example. If you have the Database Connectivity Toolkit installed, then go to the LabVIEW Help menu and select "Find Examples". It defaults to searching for tasks, so open the "Communicating with External Applications" and "Databases" and open the Read All Data. The List Column names just gives the correct header to the resulting table and is a fast operation. That's not what you are supposed to be looking at ... it's the DBTools Select All Data subVI that is the important one. If you open it and look at its diagram, you'll see that it uses a completely different set of ADO methods and properties to retrieve all the data.

  • Problem with Fetching Million Records from Table COEP into an Internal Tabl

    Hi Everyone ! Hope things are going well.
           Table : COEP has 6 million records.
    I am trying to get records based on certain criteria, that is, there are atleast 5 conditions in the WHERE clause.
    I've noticed it takes about 15 minutes to populate the internal table. How can i improve the performance to less than a minute for a fetch of 500 records from a database set of 6 million?
    Regards,
    Owais...

    The first obvious sugession would be to use the proper indexes. I had a similar Issue with COVP which is a join of COEP and COBK. I got substanstial performance improvement by adding "where LEDNR EQ '00'" in the where clause.
    Here is my select:
              SELECT kokrs
                     belnr
                     buzei
                     ebeln
                     ebelp
                     wkgbtr
                     refbn
                     bukrs
                     gjahr
                FROM covp CLIENT SPECIFIED
                INTO TABLE i_coep
                 FOR ALL ENTRIES IN i_objnr
               WHERE mandt EQ sy-mandt
                 AND lednr EQ '00'
                 AND objnr = i_objnr-objnr
                 AND kokrs = c_conarea.

Maybe you are looking for