Application Development 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: 

Code for counter logic

Former Member
0 Kudos
280

Hi,

I am planning to write a code in start routine for an ODS update rules where I need to populate document number.

I already have some code but having some difficulty in finishing it. Below is the code I was talking about.

data: lv_random(5) type c.

CALL FUNCTION 'QF05_RANDOM_INTEGER'

EXPORTING

RAN_INT_MAX = 99999

RAN_INT_MIN = 1

IMPORTING

RAN_INT = lv_random

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.

Loop at data_package.

concatenate 'B' sy-uzeit+2(4) lv_random into data_package-ac_doc_no.

modify data_package.

lv_random = lv_random + 1.

endloop.

clear lv_random.

There is no doc number in data package from source ODS. How can I write then.

Can anyone give me some input to finish this? How can you write this for an ODS.

Thanks,

AB

3 REPLIES 3

Former Member
0 Kudos
94

Maybe your question would be better in a different forum, like (just guessing)?

Anyhow, not quite sure I understand what you're trying to accomplish. Are you possibly looking already at aggregated data and that's why there's no document number? If for some strange reason you need to generate numbers, you're better off with using function module GUID_CREATE, which is designed to create a unique identifier.

Cheers, harald

0 Kudos
94

Thanks for the suggestion. I will do that.

Former Member
0 Kudos
94

opening in BI