‎2006 Feb 09 1:55 PM
Hi all,
I have the following code
FORM time_division.
help = 1.
LOOP AT datum.
CONCATENATE 'itab-datum' help INTO feld_datum.
CONCATENATE 'itab-menge' help INTO feld_menge.
ASSIGN:
(feld_datum) TO <field1>,
(feld_menge) TO <field2>.
READ TABLE b_tab WITH KEY gltrp = datum-low BINARY SEARCH.
IF sy-subrc EQ 0.---> working fine
MOVE-CORRESPONDING b_tab TO itab.
<field1> = datum-low.
<field2> = b_tab-menge.
* MOVE datum-low TO itab-datum1.
* MOVE b_tab-menge TO itab-menge1.
COLLECT itab.
clear itab.
ELSE.--> not working
MOVE-CORRESPONDING b_tab TO itab.
<field1> = datum-low.
<field2> = 0.
collect itab.
clear itab.
ENDIF.
help = help + 1.
ENDLOOP.
clear itab.
ENDFORM. " time_division
the problem Ãn the code is if the read statement is successfull then the program working fine. but when not successfull(move-corresponding not working) its appending new lines instead of modifying (bcoz its not successfull).
Please anybody tell me how to work with this problem.
Any help will be highly appreciated.
Thanks and regards
chandu.
‎2006 Feb 09 2:26 PM
Hi,
IF sy-subrc = 0. then U'lll definitely have some
values in the internal table.
But If sy-subrc fails then <b>b_tab</b> will not have
any values. and UR doing the same below which appends a
blank line.
Your coding.
ELSE.--> not working
MOVE-CORRESPONDING b_tab TO itab.
<field1> = datum-low.
<field2> = 0.
collect itab.
clear itab.
ENDIF.
Regards,
GSR.
‎2006 Feb 09 2:27 PM
‎2006 Feb 09 2:31 PM
hi,
As there is no
<b>clear: b_tab.</b> prior to
read table b_tab....
values are moving to itab from b_tab though read statement is unsuccessful.
MOVE-CORRESPONDING b_tab TO itab.
So, you might be getting wrong results.
Regards,
Sailaja.
‎2006 Feb 09 2:44 PM
Hi Sai,
What exactly is your requiremnt ? What u want to do if the read statement fails. Currently ur program is coded to append blank lines and its doing it correctly !
ELSE.--> not working
MOVE-CORRESPONDING b_tab TO itab.
Here b_tab will have no value coz sy-surc <> 0 , so its appending a blank line. If you want the program to modify b_tab based on the datum (since u are looping at datum) u might have to use modify index or modify using statment.