‎2007 Sep 26 9:31 AM
Hello,
what I am trying to do is copy the contents of Internal Table A to Internal Table B,
which do have corresponding components, but , I want to select the a date field from table A , not to be between a start and end date in table B.
Is there a quick way of doing this , without a loop within a loop?
Thanks
‎2007 Sep 26 9:34 AM
loop at itab2 into wa2.
Read table itab1 into wa1 <condition.
if sy-subrc = 0.
<statement>
endif.
endloop.
Regards,
Amit
Reward all helpful replies.
‎2007 Sep 26 9:36 AM
Hi,
You can 1st copy the entire contents from table A to table B and use the DELETE Internal table command to delete the records given in the date range.
regards,
Mahesh
‎2007 Sep 26 9:37 AM
loop at b.
read table a with key date >= b-startdate
date <= b-enddate.
move corresponding a to b.
append b.
endloop.
reward points if useful.
‎2007 Sep 26 9:38 AM
loop at itabA.
read table itabB with key ... = itaba-... BINARY SEARCH.
if sy-subrc eq 0.
<b>if itaba-start LT itabB-start and
itaba-end GT itabb-end.</b>
....
endif.
endif.
endloop.
‎2007 Sep 26 9:39 AM
no need of second table you can do the same in first table.
you can use this
SORT ITAB BY DATE.
DELETE ITAB WHERE DATE LT S_DATE-LOW and DATE GT S_DATE-HIGH.
reward if useful.
Amit Singla
‎2007 Sep 26 9:41 AM
you can use this way if u need second table as well.
ITAB1[] = ITAB[].
SORT ITAB1 BY DATE.
DELETE ITAB1 WHERE DATE LT S_DATE-LOW and DATE GT S_DATE-HIGH.
reward if useful.
Amit Singla
‎2007 Sep 26 9:42 AM
Hi..
It is must to use the LOOP in this case.
Eg: Assume F1 Is the Common field (Key) in both internal tables
SORT TAB2 BY F1.
LOOP AT TAB1 .
READ TABLE TAB2 WITH KEY F1 = TAB1-F1 BINARY SEARCH.
IF SY-SUBRC = 0.
IF TAB1-DATE NOT BETWEEN TAB2-STARTDATE AND TAB2-ENDDATE.
MOVE-CORRESPONDING TAB1 TO TAB3.
APPEND TAB3.
ENDIF.
ENDIF.
ENDLOOP.
<b>reward if Helpful.</b>
‎2007 Sep 26 9:42 AM
loop at tableb.
read tableA where date > tableb-start_date and tableb-end_date.
if sy-subrc <> 0.
<b>read tableA.
if sy-subrc = 0.
delete tableA.
endif.</b>
<b>TABLEA-DATE is what u needed now</b>
endif.
endloop.
Message was edited by:
Hymavathi Oruganti