cancel
Showing results for 
Search instead for 
Did you mean: 

how to get IDOC segment occurence

Former Member
0 Kudos

Hi All,

I am trying out IDOC to File scenario and facing a problem due to repetition of segments in IDOC.

Requirement is to repeat the field in output file base on the segment occurance.

i am trying to map the record set of target file structure to the most repeating segmetn in the Souce IDOC so that i can get the repetion.

Is there any way to identify which segments repeats the most of times?

can we map a segment to target record set in where in we count all the segment occurance and get the most repeating segment and map it to target in udf itself.

is there any direct function whcih can be used in UDF to map one segment to a recordset?

Regards,

Anika

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi all ,

I want to get the count and repeat the record set in the target structure based on the maxium count.

I am trying to write a UDF which gives the maximum repeating nodes count.I can get the count easily ,but how to map the segmetn with max count to the target data set do that it repeats.

Presently wht i did is lk i mapped one to one IDOC to file , when IDOC is triggerd (it triggered with say 10 details) ,only once the record in file is repeating.actually the file shd contain 10 records.

Regards,

Anika

Shabarish_Nair
Active Contributor
0 Kudos

1. use the wiki logic on each repeating node

2. that will give you the counts for each repeating node

3. now write a node with each count as input

4. check which is the maximum

5. then use a logic as below

assume that max_occurance variable contains the maximum repeating nodes count

then

for(int i = 0; i < max_occurance; i++)
{
result.addValue("");
}

use that UDFs output and it will create that many occurances on the target side

former_member200962
Active Contributor
0 Kudos
I am trying to write a UDF which gives the maximum repeating nodes count.I can get the count
 easily ,but how to map the segmetn with max count to the target data set do that it repeats.

have you checked the diagram in wiki....here i have applied the logic for two source nodes....you can extend the same for the nodes which you think will repeat...you need to identify them from your IDOC....also you may need to change the context of the source node to get the desired number of repeatitions...

Regards,

Abhishek.

Former Member
0 Kudos

Did you define the mapping for the target node structure ,The mapping for this node should be such way that which should define the occurences ,in this case map the source node which occured multiple times

Rajesh

former_member581827
Participant
0 Kudos

Hi,

Is the occurence of target element changed to 0 to unbounded?

Regards,

Chandra.

Answers (3)

Answers (3)

former_member581827
Participant
0 Kudos

HI,

Even you can go to WE31 transaction and give the segment name it will show how many times that segment maximum can occur.

Even you can see in occurences of IDOC structure for particular segment also.

Regards,

Chandra.

former_member200962
Active Contributor
0 Kudos

no udf needed in this case....just check this diagram:

SDN --> WIKI --> Process Integration --> Attachments --> Serach For diagram with name Count and comment Count Logic..

Regards

Abhishek.

Shabarish_Nair
Active Contributor
0 Kudos

https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/countofRecords-%2527Countontheeasiestway+through%2527

you can always get the count of any node as mentioned above

You can use this logic and then create your own