cancel
Showing results for 
Search instead for 
Did you mean: 

Incrementing a constant value in XI messages

Former Member
0 Kudos

Hey Guys! I'm trying to find a way to increment a given value, for example '1426', by '1' every time a new message is created and pass it to a field in a target system.

Mesg ID. 000100 > '1426'

Mesg ID. 000101 > '1427'

Mesg ID. 000102 > '1428'

Mesg ID. 000103 > '1429'

I've tried using the 'index' function, but it doesn't seem to want to work. Is there anything else I should be doing, or anything I might have overlooked? Thank you all so very much!

Best Regards,

Glenn Bumanlag

Accepted Solutions (0)

Answers (1)

Answers (1)

bhavesh_kantilal
Active Contributor
0 Kudos

Glenn,

Do you want to increment the value across different mappings or across the same instance of the mapping.

If it is the latter, then use Global Variables . Check this blog,

/people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14

Regards,

Bhavesh

Former Member
0 Kudos

Hello Bhavesh!

Thanks for your reply. What I would just like to happen is to increment an initial value every time a new message referring to a specific mapping is created. For example, if I declared in XI that a field has a starting value of 1246, the preceeding messages should pass a value of 1247, 1248, 1249, etc. to that field. Is there a way to do this using the standard functions provided by XI(ie. Counter, Index, etc)?

Former Member
0 Kudos

Hi Glenn,

I don't think that there is anything available that is kept across different message flows of the same interface ( those functions like counter etc..only work inside 1 message mapping )

So unless you can use one of the message header fields for this purpose ( but they only offer GUIDS, dates and time etc..), I think you need to keep the counter in your own database.

IF you prefer the ABAP side, I would create a simple table to keep the index per interface and use a first mapping step ( either XSLT or ABAP class ) only to fill the field with the new latest index.

If you prefer JAVA, you can of course do the same on the JAVA side and e.g use an UDF,

Not sure if it's the optimal solution, but it will work,

regards

Dirk

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

there's also one more reason why you should

keep this value in DB:

what if you ever need to change it?

repost the same value of something like that ?

(in case of error) or what if the mapping with the counter

would get tranported (with changes) one more time?

then the value would begin with the first one again...

you need to take those into consideration too:)

Regards,

michal

-


<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>