cancel
Showing results for 
Search instead for 
Did you mean: 

How to add context change if minOccurs = 0 in an IDoc ?

Former Member
0 Kudos

Hi,

SAP help(http://help.sap.com/saphelp_nw04/helpdata/en/1f/ea0fb12403844bbb6c4cbc8a00cda9/frameset.htm) says if you want to add 4 context changes to a node of the segment, its minOccurs has to be equal to 4. But my IDoc has a node segment which has minOccurs is 0 ...9999 . So any idea how can I add n context changes in a segment if minOccurs is 0. For me the number of context changes is variable which I generate get from RFC look up.

thanks and regards,

Accepted Solutions (0)

Answers (2)

Answers (2)

sunil_singh13
Active Contributor
0 Kudos

Hi Rakesh ,

If I am not wrong then you will get the context change value from RFC that will say change context after say 3 values or 4 values or 1 value .

Let me cleare one thing that context change has nothing to do with Min Occurence and Max Occurence . it indicates how many times that node can be created .

Well if you wish to cahnge context dynamicly then you have to use UDF for that

Take input from RFC for after how many values you have to add contaxt change use for loop and

say result.add(ResultList.CC) for context change .

if you wish to cahnge context after each value then you simlpy has to use Split by value that will change context for each value

Reward points if Helpful

Thanks

Sunil Singh

Former Member
0 Kudos

Hi Sunil,

Whether I use splitByValue or UDF to do my context change ...the target does show only the first segment. It does not show the others and the reason what I found from SAP help is that minOccurs has to be greater than 0 and equal to the number of segments which you need. SAP also says the same thing what I am facing. when I tried to do the way SAP help says , it works then.

This help link about splitByValue says the same thing about minOccurs. http://help.sap.com/saphelp_nw04/helpdata/en/1f/ea0fb12403844bbb6c4cbc8a00cda9/frameset.htm)

Even I am having hard time to believe this what SAP help says that's why I want confirmation from all of you on this.

thanks,

rakesh

Former Member
0 Kudos

Hi Rakesh,

1) You can use splitByValue function to change the context.

2) If u r using UDF the use ResultList.CC to context change.

Refer this,

http://help.sap.com/saphelp_nw2004s/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

Regards,

Rohit.

Reward points if helpful

Former Member
0 Kudos

Hi Rohit,

Even I had the same thoughts but it doesnot work . The sap help link clearly says that minOccurs of the node has to be 4 if you want to have four nodes by splitByValue. Any idea???

thanks,

rakesh

Former Member
0 Kudos

Hi Rohit,

The min occurance you give corresponding to a node means that the node must occur that number of times under its immidiate partent atleast.

here in your case the min occurance of the node is 0.means that it is optional within its immidiate parent node. and the max occurance is unbounded

So, if you use splitByValue() function to generate the node under different header. then it will work fine.

if you are getting any error while testing the mapping then let me know the same.

--Sankar Choudhury

Former Member
0 Kudos

Any Ideas Friends?

thanks,

rakesh