cancel
Showing results for 
Search instead for 
Did you mean: 

Help on counter

Former Member
0 Kudos

Hi All,

In my IDOC there are three item segments E1J3AIT, E1J3AIS, E1TXTH9.They are linked to three different structures SI1, SI2, SI3. I am creating a flat file.

In the target structure there is one common field counter. Now if my first segment has 3 items, 2nd segment has two items and if my 3rd segment has 3items my counter field in my output should start from 0 and end with 8. How can I achieve this? Your help will be highly appreciated.

---Satish

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi all,

Need to ask smething about the counter to generate the sequence numbers and pass it to the target field.

If we use the Global containers, then say if the app server goes down, the current count will also vanish. Am I correct?

So thats the case, then we should use the DB lookup for the same?

Also, the INDEX function in the Statistics part in the GUI of Message Mapping, how much that is helpful?

Respond back at the earliest possible.

Thanks in advance.

Neetesh

Former Member
0 Kudos

Hi Satish,

You can create simple UDF to generate sequence numbers one by one keeping track of the sequence number previously generated. The latest number to be stored in global container and to be sent out as output.

The output of the function can then be assigned to the counter field of all the segments in target Message.

Regards

Amit

Former Member
0 Kudos

Hi Satish,

Define a user Java function that increments a global variable and returns it. You can define an additional user function to return the value without also incrementing it.

You can press the "java sections" button (in the message mapping toolbar) and define the variable over there.

//increments the counter

public String BeginCounter(Container container){

gCounter = gCounter + 1;

return "" + gCounter;

}

//returns the value of the counter

public String GetCurrentCounter(Container container){

return "" + gCounter;

}

Good Luck,

Ofer