2009 Mar 12 7:36 AM
Hi all,
i have got some data related to sales into an it_table pertaining to G/L account for a date range.
however i want to shift this data to another internal table by putting further restriction by using where condition.
But, i want to do this without looping on my previous internal table.
please help me out with a solution.
Regards,
Kaustubh
2009 Mar 12 7:38 AM
my second internal table is of the same type as of the first.
Hi all,
i have got some data related to sales into an it_table pertaining to G/L account for a date range.
however i want to shift this data to another internal table by putting further restriction by using where condition.
But, i want to do this without looping on my previous internal table.
please help me out with a solution.
Regards,
Kaustubh
2009 Mar 12 7:38 AM
my second internal table is of the same type as of the first.
2009 Mar 12 7:43 AM
Hi,
If structure of both the internal tables are same then simple
internaltable2[] = intrenaltable1[] should work that actually copies the data from first to sec adn then
either loop at intrenaltable2 and delete the records or simply delete intrenaltable2 where condition should work.
Pooja
2009 Mar 12 7:57 AM
hi,
thank you for your suggestion but this would the same as looping on the first table as the data in the second table now is the same as it was in the first. looping on this would mean the same thing.
please correct me if im wrong.
2009 Mar 12 8:17 AM
The best way to avoid the loop would be to first append all the lines of the source itab to target itab, then delete the unwanted entries from the target tab.
append lines of itab to itab_1.
delete itab_1 where ( logical_expresion ) . " delete the entries you dont want.
regards,
Advait
2009 Mar 12 8:36 AM
@ advait
thanks a lot. it worked. exactly what i was looking out for.
thanks everyone else for your valuable feedbacks.
regards,
kaustubh
2009 Mar 12 7:38 AM
if the structure of both the internal tables are same , use Append line of statement . you can sue where condition in the same.
2009 Mar 12 7:46 AM
Hi Santosh,
i tried your suggestion. the following is the syntax i have written:
append lines of it_revenue to it_rev where budat = p_bukrs.
following is the error i got when i executed:
".", "ASSIGNING <fs>" or "REFERENCE INTO data-reference" expected after "IT_REV". -
please help.
2009 Mar 12 7:40 AM
Hi,
If the table structures are same and the where conditions are not dependent of the first table.
You can write.
ITAB2[] = ITAB1[].
DELETE ITAB WHERE <condition>.
With Best Regards,
Navneet Chaubey
2009 Mar 12 7:41 AM
Hi
ITAB2[] = ITAB1[].
That's it for your case.
Regards,
Sreeram Kumar.Madisetty
2009 Mar 12 7:43 AM
2009 Mar 12 7:47 AM
the reason being to avoid looping on a large amount of data in a practical scenario
Regards,
kaustubh
2009 Mar 12 7:45 AM
If both internal tables are having the same structure you can use this statement,
it_tab1 = it_tab2.
Regards,
Joan
2009 Mar 12 7:49 AM
Hi Kaustubh,
You can try it this way:
Data:
w_lines type i,
w_index type i value 1.
Describe table itab_1 lines w_lines.
While w_index le w_lines.
Read table itab_1 into wa index w_index.
If wa_field eq 'XYZ'. " check youe condition here
Append wa to itab_2.
Endif.
w_index = w_index + 1.
Endwhile.
With luck,
Pritam.
2009 Mar 12 7:59 AM
Hi,
can you please check
To read the contents of internal tables for further processing, you can use either the LOOP or the READ statement.
Reading Internal Tables Line by Line
You use the the LOOP statement to read internal tables line by line.
LOOP AT <itab> [INTO <wa>] [WHERE <condition>].
ENDLOOP.
Reading Single Lines Using the Index
You can select a single line by the READ statement:
READ TABLE <itab> [INTO <wa>] INDEX <idx>.
Thanks and regrds
Durga.K
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |