cancel
Showing results for 
Search instead for 
Did you mean: 

Real Time Counter

Former Member
0 Kudos

Hi all,

I have a problem regarding Real time counter. I have a field in the output structure that have unique values. The name of the field is unique document name.

For example I sent a message today with a unique doc name of test-00001. How can I send another message so that its unique doc name would be test-00002? The message could be sent anytime (right after test-00001 or tomorrow).

I understand that we can set counters for messages that are passed from 1 source. What if there are multiple sources?

Regards,

IX

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

if the name of document name in message is unique ,not a constant value then you can pass this value using Dynamic configuration UDF.

Raj

Former Member
0 Kudos

the document name is unique but it is a constant. i mean the first document that will be transferred to CLM will have a doc name of test-00001 then the second will be have a doc name of test-00002. How can I do the dynamic UDF? please help thanks!

former_member200962
Active Contributor
0 Kudos

Check the option 1 mentioned in this blog: /people/shabarish.vijayakumar/blog/2009/10/05/pixi-maintaining-sequence-numbers-in-file-name-scheme

From what I understand docName is the name of a node in your target structure and not the name of your target file....if this is the case you dont need Dynamic Configuration.

Regards,

Abhishek.

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi ,

send the document name in inoput message as orgument to UDF,

here str1 is the argument i used.use same logic..

i hope it will work finr

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

// change to new file name

conf.put(key, STR1);

return "";

Regards,

Raj

Former Member
0 Kudos

Hi, the unique doc name that I'm talking about is a field in the output. not the filename. How can I output a value that has a counter in an output field in the output message. For example, in field unique_doc_name, the 1st message passed should have the value test-00001. In the second message, field unique_doc_name should have a value test-00002. The third message, test-00003.. and so on.. How can I do this in the mapping? Thanks everyone!

rajasekhar_reddy14
Active Contributor
0 Kudos

refer abishek replay....the blog he mentioned will help you..

Former Member
0 Kudos

Hi,

Since you need the unique name in the target & the message coming to XI are indepenedent of eachother. You need to relay on any external DB for acheving this..

Maintain a variable in any external DB and try to reterive it and increment the value and pass the value to output using a lookup from the XI mapping.

You can use RFC, SOAP or JDBC adapters for this lookup based on the DB you wish to use.

this feature will be similar to the functionality provided by seeburger variables in EDI integration.

Regards,

Sunil.

0 Kudos

Hi,

You can use a Container object in udf for this purpose.

Regards,

Ramya

Former Member
0 Kudos

Container object in the mapping will help only if you are dealing with a the same message instance.

Since the case in hand is multiple messages coming into XI -- no corrleation between the messages... you need to relay on an external DB to acheive the unique target information.

Former Member
0 Kudos

Hi Sunil,

I'm not an expert in DB but I believe I can use your suggestion. Is it okay if I use an ABAP table?

former_member187339
Active Contributor
0 Kudos

Hi Igantius,

>>I'm not an expert in DB but I believe I can use your suggestion. Is it okay if I use an ABAP table?

Yes you can maintain the counter in a z table and then access it in message mapping (using the standard RFC lookup function). The functionality of this look up RFC will be to take the previous value and update the z table with an incremented value..

Regards

Suraj

former_member190389
Active Contributor
0 Kudos

Hi,

I am not sure but have you tried the edit java sections in the message mapping, there they are having global variables section which can be used for the counter, i guess

Regards

Former Member
0 Kudos

> I'm not an expert in DB but I believe I can use your suggestion. Is it okay if I use an ABAP table?

Yes, Create an z-table in R3 and store the current value (only) in the table and then use RFC LookUp to fetch the updated value from the R3 table.

Regards,

Sarvesh

Former Member
0 Kudos

Thanks minna - san. I will try to look for an RFC lookup in the other threads.

Former Member
0 Kudos

Hi, Can I use RFC_READ_TABLE even in writing data into the table? From what I have read, I can only use RFC_READ_TABLE for fetching data from the table. How can I increment the counter in the table?

Former Member
0 Kudos

Hi,

There are no standard RFC which can be used for your case.

Build a z-RFC to increase and retrieve the counter value stored in a z-table.

Regards,

Sunil

Former Member
0 Kudos

Hi Sunil, Could you please explain further? How can I create this ZRFC? Will it be ZRFC_READ_TABLE? How can I create this in such a way that it can write in the table? There's no standard for this wrtie function? That means using real time counters is really complicated..

Former Member
0 Kudos

Hi, I have read this blog:

/people/shabarish.vijayakumar/blog/2009/10/05/pixi-maintaining-sequence-numbers-in-file-name-scheme

Number 1 states that, "1. Maintain a table in SAP. Use/Code a RFC call to lookup the sequence number from this table, incrementing the value after it is read. " How can I increment the value in the table? I have searched SDN and found codes on how to read from a table, not to write in a table. Can anyone provide me with a sample UDF on how to write in a table (like RFC lookup). Thanks so much!!!

Former Member
0 Kudos

HI,

Just red these comments from the same blogs. See if it helps you in your case otherwise you have to go for creation of custom z-table.

Why ot just use the built in counter for the file name? In the receiver File communication channel, Processing tab, 
set the file construction mode to Add Counter, and then set the counter parameters accordingly.
This is a standard feature and requires no workaround... 
Why not use the built-in counter?

2009-10-06 06:17:01 Shabarish Vijayakumar Business Card
the limitations of that would be my point 5;

5. Counter option in the adapter - Only helps if you are using the NFS protocol 
and also only if the counter is needed at the end of the file name (before the file name extension)

Regards,

Sarvesh

Former Member
0 Kudos

sorry singh but i'm not adding counters to the file name but instead to a field in the message structure.

Former Member
0 Kudos

Ok, so my advise is, first you go through this link and understand the concept of RFCLookup along with creating a Z-FM as mentioned in this document then you can simulate your solutions with this one.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70d90a91-3cf4-2a10-d189-bfd37d9c3...

If you are not very much comfortable in ABAP then take help from any of your ABAP colleague.

Former Member
0 Kudos

thanks singh! i already asked my ABAP friend to create an FM that will act as a counter. Problem is, I don't know how to call that function in my JAVA UDF in the XI mapping. Does anyone know how to code that in the UDF? (ABAP FM call)

former_member187339
Active Contributor
0 Kudos

Hi Ignatius,

If you are in PI7.1, then you can make use of the standard RFC lookup function in graphical mapping (under conversions)

Else take the code from this documents:

/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b...

Regards

Suraj

Answers (1)

Answers (1)

Former Member
0 Kudos

better option is to add datetime with filename