Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Logic

Former Member
0 Likes
474

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

4 REPLIES 4
Read only

Former Member
0 Likes
448

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.

Read only

Former Member
0 Likes
448

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

Read only

Former Member
0 Likes
448
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.
Read only

Former Member
0 Likes
448

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