Finding number of lines in a program/function module

Hi Expets,
I would like to know is there any way to find the number of code lines in a ABAP program/function module.
Additionally, can i extend this to a package such that the utility will find the number of codelines in all the programs/function modules/include programs in that package.
Any hints regarding the same would be appreciated.
Regards,
Ramanath

1. First using Read report  to load the source code to your internal table.
2. Using SCAN statement to do analysis about the source code. pls refer to the sap keyword help about "SCAN".
Syntax Diagram
SCAN
Note
This statement is for internal use only.
It cannot be used in application programs.
Variants:
1. SCAN ABAP-SOURCE itab1 ...TOKENS INTO itab2
                       ...STATEMENTS INTO itab3.
2. SCAN AND CHECK ABAP-SOURCE itab1 ...RESULT INTO itab2.
Variant 1
SCAN ABAP-SOURCE itab1 ...TOKENS INTO itab2
                       ...STATEMENTS INTO itab3.
Parts marked with " ..." are interchangeable
Extras:
1. ... FROM n1
2. ... TO   n2
3. ... KEYWORDS   FROM itab4
4. ... LEVELS     INTO itab5
5. ... STRUCTURES INTO itab6
6. ... OVERFLOW INTO c1
7. ... WITH ANALYSIS
8. ... WITH COMMENTS
9. ... WITH INCLUDES [IMPLEMENTATIONS FROM itab]
10. ... WITH TYPE-POOLS
11. ... WITH LIST TOKENIZATION
12. ... PRESERVING IDENTIFIER ESCAPING
13. ... WITHOUT TRMAC
14. ... [INCLUDE] PROGRAM FROM c2
15. ... INCLUDE INTO c3
16. ... MESSAGE INTO c4
17. ... WORD    INTO c5
18. ... LINE    INTO n3
19. ... OFFSET  INTO n4
20. ... WITH EXPLICIT ENHANCEMENTS [IMPLEMENTATIONS FROM itab]
21. ... FRAME PROGRAM FROM c2
22. ... ENHANCEMENTS INTO itab

