on 09-20-2007 11:56 AM
Hw to generate 5digit unique random number followed by timestamp in output file name?
Is there any function in XI helps to meet this req?
The best and the cleanest solution is to use AddMessage ID in the file adapter. The message id is always unique. Why do you want it to be only a 5 digit number? Can't a unique sequence of characters do the trick instead?
Regards
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Iñaki Vila
This is my sample output file name 20092009NNNNN.
Here NNNNN is the 5 digit random unique number i.e [
b]the last 5 digits shld be unique.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Naresh,
the only way to make sure it is unique is by maintaining a table (a ZTable in ABAP for example) and storing the already used names.
Do you actually need them to be random? Because if they only need to be unique, just create a table and a simple rfc that reads the table value, increments it and saves it again in the table. By always incrementing, you make sure they will be unique.
Regards,
Henrique.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you use Henrique solution you must use an ABAP Mapping.
Abap Mapping help: http://help.sap.com/saphelp_nw04/helpdata/en/10/5abb2d9df242f6a62e22e027a6c382/frameset.htm
I edit with add this two very interesting blogs:
-/people/r.eijpe/blog/2006/02/19/xml-dom-processing-in-abap-part-iiia150-xml-dom-within-sap-xi-abap-mapping
-/people/r.eijpe/blog/2006/02/20/xml-dom-processing-in-abap-part-iiib150-xml-dom-within-sap-xi-abap-mapping
Message was edited by:
Iñaki Vila
Hi Iñaki Vila
As per the java code that u mentioned above, Is it generates UNIQUE RANDOM number?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you can make an user function with this code java:
import java.util.Random;
Random rnd = new Random();
return Integer.toString(rnd.nextInt(99999) + 1);
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
use the code mentioned by Inaki and then implement the same via dynamic configuration and adapter specific properties in your mapping to achieve the result.
ref:
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.