2007 May 28 7:59 AM
Hi All,
I have an internal table of following datas.
PERNR START_MONTH END_MONTH
10 01 05
10 05 09
10 10 12
.......
In my sceneario I need to check START_MONTH with END_MONTH of previous record of same employee. If found START_MONTH = START_MONTH + 1.
Second record START_MONTH should be 06. How can we do this. Can anyone help me to sort out this problem.
Thanks and Regards
Partha.
2007 May 28 8:09 AM
Hi partha,
You can code something like this.
loop at itab into wa_itab.
l_index = sy-tabix - 1.
if l_index ne 0.
read itab into wa_itab1 index l_index.
endif.
...
do all processing here
endloop
Reward points if useful.
Regards,
Atish
Hi All,
I have an internal table of following datas.
PERNR START_MONTH END_MONTH
10 01 05
10 05 09
10 10 12
.......
In my sceneario I need to check START_MONTH with END_MONTH of previous record of same employee. If found START_MONTH = START_MONTH + 1.
Second record START_MONTH should be 06. How can we do this. Can anyone help me to sort out this problem.
Thanks and Regards
Partha.
2007 May 28 8:08 AM
Hi
Declare 2 Internal tables ITAB and ITAB1 with same fields
Loop at ITAB
itab1-pernr = itab-pernr.
itab1-start_month = itab-start_month +1.
itab1-end_month = itab-end_month.
append Itab1.
clear Itab1.
endloop.
Reward points if useful
Regards
Anji
2007 May 28 8:09 AM
Hi partha,
You can code something like this.
loop at itab into wa_itab.
l_index = sy-tabix - 1.
if l_index ne 0.
read itab into wa_itab1 index l_index.
endif.
...
do all processing here
endloop
Reward points if useful.
Regards,
Atish
2007 May 28 8:14 AM
HI,
I ws trying to solve,, found little bit uncompared..
Please be clear with your question so that we can help you?
regards,
nazeer
2007 May 28 8:23 AM
Hi
Do Like This...
Declare a variable fpr storing the end_month.Give the dataType same that you use for declare END_Month in the internal table.
Loop at ITAB
if sy-tabix <> 0.
if START_MONTH = VAR_MONTH.
START_MONTH = START_MONTH + 1.
endif.
VAR_MONTH = itab-end_month
ENDLOOP.
Reward All Helpfull Answers.......
2007 May 28 8:27 AM
Hi,
see this code.modify this according to ur requirement.
data:begin of itab occurs 0,
a(2),
b(2),
c(2),
end of itab.
data:wa_itab like itab,wa_itab1 like itab.
data:l_index type i.
itab-a = '10'.
itab-b = '2'.
itab-c = '5'.
append itab.
itab-a = '10'.
itab-b = '5'.
itab-c = '9'.
append itab.
itab-a = '10'.
itab-b = '10'.
itab-c = '12'.
append itab.
loop at itab.
write:/ itab.
endloop.
loop at itab into wa_itab.
l_index = sy-tabix - 1.
if l_index ne 0.
read table itab into wa_itab1 index l_index.
endif.
if wa_itab1-c = wa_itab-b.
wa_itab-b = wa_itab-b + 1.
l_index = l_index + 1.
modify itab from wa_itab index l_index.
endif.
endloop.
skip.
loop at itab.
write:/ itab.
endloop.
rgds,
bharat.
2007 May 28 8:33 AM
internal table of following datas.
PERNR START_MONTH END_MONTH
10 01 05
10 05 09
10 10 12
.......
In my sceneario I need to check START_MONTH with END_MONTH of previous record of same employee.
Use the following logic:
Data : FIELD SYMBOLS <F1>, <F2> TYPE ANY.
LOOP at itab assigning <F1>
If sy-tabix > 1
Write your logic here
CHECK <F2>-START_MONTH = <F1>-END_MONTH
....
....
end of write your logic here
endif.
<F2> = <F1>
Endloop.
NOTE : F2 will be 10 05 09
FI will be 10 01 05
and so on...in the next iteration
F2 will be 10 10 12
F1 will be 10 05 09
until all records are processed
Thanks
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |