Move through the records

Hi,
Can anybody give me the code to move through the records (one after the other) in Module pool programing. Assuming that  I have a pushbutton, whenever i click on that button (assume button labeled as Next) it should move to the next record and to be displayed in the input/output field.
Thanks,
Sriram.

Hi Sriram
I think you aren't using a table control, are you?
You should use a index where you save the number of the index of record which is displayed.
DATA: INDEX_SHOW TYPE SY-TABIX.
I suppose that this index is 1 in the first time, after:
CASE OK_CODE.
WHEN 'NEXT'.
   INDEX_SHOW = INDEX_SHOW + 1.
   READ TABLE MY_TABLE INDEX INDEX-SHOW.
   MOVE MY_TABLE TO <SCREEN FIELD>.
  WHEN 'PREV'.
    INDEX_SHOW = INDEX_SHOW - 1.
    IF INDEX_SHOW = 0.
      INDEX_SHOW = 1.
    ENDIF.
    READ TABLE MY_TABLE INDEX INDEX-SHOW.
    MOVE MY_TABLE TO <SCREEN FIELD>.
You can use a index where you save the total number of records in your table:
DATA: INDEX_SHOW TYPE SY-TABIX,
      TOT_REC    TYPE SY-TABIX.
DESCRIBE TABLE MY_TABLE LINES TOT_REC.
I suppose that this index is 1 in the first time, after:
CASE OK_CODE.
WHEN 'NEXT'.
   INDEX_SHOW = INDEX_SHOW + 1.
So now you can check if INDEX_SHOW isn't greater than
TOT_REC.
   IF INDEX_SHOW > TOT_REC.
      INDEX_SHOW = TOT_REC.
   ENDIF.
   READ TABLE MY_TABLE INDEX INDEX-SHOW.
   MOVE MY_TABLE TO <SCREEN FIELD>.
  WHEN 'PREV'.
    INDEX_SHOW = INDEX_SHOW - 1.
    IF INDEX_SHOW = 0.
      INDEX_SHOW = 1.
    ENDIF.
    READ TABLE MY_TABLE INDEX INDEX-SHOW.
    MOVE MY_TABLE TO <SCREEN FIELD>.

Similar Messages

  • How to move  between  the records of a block  quickly

    Hi ,
    i am using dev6i  and i have a form connected to data block
    this table has 500,000 record
    when new_form_Instance  it executes the query
    the number of record dispalyed is 5
    The problem is  when i go  to the 6th Record  or higher  it takes few second to go to  each record
    The Question is
    How can i make the form fetch more record ? or how to make the movement between the record faster ?
    Regards,

    ayadsufyan wrote:
    Thanks NewRodeo
    I tried to to change the  Query _Array_Size  And Number_Of_Record_Buffered but  it doesn't work
    What did you change these properties too?  Since you are dealing with a rather large record set, I recommend you change these properties to 50 or 100 each.  The initial query time to display the first set of records will be a little longer because it is fetching so many records, but scrolling through the records will be faster because Forms will already have 50 to 100 of the records fetched.  Once the records fetched have been displayed, then Forms will have to communicate with the database to fecth the next 50 to 100 records.
    Craig...

  • Can you view movies through the mini-DVI output?

    Anyone know if you can watch rented movies on a TV with the mini-DVI output to video?

    Anyone have any feedback on whether or not you can output rented movies through the mini-DVI to watch on a television?

  • Scan through the records in the Form and display the message!

    Hello Everyone,
    We have a requirement, I do not know how to achieve it.
    In a Forms 6i, 2 fields Type, Comment.
    Type is a list of Values (1,2,3)
    Comment - Free Text Field.
    User can enter as much rows of data, but while user saves the data we have to validate that all the records of Same Type(Say 1). If not we have to display a Message.
    So how to achieve this? How to scan through the records in the Form. Any comments on it would be great.
    Thanks.

    User can enter as much rows of data, but while user saves the data we have to validate that all the records of Same Type(Say 1). If not we have to display a Message.I am assuming that you want to check from the first record. Suppose in first record the user coosed 1 and you will check for all the entries for 1.
    Couple of ways to do this.
    1. While user is entering first record. You can keep that selected type value in GLOBAL variable and while he is entering further records you can match type with that global variable. If it is not matching then you can display message.
    2. On KEY-COMMIT trigger you can start loop from first record and can check for all the records one by one. Like.
    DECLARE
      vVal DATATYPE;
    BEGIN
      GO_BLOCK('BLOCK_NAME');
      FIRST_RECORD;
      vVal:=:FORM_TYPE_FIELD;
      LOOP
        IF vVal!=:FORM_TYPE_FIELD THEN
          MESSAGE(..);
          EXIT;
        END IF;
        EXIT WHEN :SYSTEM.LAST_RECORD='TRUE';
        NEXT_RECORD;
      END LOOP;
    END;I would go for earlier approach and will use WHEN-VALIDATE-ITEM / PRE-INSERT for type field for this purpose. Because in KEY-COMMIT the system is doing same thing again.
    -Ammad
    Edited by: Ammad Ahmed on May 15, 2010 12:23 AM
    changes not equal sign to !=

  • How to purchase "Movies" through the Canadian iTune store?

    Could some one please tell me how to purchase a "movie" through the Canadian iTunes store?
    The "Movies" icon only available in the United States iTune store. I tried to set up an account through this US store but was unable due to "no option" for Canadian address.
    Back to Canadian iTune store page, but there are no "movies" available for purchase and download.
    Please help.

    At present movies are only available in the US iTunes store. There are a variety of reasons for this including copyright and licensing issues in different countries.
    You cannot purchase anything from an iTunes store outside of the country in which you live as mentioned in the Terms of Sale.
    "You agree not to use or attempt to use the Service from outside of the available territory, and that iTunes may use technologies to verify your compliance."
    The Terms of Use for the iTMS state that you agree that you won't attempt to make purchases from outside the store's country. The chance is small that Apple will cut off your account, but just be aware that it is possible. They certainly won't support your use of the US iTMS from Canada if you do have any problems.

  • Does it always take hours to download a movie through the apple tv when you rent from I tunes

    Does it always take hours to download a movie through apple tv when renting a movies through itunes?

    This is dependent on your network connection. Check www.speedtest.net
    6mbps is required for instant HD rentals
    You can switch to SD in the settings if on a slower connection

  • Having trouble playing movies through the iPod

    Does the iPod have to be in a certain mode to play movies through a component cable

    Assuming that a compatible cable is being used to output the video to a capable TV, you also need to make sure the TV Out setting is enabled from under Video -> Video Settings -> TV Out.
    See this article to determine if you are using the correct cable for your model iPod.
    http://support.apple.com/kb/ht1454
    B-rock

  • Script code sample for looping  through the records from xml data file in formCalc script

    Hi
       I have a xml data file which contains a sequence of repeating applicant data like given below
                       US
                       II
                       CEO
                       Mr
                       111111111
                       0000000111
                       GuarantorA
                       111
                       IN
                       11111
                       WILLIAMS1
                       R3
                       KENNETH1
                       City1GU
                       PA
                       1934-03-14
                       [email protected]
                       GU
                       R
                       113 Lazlo LaneCA
                       Suite 3500CA
                       OaklandCA
                       TX
                       11345
                       AL
    I want to assign a textfield with a value based on the value of coap_flag.
    So i need to loop through all the record and check the value of coap_flag and then assign the textfield a value based on that.
    I am new to Adobe livecycle...Please help me how it can be done.
    I have developed something like this
    foreach Item in ($record.applicant[*].coap_flag) do
    test.value=Item
    if(test.value=="MA")then
    concat($record.applicant.first_name,$record.applicant.middle_name)endif
    endfor

    Using the data you posted in the forum, I copied it a couple of times to give multiple records and used this code to extract the different values that you wanted. I had to wrap it in a <root> node that I called root (to make it valid XML). In my case I wrote the extracted values to a field, but in your case you can do whatever you want with them. Note that this was done in javascript:<br /><br />var currentElement;<br />var obj;<br /><br />//Get the nodes below the root node in the dataDom<br />obj = xfa.datasets.data.root.nodes;<br /><br />//Set an initial value for the textField<br />TextField1.rawValue = "The values of the coap_flag are: ";<br /><br />//Loop through the nodes in the obj set <br />for (i=0; i< obj.length ; i++){<br />     //set the currentElement to the 1st child node<br />     currentElement = obj.item(i);<br />     //Check to see if it is an applicant node<br />     if (currentElement.name == "applicant"){<br />          //It is an applican, now find the coap_flag node value and write it to the text field<br />          TextField1.rawValue += "\n" + xfa.resolveNode("xfa.datasets.data.root.applicant[" + i + "]").coap_flag.value;<br />     }<br />}

  • Loop through the records from xml data file in formCalc script

    Hi
       I have a xml data file which contains a sequence of repeating  applicant data like given below
                               US
                                II
                                CEO
                                Mr
                                111111111
                                0000000111
                                GuarantorA
                                111
                                IN
                                11111
                                WILLIAMS1
                                R3
                                KENNETH1
                                City1GU
                                PA
                                1934-03-14
                                [email protected]
                                GU
                                R
                                     113 Lazlo LaneCA
                                     Suite 3500CA
                                     OaklandCA
                                     TX
                                     11345
                                     AL
    I want to assign a textfield with a value based on the value of coap_flag.
    So i need to loop through all the record and check the value of coap_flag and then assign the textfield a value based on that.
    I am new to Adobe livecycle...Please help me how it can be done.
    I have developed something like this
    foreach Item in ($record.applicant[*].coap_flag) do
    test.value=Item
    if(test.value=="MA")then
    concat($record.applicant.first_name,$record.applicant.middle_name)endif
    endfor

    Using the data you posted in the forum, I copied it a couple of times to give multiple records and used this code to extract the different values that you wanted. I had to wrap it in a <root> node that I called root (to make it valid XML). In my case I wrote the extracted values to a field, but in your case you can do whatever you want with them. Note that this was done in javascript:<br /><br />var currentElement;<br />var obj;<br /><br />//Get the nodes below the root node in the dataDom<br />obj = xfa.datasets.data.root.nodes;<br /><br />//Set an initial value for the textField<br />TextField1.rawValue = "The values of the coap_flag are: ";<br /><br />//Loop through the nodes in the obj set <br />for (i=0; i< obj.length ; i++){<br />     //set the currentElement to the 1st child node<br />     currentElement = obj.item(i);<br />     //Check to see if it is an applicant node<br />     if (currentElement.name == "applicant"){<br />          //It is an applican, now find the coap_flag node value and write it to the text field<br />          TextField1.rawValue += "\n" + xfa.resolveNode("xfa.datasets.data.root.applicant[" + i + "]").coap_flag.value;<br />     }<br />}

  • Can i play the audio for rented movies through the airport express

    I'm watching a rented iTunes movie on my Mac and would like the audio to play through my Airport express to my stereo speakers. Can't figure it out.

    iTunes won't play the audio through your airport express due to the video and audio being out of sync.

  • Is there a way to stream your video to your apple tv and the audio stays playing on your iPhone so that you can run and hear the movie through the headphones but watch on the tv?

    I want to be able to run on my treadmill and watch a movie on my apple tv but hear the audio through my headphones on my iphone.

    Welcome to the Apple Community.
    Unfortunately, that's not possible.

  • Please can someone tell me how I can stop my apple TV remote working on my iMac when I am trying to watch a movie through the Apple TV

    Please help
    I have just bought an apple tv, my problem is that when ever i try and use the remote to do things with the TV it doues things on my iMac aswell. How do I un pair it from the iMac so it just workes with the Apple TV only

    There are several threads that address this issue.  Apparently there's an option to turn off infrared remotes in Security Preferences - but not for my MacBook Air.  Try this thread:
    Apple TV remote command macbook pro too!

  • Multi-record block (how do I loop through the block)

    I created a two canvas form. On the first canvas, the user enters data and selects 1 - 30
    reports that they want to run. When they click on <NEXT> button, I create a multi-record
    control block and display each record on the second screen using
    go_block;
    clear_block;
    move data;
    create_record;
    The user then selects on the second canvas which reports to run now and which to run later via
    a LOV. When they press the <RUN> button, I want to start at the first record and either run the
    report or schedule it. Then I want to move onto the second and the third until all selected reports
    have been handled. I know I should use a loop but can't seem to make it work.
    So my question is, How do I loop through the records in a multi-record control block, pass the information
    for that one record to a parameter form and then execute the request? Each control block record contains
    10 parameter fields.
    Thanks.
    Bob

    go_record(1);
    << do your processing >> -- This is executed only for the first record.
    if :system.last_record = 'TRUE' then -- If the 1st record is also the last record.
    RETURN;
    end if;
    LOOP
    next_record;
    << do your processing >>
    if :system.last_record = 'TRUE' then
    EXIT;
    end if;
    END LOOP;
    I created a two canvas form. On the first canvas, the user enters data and selects 1 - 30
    reports that they want to run. When they click on <NEXT> button, I create a multi-record
    control block and display each record on the second screen using
    go_block;
    clear_block;
    move data;
    create_record;
    The user then selects on the second canvas which reports to run now and which to run later via
    a LOV. When they press the <RUN> button, I want to start at the first record and either run the
    report or schedule it. Then I want to move onto the second and the third until all selected reports
    have been handled. I know I should use a loop but can't seem to make it work.
    So my question is, How do I loop through the records in a multi-record control block, pass the information
    for that one record to a parameter form and then execute the request? Each control block record contains
    10 parameter fields.
    Thanks.
    Bob

  • How to upload movie through iphone?

    hey guys anyone can help me? i dont know how to upload movies through the iphone?

    only things recorded with the ios device show up in the camera roll part of the media storage

  • Moving through each record

    How do I move through each record?
    I want to use some math function on one field and store the result in the other field one record at the time.
    How can I do it?

    How do I move through each record?
    I want to use some math function on one field and store the result in the other field one record at the time.
    How can I do it? You can read about Analytic Functions. It sounds like the one you want is either LAG or LEAD.
    LAG
    http://technet.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a90125/functions54.htm#83619
    LEAD
    http://technet.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a90125/functions58.htm#83836
    Different Function including Analytic
    http://technet.oracle.com/docs/products/oracle9i/doc_library/901_doc/server.901/a90125/functions2.htm#81312
    Good Luck,
    TwoPigs

Maybe you are looking for

  • Licencing on two laptops not, will not allow me to update to Adobe XI

    I purchase Adobe Professional 9 and is now updated to Acrobat XI Pro, I have a 2nd laptop which I also need to install Adobe Professional on I can get Pro 9 working but cannot get it to update to XI Pro, it will not accept the serial number. Any idea

  • I need help, I got a download problem!

    Hello there! I just bought a used MacBook a few days ago. It is about one year old and pretty used. Evrything seemed to work fine, untill I wanted to download something with my Firefox. The download started but then jusr stopped just before it was do

  • Gui optionpane help!!

    hi, i need some help with the optionpane component in java gui, in the option pane i need to list the strings in the array called test ( i have labelled the place where they need to go as the word "something"), can anyone assist? try {       // Creat

  • Query for highest balance for each BP

    I'm working on a query to assist with determining appropriate Credit Limits for our customers.  I have been asked to research if we can develop a query to give what the highest balance has been for each BP all in one report.  The target query will re

  • Can't connect to Internet via Netscape

    Using my new G5 (after my G4 Quicksilver crashed),I have been unable to connect to the internet via Netscape.I connect via my server Webmail but like Netscapes format and want to use it.I get the following messages after the inbox opens "failed to co