Need script or Program to count lines of source code
Hello, I need a script or a program that can count how many lines are there in a directory contains source code as well as other directories(contain code as well), there are .java files in these directories, the script or program should count number of lines with/without comments(starts with // or surrounded by /**/)
Thanks a lot!!!
I wrote a quick python program to count the lines in a file, you could just adapt it to your needs, or use the second program I have in this post that condenses all the .java files in a directory into a single text file, which you can then use a line-count on (useful if you need to print it as well - I wrote it for my IB dossier java project), if you'd like a proper script for your needs, otherwise check the other suggestions.
Run it by copying the code into a text file and saying it as script.py (change script to whatever you want) and running it with python /path/to/script.py
#!/usr/bin/env python
#Program to tally the lines in a file
#Author: lswest
import os
home=os.path.expanduser("~")
endPath=raw_input("Path to file relative to your home directory (include file name and extension): ")
count=0
ff=open(os.path.join(home, endPath))
for x in ff:
count+=1
values={'name': os.path.join(home,endPath), 'count' : count}
print "The file %(name)s contains %(count)s lines." % values
#!/usr/bin/env python
#Script to condense the multiple files of a project into one for easy printing/copying
#Author: lswest
import os
home=os.path.expanduser("~")
endPath=raw_input("Path relative to your home directory to the project folder: ")
extension=raw_input("Extension of files you want to condense: ")
outPath=raw_input("Path to output file relative to home directory: ")
outFile=raw_input("Output file name (including extension): ")
ff=open(os.path.join(home+outPath,outFile), "wt")
for root, dirs, files in os.walk(os.path.join(home,endPath), "true", "none", "true"):
for infile in [f for f in files if f.endswith(extension)]:
fh=open(os.path.abspath(os.path.join(root,infile)))
for line in fh:
ff.write(line,)
fh.close()
ff.close()
Last edited by lswest (2009-03-10 16:23:52)
Similar Messages
-
Getting an Object Identifier String given a line of source code? HELP!
(forgot to close the code tag on that last one!)
Hi there,
I am in desparate need of getting the object identifier given a particular line of source code. I need this for the debugger I'm writing, and since the jdb forum never gets reponses; just more unanswered questions.
Right so, here's my problem in more detail. I can find out when a method is called in the Java virtual machine, and what its name is, and arguments and values and such like - using the Java Debugging Interface. BUT: unfortunately I cannot get the object identifier used in the source code that generated this call. I can however get a unique long id that identifies this object .. if that helps?(thinking hashtables here maybe?!)
So, I may know that the constructor of EddClass has been called, and this the following line generated this call:
EddClass edd = new EddClass();.. so what I need is a fail safe way of finding out "edd" from this - given all types of method calls.
This is quite tricky because there are loads of ways methods can be called e.g.
tty.getClassExclusions(); // Here I would know getClassExclusions had been called, and I would need to find out the object identifier "tty" called it
Temp a, b, c;
a = b = c = new Temp(); // Here I would know the constructor for Temp had been called, but now I would just want to know "c"
AnotherEg ae = (new Egg()).getAnotherEg(); // and in this last case if I had found out that the Egg constructor had been called, I don't want to find out any object identifier from this line of code - since the object is anonymous; however if I had found out that getAnotherEg() had been called I would want "ae"Ok, well - please help: I'm making a Java Animator that will be freely available - that serves to graphically animate the execution of another java program. It'd be cool if one of you guys could help make it really cool. Plus there are Dukes available!!
- Edd.this is quite a complicated question I think!
I'm not sure but you maybe need to know just about the whole java lang. spec to do this.
I'm sure there are plenty of free java parsers around, so unless you have a lot of time available its probably best to download one, figure some way to feed it a single line from within a code block, and extract its symbol table.
Once you have the symbol table, there will probably be some other data available from the parser to say which are identifiers.
Its then up to your debugger to figure out which one is the interesting one!
sorry this is so vague but I think you've asked for something that is quite involved!
asjf -
Extra blank lines in source code
I have built a website in Dreamweaver CS4 and have a client editing pages in Contribute CS5. Both of us are working on Windows 7, and the site is hosted on Linux. When she makes edits to the page, something is introducing a GAZILLION blank lines in the source code. A typical page for this site is about 380 lines of code. The problem page is now more than 310,000 lines code with 100-200 blank lines between every "real" line of code. What the...?!
I need to know how to stop this and how to remove the blank lines from the source code using Dreamweaver.
The page in question lives here: http://www.alexandercitychamber.com/member-category.html
HELP!!!
JeffHello, Diane -
We've got two separate issues here, but I think we have the solution to both.
1. How to stop Contribute from adding blank lines in the code, and
2. How to clean up a GAZILLION lines of blank code in a document.
First, Number 1. I assume you're working in Dreamweaver. If not, I'm not sure how to guide you. But, when you define a Contribute Site, there is an area to specify administrative roles and permissions. Under each Role, at the bottom, you will see a popup for what kind of server the site is hosted on. The default is Windows. I had to change this to Unix (Linux) to match the hosting of our problem site. Find out what platform your host is using. You will have to specify this under each admistrative Role. After doing this, I had the client make some edits, then I opened the files in Dreamweaver. No new blank lines. I admit, I still have my fingers crossed somewhat.
Okay, now how to clean up your source code and remove blank lines. A developer friend found this on some forum I had not seen. I don't know where, but I am grateful to the person who wrote it. It didn't get all the blank lines in my files, but I think some of the others, which I removed manually, were probably from the client pasting content in from Word. Here's what to do:
1. Open the file in Dreamweaver
2. Click CTRL + F, or go to EDIT > FIND AND REPLACE
3. Select "Current document" in "Find In" (You can also select the folder if you have multiple files.
4. Search in "Source Code"
5. Check the box labeled "Use regular expression"
6. Type "[\r\n]{2,}" (without quotes) in "Find"
7. Type "\n" (without quotes) in "Replace"
8. Press "Replace All"
The operation chugged for a few minutes with my 301,000-line document. Yours may a take a little longer, but it did work. Good luck!
Jeff
[email protected] -
How can i add a new count to this source code ?
[4shared.com - document sharing - download db.txt|http://www.4shared.com/file/210566155/c080d93a/db_online.html] Hi everyone
I have 5 variables
1. XTSM is between 0~200
2. XTS is between 0~2
3. XRX is 0~3
4. XHAN is 0~7
5. ZHTYPE is one of these : (1)TCHF_HLF (2)TCHSD (3)TCHFULL
they are related to their with this shape .
XTSM->XTS->XRX->XHAN->ZHTYPE (Just Logical)
Please tell me how can i see this output?
----Type------------------Total---------------------Total of ZHTYPE-----------------
XTSM:0/XTS:0 in this case is : 29 TCHF_HLF:28 TCHSD:1 TCHFULL:0
XTSM:0/XTS:1 No. of found
XTSM:0/XTS:2 No. of found
XTSM:1/XTS:0 No. of found
XTSM:1/XTS:1 No. of found
XTSM:1/XTS:2 No. of foundI get XTSM/XTS/TRX/XHAN and now i want count total of this
ZHTYPE is one of these : (1)TCHF_HLF (2)TCHSD (3)TCHFULL
they are related to their with this shape .
* Each XTSM has 3 XTS (0-2)
* Each XTS has 4 XRX (0-3)
* Each XRX has 8 XCHAN (0-7)
* and Each line has a type of ZHTYPE
This is sample file: 4shared.com - document sharing - download db.txt
This output with this code is true but I want add ZHTYPE at the end of each line + XTSM/XTS please help me ???(for example this : XTSM:0/XTS:0 : 29 TCHF_HLF:28 TCHSD:1 TCHFULL:0)
public class Test {
public static void main(String[] args) throws IOException {
Test test = new Test();
test.execute();
private static String TYPE_XTSM = "XTSM";
private static String TYPE_XTS = "XTS";
private static String TYPE_XRX = "XRX";
private static String TYPE_XHAN = "XHAN";
private void execute() throws IOException {
InputStream in = null;
BufferedReader br = null;
TreeMap<Integer, TreeMap<Integer, Integer>> xtsmMap = new TreeMap<Integer, TreeMap<Integer, Integer>>();
try {
in = Test.class.getResourceAsStream("db.txt");
br = new BufferedReader(new InputStreamReader(in));
String line;
while ((line = br.readLine()) != null) {
Record rec = new Record(line);
processRecord(xtsmMap, rec);
} finally {
if (br != null) {
br.close();
printResults(xtsmMap);
private void processRecord(
TreeMap<Integer, TreeMap<Integer, Integer>> xtsmMap, Record rec) {
TreeMap<Integer, Integer> xtsMap;
if (xtsmMap.containsKey(rec.getXtsm())) {
xtsMap = xtsmMap.get(rec.getXtsm());
} else {
xtsMap = new TreeMap<Integer, Integer>();
xtsmMap.put(Integer.valueOf(rec.getXtsm()), xtsMap);
if (xtsMap.containsKey(rec.getXts())) {
Integer count = xtsMap.get(rec.getXts());
xtsMap.put(Integer.valueOf(rec.getXts()), Integer.valueOf(count
.intValue() + 1));
} else {
xtsMap.put(Integer.valueOf(rec.getXts()), Integer.valueOf(1));
private void printResults(
TreeMap<Integer, TreeMap<Integer, Integer>> xtsmMap) {
System.out.println("Type\t\tTotal");
Set<Integer> xtsmSet = xtsmMap.navigableKeySet();
for (Integer xtsm : xtsmSet) {
TreeMap<Integer, Integer> xtsMap = xtsmMap.get(xtsm);
Set<Integer> xtsSet = xtsMap.navigableKeySet();
for (Integer xts : xtsSet) {
Integer count = xtsMap.get(xts);
String outputLine = TYPE_XTSM + ":" + xtsm + "/" + TYPE_XTS
+ ":" + xts + "\t" + count;
System.out.println(outputLine);
private static class Record {
private Integer xtsm, xts, xrk, xhan;
Record(String line) {
StringTokenizer st = new StringTokenizer(line, "/");
while (st.hasMoreTokens()) {
String token = st.nextToken();
String type = token.substring(0, token.indexOf(":"));
String valueStr = token.substring(token.indexOf(":") + 1, token
.length());
Integer value = Integer.valueOf(valueStr);
if (TYPE_XTSM.equals(type)) {
xtsm = value;
} else if (TYPE_XTS.equals(type)) {
xts = value;
} else if (TYPE_XRX.equals(type)) {
xrk = value;
} else if (TYPE_XHAN.equals(type)) {
xhan = value;
public Integer getXtsm() {
return xtsm;
public Integer getXts() {
return xts;
public Integer getXrk() {
return xrk;
public Integer getXhan() {
return xhan;
}I want add ZHTYPE to this ...
Code:
Type Total
XTSM:0/XTS:0 29 such as this : TCHF_HLF:28 TCHSD:1 TCHFULL:0
XTSM:0/XTS:1 29
XTSM:0/XTS:2 29
XTSM:1/XTS:0 29
XTSM:1/XTS:1 29
XTSM:1/XTS:2 29
XTSM:2/XTS:0 29
XTSM:2/XTS:1 29
XTSM:2/XTS:2 29
XTSM:3/XTS:0 14
XTSM:3/XTS:1 14
XTSM:3/XTS:2 14
XTSM:4/XTS:0 13Thanks a lot.http://www.4shared.com/file/210566155/c080d93a/db_online.html
-
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
STHi 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 -
How to count source code lines?
Hi guys!
I have a task to calculate total amount of lines of source code. The only way i have found out is to get report
with read report prog into itab statement and get number of lines with describe itab lines num_of_lines.
But in this way it is not possible to handle classes for example. Is it possible to count lines with SQL statement?Hi,
try this report [https://wiki.sdn.sap.com/wiki/display/Snippets/SearchforStringsinABAPSourceCode].
For counting the lines you specify a search string of
The includes for classes can be specified by
ZCL_XY*
Best regards
Thomas
Edited by: Thomas Schulz on May 4, 2010 1:33 PM -
Issue with the ABAP program to find BI lookups and code Patterns
Hello dears,
I'm trying to use the ABAP program LOOKUP_FINDER:
http://wiki.sdn.sap.com/wiki/display/BI/ABAPprogramtofindBIlookupsandcodePatterns
But I have the following issue:
Runtime Errors
RAISE_EXCEPTION
Short text
Exception condition "NO_FIELDCATALOG_AVAILABLE" raised.
Error analysis
A RAISE statement in the program "CL_GUI_ALV_GRID===============CP" raised the
exception
condition "NO_FIELDCATALOG_AVAILABLE".
Since the exception was not intercepted by a superior
program, processing was terminated.
Source Code Extract
Line SourceCde
1 method set_sort_criteria.
2
3 *... (1) Trace?
4 if not mr_trace is initial.
5 call method mr_trace->add_trace_item
6 exporting
7 i_trace_item = 'SET_SORT_CRITERIA'
8 ir_variant = m_cl_variant
9 it_data = mt_data
10 it_info = mt_info.
11 endif.
12
13 if m_cl_variant->mt_fieldcatalog is initial.
>>>>> raise no_fieldcatalog_available.
15 endif.
16
17 m_cl_variant->mt_sort = it_sort.
18
19 call function 'LVC_SORT_COMPLETE'
20 exporting
21 it_fieldcat = m_cl_variant->mt_fieldcatalog
22 changing
23 ct_sort = m_cl_variant->mt_sort.
24
25 endmethod.
This issue is located in the FM 'REUSE_ALV_GRID_DISPLAY' called at the end of the program.... maybe because the catalog is empty?
For your information, I called the program 'ZLOOKUP_FINDER'.
Can you help me to fix this issue?
Regards,
Vince.Hi Vince,
If a table is empty field catalog usually return no error it just display your field catalog with headers .
I think the issue is with building of field catalog .
May be some settings are missing there .
Please check FM REUSE_ALV_FIELDCATALOG_MERGE where field catalog is getting generated.
Regards,
Jaya Tiwari -
Need Help With Check Box count Script
Need to count the number of checked boxes. I'm using the script below and its not working. What I'm I doing wrong? It's driving me crazy.
// document level function to sum named fields
function Sum(aFieldNames) {
var sum = 0; // sum of values
// loop through fields
for (var i = 0; i < aFieldNames.length; i++) {
if(!isNaN(this.getField(aFieldNames[i]).value) )
sum += Number(this.getField(aFieldNames[i]).value);
return sum;
} // end of Sum function
// array of field names sum
var aCheckBox = new Array('Check Box5', 'Check Box8', 'Check Box11', 'Check Box16', 'Check Box19','Check Box22', 'Check Box25','Check Box28', 'Check Box31', 'Check Box34','Check Box37', 'Check Box40','Check Box43', 'Check Box46', 'Check Box49','Check Box52', 'Check Box55','Check Box58', 'Check Box61', 'Check Box64','Check Box68');
// sum named fields
event.value = Sum(aCheckBox);Then why are you checking if they're a number by using the isNaN function, and then trying to add that number to the sum variable? It looks like you just copied the code from somewhere else, even though it doesn't apply to your situation.
Replace those two lines of the code with this:
if (this.getField(aFieldNames[i]).value!="Off") sum++; -
ABAP SCRIPTS Examples Programs ,Screen shots ...i need?
Hi to ALL
hru?
Friends
i need ABAP SCRIPTS Examples Programs and screen shots those are most useful for me and pdf file.
plz help to me send immid.
Thanking U
MuraliYour imany nterview type questions have all been locked => please read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] before posting again.
Many thanks,
Julius -
Java Program+To count the number of lines in a method excluding comments???
Hi friends
can u plz help me out, the java program is counting the number of lines in a method excluding comments.
The first thing is how to identify a method, then there can be an inner method inside the parent method,
Please friends its urgent
Bye
SandyThere's no such thing as an inner method in Java. You can either write the code yourself to parse Java source, or maybe something like ANTLR can do it.
-
Need example report program using PNPCE LDB in SAP HR
Need example report program using PNPCE LDB in SAP HR.
and how to create a report category in sap hr for using it as cutomised selection screen.Hi,
Go through the following links, i hope it will help you.....
/people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
http://sap.ittoolbox.com/groups/technical-functional/sap-r3-dev/893908#
A sample prog with LDB PNP
*& Report ZH_REPT_PAYMENT *
report zh_rept_payment line-size 80 no standard page
heading.
tables: pernr, " Standard Selections for HR Master Data Reporting
pcl1, " HR Cluster 1
pcl2, " HR Cluster 2
pa0009,
PA9001,
PA9006,
pa0002,
pc260 , " Cluster Directory for Payroll Results
bnka .
Infotypes
infotypes: 0001. " Organizational Assignment
Declaration of Internal Tables
data : bnka1 like bnka occurs 0 with header line .
data: begin of t_int_rep occurs 100,
bankl like pc209-bankl, " Bank Number
zlsch like pc209-zlsch, " Payment method
pernr like pernr-pernr, " Employee Number
ename like pernr-ename, " Employee Name
bankn like pc209-bankn, " Bank Account Number
betrg like pc209-betrg, " Amount to be transfered
zweck like pa0009-zweck, " Purpose
end of t_int_rep.
data: begin of int_rep occurs 100,
bankl like pc209-bankl, " Bank Number
zlsch like pc209-zlsch, " Payment method
pernr like pernr-pernr, " Employee Number
ename like pernr-ename, " Employee Name
bankn like pc209-bankn, " Bank Account Number
betrg like pc209-betrg, " Amount to be transfered
zweck like pa0009-zweck, " Purpose
begda like pa0009-begda, "Begin date
end of int_rep.
Declaration of Data Variables
data: ws_betrg like pc209-betrg, " BT Amount
w_val like spell occurs 0 with header line,
int_rep1(6), " TYPE I, " Employee Number
cnt type i value 0, " Counter
calcmolga like t500l-molga value '40', " Country Grouping
v_id(15),
calc_currency like t001-waers value 'INR'. " Currency
data : ctr type i,
dt_merge like pa0009-begda.
data: ws_totemp(6) type c,
ws_totamt(20) type c,
r_mth(9) type c,
ws_fpbeg(6) type c,
ws_fpend(6) type c,
ws_mthyr(6) type c,
ws_mthyr_r(14) type c,
r_mth_t(3) type c,
ws_amt(8) type c,
ws_bankl(14) type c,
ws_date(6) type c,
amount_word(500),
total_page type i,
pages type i,
remain type i.
data begin of i_spell.
include structure spell .
data end of i_spell .
data : c_molga type t500l-molga value '40',
c_banks type bnka-banks value 'IN'.
Standard Includes
include rpc2cd09. "Cluster CD data definition
include pc2rxin0.
include rpc2rx09.
include rpppxd00. " Data Definition buffer PCL1/PCL2
include rpppxd10. " Common Part buffer PCL1/PCL2
include rpppxm00. " Buffer Handling RoutinePCL1/PCL2
include zrpc2rox2. " Data Definition POCLSTERS (not J,K,U)
Selection Screen
selection-screen begin of block b1 with frame title text-001.
parameter: pa_mth(2) type c default sy-datum+4(2) obligatory,
pa_year(4) type c default sy-datum(4) obligatory,
p_bankl like pc209-bankl, " Bank Number
p_zlsch like pc209-zlsch. " Payment method
selection-screen end of block b1.
save_calc_currency = calc_currency.
count_top = 0.
get_pernr_flag = 0.
Top-Of-Page
top-of-page.
perform convert_month using pa_mth(2) r_mth.
ws_mthyr_r = r_mth.
concatenate ws_mthyr_r pa_year into ws_mthyr_r separated by space.
SKIP 5.
skip 1.
skip 4.
if int_rep-bankl eq ' '.
if int_rep-zlsch eq 'C' or int_rep-zlsch eq 'E' or
int_rep-zlsch eq ' '.
write: /1(85) 'CHEQUE PAYMENT STATEMENT'(047) centered.
elseif int_rep-zlsch eq 'L'.
write: /1(85) 'DEMAND DRAFT STATEMENT'(047) centered.
endif.
else.
write: /1(85) 'BANK TRANSFER STATEMENT'(002) centered.
endif.
skip.
write: /34 ws_mthyr_r,
62 'Page :'(008),69(2) sy-pagno intensified off,
' Of ',78(2) pages intensified off.
clear pages.
read table bnka1 with key bankl = int_rep-bankl .
if sy-subrc = 0.
if int_rep-zlsch eq 'T'.
write:/03(10) 'Bank Name : ', bnka1-banka.
write:/03(10) 'Branch : ', bnka1-brnch.
write:/03(10) 'Address : ', bnka1-stras.
endif.
endif.
skip.
write:/1(80) sy-uline.
write: /1 sy-vline, 2(5) 'Sl.No'(002),
7 sy-vline, 8(8) 'Emp.No.'(003),
16 sy-vline,17(35) 'Employee Name'(004).
*--added for Demand Draft
if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
write : 47 sy-vline, 48(15) 'Payable at'(005).
else.
write : 47 sy-vline,48(15) 'Account No.'(005).
endif.
write: 63 sy-vline,64(16) 'Amount'(006),
80 sy-vline.
write:/1(80) sy-uline.
end-of-page.
write:/1(80) sy-uline.
write:/2 'Printed on ', sy-datum.
Start-of-selection.
start-of-selection.
*perform h_headr.
ctr = 0.
set margin 5.
call function 'RP_GET_CURRENCY'
exporting
molga = calcmolga
importing
waers = calc_currency
exceptions
others.
if sy-subrc ne 0.
calc_currency = 'DEM'.
calc_currency = save_calc_currency.
endif.
get pernr.
cd-key-pernr = pernr-pernr.
perform import_cluster.
get_pernr_flag = 1.
check : ocd-version-molga eq calcmolga.
The table 'tabpernr' is filled with the personnel numbers
and is used after selection is finished.
move-corresponding pernr to tabpernr.
append tabpernr.
The table 'tab_rgdir' is filled
loop at rgdir.
rx-key-pernr = pernr-pernr.
unpack rgdir-seqnr to rx-key-seqno.
perform int_tab. "fill tab_rgdir
perform import_bt.
perform validate.
endloop.
End of Selection
end-of-selection.
*perform h_headr.
perform convert_date_a using pa_mth r_mth_t.
sort int_rep by bankl zlsch pernr betrg descending.
delete adjacent duplicates from int_rep
comparing bankl zlsch pernr .
sort int_rep by bankl zlsch bankn . "PERNR.
loop at int_rep.
at new bankl.
select single * into bnka1 from bnka
where banks = c_banks and
bankl = int_rep-bankl .
append bnka1.
clear bnka1.
endat.
endloop.
for Demand Draft - purpose added
loop at int_rep.
concatenate pa_year(4) pa_mth(2) '01' into dt_merge.
select single * "zweck into int_rep-zweck
from pa0009 where
pernr = int_rep-pernr and
bankl = int_rep-bankl and
zlsch = int_rep-zlsch
and begda <= dt_merge and
endda >= dt_merge .
if sy-subrc = 0.
int_rep-zweck = pa0009-zweck.
modify int_rep.
endif.
endloop.
*-for DD and Chq sorted by PAyable at and EMPNO wise
if p_zlsch = 'T' .
sort int_rep by bankl zlsch bankn . "PERNR.
else. "added for "payable at" for DD/Chq
else.
sort int_rep by zweck pernr . "PERNR.
endif.
*delete adjacent duplicates from int_rep.
t_int_rep] = int_rep[.
loop at int_rep.
*-for page of page no.
total_page = 0.
loop at t_int_rep where bankl = int_rep-bankl
and zlsch = int_rep-zlsch.
total_page = total_page + 1.
endloop.
pages = total_page div 25.
remain = total_page mod 25.
comment bcoz its adding one extra page no.
done as on 29/11/2004
if remain > 0.
pages = pages + 1.
endif.
**-end
at new bankl.
ctr = 0 .
new-page.
endat.
at new zlsch.
ctr = 0 .
new-page.
endat.
clear v_id.
select single natio
into pa0002-natio
from pa0002
where pernr eq int_rep-pernr.
*-testing......for soma
if ctr > 24.
ctr = 0 .
write:/1(80) sy-uline.
new-page .
endif.
ctr = ctr + 1 .
cnt = cnt + 1.
pack int_rep-pernr to int_rep1.
write:/1 sy-vline, 2(3) cnt intensified off,
7 sy-vline, 9(6) int_rep1 intensified off,
16 sy-vline,17(35) int_rep-ename intensified off .
if ( int_rep-zlsch = 'l' or int_rep-zlsch = 'L' ).
write : 47 sy-vline,48(15) int_rep-zweck intensified off.
else.
write:
47 sy-vline,48(15) int_rep-bankn intensified off .
endif.
write: 63 sy-vline,64(16) int_rep-betrg
intensified off currency 'INR',
80 sy-vline.
ws_betrg = ws_betrg + int_rep-betrg.
*-testing......for soma
skip.
write :
/1 sy-vline, 7 sy-vline ,16 sy-vline ,47 sy-vline,63 sy-vline,80
sy-vline .
*-end testing......for soma
at end of zlsch.
if int_rep-bankl = ' '.
call function 'HR_IN_CHG_INR_WRDS'
exporting
amt_in_num = ws_betrg
importing
amt_in_words = amount_word
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2
w_val-word = amount_word.
concatenate 'INR.' w_val-word into w_val-word
separated by space.
write:/1(80) sy-uline.
write: /1 sy-vline, 7 'Total transfer:'(009),
64(16) ws_betrg intensified off currency 'INR',
80 sy-vline.
write:/1(80) sy-uline.
write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
80 sy-vline.
write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
80 sy-vline.
write:/1(80) sy-uline.
clear: ws_betrg,cnt.
skip 2.
write: /2 'Prepared by :'(010), '_______________'(013),
45 'Checked by :'(011),'_______________'(013).
skip 2.
write: /2 'Printed On ', sy-datum,
45 'Approved by :'(012),'_______________'(013).
clear sy-pagno.
endif.
endat.
at end of bankl.
if int_rep-bankl ' '.
call function 'HR_IN_CHG_INR_WRDS'
exporting
amt_in_num = ws_betrg
importing
amt_in_words = amount_word
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2
w_val-word = amount_word.
concatenate 'INR.' w_val-word into w_val-word
separated by space.
write:/1(80) sy-uline.
write: /1 sy-vline, 7 'Total transfer:'(009),
64(16) ws_betrg intensified off currency 'INR',
80 sy-vline.
write:/1(80) sy-uline.
write: /1 sy-vline, 3 w_val-word+0(76) intensified off,
80 sy-vline.
write :/1 sy-vline, 10 w_val-word+76(70) intensified off,
80 sy-vline.
write:/1(80) sy-uline.
clear: ws_betrg,cnt.
skip 2.
write: /2 'Prepared by :'(010), '_______________'(013),
45 'Checked by :'(011),'_______________'(013).
skip 2.
write: /2 'Printed on ', sy-datum,
45 'Approved by :'(012),'_______________'(013).
clear sy-pagno.
NEW-PAGE.
endif.
endat.
endloop.
End of Page
end-of-page.
write: /2 'Prepared by :'(010), '_______________',
45 'Checked by :'(011),'_______________'.
*& Form IMPORT_CLUSTER
Importing Data from Cluster *
form import_cluster.
sy-subrc = 0.
rp-imp-c2-cd.
if sy-subrc eq 0.
if cd-version-number ne ocd-version-number.
endif.
endif. " SY-SUBRC EQ 0
endform. " IMPORT_CLUSTER
*& Form INT_TAB
Filling internal table tab_rgdir form int_tab.
*Fill internal table tab_rgdir.
move-corresponding rgdir to tab_rgdir.
tab_rgdir-pernr = pernr-pernr.
append tab_rgdir.
endform. " INT_TAB
*& Form IMPORT_bt
Import Values from Bank Transactions Table (BT) form import_bt.
rp-init-buffer.
RP-IMP-C2-RX.
rp-imp-c2-in.
if rp-imp-in-subrc eq 0.
if in-version-number ne oin-version-number.
write: / 'Schlüssel des Clusters RX:'(015),
rx-key-pernr, rx-key-seqno.
write: / 'The imported version of the cluster'(016), 'RX',
'is not current'(017).
write: / 'Imported version :'(018),
oin-version-number.
write: / 'Current version of cluster :'(019),
in-version-number.
stop.
else.
sy-subrc = 0.
endif.
else.
sy-subrc = 8.
write: /
'Inconsistencies between cluster directory and directory for'(020).
write: /
'No payroll results found for data in cluster directory'(021).
write : /
'Please contact hotline to solve the current problem'(022).
endif.
ws_fpbeg(2) = versc-fpbeg+4(2).
ws_fpbeg+2(4) = versc-fpbeg(4).
ws_fpend(2) = versc-fpend+4(2).
ws_fpend+2(4) = versc-fpend(4).
ws_mthyr(2) = pa_mth.
ws_mthyr+2(4) = pa_year.
check ws_mthyr = ws_fpbeg.
check ws_mthyr = ws_fpend.
loop at bt. "from pc209
int_rep-pernr = pernr-pernr.
int_rep-ename = pernr-ename.
int_rep-bankl = bt-bankl.
int_rep-bankn = bt-bankn.
int_rep-betrg = bt-betrg.
int_rep-zlsch = bt-zlsch.
append int_rep.
endloop.
IF P_BANKL ' ' AND P_ZLSCH ' '.
DELETE INT_REP WHERE BANKL P_BANKL.
ELSEIF P_BANKL = ' ' AND P_ZLSCH ' '.
DELETE INT_REP WHERE ZLSCH P_ZLSCH.
ELSEIF P_BANKL ' ' AND P_ZLSCH = ' '.
DELETE INT_REP WHERE BANKL P_BANKL.
ENDIF.
endform. " IMPORT_BT
*& Form CONVERT_MONTH
Fetching Month Text form convert_month using mth t_mth.
case mth.
when '01'.
t_mth = 'January'(023).
when '02'.
t_mth = 'February'(024).
when '03'.
t_mth = 'March'(025).
when '04'.
t_mth = 'April'(026).
when '05'.
t_mth = 'May'(027).
when '06'.
t_mth = 'June'(028).
when '07'.
t_mth = 'July'(029).
when '08'.
t_mth = 'August'(030).
when '09'.
t_mth = 'September'(031).
when '10'.
t_mth = 'October'(032).
when '11'.
t_mth = 'November'(033).
when '12'.
t_mth = 'December'(034).
endcase.
endform. " CONVERT_MONTH
*& Form CONVERT_DATE_A
Fetching Month Text * form convert_date_a using mth_t t_mth_t.
case mth_t.
when '01'.
t_mth_t = 'Jan.'(035).
when '02'.
t_mth_t = 'Feb.'(036).
when '03'.
t_mth_t = 'Mar.'(037).
when '04'.
t_mth_t = 'Apr.'(038).
when '05'.
t_mth_t = 'May.'(039).
when '06'.
t_mth_t = 'Jun.'(040).
when '07'.
t_mth_t = 'Jul.'(041).
when '08'.
t_mth_t = 'Aug.'(042).
when '09'.
t_mth_t = 'Sep.'(043).
when '10'.
t_mth_t = 'Oct.'(044).
when '11'.
t_mth_t = 'Nov.'(045).
when '12'.
t_mth_t = 'Dec.'(046).
endcase.
endform. " CONVERT_DATE_A
*& Form VALIDATE
text
--> p1 text
<-- p2 text form validate .
if p_bankl <> ' ' and p_zlsch ' '.
delete int_rep where bankl p_bankl.
elseif p_bankl = ' ' and p_zlsch ' '.
delete int_rep where zlsch p_zlsch.
elseif p_bankl ' ' and p_zlsch = ' '.
delete int_rep where bankl p_bankl.
endif.
endform. " VALIDATE
check this weblog.....
/people/dj.adams/blog/2003/11/13/food-for-thought-ldbs-and-abap-objects
Also , check the following link too.
http://www.datamanagementgroup.com/Resources/Articles/Article_1005_2.asp
Regards,
Harish -
Rookie needs help with program!!
Hi everyone,
I am new to JAVA programming and am trying to figure out my first progam. Any suggestions? Here's what I have to come up with...
This program will test your ability to code a loop function and some work with the strings methods.
INPUT
A SENTENCE OF UNKNOWN LENGTH.
OUTPUT
THE NUMBER OF WORDS IN THE SENTENCE AND EACH WORD ON A SEPARATE LINE. Two spaces are not a word; "a" is a word.
HINT
Use a loop until the end of the sentence and count each word that is removed from the front of the sentence (one at a time). Each time the sentence should be shortened.
I know I need to use a string method...Here's what I have so far...
public class jmstr
public static void main (String[ ] args)
System.out.println ("Please enter a sentence starting with some spaces ");
inputline = SavitchIn.readLine ( ) ;
System.out.println (inputline);
I'm not really sure what to do next....?
Any help would be appreciated!
matermanhttp://java.sun.com/j2se/1.4.2/docs/api/java/util/StringTokenizer.html
look at the example on the page, then scroll down to the Methods section and click on
countTokens() -
Need one abap program.....pls help
Hi all,
i have need one ABAP program , which can dispaly how many same number of charecter are there.
ex : my input is suresh.
output is,,,
2 - s
1 - u
1 - r
just like that..
pls help me..
thanks in advance.
induHello
Try this:
data: string(100),
length type i.
data: begin of itab occurs 0,
chart,
count type i,
end of itab.
string = 'suresh'.
length = strlen( string ).
do length times.
length = length - 1.
clear itab.
itab-chart = string+length(1).
itab-count = 1.
collect itab.
enddo.
loop at itab.
write: itab-chart, itab-count. new-line.
endloop. -
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. -
Program to count number of words
I need some help with writing a program that counts the number of words in a file. Can anyone help me?
I would try:
read line
save line to a string
use split(" ") method from String to get each word
into a String[]
then put each entry in the array into a list
repeat for all lines
get size of listThat will only work for small-ish files. I would recommend using indexOf() until EOF is reached. You would need logic to ignore consecutive spaces and the like, but it should be both significantly smaller in memory footprint and faster in execution speed.
- Saish
Maybe you are looking for
-
Problem with iTunes and iTouch.
Hello, I have my iPod Chromatic Nano which appears to work fine with iTunes, but as soon as I insert my iPod Touch, within seconds I get the blue screen, having to reboot my computer, I've tried reinstalling my iTunes yet it still doesn't fix the pro
-
Error in /LogoPage.html after deploying SAP MII 14.0 SP5
Hi Experts, I am using SAP EHP1 for NW 7.3 SP07. Recently I upgraded from SAP MII 14.0 SP04 patch 5 to SP05 patch 2. After Upgrading I am getting many issues as below: 1. When opening "http://hostname:port/XMII/" as file "/LogoPage.html" does not exi
-
The best way to get wireless internet?
I have a new g5 but didnt know it doesnt come with aiport card. What adapter would work best to get signal from our linksys router in the house? thanks
-
user raised directly invoice from the plant , when executinng sales register in Z report user want plant wise sales report .and in report they want profit center field in report , for this what settings we have to do in Z report.
-
I already have sampled data of a input signal in time domain. the signals are sampled via ADC and stored in excel file(around 16K samples). I need to feed it to FFT VI to obtain the FFT plot. I tried multiple FFT VIs but no one accept samples data di