Count lines in sapscript

i have this
matnr meng
23333  3
34445  4
44444  4
total   3 lines. how i can count the lines?

Hi yehiel,
1. since it is sap standard as u said,
  then FROM WHERE
  do u want to count the number of lines ?
regards,
amit m.

Similar Messages

  • Count lines of code present in methods of a class

    Hi Friends,
    Can anyone suggest how to count lines of abap code in methods of a class?I have used the function module  'SEO_CLASS_GET_INCLUDE_SOURCE' but this function module doesnt counts the code for methods of a class.
    Kindly help.
    Regards
    ST

    Hi siji,
    once try the below info.
    data: itab type table of string.
    data: w_lines type i.
    read report <reportname> into itab.
    describe table itab lines w_lines.
    write: / 'Report lines:', w_lines.
    It is however important to find the exact report name.
    For standard ABAP reports it is easy, it is the name of the report itself.
    For classes and function modules this is somewhat different.
    Correct report name for function modules can be found as follows :
    Use table TFDIR, field FUNCNAME is your function module.
    PNMAME contains the main program name of the function group, not of the function module.
    Function module report can be created as follows PNAME+3 concatenated with 'U' and field INCLUDE.
    Example for the function module RFC_PING this will be
    'LSRFC' + 'U' + 07 = report name LSRFCU07
    Also take a look at the function module FUNCTION_INCLUDE_CONCATENATE
    Hint: lines( ) is a built-in (system class) static function returning the number of lines in a given internal table. You will like it much better than old-fashioned DESCRIBE TABLE statement where you make us of a count variable an need one more statement for the summing up.
    Note:  If you dont want to count blank line and comments, try this code
         delete itab where table_line is initial or table_line(1) = '*'.
           add lines( itab ) to total_linecount.
    Regards,
    Ravi

  • Drawing a vertical line in sapscript

    Hi all,
    How can I draw vertical lines in sapscript? Box can be used, but is there any other way? like vline or something else?
    Regards,
    Netrey.

    Hi
    Try with the field &VLINE&
    if don't work,You have to draw boxes only as per the size of the windows.
    /: BOX FRAME 10 TW
    There is no other way like how we write in Report output.
    Reward points if useful
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • Count lines in table

    hallow
    i have internal table and i wont to count lines with key
    example
    data
    001
    001
    002
    003
    001
    i wont in some fiels to now how much number of 001 i have here 3
    regards

    Hi Shnya,
    first sort the internal table based on the field that u want to have count...
    Example: lets suppose that the field name itself is data and the internal table name is l_itab and it has the values that u have given in your post...
    Sample code:
    sort l_itab by data.
    loop at l_itab into wa_itab.
      lv_counter = lv_counter + 1.
      at end of data.
      Each time it triggers, lv_counter will be having the *   value for a particular value in data field.. for the *   first time it will be having counter for 001, second *   time 002 and so on...
      write code according to your requirement.. and then *   clear lv_counter...  
      endat.
    endloop.
    Hope this helps u...
    Regards,
    Phani.

  • Counting lines problem. Please help!!

    Hi all,
    I just have a small problem i cannot resolve, here it is: I read through a file and i like to count the lines of the file there is before a special word.
    E.g
    My file contains:
    "hi
    how are you
    my name is john
    and i live
    britain"
    I'd like to count how much lines there are in the file before the word LIVE ==> result would be 4.
    I proceed with StreamTokenizer, but i don't knor how to specify the word. Here is my code:
         try {FileReader fr = new FileReader("test2.dat");
                   BufferedReader br = new BufferedReader(fr);
                   StreamTokenizer stk = new StreamTokenizer(br);
                   do {
                   n = stk.nextToken();
                   li = stk.lineno();
                   if (n == stk.TT_NUMBER) {
                        n = stk.nextToken();
                   if (n == stk.TT_EOL) {
                        li++;
                        n = stk.nextToken();
                   if (n == stk.TT_WORD) {
                        String str = stk.sval;
                        if ("entier".equals(str)) {
                             System.out.println(li);
                        else {
                             n = stk.nextToken();
                   while (??????????????);
    I want here to specify the word "entier" but how to do this??
    Thanks very much for your precious help....

A: Counting lines problem. Please help!!

Use LineNumberReader, which counts lines for you. Here's a complete program in 16 lines:
import java.io.*;
public class test4 {
  public static void main(String[] argv) {
    if (argv.length < 2) { System.err.println("no arg"); System.exit(0); }
    try {
      LineNumberReader in = new LineNumberReader(new FileReader(argv[1]));
      String line;
      while((line = in.readLine()) != null)
        if (line.indexOf(argv[0]) != -1)
          System.out.println("Found match at line " + in.getLineNumber());
    } catch (IOException e) {
      e.printStackTrace();
}If you want case insensitivity, you can make both lines lower-case before searching. Or you can use regular expressions.

Use LineNumberReader, which counts lines for you. Here's a complete program in 16 lines:
import java.io.*;
public class test4 {
  public static void main(String[] argv) {
    if (argv.length < 2) { System.err.println("no arg"); System.exit(0); }
    try {
      LineNumberReader in = new LineNumberReader(new FileReader(argv[1]));
      String line;
      while((line = in.readLine()) != null)
        if (line.indexOf(argv[0]) != -1)
          System.out.println("Found match at line " + in.getLineNumber());
    } catch (IOException e) {
      e.printStackTrace();
}If you want case insensitivity, you can make both lines lower-case before searching. Or you can use regular expressions.

  • Counting lines in SAP script

    Hi Gurus,
    Can someone help me count the number of lines in a sap script in a page.
    Thanks in advance!

    Hi rajbans..
    Try with this  code....
    /: DEFINE &COUNTER& = &Counter& + 1.
    /: DEFINE &SAPSCRIPT-COUNTER_9& = 0
    /: &SAPSCRIPT-COUNTER_9(+)&
    I hope this will work but am not sure.
    Thanks & Regards
    Gopal.B

  • My IF statement can't fit on 1 line in SAPSCRIPT

    Hello experts and friends,
    I am currently inserting a particular IF statement in a particular window in SAPSCRIPT editor(SE71) and it doesn't fit. Any suggestions? Thanks a lot guys!

    Hi,
    Put your cursor on the line that has the IF statement & use the menu option Edit--> Page Left/Right or 'Shift+F8'
    Regards,
    Suresh Datti

  • How to set vertical line in SAPScript

    Dear All,
    I have to set vertical line at a particular position of SAPScript. Here the lines are of varying length. Can you suggest how to do that?
    Line 1......................            | Vertical Line
    Line 2.........................         | Vertical Line
    Line 3...............                   | Vertical Line
    Thanks and regards,
    Atanu

    Hii
    use this
    BOX WIDTH 0 FRAME 10
    BOX HEIGHT 0 FRAME 10 
    BOX WIDTH 5 CM  HEIGHT 1 CM FRAME 10 TW INTENSITY 10
    BOX WIDTH 7 CM  HEIGHT 5 CM FRAME 10 TW INTENSITY 10
    HOPE THIS HELPS
    Thanks & Regards
    Naresh

  • Counting lines in a text/csv file.

    Can you advice me, how I can get the total number of lines in a text/csv file please using java code.
    I will get the text/csv file content in a string variable not as a file.
    EX: string var = "123\n234\n123\n3456\nsdfsd\n" here \n is in the new line.
    for this I have to get the total lines as 5.
    Please advice.
    Thanks.

    Kayaman wrote:
    user12679330 wrote:
    Oh ok.. ignore the last one, Any idea on this please.Count the newline characters like morgarl told you. You're being very difficult to help for such a simple problem.Thats because nobody has posted the code yet dude ;)
    I'm pretty sure that once the OP finally takes the hint and writes the two lines of code needed to solve this question, he'll come up with something that sometimes gives the correct answer and other times gives a count that is one-off.

  • Count lines in text file

    Folks:
    What's the best way to count the number of lines in a text file?
    thanks,
    Kevin

    You can also skip the open/create, you'll still get a file dialog. I guess EOL conversion is also not needed.
    So the most minumalistic code is as follows.
    Has anyone done any benchmarks? Somehow I have the feeling that temporarily creating that big array of strings might not be the most efficient compared to reading all as one string and counting linefeeds. Who knows...? How big are your files?
    Message Edited by altenbach on 09-29-2006 04:03 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    CountLines.png ‏1 KB

  • PERFECT/COMPLETE VERTICAL LINE IN SAPSCRIPT?

    Hello all,
    I have to draw vertical lines to make a grid in a SAPscript. But the grid size is not fixed, there a number of records and long texts that are displayed based on certain conditions.
    Is there a way to draw a perfect/complete veritcal in SAPscript dynamically?
    Looking forward to hear from you peoples...

    You can use the BOX command to draw vertical lines.
    /: BOX [xpos] [ypos] [width][height] [frame] [intensity].
    here the widt has to be 0 to get a line and the height can be a variable as required.
    Thanks,
    Renjith.

  • Counting Line items in FBL3N

    Hi Gurus,
    If we execute a report FBL3N and system shown 110 items. We use a filter to filter out 15 items so how can we see in a system that how many items are remaining. Is there any facility to count these items?
    Please revert asap.
    Thank You

    Hi
    There is no standard functionality to count the line item. U have to download the data into Excel and do the excercse manually there.
    Thanks
    GG

  • How can i count line wich begins with NCOUNT word

    I want to make a loop to count first a number of lines in file after that to count number of block data wich begins with NCOUNT word

    Look at the discussion on a similar thread here from a week ago and see if it helps.

  • Counting line breaks

    Hello,
    I have a text field which can display up to 4 lines in Arial, size 9.
    I want to change the font size when there are more than 4 lines in it. Is there a way to count carriage returns in a field?
    e.g.
    IF string.count(:RECIPES, "<cr><lf>") > 3 THEN
    srw.set_font_size(7)
    END IF
    Thank you
    Edit: I found out how to determine how often one string contains another one. This makes the font size smaller when there are at least 5 "%" in the text:
    IF (INSTR(:RECIPES, '%', 1, 5) > 0) THEN
    srw.set_font_size(7)
    END IF
    My Question now: What do I have to search to find line breaks?
    I am completely new to Oracle.
    Thank you,
    Thomas
    Message was edited by:
    Wieczo

    Great, thank you for the answer.
    It didn't work with chr(13), so I changed it to chr(10) and it works.

  • Counting Lines/Char/Words in a txt file

    I created this method that counts the mount of lines/words/ and char in a file. But for somereason, its not working correctly. Its giving me numbers that are a little off.
         // Method countLineWordChar counts the number of lines, words, and chars, in
         // a file given as a parameter. This method returns an array of intergers. In
         // the array, the first position is the amount of lines, the second posistion
         // is the amount of words, and the third is the amount of chars.
         public static int[] countLineWordChar(File f)
              int[] countInfo = new int[3];
              int lineCount = 0;
              int wordCount = 0;
              int charCount = 0;
              try
                   FileReader fr = new FileReader(f);
                   StreamTokenizer st = new StreamTokenizer(fr);
                   st.eolIsSignificant(true);
                   while(st.nextToken() != StreamTokenizer.TT_EOF)
                        switch(st.ttype)
                             case StreamTokenizer.TT_WORD:
                             wordCount++;
                             String wordRead = st.sval;
                             charCount += wordRead.length();
                             break;
                             case StreamTokenizer.TT_EOL:
                             lineCount++;
                             break;
                             default:
                             break;
              catch (FileNotFoundException fnfe)
                   UserInterface.showFileNotFoundError();
              catch (IOException ioe)
                   JOptionPane.showMessageDialog(null, ioe.toString(), "Error",
                   JOptionPane.ERROR_MESSAGE);
              countInfo[0] = lineCount;
              countInfo[1] = wordCount;
              countInfo[2] = charCount;
              return countInfo;
         // Based on the countLineWordChar method, returns the amount of lines.
         public static int getLineCount(int[] countInfo)
              return countInfo[0];
         // Based on the countLineWordChar method, returns the amount of words.
         public static int getWordCount(int[] countInfo)
              return countInfo[1];
         // Based on the countLineWordChar method, returns the amount of chars.
         public static int getCharCount(int[] countInfo)
              return countInfo[2];
         }

    Well, for one thing, you're adding the number of characters in words, not the number of characters overall. Are you sure it's not supposed to be the latter?
    Otherwise, how is it off?
    Basically the way you fix this kind of thing is to add debugging code, then give it a small data sample and watch the debugging messages.
    By the way, returning an array of different kinds of values like that isn't ideal. In this case it's not so bad, because the kinds of values are actually really similar -- they could be viewed as a tuple. But don't make a habit of it. An example of a bad application of this would be if you were returning an array that counted, say, the weight of a ship, the length of its hull, and the distance it travelled in the last year. The alternative is to create a class that encapsulates the data being returned, or to move functionality around so the data isn't being returned at all.

  • Maybe you are looking for

    • DVD- RW Problem

      i am having problem burning a dvd in my HP pavilion dv6 2001au laptop. it used to burn dvds before but now there is an error message saying "burning failed" it  strats to burn the dvd but when it reaches say 80- 90% nothing happens and ": burning fai

    • No internet access after Snow upgrade

      Was very upset yesterday after upgrading my 13" Macbook Pro to Snow Leopard only to find out I couldn't get online via ethernet or Airport. Went through all kinds of troubleshooting and just got off a 90 minute long convo with an Apple phone genius.

    • What happened to clicker/headphones in the 3rd generation Nano?

      In previous models I've set the clicker setting to headphones. This way I was able to operate the iPod without looking at the screen, even with sound isolating headphones. In the new Nano the only options are on and off, in both settings I am unable

    • "locked" users  open to non-admin and guest users

      I had this problem a while ago and did a work around that worked. When I am on guest or other non-admin users accounts and open hard drive and then users I can access files that should be locked. Mine is the only acct that has a Red slashed circle th

    • How to Install HP Photosmart Ink Adv K510 in Mac Book Air?

      Does anyone know how to add printer in mac book air? we have HP Photosmart Ink Adv K510 but i dont know how can I install it in  our macbook air. Our Printer is connected through WLANand even our mac book is connected in WLAN. Please Help.