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

Similar Messages

  • Count lines of code in WDA component

    Is there a way to count the lines of own code (or otherwise measure the "size") in a WDA component on a 7.01 system? Please don't make me go through every single method one by one

    If you load the Web Dynpro Component in SE80 and then choose Web Dynpro Component->Check->Generation Limits, this will give you the load size in bytes of the WD Component. It also has some breakdown liek the number of variables declared.  However nothing that gives you the exact lines of code.
    The source code of all WD methods is stored in table WDY_CTLR_COMPO, so I supposed if if you really needed to you could write a small program to count the number of lines of code or the number of characters.

  • Transaction code which using method of a class as start object

    Hi all,
    I'm creating a new tcode 'Z123' which is tied to a method of a class in SE93. However, when I run this tcode and into debug mode, SY-TCODE will always return OS_APPLICATION. How can I get the actual tcode, which is 'Z123' into my program?
    Thanks in advance

    You can try using the method GET_CURRENT_TRANSACTION of class CL_DYNPRO. Check this SAP documentation for details:
    ... the method GET_CURRENT_TRANSACTION of the class CL_DYNPRO can be used to obtain the transaction code of the current transaction. This method returns the transaction code during a parameter transaction or variant transaction instead of the transaction code of the implicitly called dialog transaction.
    But if i try checking sy-tcode in a tcode bound to a method of a class i get the correct tcode & not OS_APPLICATION.
    Br,
    Suhas

  • Counting lines of code

    Does anyone know a way to count the lines code in a package
    excluding comments? The following are commenting styles:
    * comment1
    -- comment 2
    /* comment 3 */
    comment 4

    CREATE OR REPLACE PROCEDURE count_code(p VARCHAR2) Is
    CURSOR c1 IS SELECT * FROM user_source WHERE name=UPPER(P);
    l_count number :=0;
    l_tot_count number:=0;
    comment_flag boolean:=false;
    BEGIN
    for crec in c1 loop
    l_tot_count := l_tot_count+1;
    IF substr(trim(crec.text),1,2) not IN ('--','/*') and not
    comment_flag THEN
    l_count := l_count+1;
    ELSIF substr(trim(crec.text),1,2)='/*' THEN
    comment_flag := true;
    end if;
    IF comment_flag and instr(trim(crec.text),'*/')>0 THEN
    comment_flag:=false;
    end if;
    END LOOP;
    dbms_output.enable(100000);
    dbms_output.put_line('Object
    Name : '||p);
    dbms_output.put_line('Total number of lines
    Code : '||l_tot_count);
    dbms_output.put_line('Total number of lines Code with out
    comments : '||l_count);
    END;
    Suresh Vemulapalli

  • ABAP Methods _ 50 lines of code or less recommendation

    Hi,
    I'm looking for a document that I recall seeing that recommends that an ABAP method should have only around 50 lines of code. Can anyone recall this document and where to get it? Not sure if it was a blog or pdf paper by someone.
    Thanks,
    Ken Murray

    Hi,
    Please refer link and page number 8.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/4fbafc9e-0e01-0010-dea9-9d23d1b269fb
    Generally, limited lines are useful for effective modularisation and easier maintanance.
    Thanks,
    Chetan Shah

  • What line of code do I need to use to run flashplayer offline in a HTML presentation?

    I have a client who has had an HTML presentation built that uses Flashplayer when online, using the following lines of code:
    <!-- flash embed part -->  
                 <div id="flashPreview">
                     <a href="http://www.adobe.com/go/getflashplayer">
                        <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
                     </a>
                 </div>
    He now wants to use it off line. What line of code to I need to add to the header to run Flashplayer on the local machine instead?
    thank you

    HI Mike,
    thank you for your help. The file was built by someone else, so trying to get inside their head!!
    There is coding for the expressInstall.swf:
    // FLASH EMBED PART
                                  var flashvars = {},params = {},attributes = {};
                                  params.quality = "high";
                                  params.scale = "noscale";
                                  params.salign = "tl";
                                  params.wmode = "transparent";
                                  params.bgcolor = "#111111";
                                  params.devicefont = "false";
                                  params.allowfullscreen = "true";
                                  params.allowscriptaccess = "always";
                                  attributes.id = "flashPreview";
                                  swfobject.embedSWF("preview.swf", "flashPreview", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
    but nothing for the swfobject_modified.js, where would I put it???
    I really appreciate your help

  • No of classes, Methods, Lines of codes, DLL's used and Third Party Libraries details identifying tools

    We have started a project to migrate 100+ Web Applications developed using legacy Microsoft technologies to latest .Net 4.5 Framework.
    The following are the planned migration approach
    Classic Asp à                                                   
    Asp.Net 1.1 Framework à Asp.Net 4.5 Framework
    Asp.Net 2.0, 3.5, 4.0 Framework à         Asp.Net 4.5 Framework (Direct Migration)
    Asp.Net 2.0, 3.5, 4.0 Framework à         Asp.Net 4.5 Framework (Application Rewrite
    using MVC/Entity Framework)
    VB 6 (COM/DCOM) à                                  
    C# .Net 4.5 (Web Services)
    We have to analyze 100+ applications to categorize them as Simple/Medium/Complex conversions for planning the timeline for completing the migration activities.
    Analysis includes identifying the following details - No of classes, Methods, Lines of codes, DLL’s used and Third Party Libraries  details
    for 100+ Microsoft applications.
    Could you please let me know do we have any effective tool to identify above mentioned details?

    This forum is for Microsoft Project Server, an EPM tool. You will need to find a more suitable forum for your question.
    Good Luck with the conversion!
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Code presentation in java cert.

    Hello -
    I am taking the java certification exam by sun (310-035) in a couple of days. However, I am having a question with regards to the presentation of code in the exam.
    If the code sarts from line 1, and does not start with a class declaration then should I consider it as the beginning of the code (in which case the compilation fails)?
    Example:
    1. int a=0;
    2. public void foo(){
    3. System.out.println("Foo");
    4. }
    as opposed to
    1. public class A{
    2. int a=0;
    3. public void foo(){
    4. System.out.println("Foo");
    5. }
    6.}
    It will be extremely useful to me if some clarifies me.
    Regards.

    As Java is fully Object Oriented LangauageWell, that's not quite true.any examples?
    and based
    on fundamentals, Whatever that means. :-)
    you can not define any methods or
    variables outside class.True, unless you count defining methods in an
    interface.
    well, still not outside the interface structure.
    primitives for one.

  • Netbeans 6.0 - code completion of method parameters

    I just updated to NetBeans 6.0 and I find the code completion of method parameters very annoying and counter productive.
    It inserts the parameters as keywords when choosing a method from the list after pressing CTRL+SPACE.
    How can I switch this off?
    I searched the options and also the forum but didn't find a solution.

    I know that pressing space or whatever replaces the selected parameter. For a method with a single parameter is not a big problem but this is a poor workaround if a method has more parameters, like eg
    public static String formatDate(Date myDate, String myFormat)
    When typing
    Str.form<CTRL+SPACE,choose method, ENTER>
    it looks like
    Str.formatDate(myDate, errorMessage)
    Although myDate is selected and I can overwrite it, I have to proceed to the next parameter with CTRL+M instead of simply typing a comma. This is very annoying if a method has more parameters and as this annoyance occurs approx. every 5 lines that accumulates.

  • How to count number of items present in a data block

    hi all,
    how to count how many items present in a particular data block in oracle forms 10g.
    whether it is a text_item or display_item or list_item etc is there any method to do this.
    please reply....

    hi all,
    i have written this when-button pressed but the problem is how to get the next item name in the block
    DECLARE
         V_COUNT NUMBER:=0;
         V_FIRSTITEM VARCHAR2(100):='';
    BEGIN
         GO_BLOCK('BLOCK_ITEMCOUNT');
         V_FIRSTITEM := GET_BLOCK_PROPERTY('BLOCK_ITEMCOUNT', FIRST_ITEM);
         LOOP
              V_COUNT := V_COUNT + 1;
              EXIT WHEN GET_ITEM_PROPERTY(V_FIRSTITEM, NEXTITEM) IS NULL;
              --V_FIRSTITEM := GET_BLOCK_PROPERTY('BLOCK_ITEMCOUNT', NEXTITEM);
              --V_COUNT := V_COUNT + 1;
         END LOOP;
    END;

  • 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.

  • Total number of lines of code in a  project

    Hi All,
    We had developed a project in oracle adf using jdeveloper Version 11.1.1.4.0.Is there any way to find how many lines of code we had wriiten in the entire project.
    Regards,
    Smaran

    Hi,
    NOS stands from Number Of Statements and is a bit different than nloc (line of codes) that is count the statements rather than lines, thus independent from coding styles. As for V(G), it's the cyclomatic complexity, also known as McCabe.
    Regards,
    ~ Simon

  • Total number of lines of code in a class.

    Dear Experts,
    Given a class, I want to find out the total number of lines of code in all of its methods.  Following sub-parts are derived.
    1.  Find out all the methods of the class
    2.  Find out the number of lines for each of these methods and finally add the total number.
    Can you kindly let me know how I can do this?  Thanks a lot !
    Best Regards, Vikram

    Be aware that a 2D array is an array of arrays, which don't necessarily have to be the same length. e.g.int[][] a = new int[2][];
    a[0] = new int[10];
    a[1] = new int[20];
    /* a.length == 2
       a[0].length == 10
       a[1].length == 20*/

  • Is it too much lines of code inside a class file?

    Hi,
    I was wondering about how many lines can be considered too much in a java class file. I saw some class files with more the two thousand lines of code and even more than three thousand lines. When we have so many lines in the code I've realized that the file becomes slow for edition and it's not readable as it should be. So, as a best practice, or even due to technical issues, in average how many lines of code we'd write in order to keep the readability and avoid compile and build issues? How many lines a class should have without putting our code and performance at risk ?
    thanks a lot

    My general rule of thumb--in a class everything shold be very consistent, that is to say: you should be focusing on 1 idea in your class. IMO: If you have a class for users, you need to consistent in just what that class does. When the class becomes large, then look for related themes that run through methods of that class, and if here are many, you should make a "related class" that does satelite functions of the "core" offered in the main user class.
    Thousands of lines do not a good class make, I break in to related categories of classes long before then, and as a rule I keep under 500 lines in a class--usually under 300. In any case, no more lines of code need go into a class than that to implement the core features in the main idea for that class--and no less lines of code than is needed too, don't religate a method to another class just becasue you feel it would make the class it belongs too big.
    Along the idea of the user class:
    Storage for the user data
    Home information
    Work information
    physical information
    tastes and preferences
    family
    and etc
    all of these could be a class in and of themselves, but definetely are closely related to the user class.

  • 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.

Maybe you are looking for