You, basically, don't need a procedure. Just create a field (input must be allowed) that is long enough to hold value read by a hand scanner.
Of course, when you have that field populated, you can write a simple query to extract parts of it if necessary.
For example, you read something like 0387779-23-08045.
When you read this value from a document, it is stored into a field named PNB. Next, you'll do something like:
:ID := SUBSTR(:pnb, 1, 7);
:vk := SUBSTR(:pnb, 9, 2);
:mmyy := SUBSTR(:pnb, 12, 4);
:k := SUBSTR(:pnb, 16, 1);