Count rows in an internal table
Anybody how knows how I can count rows in my internal table?
Hi,
Data: lines like sy-tabix.
DESCRIBE TABLE ITAB LINES LINES.
where itab is your internal table.
This will work out.
Please award sutiable points .
Regards,
Irfan
Similar Messages
-
Merging of multiple rows in an internal table as a single record
Hi All,
I have an internal table which has the following columns:
text, date, time, user.
it stores notes in the internal table.
The problem is...when I save a note with multiple lines and spaces it saves each line of the note as a row in the internal table.
Thus i get more no. of rows in the internal table compare to the no. of rows!
I need to store each notes as single row in the internal table.
Please advise how to approach this?
Helpful answers will be rewarded.
Thanks & Regards,
Anshumita.You can create a deep internal table. You can declare one Column as an internal table and store the NOTES in that Internal table for each row.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm
you can check the example in the link
regards,
abhishek -
SWAP COLUMNS AND ROW IN AN INTERNAL TABLE to display in ALV
Hi ,
I want to swap all the rows in an internal table with the column of the internal table to display it horizontally in ALV grid.
e.g
1 2 3 (field names)
A P X
B Q Y
C R Z
should look like :
D A B C
E P Q R
F X Y Z
Where D , E, F in first column is already apended in new table.
Or else is there a way to rotate the ALV grid so that it can display rows as columns & columns as rows.
regardshi,
i have an internal table which is like
f1 f2 f3 f4 (column header)
A 1 2 3
B 4 5 6
C 7 8 9
the values in o/p table should be
A B C ( column header)
1 4 7
2 5 8
3 6 9
Please help!! -
How to process a block for each row in an internal table....
Hi experts....
In po approval workflow the scenario is like this.... for each po there may be more than one approver. approvers list i am maintaining in the ztable. list of approvers(no of approvers) is decided by the po value. I have collected these approvers into internal table. now i have to process a block ( approving or rejecting the po... )in the workflow for each row in the internal table.
how can i do this. based on the decision of the 1st approver approves the po then it should go to next approver in the internal table...otherwise end the workflow.....
Please help me......i have created an internal table in the workflow container in which i am getting the list of approvers....
how can i loop the internal table in the workflow...?
how can i know the index of the loop in the workflow.....(will sy-index work here....? so that i can use loop until step in the main workflow to call the subworkflow..so that if sy-index is greater than no of entires in the itab then i can come out of the loop) -
Read first row of the internal table
Dear All,
Please let me know how to read the first row of the internal table?
I used following read statement but it is not working
READ TABLE t_cdhdr INDEX 1.Hi,
i think you are not reading an internal table
according to your code i think you are reading a type
which may be declared as types...
types are declared just for reference
eg
types: begin of t_cdhdr .
include strucuture cdhdr .
types: end of t_cdhdr .
types: t_it_cdhdr type standard table of t_cdhdr.
data: git_t_cdhdr type t_it_cdhdr.
data: gwa_t_cdhdr type t_cdhdr.
now have to fill the iternal table
and
read table git_t_cdhdr into gwa_t_cdhdr index 1.
reward points if helpful
thanks & regards,
venkatesh -
No. of Rows in an internal table
Dear Friends,
Please let me know which ABAP System Field shall give me the no. of rows in an internal table. If it is sy-dbcnt kindly provide an example on how to use it in a program.
Regards,
Alok.Hi Alok,
Use the Describe Statement.
Sample Program :
*TABLES ZVIJIRANK.
*DATA : BEGIN OF IT OCCURS 10.
*INCLUDE STRUCTURE zvijirank.
*DATA : END OF IT.
*data : lines1(4) type n,
knd type c,
n type i.
*select * from zvijirank into table it.
**describe table zvijirank lines lines1. -
> Describe statement is only used for Internal Tables.....
*write : / 'BEFORE DESENDING'.
*LOOP AT IT.
*WRITE : / IT-REG_NO , IT-NAME.
*ENDLOOP.
*ULINE.
*describe table it lines lines1. "-----> To find No Of lines
Write : lines1.
Thanks.
Message was edited by:
Viji -
Create an internal table with the rows of another internal table.
Hi I want to know if posible to create an internal table structure with the rows of another internal table?
ex.
If in i_tab column A has this values: row 1 = first, row 2 = second, row 3 = third.
Now I want that the structure of my internal table be: first, second, thirdHi,
If you do this way then what will be the difference between the two table anyway?? First internal table has the same structure irrespective of which row you select. and you are going to store the data from each row to the rows of the second internal table. In that case, the structure of the internal table is the same as first table. and it would have same rows.
Am I missing something here? or you want to declare the internal table with each field being the structure of the first table? In this case you'd have to do a dynamic declaration of data as the first table can have any no of rows then the second table would have any no of fields in the structure.
Now if you know that your first internal table is going to have a fixed no of rows eg 3 rows then it becomes simple. Do the following then
Data: begin of second_table occurs 0,
first type <first_table type>,
second type <first_table type>,
third type <first_table type>,
end of second_table.
Regards
Prasenjit -
Delete row in an internal table
Hi,
with key1 and key2 how do I delete a row in an internal table itab?
I want to do something like (but dont succeed) this:
DELETE itab WHERE x = key1 AND y = key2
thanks in advanceHi Baran,
Please try like this.
DELETE TABLE itab WITH TABLE KEY x = key1
y = key2.
Regards,
Ferry Lianto -
CONVERTING ROWS OF AN INTERNAL TABLE TO COLUMNS OF ANOTHER INTERNAL TABLE
Hi,
I hv an internal table itab as below with 3 columns.
name age place
sandeep 24 delhi
ajay 22 bangalore
abhishek 25 mumbai
internal table itab can have any number of rows.
from this internal table i want to make another internale table itab_new as
sandeep ajay abhishek
24 22 25
delhi bangalore mumbai
thanksHi,
Check this example:
data:p_temp(30) TYPE c value 'ztmp_projectreport'.
*data declaration
DATA: it_tab TYPE filetable,
gd_subrc TYPE i,
answer TYPE c.
TYPES: BEGIN OF t_abapcode,
row(72) TYPE c,
END OF t_abapcode.
DATA: it_abapcode TYPE STANDARD TABLE OF t_abapcode INITIAL SIZE 0.
data:it_prps like prps occurs 0 with header line.
data:colum(20) type c.
data:ncol type i.
data:ccol type c.
select * into corresponding fields of table
it_prps from prps where
append 'report ztmp_projectreport' to it_abapcode.
append 'data:begin of it_prps2,' to it_abapcode.
ncol = 1.
loop at it_prps.
ccol = ncol.
concatenate 'colum' ccol '(20)' into colum.
concatenate colum 'type c,' into it_abapcode.
add 1 to ncol.
endloop.
append 'data:end of it_prps2.' to it_abapcode.
'All your code here to fill the internal table and alv grid
'End of all your code
INSERT REPORT p_temp FROM it_abapcode.
SUBMIT (p_temp) AND RETURN.
DELETE REPORT p_temp.
Please provide points -
Count distinct rows from an internal table
Hi,
i have an internal table containing pairs of entries like
1 1
1 2
1 3
2 1
2 2
What i want to do is to determine the value of rowcount from first column ( here it would be 2 and not 5 ) - to me it seems like a DISTINCT. Any suggestions for that ?
ClemensHi clemens,
1. One of the ways is to use COLLECT.
2. suppose your original internal table is ITAB.
Create one more with just one field
STAB eg.
3. Loop at ITAB.
STAB-field1 = ITAB-Field1.
COLLECT stab.
ENDLOOP.
4. In stab u will have only TWO records,
1
2
regards,
amit m. -
SMARTFORM: How to print on document per row in an internal table
Hi.
I have created a SmatForm that is a one-page document to be printed once for every row in an itab I'm sending it via the Table Interface.
I hope I didn't waste my time designing this form but I created several Windows for each section (header, recipient address, summary of coverage, detail coverage information, disclaimer, etc.). I arbitrarily chose the header window as the "main" window (mainly because I couldn't find out what the difference between the different choices was). I've got the form laid out exactly how I want it.
If I test the SmartForm and pass in 2+ records via the test screen only the first one prints.
I thought about trying a LOOP but since you have to place the text within the loop that means all the Windows I have defined won't "get" any of the data.
I thought about looping in the driver ABAP program and just calling the SmartForm once per row but that seems horribly inefficient.
PLEASE HELP! Can I salvage what I've done already?Valter:
OK. I'm trying this and running into a snag.
In the Form Interface section I have a table interface parameter defined as this:
P_CERTIFICATES_IN TYPE ZBNTT_LIFECERTIFICATE
next I declared a variable named "IT_CERTIFICATES LIKE LINE OF P_CERTIFICATES_IN" in the "Global Definitions" section and on my LOOP element (under my new MAIN window) I have "[X] Internal Table" checked and
"P_CERTIFICATES_IN" "INTO" "IT_CERTIFICATES"
but the compiler says "Global Definitions Field "P_CERTIFICATES_IN" is unknown. It is neither in one of the specified tables nor defined by a "DATA" statement . . . . . .".
Why can't the Smartform "see" P_CERTIFICATES_IN? -
How to compare each row in an internal table
Hi,
Say I have an internal table with 3 fields in each row, num1, num2, num3, each type of integer i, now I want to get the maximum of num1, num2, num3 and put this maximum number into num4, may I know how can I do that? Also, if say I need to pull out this num4 and play around with it, sould I just loop it into my workarea of internal table and assign a variable for whatever that is in the work area? Thanks a lot!
Regards,
AnyiHi,
Inside a loop of the table compare each field like this:
loop at itab.
l_num4 = itab-num1.
if l_num4 < itab-num2. l_num4 = itab-num2. endif.
if l_num4 < itab-num3. l_num4 = itab-num3. endif.
Here you can play with the maximum number
itab-num4 = l_num4.
modify itab.
endloop.
You can also do the same using field-symbols (it's faster to assignations) :
loop at itab assigning <a>.
endloop.
Regards. -
How do I select a range of rows from an internal table in the debugger?
Hi,
I have a case where I wanted to delete a range of rows (several thousand) from an internal table using the debugger.
It seems that rows can only be selected one at a time by selecting (clicking) on the far left side of the row.
This is cumbersome, if not impossible when wishing to delete several thousand rows.
Other tools, such as Excel for example, allow for selecting a range of rows by selecting the first row and then holding the SHIFT key and selecting the last row and all rows in between will be selected.
I can't seem to find the combination of keys that will allow this in the table (or structure) tab of the debugger.
Is it possible to select a range of rows without having to select each row one at a time?
Thanks for your help,
AndyWhile it's a Table Control and should/could have a button to select all fields (or visible fields)...I don't think we can do it right now...I know it's a pain to select each row one at a time...but I don't we have any more options...
Greetings,
Blag. -
To convert the row of an internal table into columns
Hi ,
I want to use the rows of a single column internal table itab1
to form another internal table itab2 with column names same as the rows of itab1 .
How is this possible?
Regards,
Harshit RungtaHi,
Check the link..[Convert Rows of internal table to Columns|http://docs.google.com/Doc?id=dfv2hmgs_5d6bcxqgp&hl=en] -
Delete rows dynmically from internal table
Hi Gurus,
I have got an problem. I have an internal table itab.
Case 1. It has got some 10 rows. I want to delete rows between those two rows containing same field value of a Field 'X'. Here same value of that field could come on 1st and 7th row. Then mean, I need to delete 2nd to 6th row.
It could come in 4th and 10th row. Then I need to delete 5th to 9th row.
Case 2. It has got some 20 rows. Now same I want to delete rows between those two rows containing same field value of a Field 'X'. Here again, same value of that field could come on 1st and 17th row. Mean I will delete 2nd to 16th row. It could come in 7th and 19th row. Then I need to delete 8th to 18th row.Hi Vaibhav
Please find the code, I hope it helps
DATA: BEGIN OF itab OCCURS 10,
val,
END OF itab.
DATA: jtab LIKE itab OCCURS 0 WITH HEADER LINE,
l_ind1 TYPE i,
l_ind2 TYPE i,
l_lines TYPE i,
l_flg.
itab-val = 'a'.
append itab.
itab-val = 'b'.
append itab.
itab-val = 'c'.
append itab.
itab-val = 'd'.
append itab.
itab-val = 'e'.
append itab.
itab-val = 'f'.
append itab.
itab-val = 'c'.
append itab.
itab-val = 'g'.
append itab.
itab-val = 'c'.
append itab.
itab-val = 'h'.
append itab.
jtab[] = itab[].
DESCRIBE TABLE itab[] LINES l_lines.
LOOP AT itab.
MOVE sy-tabix to l_ind1.
l_ind2 = l_ind1 + 1.
LOOP AT jtab FROM l_ind2 to l_lines WHERE val eq itab-val.
l_ind1 = l_ind2.
l_ind2 = sy-tabix.
l_flg = 'X'.
exit.
ENDLOOP.
IF l_flg eq 'X'.
exit.
ENDIF.
ENDLOOP.
delete itab FROM l_ind1 to l_ind2.
LOOP AT itab.
WRITE: /2 itab-val.
ENDLOOP.
Still if you want to apply this multiple values, create another internal table and store the values which have been deleted already. So before you going to delete them again you can check from these new internal table.
Please let me know, if any issues still exists.
Regards
Praveen
Maybe you are looking for
-
Do I need to create billing for FD (free delivery) sales order
Hi I have a question. I created first a sales order (FD) in our sap system. but I don't know whether I need to create billing for the FD order. when I try to create billing for this FD order, SAP cannot to process it. I also research configuration. i
-
CURRENT TIME IN MILLISECONDS.
Hi all, I need to get the current time in milliseconds. Is there any simple function for that. Please do help me. Thanking in advance... Regards, Aswathy.
-
Can Preview recognize hyperlinks (embedded URLs) in PDF docs?
I've been trying to research this online but I get conflicting answers. Can Preview recognize hyperlinks (embedded URLs) in PDF documents? If it can, then how are those created? I am using Adobe Acrobat Professional v7 (on Windows) and Preview doesn'
-
Java.lang.VerifyError: Cannot inherit from final class
Hi i am trying to call a crystal report from jsp but i am getting this error error:- org.apache.jasper.JasperException: Cannot inherit from final class org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
-
My ipod refuses to update.
I just attempted to update my 30gig ipod video and it will not update. When I tried to update it all of the music got wiped off of it but the pictures stayed. My third generation ipod updates just fine though. I already formatted my ipod aswell as re