Similar Messages

  • Exchange rate, plan exchange rate Programs & Function modules in SAP ....

    Hi Friends,
    Could anybody please tell me  what are the  " Exchange rate " & Plan exchange rate "  standard programs, function modules  avaialble in SAP  .
    Thanks in advance,
    Ramesh.

    Check via transaction OB07 (or SPRO - General Settings - Currencies - Check exchange rate types) usually you will find a "M" average exchange rate (which is used operationally everywhere in Logistics) and a "P" planned exchange rate (used for cost planning)
    Exchange rates are maintained via transaction OB08 (or SPRO, same tree - last node - Enter exchange rates)
    When programming, use tables TCUR* or FM of function groups like SCUR "Translation of Currency Amounts etc." (CONVERT_TO_FOREIGN_CURRENCY, CONVERT_TO_LOCAL_CURRENCY and READ_EXCHANGE_RATE among others)
    Regards,
    Raymond

  • Exchange rate, Plan exchange rate Programs & Function modules in SAPBW ....

    Hi Friends,
    Could anybody please tell me what are the  " Exchange rate, & Plan exchange rate " Programs & Function modules.
    If any customized also , I can do modify and i will use it.
    Thanks in advance,
    Ramesh

    Hi there
    Exchange rates are used for currency conversion rules in queries, data loads, etc.
    You can export exchange rates from R/3 (or other system) to SAP BI, and change them or define your own exchange rates.
    For planning, you can create exchange rates specifically for that purpose.
    In currecny conversion rules you can tell the system which exchange rate to use (for example EURX from EUR->USD)
    To view/mantain exchange rates go to transaction SPRO->SAP Reference IMG->SAP Netweaver->General Settings->Currencies->Enter Exchange Rates
    Diogo.

  • ABAP program/Function module to assign the roles in SU01

    Hi,
    Is there any ABAP program/function module to assign the roles in SU01. And program/function module which does all teh SU01 related activities.
    Thanks and Regards,
    Rashmi

    Hello,
    Check the function modules that start with BAPI_USER*
    To assign roles :
    BAPI_USER_ACTGROUPS_ASSIGN
    To assign profiles :
    BAPI_USER_PROFILES_ASSIGN
    To change user's metadata (name, settings, ... other SU01 functions) :
    BAPI_USER_CHANGE
    Success.
    Wim

  • How to find number of lines in an internal table

    Dear all,
    how to find number of records present in an internal table.

    DESCRIBE TABLE
    Syntax
    DESCRIBE TABLE itab [KIND knd] [LINES lin] [OCCURS n].
    Extras:
    1. ... KIND knd
    2. ... LINES lin
    3. ... OCCURS n
    Effect
    This statement determines some properties of the internal table itab and assigns them to the specified variables. The various additions enable you to determine the table type, the number of currently filled rows and the initial memory requirement.
    In addition, the system fields sy-tfill and sy-tleng are filled with the current number of table rows and the length of a table row in bytes.
    Notes
    For detailed information about an internal table, you should use the methods of RTTS of the DESCRIBE TABLE statement.
    Without the specification of an addition, the statement DESCRIBE TABLE only sets the system fields sy-tfill and sy-tleng.
    Addition 1
    ... KIND knd
    Effect
    The table type of the internal table itab is determined and a corresponding one-digit identification is assigned to the data object knd. A character-type data type is expected for the data object. The identifications are "T" for standard tables, "S" for sorted tables and "H" for hashed tables. These values are also defined as constants sydes_kind-standard, sydes_kind-sorted, and sydes_kind-hashed in the type group SYDES.
    Addition 2
    ... LINES lin
    Effect
    The current number of table rows of the internal table itab is determined and is assigned to the data object lin.The data type i is expected for the data object.
    Note
    As of release 6.10, the current number of rows of an internal table can also be determined using the in-built function lines.
    Addition 3
    ... OCCURS n
    Effect
    The initial memory requirement defined during the creation of the internal table with the addition INITIAL SIZE or the obsolete addition OCCURS is determined and assigned to the data object n. The data type i is expected for the data object.
    Example
    Descending sorting of a generically typed internal table in a subprogram. Since sorted tables cannot be sorted in a descending order, the table type is checked to avoid an exception that cannot be handled.
    TYPE-POOLS sydes.
    FORM sort_descending CHANGING itab TYPE ANY TABLE.
      DATA tabkind(1) TYPE c.
      DESCRIBE TABLE itab KIND tabkind.
      IF tabkind = sydes_kind-standard OR
         tabkind = sydes_kind-hashed.
        SORT itab DESCENDING.
      ELSEIF tabkind = sydes_kind-sorted.
        MESSAGE '...' TYPE 'E'.
      ELSE.
        MESSAGE '...' TYPE 'E'.
      ENDIF.
    ENDFORM.
    DESCRIBE FIELD INTO
    Note
    This statement is for internal use only.
    It cannot be used in application programs.
    Syntax
    DESCRIBE FIELD dobj INTO td.
    Effect
    All characteristics of the field f, its components , sub-components etc. are displayed in the field td (type description). td has to be of the type SYDES_DESC, defined in Type Group SYDES. Because of this, the type group SYDES must be integrated into the ABAP-program with a TYPE-POOLS statement .
    The structure SYDES_DESC has two table-type components TYPES and NAMES:
    In TYPES, the tree structure of the type belonging to f is displayed. The components of a node are stored in the table TYPES in a continuous manner. Beginning and end of the line area that represents the components are stored in TYPES-FROM and TYPES-TO. The reference to the superior node can be found in TYPES-BACK. If no superior resp. subordinate node exists, then this is marked by the value 0 (For the relevance of further components, refer to the following sections).
    The names of components, types etc. are not stored directly in TYPES. Instead, the components TYPES-IDX_... hold an index in the name table NAMES. The value 0 indicates that there is no reference to the name table.
    NAMES contains the possibly fragmented names in the component NAMES-NAME. If a name continues in the following line, this is indicated by an asterisk ('*') in the component NAMES-CONTINUE.
    The type description table (TYPES) not only stores information about the tree structure but also further information about the type of f resp. its components. This includes especially all information that can be determined using the usual additions to DESCRIBE FIELD. In detail, TYPES contains the following columns:
    IDX_NAME
    Component Name
    IDX_USER_TYPE
    Name of a user-defined type, i.e., a type that was defined through its TYPES-statement. Derived types (... TYPE A-B) and structures from the ABAP-Dictionary are not considered to be user-defined types.
    CONTEXT
    For user-defined types only: The context, in which the type is defined. Possible values are defined in the constant SYDES_CONTEXT of the type group SYDES. Please only use these constants to carry out a comparison. In detail, we distinguish between the following type contexts:
    SYDES_CONTEXT-PROGRAM: Program-global type
    SYDES_CONTEXT-FORM   : FORM-local type
    SYDES_CONTEXT-FUNCTION: FUNCTION-local type
    SYDES_CONTEXT-METHOD : METHOD-local type
    IDX_CONTEXT_NAME
    For user-defined types only:
    With a local context: The name of the FORM or FUNCTION, whose type was defined. The name of the associated program is then the first entry in the name table.
    With a global context: The name of the program in which the type was defined.
    IDX_EDIT_MASK
    Conversion routine from the ABAP-Dictionary, is in accordance with the addition EDIT MASK at simple DESCRIBE.
    IDX_HELP_ID
    Help-Id when referencing to fields from the ABAP-Dictionary
    LENGTH
    Internal length, corresponds to the addition LENGTH at simple DESCRIBE
    OUTPUT_LENGTH
    Output length, corresponds to the addition OUTPUT-LENGTH at simple DESCRIBE
    DECIMALS
    Number of decimal digits, corresponds to the addition DECIMALS at simple DESCRIBE
    TYPE
    ABAP-Type, corresponds to the addition TYPE at simple DESCRIBE
    TABLE_KIND
    A table type is stored here for the components which represent an internal table. The same values are returned as with the variant DESCRIBE TABLE itab KIND k. Components which do not represent a table get the return value set to SYDES_KIND-UNDEFINED (see type group SYDES).
    Example
    Example definition of the complex data type EMPLOYEE_STRUC:
    PROGRAM DESCTEST.
    TYPES: BEGIN OF name_struc,
             first  TYPE c LENGTH 20,
             last   TYPE c LENGTH 20,
           END OF name_struc,
           BEGIN OF absence_time_struc,
             day        TYPE d,
             from       TYPE t,
             to         TYPE t,
           END OF absence_time_struc,
           phone_number TYPE n LENGTH 20,
           BEGIN OF employee_struc,
             id         LIKE sbook-customid,
             name       TYPE name_struc,
             BEGIN OF address,
               street  TYPE c LENGTH 30,
               zipcode TYPE n LENGTH 4,
               place   TYPE c LENGTH 30,
             END OF address,
             salary_per_month TYPE p LENGTH 10 DECIMALS 3,
             absent           TYPE STANDARD TABLE OF absence_time_struc
                                   WITH NON-UNIQUE DEFAULT KEY,
             phone            TYPE STANDARD TABLE OF phone_number
                                   WITH NON-UNIQUE DEFAULT KEY,
           END OF employee_struc.
    You can determine the structure of the type EMPLOYEE_STRUC by collecting the type group SYDES as follows:
    TYPE-POOLS: sydes.
    DATA: employee TYPE employee_struc,
          td       TYPE sydes_desc.
    DESCRIBE FIELD employee INTO td.
    The following table shows a few selected columns of the type description table TD-TYPES. For a better overview, the names of the columns IDX_NAME, IDX_UERR_TYPE and IDX_EDIT_MASK have been shortened:
        |FROM| TO |BACK|NAME|UTYP|EMSK|TYPE
    |--||||||--
      1 |  2 |  7 |  0 |  0 |  2 |  0 |  v
      2 |  0 |  0 |  1 |  6 |  0 |  4 |  N
      3 |  8 |  9 |  1 |  7 |  5 |  0 |  u
      4 | 10 | 12 |  1 |  8 |  0 |  0 |  u
      5 |  0 |  0 |  1 |  9 |  0 |  0 |  P
      6 | 13 | 13 |  1 | 11 |  0 |  0 |  h
      7 | 17 | 17 |  1 | 12 |  0 |  0 |  h
      8 |  0 |  0 |  3 | 13 |  0 |  0 |  C
      9 |  0 |  0 |  3 | 14 |  0 |  0 |  C
    10 |  0 |  0 |  4 | 15 |  0 |  0 |  C
    11 |  0 |  0 |  4 | 16 |  0 |  0 |  N
    12 |  0 |  0 |  4 | 17 |  0 |  0 |  C
    13 | 14 | 16 |  6 |  0 | 18 |  0 |  u
    14 |  0 |  0 | 13 | 20 |  0 |  0 |  D
    15 |  0 |  0 | 13 | 21 |  0 |  0 |  T
    16 |  0 |  0 | 13 | 22 |  0 |  0 |  T
    17 |  0 |  0 |  7 |  0 |  0 |  0 |  N
    Please note that the entries in rows 6 and 7 represent internal tables (ABAP-Type h). There is always an entry for the corresponding row type (rows 13 and 17) to an internal table.
    The indices in the rows 5 to 7 refer to entries in the name table TD-NAMES. If you look, e.g., at row 3, you find the corresponding component name in TD-NAMES from row 7 (NAME) onward and the corresponding user type from row 5 (NAME_STRUC) onward.
    In the name table TD-NAMES you find the following entries. Note that the names SALARY_PER_MONTH and ABSENCE_TIME_STRUC are stored in two parts:
        |CONTINUE|NAME                   |CONTINUE|NAME
    |--|     -||--
      1 |        |DESCTEST            12 |        |PHONE
      2 |        |EMPLOYEE_STRUC      13 |        |FIRST
      3 |        |SBOOK-CUSTOMID      14 |        |LAST
      4 |        |==ALPHA             15 |        |STREET
      5 |        |NAME_STRUC          16 |        |ZIPCODE
      6 |        |ID                  17 |        |PLACE
      7 |        |NAME                18 |   *    |ABSENCE_TIME_ST
      8 |        |ADDRESS             19 |        |RUC
      9 |   *    |SALARY_PER_MONT     20 |        |DAY
    10 |        |H                   21 |        |FROM
    11 |        |ABSENT              22 |        |TO

  • How to find number of lines in an input file.

    Hi,
    Can someone tell me, if there is a way to find out the number of lines in an input file. I do not want to read line by line and then count the number of lines read.

    Then how do you think a program could determine the amount of lines in an input file? How does a human know how many lines are on a page? You're going to have to count the items that separate two lines to know how many lines are in your file.
    Either read line by line and count the amount or read char by char and count the number of '\n' occurences instead.
    If you have control over writing the input files, however, you can make this better. Write a header in the file that specifies the amount of lines in it. The first line of your file will then hold a number that represents the amount of lines in the file, so you need only read the first line to know how many lines are in your file.

  • Find number of lines a string will wrap to?

    I'd like to find the number of lines a string will wrap to, given a font and a width.
    Is this possible?
    Thanks

    You could get the height of resulting string using sizeWithFont:constrainedToSize, and then divide it by the height of one line (computed using the saem function with jsut one letter).

  • How can find number of line item?

    HI All.
    I have one internal table it has PO number ,line item and quantity.
    Each PO number have number of Line item ,
    now i want find how many line item per Po number .I need find for line item for all Po number.please help me
    Thanks.
    Jay

    see the below code and i tested and it is working well.
    data : begin of i_ekpo occurs 0,
           ebeln like ekpo-ebeln,
           ebelp like ekpo-ebelp,
           end of i_ekpo.
    data v_count type i.
    start-of-selection.
    select ebeln ebelp from ekpo into table i_ekpo.
    loop at i_ekpo.
    v_count = v_count + 1.
    at end of ebeln.
    write:/ i_ekpo-ebeln,v_count.
    clear : v_count.
    endat.
    endloop.
    Reward points if it is helpful
    Thanks
    Seshu

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

  • Please how can i read file, to find number of lines and to extract number of block data, and number of data in each block

    please if you can give me an example

    I attach a file wich i want read:
    1- to know a number of lines in file
    2- from the second line of the file to the line befor NCOUNT, put the lines in array like this, Variable and values like this Ex: TIMET 1 0 1 ..... first line
    and put the values of NCOUNT in array
    I attach a file
    Attachments:
    karim1.txt ‏2 KB
    Read_Filenew.vi ‏29 KB

  • Need to know how to find the last execution time for a function module

    HI all
    I need to know
    1) How to find out the last execution time of the function module ?
      say for eg. I have executed a func. module at 1:39pm. How to retrieve this time  (1:39pm)
    2) I have created 3 billing document in tcode VF01 i.e 3 billing doucment no. would be created in SAP TABLE "VBRP" b/w 12am to 12:30 am.
    How to capture the latest SAP database update b/w time intervals?
    3) Suppose I am downloading TXT file using "GUI_DOWNLOAD" and say in 20th record some error has happened. I can capture the error using the exception.
    Is it possible to run the program once again from 21st records ? All this will be running in background...
    Kindly clarify....
    Points will be rewarded
    Thanks in advance

    1.Use tcode STAT input as Tcode of Fm and execute .
    2. See the billing documents are created in table VBRk header and there will always be Creation date and time.
    VBRk-Erdat "date ., u can check the time field also
    So now if u talk the date and time we can filter then display the records in intervals.
    3. with an error exeption how is my txt download finished .
    once exception is raised there will not be a download .
    regards,
    vijay

  • Passing Message number as an parameter in a Function module

    Hi all,
    I have  to pass the Message number(sy-msgno) as an parameter into an function module
    and that Message should be like "PO NUMBER  #######  is deleted"
    This Funtion module is an loop and PO number changes for every loop
    How to define this Message in the Message class.
    Regards
    Ajay

    Hi,
    Message definition SE91 should be like below.
    PO NUMBER & is deleted.
    Here & is the place holder where u can pass one value dynamically. If u want to pass 2 dynamic values then u have to use 2 place holder and so on.
    eg: PO NUMBER & is deleted by user &.
    When u call this message it will display like
    PO NUMBER 12345 is deleted by user user1.
    Thanks,
    vinod.

  • Difference between a programe&function module in R/3 & BW

    Hi Gurus
                    i would like to know differenece between programe and function module in R/3
    and BW, so can some one give me  a brief idea about it cheers thanks .....

    Hi,
    Function modules are ABAP routines that are administered in a central function library. They apply across applications and are available throughout the system. You must assign function modules to a function pool that is called a function group. A function group is nothing but a container for the function modules. Now create a function group and then a function module.
    it is  a kind of standrad program where u can use it in differnt local programes .
    take an example  standrad function module "REUSE_ALV_CHECKBOX_SET"  suppose u want to create a checkbox in output screen u dont need to write a program for that u can use above mentioned function module in ur programe.
    hope this information helps u
    Regards,
    Gurudatt Bellary

  • I couldn find it in forum.Plz help on function module

    which is the function module to update data to tables of different system dynamically.
    Moderator message : Vague question, show the work you have already done.  Thread locked.
    Edited by: Vinod Kumar on Feb 1, 2012 2:58 PM

    Hello,
    This is a generic question please explain the requirement.
    You'll have to code your Function Module call this FM in your report Prg, and schedule the Prg.
    Regards,
    Abhishek

  • How to find the Access Key of Standard SAP Function Module

    Hi Experts,
    I have to change one sap standard function module.
    so how can i know the access key for that function module.......
    Regards,
    DS

    Contact the Basis Consultant in your project.
    The access key for standard SAP objects can be obtained from service.sap.com under Keys and Requests.
    Note 86161 - Registering developers and objects

Maybe you are looking for

  • Out of the Box   Aperture 2    Problem with viewer

    I loaded Aperture 2 and was getting familiar with the settings. I was following along with the small book that came with the software. I was only as far as Chapter 2 moving between the browser and viewer and checking out the metadata. The viewer went

  • When charging iPhone, cannot get calls

    Hi there, I realized as I am charging my iPhone after installing Snow Leopard, my phone won't take calls and is unavailable, thus flies straight to my voice messages. Also I tested SMS to my own phone using my wife's phone, still no messages until I

  • How to maintain LCM job integrity while promoting?

    Hi Question/Issue: We are trying to find out how to maintain job integrity while promoting using LCM? This is from a process security perspective that "only tested and approved items should move from QA to PROD" Use Case/Scenario: We are using BO in

  • XI and PI connecting to the same ECC system

    I had read this thread XI and PI Currently, our ECC is connecting to XI.  In Integration Engine config of ECC, role of business system is "Application System".  In XI, role is "Integration Server".  If we need to add a PI and connect to ECC, what sho

  • Creating a TOC or Index for a pdf?

    Is it possible to create a word index or table of contens for a pdf that doesn't have one from Acrobat Pro?