cancel
Showing results for 
Search instead for 
Did you mean: 

useOneAsMany function: Queues Issues

Former Member
0 Kudos

Hi experts,

I'm facing an issue while trying to use the function useOneAsMany

In my requirement i have to map in different cases a header value as many times per each item it has,

1- mapping the document number (header value) in every item position of the item level in the target

2- In the same way, i have to do the same with different segments (Mapping the item number within each segment of the price conditions item)

I have to do it like that because the structure of the Idoc has those values always separated, having ITEM data, but at lower levels has the condition types, texts, and so on, so i have to do that link with the corresponding item number

I don't have problems using the function, but the issue is that the mapping fails when any of it's parameter is missing

- For example:

I'm mapping the item number per each ID of the TEXT segment, so i can present it like this:

ITEM NUMBER/TEXT ID/TEXT DESCRIPTION/TEXT LANGUAGE..

First position is correct but in the second one the TEXT Segment is not coming so the function fails stating the queues have to have of the same size, (TEXT ID is "SUPPRESS")

- How could i solve this issue?

The map fails even if that segment is not supposed to be generated (i'm generating the segment per TEXT segment in the source)! so i guess the function compile anyway? or maybe is because the function is executed only once but the queues are not correct

So i see that the function is really useful but if an empty values appears it raises an error

I

Any ideas?

Thanks!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

Use Map with default , so that if the field contains the value it will take the value , if its not there it won't throw any error

Regards,

jude

Former Member
0 Kudos

Thanks for the quick responses

I've tried using Mapwithdefault with no results,

the structure is an CRM IDoc: CRMXIF_ORDER_SAVE_U03

the structure is a bit complicated, having a header segment E101CRMXIF_BUSTRANS (1 structure) and within it, the different segments (PARTNERS, SALES DATA, PRICING CONDITIONS, SHIPPING DATA, etc 1.1, 1.2, 1.3 and so on)

and a item level E101CRMXIF_BUSTRANS_ITEM with the same segments as header value, which means that items also have partners data, sales data, pricing.. etc

So i only have the item number at the first segment and i'm required to link in my source structure so every segment created has the corresponding item position (as explained above, 1 item can have many partners, pricing conditions, etc)

That's why i'm using useOneAsMany, which works perfectly unless there's any missing data

For example, of 2 items, one has price conditions the other not, that causes that the queues logic fails

Maybe i'll have to do a workaround, but i'm surprised to find this issue because it means it won't work well if some data is not avaliable (is not mandatory to have pricing condition per each item)

I'll check that blog, although any help would be great!

Thanks!

Former Member
0 Kudos

Hi Alexis,

When we use the OneAsMany node function we have to send the data otherwise it throws an error.

So use map with default (give space value) function.

Input values to the OneAsMany function is Document numberafter add Map with Default function, Item node, Item node then output map to the corresponding field.

After OneAsMany use Split by Valu node function (Property is for each Value) later just before the target field use the below UDF (because target might be mandatory field).

Create UDF type as Queue

for (int i=0;i<value.length;i++)

{

if (value<i>.equals(""))

result.addValue(ResultList.SUPPRESS);

else

result.addValue(value<i>);

}

Here value is the input field.

Regards

Ramesh

Former Member
0 Kudos

Hi Alexis,

You can try with mapwithdefault function with spaces in it. Can you give the source structure and target structure so that somebody can help you out. Also you can see claus blog for some limitations with this function and how to overcome.

/people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool

Regards,

---Satish