2009 Dec 17 2:03 PM
Hello experts
Iu2019m writing a custom program and pulling data from VBAK & VBAP. As per requirement I also need to generate a sequence number randomly and finally store all data in text file and upload at server. The hiccup is I donu2019t know how to generate sequence numbers. Can somebody please show me how I can accomplish it?
Thanks a lot in advance
2009 Dec 17 2:10 PM
Hi ,
Use FM QF05_RANDOM_INT to generate random numbers.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
RAN_INT_MAX = '999'
RAN_INT_MIN = '000'
IMPORTING
RAN_INT = d_result
EXCEPTIONS
INVALID_INPUT = 1
OTHERS = 2
.
IF SY-SUBRC 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Hi ,
Use FM QF05_RANDOM_INT to generate random numbers.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
RAN_INT_MAX = '999'
RAN_INT_MIN = '000'
IMPORTING
RAN_INT = d_result
EXCEPTIONS
INVALID_INPUT = 1
OTHERS = 2
.
IF SY-SUBRC 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2009 Dec 17 2:07 PM
hi
for genetae a number you can use the function module
NUMBER_GET_NEXT.
input-Create a object from SNRO tcode.
2009 Dec 17 2:10 PM
Hi ,
Use FM QF05_RANDOM_INT to generate random numbers.
CALL FUNCTION 'QF05_RANDOM_INTEGER'
EXPORTING
RAN_INT_MAX = '999'
RAN_INT_MIN = '000'
IMPORTING
RAN_INT = d_result
EXCEPTIONS
INVALID_INPUT = 1
OTHERS = 2
.
IF SY-SUBRC 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
2009 Dec 17 2:31 PM
0 - your question is not exactly basic, but it does show a lack of willingness to find an answer on your own. Simply typing random and pressing F4 in SE37 returns a passle of hits.
Please search next time before asking.
Rob
2009 Dec 17 2:53 PM
Find the below code,
data: lv_range type datatype-char0128.
call function 'RANDOM_C'
exporting
len_min = 20
len_max = 20
char_min = 1
char_max = 20
importing
rnd_value = lv_range.
LV_RANGE param will have a random value..
If you need number you can use the FM "RANDOM_I4"
Thanks,
Prathap
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |