Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Count function.

Hi Folks,

I have a quick question for you guys. Can any body help me in my mapping.

My problem is ...

I am having a field in sender structure which can hold values like A, B, and C. I just like to know the count the existance of that perticular field which hold the value "C".

note that this field may exists in multiple contexts and multiple times in each context.

Example below.

<Node>

*****<Node>

***********<Node1>

****************<Field1 - A>

****************<Field1 - B>

****************<Field1 - B>

****************<Field1 - C>

****************<Field1 - C>

****************<Field1 - A>

***********<Node1>

****************<Field1 - A>

****************<Field1 - B>

****************<Field1 - C>

****************<Field1 - C>

****************<Field1 - C>

****************<Field1 - A>

***********<Node1>

****************<Field1 - A>

****************<Field1 - B>

****************<Field1 - A>

****************<Field1 - A>

****************<Field1 - B>

****************<Field1 - A>

If i got the sender structure like this i need the out put as

<Node>

*****<Field1 - 2>

*****<Field1 - 3>

*****<Field1 - 0>

Please let me know any body have inputs.

Regards,

Ramana.

Former Member
Former Member replied

Hi,

Are you sure the field name is same within one context ? I'm doubtful about that.

But if your structure is

<Node>

*****<Node>

***********<Node1>

****************<Field1 - A>

**********</Node1>

<Node1>

<Field1 - C>

</Node1>

<Node>

<Node>

Using if without else, check the value is 'C'

in the then part use the counter function, with increment by 1.

one thing here is that you cannot have field1 in the same context 3 times. You might have to create something like this.

<Node>

<field1>2</field1>

</Node>

<Node>

<field1>3</field1>

</Node>

<Node>

<field1>03</field1>

</Node>

And as many times the Node appears. In short for each Node, you will count how many times the Field1 has value C

Hope this helps.

regards,

Advait

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question