‎2008 Jun 04 4:31 PM
I have selection option for Document number .
select-options : s_docno for vbak-vbeln obligatory.
For example after user enters document number in the input screen. I am getting a values like the below mentioned.
Line SIGN OPTION LOW HIGH
1 I BT 0000069686 0000069696
Then I am making a select using this s_docno from VBAK.
But the VBAK table i don't have document number 0000069689 & 0000069692.
I need to find these missing numbers
a®
‎2008 Jun 04 4:37 PM
Hi,
Here is idea. hope this helps.
First selct all entries from VBAK based on s_docno.
lv_var = s_docno-high - s_docno-low.
lv_doc = s_docno-low.
do lv_var times.
read table itab with key vbeln = lv_doc.
if sy-subrc NE 0.
........ append in diff table as this value not present in VBAK
endif.
lv_doc = lv_doc + 1.
enddo.
thnx,
ags.
‎2008 Jun 04 4:37 PM
Hi,
Here is idea. hope this helps.
First selct all entries from VBAK based on s_docno.
lv_var = s_docno-high - s_docno-low.
lv_doc = s_docno-low.
do lv_var times.
read table itab with key vbeln = lv_doc.
if sy-subrc NE 0.
........ append in diff table as this value not present in VBAK
endif.
lv_doc = lv_doc + 1.
enddo.
thnx,
ags.
‎2008 Jun 04 4:46 PM
ags/nimesh
I already that way you mentioned. but if user enters values like this way
If user enters S_DOCNO this way then
Line SIGN OPTION LOW HIGH
1 I BT 0000069686 0000069696
2 I GE 0000069686 0000000000
3 E NE 0000069687 0000000000
4 E LT 0000069686 0000000000
5 E BT 0000069656 0000069666
6 I NE 0000069693 0000000000
or i am looking for any function module/class that will provide the running numbers from a select-options ?
a®
‎2008 Jun 04 4:54 PM
Hmm..
Customer is the boss.
If this is the requirement and there's no way around then we should find any way to populate internal table with serial numbers from 1 to some big number ideal will be 9999999999 (since vbeln is 10 digits.)
and then you will have to do:
DELETE itab where num NOT IN s_docno.
and then read this table for validating VBAK entries...
.. i hope you will find much better way to achieve this.
also do let me know once you got the solution. I will also keep thinking.
thanx,
ags..
‎2008 Jun 04 4:55 PM
A user entering this combination of criteria should get spanked, imo.
Does that make sense at all? Sorry, can't check, got to leave office now
‎2008 Jun 04 4:57 PM
Better solutions compared to previous:
TABLES: VBAK.
DATA: ITAB TYPE STANDARD TABLE OF VBAK WITH HEADER LINE.
DATA: L_VBELN TYPE VBELN.
SELECT-OPTIONS: S_VBELN FOR VBAK-VBELN.
START-OF-SELECTION.
* ITAB is the table which has all the records from the VBAK
*select * from vbak
* into table itab
* where vbeln in s_vbeln.
* Cration of test data
DO 10 TIMES.
ITAB-VBELN = SY-INDEX.
APPEND ITAB.
ENDDO.
* delete 4,5 and 7
DELETE ITAB INDEX 4.
DELETE ITAB INDEX 4.
DELETE ITAB INDEX 5.
READ TABLE ITAB INDEX 1.
L_VBELN = ITAB-VBELN.
LOOP AT ITAB.
IF ITAB-VBELN <> L_VBELN.
WHILE ITAB-VBELN > L_VBELN.
* missing. = l_vbeln
WRITE: / L_VBELN.
L_VBELN = L_VBELN + 1.
ENDWHILE.
ENDIF.
* assume next number
L_VBELN = ITAB-VBELN + 1.
ENDLOOP.
Regards,
Naimesh Patel
‎2008 Jun 04 5:04 PM
Naimesh,
Your reply is closest to the solution, I need to workon this.
Thanks all.
a®
‎2008 Jun 04 4:44 PM
Something like this:
DATA: L_VBELN TYPE VBELN.
LOOP AT S_VBELN.
L_VBELN = S_VBELN-LOW.
WHILE S_VBELN-HIGH < L_VBELN.
L_VBELN = L_VBELN + 1.
READ TABLE ITAB WITH KEY VBELN = L_VBELN.
IF SY-SUBRC <> 0.
* missing
ENDIF.
ENDWHILE.
ENDLOOP.
I know this is not the best solution. but you can make some workaround based on this:
Regards,
Naimesh Patel