How to find the current line in the table control in module pool ?

How to find the current line in the table control in module pool ?
This is an urgent requirement? please do help me.

refer to this example
REPORT demo_dynpro_tabcont_loop_at.
CONTROLS flights TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF flights-cols,
lines TYPE i.
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 CORRESPONDING FIELDS OF 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'.
DESCRIBE TABLE itab LINES lines.
flights-lines = lines.
ENDMODULE.
MODULE cancel INPUT.
  LEAVE PROGRAM.
ENDMODULE.
MODULE read_table_control INPUT.
  MODIFY itab FROM demo_conn INDEX<b> flights-current_line.</b>
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.
ENDCASE.
ENDMODULE.

Similar Messages

  • How to delete a column from the table control in module pool?

    Hi,
      can any one please tell How to delete a column from the table control in module pool?
    thanks in advance
    warm regards
    HareeshKumar N

    hi hareesh,
    I think it is better to hide it.
    How to hide: You can check this link
    Dynamic Hide column in table control

  • How to find number of lines in the text content?

    Hello All,
    I have a multi line text item. I want to know the number of lines in a text item? How can I do that?
    Note that every lines end with the shift+enter.
    Example,
    This is a
    sample.
    After line This is a there is (Shift + Enter).
    Thanks for any help.

    Whenever the user inputs Shift-Enter, Photoshop inserts an [EOT] (End Of Text) control character (\x03 or \u0003) in the string.
    Also, in order to split the text according to multiple separators in only one call, it is necessary to use a regular expression instead of a string.
    Try replacing:
    var theArray = theText.split("\r");
    with:
    var theArray = theText.split(/[\u0003\r]/);
    BTW, you can improve performance by explicitely requesting the textKey property of the current layer object.
    Try using:
       ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("textKey") );
       ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    instead of:
       ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    HTH...

  • 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

  • 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

  • How to control the cursor position in the Table control in Module pool

    Hi,
    Can any body tell me how to change the cursor positon from last field of the first record to the
    first field of the second record , when user presses enter in the last field in the module pool
    programming.
    Thanks

    Hi,
    Please avoid posting duplicate posts.
    Re: how to get the cursor position from screen in module pool program
    Nag

  • How to find  dynamic value(screen value) in table control for current row .

    hi to all,
    i used table control in my screen. for column no 2 field i was used serrch help. and for column number 3 i used a dynamic help.
    in change mode you can change any row for table control.
    when i was using search help for a row which was already entered in column no 3 i cannot get any value.
    how i can get value of row no 3 and column no 2 value.
    thanks

    Try using like index for the serarch the TC-current_line

  • How to use table control in module pool programming

    Hi
    I want to use a table control to fetch some data from mara table.
    Please guide me with the procedure and the steps which I can follow to complete my program correctly.
    thanks
    Lalit Gupta

    As [vinraaj|http://forums.sdn.sap.com/profile.jspa?userID=3968041] wrote, call transaction SE51, there is a Wizard to help you generate the table control, it will create the table control and some includes with PBO/PAI modules > Read [Using the Table Control Wizard|http://help.sap.com/saphelp_bw/helpdata/en/6d/150d67da1011d3963800a0c94260a5/frameset.htm]
    Also there is a tutorial in the wiki, read [Learn Making First Table Control |http://wiki.sdn.sap.com/wiki/display/ABAP/LearnMakingFirstTableControl] by [Krishna Chauhan|http://wiki.sdn.sap.com/wiki/display/~nc0euof]
    Regards,
    Raymond

  • How can we select multiple rows in table control for module pool program?

    hi guru's
                 i cannt able to select multiple table control rows for deletion of records please give any code to select rows?
    regrards,
    satheesh.

    On the Table Control attributes there is a "Selectability" option where you choose one of: None, Single, or Multiple.  In your code you then need to pick up which rows have the selection column set to 'X'.

  • How to find dynamically the current line number in the source file

    Is there a mechanism like __LINE__ and __FILE__ macro in C to get dynamically
    the current line number and file name of a source file?

    Don't know - but others have asked too. Have you searched the forum? For example:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=210496

  • SapScript, How do I read the current line number?

    I have sections of text - each in it's own element with an 'include' of the standard text.
    These sections are variable in size.
    All elements are in the MAIN window.
    I do not want a paragraph to split over two pages.
    How do I read the current line number within the sapscript before the section prints so I can issue a new-page command at the beginning of the paragraph?
    Thanks!

    Yes, that does work for paragraphs.
    If I have multiple elements to print from within a loop where "at first, at each and at last" each call the Sapscript funtcion write_form - how can I keep the whole section together.  protect/endprotect will keep each element together but not the group of elements.
    There must be a way to find the current line number.

  • Get the current line no.(similar to sy-linno in report) in  Sapscript form

    Hi everyone,
    In ABAP reporting, you can use sy-linno to determine the current line no.
    But if in sapscript form,
    does any system field to get the currect line no. or y-origin. ?
    Just say the program is now runing and have written several lines in a window of the form.
    AS         This is the first line
    AS         This is the second line
    AS         This is the third line
    how to get the current line = 3 or  yorigin '+3'  LN?
    Thanks for reply in advance.

    Hi,
    you can also chk the sy-linno directly in your script.
    Regards
    Subramanian

  • Can the current line be highlighted using a background color or have the cursor flash?

    I use the split screen and left click in the Design pane to jump to where I want to be in the Code pane in Dreamweaver CS6. The problem is that it can be very hard to tell where the cursor is in the Code pane since the cursor doesn't flash.
    Is there a way to force Dreamweaver CS6 to change the background color of the currently selected line or at least have the cursor flash in both panes? There must be some way to make it easier to find the current line of code.
    Thanks.

    John Waller wrote:
    The cursor does not flash in Code View only when Code View is not in focus i.e. you're working in the Design View window in Split View.
    In those caases, I just highlight a word or two in Design View and the corresponding words are highlighted by DW in Code View (even when Code view is not in focus).
    Thanks. I've been doing that, but sometimes there is no text to highlight. I hoped Dreamweaver might have a hidden setting that I could enable. That's a lot of extra sliding of the hand/wrist for no good reason when it would be easy for the Dreamweaver programmers to change the background color of the current line or make the cursor flash or do something else to indicate where you are in the code besides making the user constantly make a smearing action with the mouse. All of those extra movements add up the wear and tear when you're trying to avoid getting a repetitive stress injury, especially if you already use mouse gestures in a browser.

  • Get the index of the current line in use

    Dear All,
    Well how can i get the index of the current line in use?
    this the code I am using :
    Dim i As Integer
    Set oBatchForm = SBO_Application.Forms.GetForm(Form_Id, 1)
    Set oMainMatrix = oBatchForm.Items.Item(Matrix_Id).Specific
    For i = 1 To oMainMatrix.VisualRowCount
        If oMainMatrix.IsRowSelected(i) = True Then
           GB_SelRow = i
            Exit For
        End If
    Next
    Exit Sub
    This code is not working when there is a line in the document type texte.
    please advice.

    Hi Mary,
    this is code in C#.NET which is working fine, try to do same in your code:
    for(int irow=1; irow<=oMatrix.RowCount; irow++)
         if(oMatrix.IsRowSelected(irow))
         SelectRow = irow;
                    break;
    Hope it helps.

  • How to load the boot menu using the command line , after the configuration change ?

    how to load the boot menu using the command line , after the configuration change ?

    Hi @Bask-48 
    Welcome to the HP Forums!
    It is a terrific place to find answers.
    For you to have the best experience in the HP forum I would like to direct your attention to the HP Forums Guide Learn How to Post and More
    I grasp you are trying to change the boot order.  Here is a link to Configuring the Boot Order in the System BIOS
    that will assist you.
    Good Luck and Happy Holidays!
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

Maybe you are looking for

  • Macbook Pro i7 2.2 2011 constant crashing

    Would really appreciated nay help I can get on this please. I installed an Apple SSD a few months ago and it has been working great. However my system seems to be crashing more and more to the point all my apps crashing every few mintues (exspecially

  • Where can I find "iMovie splash" video?

    Following a catastrophic kernel panic and subsequent erase and install, I seem to have lost that little QuickTime video called "iMovie splash". Does anyone know where I can download it again? It lasts about 7 seconds and consists of a group of childr

  • Search bar opens in new tab but without focus

    I have Firefox operating on 2 computers. On one when I use the search bar the results are in a new tab and that tab gets the active focus. On the other the search bar results are in a new tab, but that tab does not get the active focus. Both computer

  • I have downloaded the trial version but can not open. It is not recognized

    I have downloaded the trial version of final cut pro x. I can not get it to open. I get a message that it is not recognized. i have tried dowloading several times. Any help will be appreciated.

  • How to find the screen exit of migo screen

    Hi anybody,   Please tell me how to find the screen exit in MIGO Sceen. Thks Kali.