2008 Dec 05 2:14 PM
Hi,
How to find the missing number(not number range) .Is there any functional module is there for missing nos.
ex: i have nos. from 50 to 100 & no.79 is missed.
For this issue if any functional module is there pls let me Know.
Thanks & Regards
Venkat
Hi,
How to find the missing number(not number range) .Is there any functional module is there for missing nos.
ex: i have nos. from 50 to 100 & no.79 is missed.
For this issue if any functional module is there pls let me Know.
Thanks & Regards
Venkat
2008 Dec 05 2:32 PM
I cant even think of a function module offering such a customised requirement.
You should probably rely on some logic to find the missing number.
There could be several ways to point out the missing number.
2008 Dec 05 2:34 PM
Its quite simple logic if u wanna code it, so try to write ur code u'll definately be able to do it.
2008 Dec 05 2:34 PM
Hi Venkat,
This can be achieved by simple logic, you can write a piece of code for this.
Input1 = 50
input2 = 100
Suppose you are searching for a missing item in the internal table.
loop at itab.
if itab-item = input1.
else.
missig = input1 .
endif.
input1 = input1 + 1.
endloop.
if you want to have all the missing values means, you can append all the values into a table.
Hope this logic may help you
-Sujatha
2008 Dec 05 2:41 PM
Not sure about a function, but you could create your own function and use this logic.
REPORT zrich_0001.
TYPES: BEGIN OF ttab,
number TYPE i,
END OF ttab.
DATA: itab TYPE TABLE OF ttab.
DATA: wa LIKE LINE OF itab.
DATA: tmp LIKE LINE OF itab.
DATA: diff TYPE i.
DATA: rows TYPE i.
DATA: low_number TYPE i.
DATA: high_number TYPE i.
DATA: tmp_number TYPE i.
* Build an internal table with all the numbers
wa-number = 50. APPEND wa TO itab.
DO 50 TIMES.
wa-number = wa-number + 1. APPEND wa TO itab.
ENDDO.
* Create some missing numbers in the table
DELETE itab WHERE number = 63.
DELETE itab WHERE number = 64.
DELETE itab WHERE number = 65.
DELETE itab WHERE number = 79.
sort itab ASCENDING .
* find the low value.
clear wa.
READ TABLE itab INTO wa INDEX 1.
IF sy-subrc = 0.
low_number = wa-number.
ENDIF.
* Get the high value
rows = LINES( itab ).
clear wa.
READ TABLE itab INTO wa INDEX rows.
IF sy-subrc = 0.
high_number = wa-number.
ENDIF.
* Now find the missing numbers.
tmp_number = low_number.
DO.
IF tmp_number = high_number.
EXIT.
ENDIF.
READ TABLE itab INTO wa with key number = tmp_number.
IF sy-subrc <> 0.
WRITE:/ tmp_number.
ENDIF.
tmp_number = tmp_number + 1.
ENDDO.Regards,
Rich Heilman
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |