How to set cursor at the first line in a table control?

Hi,
       I have a customized infotype screen where a table control is being used to input new values.The tab control has 30 lines.Now, the problem is that when the screen is displayed, the cursor always starts at 8th or 4th line.The behaviour is not very consistent.I tried the following statement in the PBO, but no effect.
SET CURSOR FIELD P9417-ZCOUNTRY LINE 1.  ( P9417-ZCOUNTRY is the name of the tab control field where i want to set the cursor ).This is the last statement in the PBO.
Can someone please tell me why still I am not able to set the cursor at the first line? I have infact noticed that , in the debugging mode , sometimes the cursor starts at the first line.Please help. Thanks

I have got a new requirement on this now. If the table control does not have any records , then the cursor position should be on the first row.Otherwise, if it already has some records, then the cursor should be at the first empty row.I wrote the code like below.
if sy-ucomm = 'INSERT'.
set cursor 'P9714-ZCOUNTRY'  line 1.
else if sy-ucomm eq 'CHANGE'.
describe table itab lines fill.
fill = fill + 1.
set cursor 'P9714-ZCOUNTRY'  line fill.
endif.
I am facing a strange problem now.The table control has some 10 rows when you see the screen for the first time.If the number of records already present is less than 10, I am able to position the cursor on the first empty row.But if the number is say 15, then the cursor position goes to eighth or fourth line or sometimes the first line.
Is there any way to display the last few records , ie, if there are 15 records , is there any way to display the last five rows when I see the screen for the first time, rather than showing the first 10 records?How can I position the cursor at the first empty row, when there are more records?
Thanks in advance..good answers will be rewarded.
Mahesh

Similar Messages

  • How to get First line item in Table control for BDC.

    Hi,
    I have a requirement while creating the return order from the reference Sales order for BOM.
    Once I compare the line items and delete the items not to be returned, I want to read the first line item which in fact is header, to make some changes.
    How to read  this as cursor points to the last line item.
    -B S B

    Hi Bsb,
    What is exactly unclear to you? =POPO will give a popup screen in which you can enter the order position number. This number will then be on the top of the table which means you can refer to it in BDC with "(01)".
    Regards,
    John.

  • How to set cursor at the end of text item?

    If I use Go_Item, it will go to the item but select the whole content of the item(displayed in blue color). How can I set the cursor at the end of the text item and not to make the content selected?

    You may be seeing <Bug:1186653> which is fixed in 6.0.5.36 however if running on windows awprkaoutnd may be to use d2kwutil.
    Place the following code within a when-new-item-instance trigger on the
    item(s) you wish to disable highlighting:
    DECLARE
    v_handle pls_integer;
    BEGIN
    win_api_shell.sendkeys(V_HANDLE,'{home}',FALSE);
    END;
    The above code will result in no highlighting occurring and the cursor will be
    placed on the first character of the item. If you wish the cursor to appear at
    the end of the item, replace the word home to end. For more information,
    please refer to the d2kwutil documentation.
    Note that this solution will only work on windows in a client server environment.
    For a web solution you will have to create a java bean that will perform the
    necessary functionality.
    Regards
    Grant Ronald

  • How to set cursor in the beginning of a test in a JTextField in Java Swings

    hi
    I am new to Swing.I have to display a large text in a text field.Whenever I am displaying it is showing the tale of the text.To see the beginning of the text I have to move the cursor using keys.How can I set the cursor in the beginning of the text or how can I display the text with its beginning characters.

    You're practically there...
    You usually put all the jars in the same directory and then specify the class-path attribute in your manifest:
    Class-Path: other.jarYou can of course specify a relative path to another jar:
    Class-Path: lib/other.jarBut that's up to you how you want to package these things.
    I don't think that jars in jars are permitted.
    Hope this helps.

  • How to handle the single line selection in table control

    Hi All,
       I am facing a problem in the table control of modulepool program.
       I have line selection as "Single" in the table control attributes. But when i am selecting a line in the table control as long as it is in the same page,the line selection is single but when i am selecting the line in the next page,the previous selection is not deselected. So I am seeing two selection for "Single line selector" attribute.
       Could any one help me solve this problem?
    Thanks & Regards,
    S.Lakshmi

    Hi Lakshmi,
    Just Go to Table control , click on it , you can see the attributes screen , there you can see option for
    <b>Line selection</b>
    none
    multiple selection
    single selection
    check the radio button single selection.
    that will solve your problem..
    regards
    vijay

  • Alv grid: how to set cursor to the next field

    Hi Abapers,
    When I input the data in first cell and do a tab for coming to next cell to give the input it is coming back to my first cell in the ALV grid.
    Any idea's on how do I deal with this.
    Many Thanks,
    Jagan.

    Hi Group,
    Finally I got the solution for this, here is the stuff we need to do:
    ***********04/03/2010
    *----Get the current cell
                CALL METHOD wa_grid->get_current_cell
                  IMPORTING
                    es_col_id = li_col
                    es_row_no = li_rows.
    **--Get Scroll Position
                CALL METHOD wa_grid->get_scroll_info_via_id
                  IMPORTING
                    es_col_info = ls_col
                    es_row_no   = ls_num.
    ***********04/03/2010
                CALL METHOD wa_grid->refresh_table_display.
               CLEAR: wa_profile1.     ", wa_pro_new.
    ********04/03/2010
    *--Set Scroll Position
                CALL METHOD wa_grid->set_scroll_info_via_id
                  EXPORTING
                    is_col_info = ls_col
                    is_row_no   = ls_num.
    *----Set the cell information
                ls_row-index = li_rows-row_id.
                CALL METHOD wa_grid->set_current_cell_via_id
                  EXPORTING
                    is_row_id    = ls_row
                    is_column_id = li_col
                    is_row_no    = li_rows.
    ********04/03/2010
    Hope this info might be useful to anyone facing the similar issue.
    Cheers,
    Jagan.

  • I need to change the "from" address (the "add to addressbook" address) in the first line of emails that I send. How do I do this?

    I need to change the "from" address (the "add to addressbook" address) in the first line of emails that I send so that people reply to my email alias not the address where my emails originate. How do I do this?

    So you have added a new 'Identity' to your existing email address.
    If someone sends an email using that 'other identity'
    you have a choice of where those received emails can go. they can be received into the original mail account, like a collect all in the one Inbox or perhaps sent to Local Folders, so you can see them as separate. Or you can filter on that identity to put those emails in a specific folder.
    When you REply to any incoming mail that has used that new identity email address, it will use the new identity in the Email address in FROM assuming the received email in the main mail account of which the new identity email is applied.
    This should also now offer the added identity email address as an option in the FROM drop down list. So you can easily swap when sending an email if required.
    If you want to send using your default email address to people, but want their reply to use the identity email address:
    Tools > Account Settings
    select the original email address mail account name
    Where it says: 'Reply to addresses: enter the reply to identity email address.
    click on OK
    This means when they click on 'Reply' it will auto insert the Reply-to option.
    This will work providing it is a 'Reply' to an email you sent which contains the Reply-to email address.
    If someone is not actually replying by using the Reply-to new identity email address:
    In other words they are sending you a new email using the original email address because perhaps that is the one in their address book or the one they located on a webpage etc.
    Then, when you select to Reply to that email, it will use the email address to which it was sent to in the FROM field - the original email address. Hence why you would need to select the new identity FROM in the drop down list.
    One way to get around this is set out below.
    If you do not use an identity - instead you create another existing mail account for the 'identity' email address, so you have two mail accounts for the two email addresses.
    You can move selected emails manually or perhaps using a filter to screen them from the original mail account into the newly created mail account.
    Then when you click on Reply, it will use the new mail account email address instead of the original email address.

  • Could not parse the file contents as a data set. There were too many variable names in the first line of the text file.

    Could not parse the file contents as a data set. There were too many variable names in the first line of the text file.

    What are the Variables settings, what is the text file’s content, …?

  • How to echo the first line???

    Hi everybody,
    I need to know how to echo the first line of an XML document with a SAX parser, for example :
    <?xml version="1.0"?>I've already tried :
    public void processingInstruction(String target, String data) throws SAXException {
            System.out.println("Target = (" + target + ")");
            System.out.println("Data = (" + data + ")");
        }but it doesn't work.
    Please, help me...
    Thanks.
    Maxime.

    http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXPSAX4.html

  • Help with how to count the number of tokens from the first line

    Hi
    I want to count the number of tokens from the first line of text, from my incoming file and print it out.
    For example i have 12 tokens in the first line, so i want it to print out the number 12
    my code is below
    thanks
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    import java.util.StringTokenizer.*;
    import java.sql.*;
    public class Data {
         public static void main(String[] args) {
                        String token = null;          
                        String currentToken = "";
                        Hashtable hh = new Hashtable();     
              try {
                   Vector v2 = new Vector(100);
                   Vector v = new Vector(100);
                   FileReader file = new FileReader("words.txt");
                   BufferedReader buff = new BufferedReader(file);
                   String line = buff.readLine();
                   StringTokenizer s = null;
                   boolean eof = false;
                   while  (!eof){
                        s = new StringTokenizer(line.trim(),",",true);
                        boolean lastToken = true;
                   while (s.hasMoreTokens()) {
                              token = s.nextToken();
                                  if (lastToken){
                                   if (token.equals(",")) {
                                        v.add("");
                                               lastToken = false;
                                      if (! token.equals(",")) {
                                   v.add(token);
                                  else { if (currentToken.equals(",")) {
                                        v.add("");
                                  currentToken = token;
                        if (token.equals(",")) {
                               v.add("");
                   line = buff.readLine();
                        if (line == null){     
                             eof = true;}
                   buff.close();
              }catch (FileNotFoundException fe) {     
                        System.out.println("Error - - " + fe.toString());
              }catch (NumberFormatException ne) {
                        System.out.println("Error - - " + ne.toString());
              } catch (IOException e) {
                   System.out.println("Error - - " + e.toString());
    }     2.

    I can print out the amount of tokens from each line,
    But i only want the first line to be counted, And i
    also do not want the delimeters to be counted.
    could you please give me some ideas?
    Thanks
    try
       BufferedReader br = new BufferedReader(new FileReader("item.kr"));
       while((str=br.readLine())!= null)
          itemslist.add(str);
    catch(IOException ioe)
       System.out.println("Exception Occurred!!!");
    }This snippet gets one Line from the item.kr file.
    Then i would count (By useing a diffrent String Tokenizer) to count only this line!!!

  • How to set cursor in table control?

    I have a table control (Screen 300) to display invoice number and amount. For some checks we have around 200 invoices to be displayed.  When user enters the invoice number in invoice text box and click on OK, it should highlight the invoice number and amount row or set the cursor position.
    I have another problem.
    Screen 300 is being called from Screen 200. When the user clicks on OK in 300, 300 is getting closed. Acutally it should be displayed with Cusor position or highlighted row.
    I appreaciate your help ... Thanks

    I believe that you can use the SET CURSOR statement to do the first part of your requirement.  Something like this should work:
    SET CURSOR FIELD w_field LINE w_line.
    Here's the info from SAP help:
    Effect
    : The cursor is positioned on the screen element whose name is contained in upper case in field. The data object field must be character-type and flat. The screen layout or a table control is scrolled in the display so that the screen element on which the cursor is positioned is visible. If the specified screen element is not found, the statement is ignored.
    If the specified screen element is part of a table control or a step loop, the line of the table control or group of the step loop in which the cursor is positioned on the specified screen element must be specified using the addition LINE. For the data object line, the type i is expected. If there is no line or group for the value of line, or the addition LINE is not specified, the statement is ignored. The statement is also ignored if the addition LINE is specified and the screen element is not part of a table control or step loop.
    I hope this helps.
    - April King

  • How to set cursor in perticular field Table Maintence generator?

    Hi
    All
    I have created a table with 2 fields  Start_date and End_date. Now my requirement is i have to validate the both date field as Start_Date must be LESS than or EQUAL to End_Date. In table maintenance maintenance generator i have created a event VALIDATE_DATE in event 21. Its validating perfectly. The issue is after the ERROR message the Cursor is going to the key field. I want to set the cursor at End_Date field.
    I used
    data:ly_pos type i.
    IF NOT start_date LE end_date.
        SET CURSOR FIELD 'TABLE_NAME-END_DATE' LINE sy-linno OFFSET lv_pos.
        MESSAGE exxx(MsgClass).
    ENDIF.
    Its working for the FIRST time i am entering the new data. Next time the cursor going to the KEY field.  I have been asked not to write code in SE80. Anyhow i have to set the cursor in table maintenance maintenance generator event.
    Can anybody help?

    Hi Sourav,
    Please follow the below method:
    Go to Maintainance Screen (where you want the cursor setting). Goto Status - > Remember the screen name -> Double click on Program name.. Open Object list and expant Screen Tree -> double click on the same screen Number -> Go to its first tab attributs -> Change Mode -> Do F4 on Cursor Position field -> Choose the field where you want the cursor.
    But this way will always set the cursor at the HardCoded Field Name.
    Thanks,
    Preyansh

  • How to calculate the total of absences? How to collect data from a specific line of a table?

    Hi,
    Again, I made a nice coloured picture from a screen capture which summarise the improvements that I would like to make in my form,
    Situation:
    For an educational purpose, I made this form   to simplify the way of recording the data and also to develope the independence of the students.
    ( I am doing this on a voluntary basis, working extra hours on my free time but I don't really mind because I am learning a lot of things in the same time)
    After being tested by the teacher, the student has to record the short date, the lines memorised, his grade, number of mistakes, and his attendance.
    I created everything in Word, then converted the file in PDF, then I created all the different fields with Adobe acrobat.
    There is in total 4 sheets, there are all similar except the first one in which there is a box with: date started, date finished, total time spent, absences.
    Below this box there is a table with 16 lines from (A to P) and 7 columns (Days, Date, From.. to.. , Grade, No. lines memorised, No. Errors, Attendance) ( so this table is present on all the sheets)
    Due to the fact that some students need more time than others, and also beacause some text need more time, I estimated a need of 4 sheets at the very most.
    I would like to make the following amelioration and automate the inputting of some of the data because I know that some of the students will certainly forget, so to avoid this scenario I am trying to make this form the easiest possible.
    screen capture of the form:
    screen capture of the form editing, you can see the names of the different fields:
    here is the form (only the first page) : http://cjoint.com/12fe/BBotMMgfYIy_memorisation_sheet_sample.pdf
    In  yellow 00000:
    At present, the students has to input the total of absences manually, is there a way ( script) to automate this by initialising the field next to "Absences" at  " 0 day"   and then everytime that Absent is selected from the COMBO BOX, it add 1 and it is displayed like this:  " 1 day" then " 2 days"  then " 3 days" etc … (so from what I read I have to initialise a counter a the beginning and then for (i...   ) count= count++; something like this...
    Furthermore, I need a solution to overcome the possibility that a second sheet may be needed for the same student; therefore I would need the data from the "attendance column" from the second sheet ( and perhaps the 3rd and 4th aswell) to be added on the "absences field" in the first sheet
    My idea: everytime that the short date is inputted in the first line (next to A) in the "Date" column of one of the 4 sheets then we check the 16 Combo box of the attendance column in this sheet instead to check 16*4=64 fields fot the 4 sheets in one go?
    but I don't know at all how to write it in Javascript. Or perhaps there is a way more easier than that?
    Shall I allocate a value for Absent on the “ export value”?
    In purple
    At present I wrote a simple script which matches the number of lines to the poem selected (Eg.  if I select the poem V.Hugo,  the number "36" will appear next to Number of lines).
    Again I would like the make the life of the students very easy so I would like a script which detects this number “36” on the "From .. to …" column,  as soon it is detected (on the first sheet or 2nd or 3rd or 4th)  check from the same line if "A / Pass" or "B / Pass" have been selected in the "Grade" column ,if yes the short date inputted on this line will be written on the field next to "Date finished" .
    this is a simple example with 36 lines only but somethimes, the students may have to memorise 80 lines and more, this is the reason for having 4 sheets in total.
    So basically I would like to automate the field next to" Date finished:" with a script that collect the short date from the day in which the student has finished his memorisation with "A / Pass" or "B / Pass"
    As for the "Total time spent" George Johnson helped me with a script that calculate the difference betwen date started and date finished (thank you)
    I am sollicting your help, because after trying for hours I was really confused with the different if/else needed. And in top of that, it’s my first experience with Javascript.
    I anticipate your assistance, thanking you in advance.

    I found this for counting the absences, its give you the total that's perfect, but is there a better methode which avoid me to write all the fields name, more simple????
    ( I found the idea here : Re: Total number added automatically  )
    // custom calculation script for field "Total #"
    function CountFields(aFields) {
    var nFields = 0;
    for(i = 0; i < aFields.length; i++) {
    try {
    // count null values, export value of Absence is 0;
    if(this.getField(aFields[i]).value == "0") nFields++;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to count
    var aNames = new Array("Sheet1AttendanceA","Sheet1AttendanceB","Sheet1AttendanceC","Sheet1AttendanceD","Sh eet1AttendanceE","Sheet1AttendanceF",
    "Sheet1AttendanceG","Sheet1AttendanceH","Sheet1AttendanceI","Sheet1AttendanceJ","Sheet1Att endanceK","Sheet1AttendanceL",
    "Sheet1AttendanceM","Sheet1AttendanceN","Sheet1AttendanceO","Sheet1AttendanceP" );
    // count the non-null fields;
    event.value = CountFields(aNames);
    As for the 2nd question, I've tried to do something similar to the previous script, but of course it doesn't work, but I am quite sure that the idea is similar:
    I don't know also how to add the other condition: the student should get A / Pass or B / Pass in order to consider he has finished??? and also how to check these condition from page 2, 3 and 4 and collect the date
    function Datefinished(bFields) {
    d2.value = nFields[i].value;
    for(i = 0; i < aFields.length; i++) {
    try {
    if(this.getField(aFields[i]).value == this.getField("NumberLines").value) d2.value = nFields[i].value;
    } catch(e) {
    if(e['message'] == "this.getField(aFields[i]) has no properties") app.alert("unknown field name: " + aFields[i]);
    else app.alert(e.toString());
    } // end catch
    } // end for aFields
    return nFields;
    // create array of field names to check
    var aNames = new Array("Texte00","Texte54","Texte56","Texte58","Texte60","Texte62","Texte64","Texte66","Te xte68","Texte70","Texte72","Texte74","Texte76","Texte78","Texte80","Texte82");
    var bNames = new Array("d1","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14 ","d15","d16","d17");   // d1 is included because in some cases a student can finish in 1 day (short text);

  • File Sender adapter not reading the first line

    Hi,
    I have a scenario configured from file to jdbc adapter.
    However, I found a problem in my file sender adapter. My file adpater always not picking up the first line from my text even I have set the 'Document Offset' to 0.
    Any Ideas? Thanks.
    Regards,
    Pua

    Hi Latika Sethi,
    My complete input text file is as below, it contains only 2 testing records:-
    H1|DIZ1                          |A0016507    |10000020|09/2007
    H2|ABC0001
    D|P|0001|Gaji Pokok       |   1,000.09
    D|D|0002|Denda              |   1,000.00
    D|P|0003|Elaun               |   1,000.00
    H1|PUA1                        |A0016508    |10000021|09/2007
    H2|ABC0002
    D|P|0001|Gaji Pokok       |   2,744.09
    D|D|0002|Denda              |   2,000.00
    D|P|0003|Elaun               |   2,000.00
    After the message mapping, I found the pipeline existed in sxmb_moni as below:-
    <?xml version="1.0" encoding="utf-8"?>
    <ns:mt_rmp03B_filejdbc_sender xmlns:ns="urn:rmp03:pdrm:ips:jdbcjdbc">
    <PaySlip>
    ..<Header2>
    .... <IC>ABC0001</IC>
    .. </Header2>
    .. <Details>
    .... <Jenis>P</Jenis>
    .... <No>0001</No>
    .... <Deskripsi>Gaji Pokok</Deskripsi>
    .... <Jumlah>1,000.09</Jumlah>
    .. </Details>
    </PaySlip>
    <PaySlip>
    .. <Header1>
    .... <Nama>PUA1</Nama>
    .... <KWSP>A0016508</KWSP>
    .... <NoGaji>10000021</NoGaji>
    .... <Bulan>09/2007</Bulan>
    .. </Header1>
    .. <Header2>
    .... <IC>ABC0002</IC>
    .. </Header2>
    .. <Details>
    .... <Jenis>P</Jenis>
    .... <No>0001</No>
    .... <Deskripsi>Gaji Pokok</Deskripsi>
    .... <Jumlah>2,744.09</Jumlah>
    .. </Details>
    </Payslip>
    There are 2 payslips as for the top payslip node...Header1 tag is missing. It means that during the file sender step....the first line of my record which is :-
    "H1|DIZ1                          |A0016507    |10000020|09/2007"
    is not read into the xi pipeline. Basically this is the problem i faced.
    Has somebody facing the same problem before? Currently I have no choice but moved the First line of the text into Second line and left the first line of the text become null/ empty line. As such both records can be successfully read by the XI.
    However what I wondered is sometimes clients will do insert the records into the first line and this might made some data loss.
    Thanks...

  • How to transfer the contents of a line of a table control to second screen?

    Hi,
    I have a table control and I have entered some contents in one line of a table control .
    When i click on this line and then click on the detail button on the screen , it should take me to another screen and whatever I have entered in the table control should be transferred to the second screen .
    Please could anyone help me out with this .
    Regards,
    Sushanth H.S.

    Hi
    U need to get the index of the line of table control by command GET CURSOR:
    PROCESS PAI.
    LOOP AT ITAB.
       MODULE GET_CURSOR.
       MODULE MODIFY_ITAB.
    ENDLOOP.
    MODULE USER_COMMAND.
    Module to pick up the selected line:
    MODULE GET_CURSOR.
      GET CURSOR LINE VN_LINE.
    ENDMODULE.
    Module to transfer the data from table control to internal table:
    MODULE MODIFY_ITAB.
      ITAB-FIELD1 = <FIELD OF TABLE CONTROL>.
      MODIFY ITAB INDEX <TABLE CONTROL>-CURRENT_LINE.
    ENDMODULE.
    U should considere the variable line has the value of the index of the line of table control, so u need to calculate the number of the corresponding line of internal table:
    MODULE USER_COMMAND.
      CASE OK_CODE.
        WHEN 'DETAIL'.
    * Calculate the line of internal table:
           VN_LINE = <TABLE CONTROL>-TOP_LINE + VN_LINE - 1.
    * Read the data
           READ TABLE ITAB INDEX VN_LINE.
    * Transfer the data to the output structure of the new screen
           <STRUCTURE>-FIELD1 = ITAB-FIELD1.
    * Call the new screen
           SET SCREEN <NEW SCREEN>.
           LEAVE SCREEN.
    Max

Maybe you are looking for

  • IMac keeps crashing every few days or sometimes weeks OS.10.9.4

    My iMac see info below, crashes when left alone for a period of time sometimes overnight, sometimes after an hour or so. When it crashes the screen goes black but the mouse is still movable & visible.  Nothing else works. The only fix is the button i

  • How to manage resource

    I've figured out how to add a resource in the calendering system. I have assigned an user to manage the resource. He gets an email in Outlook about the resource. But for the life of me we can't figure out how he is suppose to approve the use of the r

  • Advice on Exporting Flash To Video

    Greetings everyone. I'm in a bit of a pickle. I promised a client that I would be able to export the flash piece I did for them into a Quicktime Movie. I am using Flash 8, and using many Flash 8 only features (i.e. blending modes, blur filters). Now,

  • Dock Problem with External Display

    I have a macbook hooked up to an external monitor. I made the external display the primary display so it has the menubar and main desktop, but for some reason the dock wont move from the macbook's display, which is the secondary one. I tried restarti

  • Putting a AMD R9 270 in a Dell XPS 7100 from 2010

    Currently have a Dell XPS 7100 (2010) with a HD 5870. I would like to remove the HD 5870 and add a AMD R9 270. I believe I am OK as far as space, power, bottlenecking, and PCI slot. However, I read a thread in a forum that the Dell XPS 7100 motherboa