‎2007 May 17 5:47 AM
Hi alla,
Can anyone help me in this below logic.
Iam having start amount and end amount.
SNO start amount end amount
1 2000 3000
2 3000 3400
3 3400 3500
................................................
like this and the<b> previous record end amount</b> must be the<b> present start amount</b>.
In the program i need to check the previous record ending amount and present start amount.If not equal i need thow a error message.
can any one help me.
For good solution i will reward points
‎2007 May 17 5:49 AM
Hi,
If your data is in internal table you can do this :
DATA : endamount.
LOOP AT itab.
IF sy-tabix > 1. " from row 2 onwards
IF itab-startamount <> endamount.
" Show error.
ENDIF.
ENDIF.
endamount = itab-endamount.
ENDLOOP.
Hope this helps you.
‎2007 May 17 5:51 AM
Hi
Put the data in internal table
declare
data: v_index type i,
amnt1 type netwr,
amnt2 type netwr.
Read table ITAB with index sy-tabix.
if sy-subrc = 0.
amnt1 = itab-f2.
endif.
v_index = sy-tabix -1.
Read table ITAB with index v_index.
if sy-subrc = 0.
amnt2 = itab-f2.
endif.
if amnt1 <> amnt2.
message ' amounts not eqaul'.
endif.
Reward points if useful
Regards
Anji
‎2007 May 17 5:52 AM
sort itab by SNO start_amt end_amt.
describe table itab lines v_lines.
loop at itab.
v_tabix = sy-tabix.
v_Samt = itab-end_amt.
v_tabix = v_tabix + 1.
check v_tabix LE v_lines.
read table itab index v_tabix.
v_Eamt = itab-start_amt.
if v_Samt NE v_Eamt.
" error message
endif.
clear all variables here.
endif.
‎2007 May 17 5:57 AM
Hi Vijay,
Refer this logic :
data : temp(10) type i.
Loop at itab.
if itab-sno gt 1.
if itab-startamount <> temp.
message e001.
endif.
endif.
clear temp.
temp = itab-endamount.
endloop.
Reward points if helpful.
Regards,
Hemant