Read table and checking condition in PAI

Hi,
I have a requirement where I need to check and compare with (Custom table) Bankn with Partner Bank`s bankn.
I have wrote a code in PAI like this.
MODULE CHECK_BANKN INPUT.
   Data: l_bankn like (Custom table)-bankn.
   select bankn from (Custom Table) into l_bankn
       where recno = g_recno.
   IF NOT g_head-bankn IS INITIAL.
  Read table i_bvtyp with key bankn = i_bvtyp-bankn .
     IF l_bankn <> i_bvtyp-bankn.--------->" Comparison of (custom table) Bankn with internal table I_BVTYP-BANKN
       MESSAGE w022 WITH text-w06.
     ENDIF.
   ENDIF.
ENDMODULE.
My Read Table statement is seems to be wrong and my checking condition is also wrong.
So, how to resolve this?
regards,
Kiran

Hi Kiran,
If you observe your read statement, you are comparing the field with it's own table field.
   Read table i_bvtyp with key bankn = i_bvtyp-bankn .
Untill unless you read I_BVTYP, i_bvtyp-bankn will be initial and you cannot find the matching record with Null-Value.
So, I think you need compare with l_bankn.
   Read table i_bvtyp with key bankn = i_bankn .
Then you can directly raise a message using SY-SUBRC value.
   Read table i_bvtyp with key bankn = i_bankn
      if SY-SUBRC <> 0 .
          <MESSAGE>    
     endif.
Regards,
Vijay

Similar Messages

  • Reg value table and check table

    Hi Friends,
        I have defined a value table(ZVALTAB) for a domain and defined the relation ship between check table(ZCHKTAB) and dependent table(ZDEPTAB). Here value table and check table both are different. My problem is while I am entering the values into check table, it is not restricting the values to enter into check table even those values are not in value table. And while I am entering values into the dependent table through the menu option Utilities->Create entries then also foreign key is not working. But when I use the SM30 then the foreign key is working. So can any body explain me when this value table restrict the values and why the option Utilities->Create entries is not validating the foreign key relation ship.
    Sathish Reddy

    Hi,
      Value Table will just provide you the possible set of values.  It won't restrict u for the wrong entries.  Moreover whenever u enter entries thru Create entries no user interface is available.  The constraints whatever we give is not at all stored in the Data Dictionary.  Only the user interface which takes care all about this.  Hence it wont restrict you.  For this u have to create table maintenance generator for your table.  Then it will restrict the values against check table.
    Both Value table and Check table will provide u possible set of values.  But only the check table will restrict the values.
    Hope this will help u.

  • How to read tables and fields transaction,how to find table from a strucre

    hi all,
      i am having problem in reading tables and fields for developing a customised report. can anybady help me how to extract tabele and fields from a transaction code and how to map table from a structure.
    It will me much help full, if u had any documentation. u should be appreciated.
    Thanking u
    kiran
    Message was edited by:
            kiran

    Hi Kiran,
    You can make use of the tables or Views available.
    Reward If Useful.
    Regards,
    Chitra

  • Read   table and loop at

    Hi EXpert,
    I have an internal table say itab and I need to fetch a single record with some given conditions.
    Hence I have used READ table statement ,
    But on using this read table statement , I am unable to fetch the record :-(((( . It gives sy-subrc  =  4.
    And the same conditions when are put in Loop at itab  statement, then I am able to fetch the data .
    My requirement is only 1 record for the given conditions ( in where clause in case of loop at statement).
    I think I am probably missing out on some minor thing..
    <removed_by_moderator>
    Warm Regards,
    SUDHA
    Edited by: Julius Bussche on Feb 7, 2009 2:48 PM

    Hi,
    Test the following Code hope it will solve out your problem,
    PARAMETERS: key TYPE i .
    TYPES: BEGIN OF t_test,
      s_no TYPE i,
      name(15),
      END OF t_test.
    DATA: it_test TYPE STANDARD TABLE OF t_test WITH HEADER LINE.
    DO 10 TIMES.
      it_test-s_no = sy-index.
      it_test-name = 'SDN'.
      APPEND it_test TO it_test.
    ENDDO.
    READ TABLE it_test INTO it_test WITH KEY key.
    IF sy-subrc = 0.
      WRITE: 'sy-subrc = ' , sy-subrc,
             /1 it_test-s_no, 15 it_test-name.
    ELSE.
      WRITE: 'sy-subrc = ' , sy-subrc,
             / 'Sorry there is no Records with this Key'.
    ENDIF.
    Kind Regards,
    Faisal
    Edited by: Faisal Altaf on Feb 7, 2009 6:59 PM

  • "Read table" and field symbols

    Hello all,
    I have a (hopefully simple) question. Let's suppose I want to do the following:
    loop at itab1 assigning <fs1>.
      read table itab2 assigning <fs2> with table key <fs1>-field1.
      if sy-subrc eq 0.
        move <fs2>-field1 to ls_out-field1.
      endif.
      read table itab3 assigning <fs3> with table key <fs1>-field2.
      if sy-subrc eq 0.
        move <fs3>-field1 to ls_out-field2.
      endif.
    endloop.
    It's also possible to do the following instead:
    loop at itab1 assigning <fs1>.
      unassign: <fs2>,
                <fs3>.
      read table itab2 assigning <fs2> with table key <fs1>-field1.
      read table itab3 assigning <fs3> with table key <fs1>-field2.
      if <fs2> is assigned.
        move <fs2>-field1 to ls_out-field1.
      endif.
      if <fs3> is assigned.
        move <fs3>-field1 to ls_out-field2.
      endif.
    endloop.
    My question is: is it "better" to check sy-subrc after each read, and then do a move statement within that if statement, or is it better to check whether the field symbol is assigned each time I want to fill in a field and read everything at the same time?
    I'm only really concerned about the case where you don't want to drop out of the loop after the read (so if the read fails you just don't fill any data in). I'm also discounting potential human error (otherwise the sy-subrc method wins hands-down).

    Just to close this one (albeit somewhat belatedly). I asked Harry Dietz (the ABAP Performance blogging fella) what he would suggest, and he says sy-subrc all the way. Checking that an integer is zero is considerably faster than checking for the assignment, or otherwise, of a field symbol. Furthermore, whilst the field symbol method has the potential to be faster than the sy-subrc method given some compiler optimizations, unfortunately these optimizations don't exist in the ABAP compiler - they're there in the Java compiler though! Shame really. Apparently the ABAP compiler is a pretty simple beast.
    Anyway - thanks Harry for clearing this one up!

  • Inserting data in a table and checking

    create or replace procedure testpara1( p_IN in VARCHAR2,p_result out varchar2)
    Is
    CURSOR cur_key IS
          SELECT * FROM object_keywords;
    TYPE objkey_tab_type IS TABLE OF OBJECT_KEYWORDS%ROWTYPE;
    v_keywords  objkey_tab_type;
    v_keepwords varchar2(100);
    Begin
    INSERT INTO TEMP_TABLE
    VALUES(p_IN);
    COMMIT;
    OPEN cur_key;
           FETCH cur_key BULK COLLECT INTO v_keywords;
         CLOSE cur_key;
           FOR i IN v_keywords.FIRST .. v_keywords.LAST
             LOOP
                  v_keepwords := '%'||v_keywords(i).KEYWORDS||'%';
               select STOREVAL into p_result from TEMP_TABLE
               where CONTAINS(STOREVAL,'ahole') > 0;
    END LOOP;
    delete from TEMP_TABLE;
    commit;
    End  testpara1;here i m inserting a string a string in a table and trying to check that the present in object_keywords tabe is present in this string or not but showing error no data faound if also the desired data is present plz help me
    thanks in advance..
    Edited by: BluShadow on 24-May-2011 08:45
    added {noformat}{noformat} tags to keep formatting.  please read {message:id=9360002}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    hmm.. i did some search on this. issue is probably due to index not sync with the table.
    Here is my test case
    SQL> drop table temp_table purge;
    Table dropped.
    SQL> create table temp_table
      2  (storeval varchar2(50));
    Table created.
    SQL> insert into temp_table
      2  values
      3  ('ahole is the word');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> CREATE INDEX temp1_idx ON temp_table
      2    (storeval
      3    ) indextype IS ctxsys.context;
    Index created.
    SQL> select * from temp_table where
      2  contains(storeval,'ahole') >0;
    STOREVAL
    ahole is the word
    SQL> delete from temp_table;
    1 row deleted.
    SQL> insert into temp_table
      2  values
      3  ('ahole is the word');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from temp_table where
      2  contains(storeval,'ahole') >0;
    no rows selectedYou might need to sync the index using ctx_ddl.SYNC_INDEX(<index_name>)
    SQL> exec ctx_ddl.SYNC_INDEX('temp1_idx');
    PL/SQL procedure successfully completed.
    SQL> select * from temp_table where
      2  contains(storeval,'ahole') >0;
    STOREVAL
    ahole is the wordHere's the link
    http://www.techxplore.net/2008/03/05/oracle-text-ctxsys-context-index-type-not-showing-search/
    Vivek L

  • Read table and binary search

    Hi all,
    I have a simple query regarding read int_tab with binary search.
    Why reading  internal table with binary search fails if it is sorted in descending order table must be sorted in ascending order?
    I check fo the algorithm of binary search, it does not talk about sort order. As far as my understanding goes binary search only require sorted table but while reading table in SAP it has to be sorted in ascending order!!

    By default binary search assumes that the sort order is ASCENDING.
    If you sort the list in descending and then try to binary search your quires will fail. Look at an example:
    Let the descending order internal table as:
    Field1      Field2
    Sam        50000
    John       34786
    Boob      54321
    Alice       12345
    When you do binary search with key = 'Sam' then it will directly go to 2nd and 3rd records for comparision. The binary search algorithm compares 'Sam' with 'John' and it concludes that 'Sam' is greater than 'John' and it will continue to look downward into the internal table. And when it reaches the end of the internal table then the value of SY-TABIX = 5 and SY-SUBRC = 8 (Key is greater than the all).
    And if you do binary search with key = 'Alice' then the binary search algorithm compares 'Alice' with 'John' and it concludes that 'Alice' is lower than 'John' and it will continue to look upward into the internal table. And when it reaches above the first record in internal table then the value of SY-TABIX = 1 and SY-SUBRC = 4 (points to the next largest entry).
    The only correct result you will get is when you execute statement with key='John' (In this particular case) . SY-TABIX = 2 and SY-SUBRC = 0. I think you got this binary search algorithm.

  • How to read tables and fields from a transaction screen.

    hi all,
    i am having problem in reading fields and tables from a screen, could any one help me in mapping tables from a structure as well.
    it will be very help full if u had any documentation.
    Thanking u
    kiran

    Hi,
    In classical debug mode from CALL STACK tab try to find out the structures holding the screen values .
    Capture the values from transaction using FIELD SYMBOLS .
    See the below code.
    DATA : l_prog_val(50) TYPE c VALUE '(SAPLCTMS)WI[]'.
    **To get the (SAPLCTMS)WI value in this program from call stack.
      FIELD-SYMBOLS: <wi> TYPE ANY.
    *Assign the structure (SAPLCTMS)WI to field symbol
      ASSIGN  (l_prog_val) TO <wi>.
      IF sy-subrc NE 0.
        EXIT.
    *Assign the structure (SAPLCTMS)WI to internal table
      ELSE.
        it_wi[] = <wi>.
      ENDIF.
    Sastry.

  • My 4215 all in one HP printer error message suddenly reads "remove and check right cartridge" .

    My all in one 4215 printer suddenly is flashing an error message in the screen saying "remove and check right cartridge"...For what I am checking it is unclear. I have removed and reinstalled the cartridge and it looks OK to me...It is not empty, and the last thing it printed was fine...Help!
    This question was solved.
    View Solution.

    I'm betting that the contacts inside the printer or on the ink cartridge are dirty. This happens over time. The document below will walk you through cleaning the contacts. Let me know what happens.
    http://goo.gl/9oXc9
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------

  • [Project siena]How to get random table and check if answer is good

    Hey, i have excel file with one table with: state and capital fields.
    I want to randomly (After pressing button) get state. then when i write in input field capital of this state i want to get answer wrong/good. How can i do this?

    Assuming:
    The table is called Table1, and it has at least State and Capital columns.
    The input field is called Text1.
    Put the following in the OnSelect property of a button:
    If(Lower(Text1!Text) = Lower(Question!Capital) ,UpdateContext({Question: First(Shuffle(Table1))}))
    Create a label, and set its Text property to:
    Question!State
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This is beneficial to other community members reading the thread.
    -Bruton

  • Can you read Reports and Tables through RFCs and BAPIS?

    Is there any way to read established reports and tables through RFC or BAPI function calls?  We have a middleware that can execute various BAPIs and RFCs.  I see a few promising ones: RFC_READ_REPORT, but no examples anywhere what the parameters needed are for the inputs. 

    Hello Scott,
    Check below FMs for reading tables and programs.
    Tables : RFC_READ_TABLE
    Program : RFC_READ_DEVELOPMENT_OBJECT
    Please note that for reading program using RFC_READ_DEVELOPMENT_OBJECT , lines in program should not exceed 72 chars else FM will throw dump(READ_REPORT_LINE_TOO_LONG).
    Program code will appear in table QTAB which is 72 chars wide.

  • Read Table Vs Loop at

    Dear All,
    Please let me know which one of the two should I use to improve the performance, for tables containing a lot of data ?
    Regards,
    Thanks in anticipation.
    Alok.

    Hi,
        Follow below steps.
        In se30 transaction you can look for
        Tip&TRicks button on application toolbar
        apart from below conventions
       Follow below steps
    1) Remove corresponding from select satement
    2) Remove * from select
    3) Select field in sequence as defined in database
    4) Avoid unnecessary selects
    i.e check for internal table not initial
    5) Use all entries and sort table by key fields
    6) Remove selects ferom loop and use binary search
    7) Try to use secondary index when you don't have
    full key.
    8) Modify internal table use transporting option
    9) Avoid nested loop . Use read table and loop at itab
    from sy-tabix statement.
    10) free intrenal table memory wnen table is not
    required for further processing.
    11)
    Follow below logic.
    FORM SUB_SELECTION_AUFKTAB.
    if not it_plant[] is initial.
    it_plant1[] = it_plant[].
    sort it_plant1 by werks.
    delete adjacent duplicates from it_plant1 comparing werks
    SELECT AUFNR KTEXT USER4 OBJNR INTO CORRESPONDING FIELDS OF TABLE I_AUFKTAB
    FROM AUFK
    FOR ALL ENTRIES IN it_plant1
    WHERE AUFNR IN S_AUFNR AND
    KTEXT IN S_KTEXT AND
    WERKS IN S_WERKS AND
    AUART IN S_AUART AND
    USER4 IN S_USER4 AND
    werks eq it_plant1-werks.
    free it_plant1.
    Endif.
    ENDFORM. "SUB_SELECTION_AUFKTAB
    Regards
    Amole

  • About Read table

    Can any body explain about Read table and when it can use.

    Hi,
    When u want to read a record based on some condition then u can use READ.
    LOOP AT itab.
    READ TABLE itab WITH KEY matnr = itab-matnr.
    IF sy-subrc = 0.
    ENDIF.
    ENDLOOP.
    U can read only a single record.
    U can also use
    READ TABLE itab INDEX 1.
    Reward points if this is helpful.

  • Edit table and write changes back to DB

    Hi All,
    I created a test program that uses AbstractTableModel to display the results of an SQL select statement in a JTable. I want to proceed to the next step which to edit cells and then write the changes back to the DB.
    I imagine making a number of edits, then clicking a "save" buton and then looping through the table and checking for updated rows and then sending the sql update statements to the db.
    I've spent most of this afternoon researching JTables, but am still uncertain as to where to go from here, so now I'm asking for someone to point me in the right direction.
    This is where I'm at:
    * I've implemented the getRowCount, getColumnCount, isCellEditable and getValueAt methods.
    * My model doesn't use any vectors, or other array storage for the data, it just uses the JDBC ResultSet methods absolute(rowNumber) and getObject( colNumber)
    * Whenever I edit a cell, the value reverts back to it's original. I assume this is because I havn't implemented setValueAt() yet.
    In my current setup, I'm not sure how I should implement setValueAt() since all I have is the JDBC result set. Should I be implementing some kind of sparse array to hold modified data, and use that to hold updated rows? Presumably, non updated rows could still be obtained from the JDBC result set.
    Anyway, I'd like to hear your advice on this.
    Thanks
    Iain

    OK, here's the plan:
    I already have very basic Data Access Objects (DAOs) for all of the tables in my system. Apart from encoding the most common SQL, the DAO has instance variables for each column in the table, thus implementing a record structure.
    So, in my AbstractTableModel, I 'll create a Vector of the DAO, which should give me a sparse array (Vector implements a sparse array, right?) of database records that will be used to hold the rows that have been edited.
    The Abstract Data Model's getValueAt( ) method would then be modified to check the cache of edited rows and get the data to display from there for updated rows, and from the ResultSet for non-edited rows.
    When it's time to write updates to the database, all I have to do is process the Vector, and destroy it afterwards.
    If checking the Vector each time getValueAt( ) is invoked is too expensive, then I could just implement a standard array of booleans. I'll need to keep track of rows to be inserted and deleted too, so an array of ints might be better.
    This seems like a good idea to me, but I have no idea if it's gonna work....

  • Re: Remove and check cartridge on right.

    I own an Officejet 7310 All in One. I have received an error that reads "Remove and check cartridge on right". After removing and inspecting the nearly full black cartridge, I could not identify any abnormalities. After reinsertion, the error returns. Perhaps I don't understand what is meant by "check". Please help.
    Ralph Sellers 

    The document here may help resolve the "remove and check" error.  The photo in the post here may be helpful in checking for damage to the x-bias-spring.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

Maybe you are looking for