cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping N to 1 fields

Former Member
0 Kudos

Hi ,

Currently, i have scenario like N..1 mapping

Source field :

i have segment E1ADRM1 ( occurence 0..99 )in that two field partner_id and partner_q.

target Field : I1NPT00 (0..1)

i have PHSHTO and PHSOTO

my condition is if partner_q has pass value "WE" than value is pass to PHSHTO

my condition is if partner_q has pass value "AG" than value is pass to PHSOTO

on target side there is occurence 1..1.

i developed logic , it's working fine, but the problem is if first condition satisfy

than it will not ask for second conditions.

like i have two E1ADRM1 segment , first segment contains "WE" and second contains "AG" but if first condition satisfy it will not ask for second:

While i required in every repeting segment, it;s check conditions...

waiting for positive reply.....

regards

Bhaumik

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello Bhaumik,

You can develop both mappings (the one for PHSHTO and the one for PHSOTO) completely independently. You may apply a typical filter mapping (you'll find an example in SWCV SAP BASIS, namespace <i>http://sap.com/xi/XI/System/Patterns</i>.

You simply have to take care of the occurrence of both target fields. You wrote that it is set to 1..1 which might create problems at runtime if the filter removes values. In this case you probably have to apply a defaulft value (mapWithDefault).

Best regards

Joachim

Former Member
0 Kudos

Yet, i didn't find solutions , if anybody please help me...to find my solutions

Former Member
0 Kudos

Hi,

We can make it check for all occurences of E1ADRM1, but whats the logic on the target side.

Will each occurence of E1ADRM1 create a I1NPT00?

If thats the case, you need to change the context of E1ADRM1 in your logic itsel. I think it should work.

Regards,

P.Venkat

Former Member
0 Kudos

hi venkat

there is two target node maped with same source fied.

that source segment is repeat while target is not check same condition again

Target side logic is

bhavesh_kantilal
Active Contributor
0 Kudos

Bhaumik,

TO add the 2 condtions, right click on your target node / element,select option "duplicate subtree" in the mapping editor. Now, add each condition to each node.

Regards,

Bhavesh

Former Member
0 Kudos

hi

Bhavesh

Can you please tell me in more details

Former Member
0 Kudos

"

i will check with duplicate subtree

but my problem is N..1

there E1EDL1 segment Repeat while tager side only two field we have to mapped

so if first E1EDL1 segment satisfy the condition it will not check other condition

former_member189558
Contributor
0 Kudos

Bhaumik,

If I understand correctly .. you need to check for the first logic for all the subsequent source segments...

That case you need to use a que function... check my earlier post....

Cheers,

Himadri

Former Member
0 Kudos

hi

can you please tell me where is que mapping

regards

Bhaumik

former_member189558
Contributor
0 Kudos

Bhaumik...

It is loke accepting the source in an array and the output is also a array....

That case you have complete contol of all the source occurance for the fields .. which will be passed on to your Que funcion as a que / or array..

you have to loop through them and build up the output que / array....

Cheers,

Himadri

Former Member
0 Kudos

hi

i used que mapping

but the problem is E1ADRM1 segment is repeat, in that partner_q and partnet_id value is also chage

so i want to check if partner_q is equals WE than map with PHSHTO

otherwise if partner_q is equals AG than map with PHSOTO

but in both tyme partner ID value is different...

so i will try que mapping it put same partner_id into PHSOTO and PHSHTO

while i want different value....

waiting for your positive reply

former_member189558
Contributor
0 Kudos

Bhaumik,

For que mapping set the context of partner_q and partner ID at the idoc level ---(This will bring in all the values from all the repiting segments)

Inside the function in a loop check for partner_q is equals WE and populate the output as you require... and you can set a flag here to note that first condition satisfied.....

If the first condition is not satisfied then check for the second condition...

You basically have to form the programming logic here...

Cheers,

Himadri

Former Member
0 Kudos

but E1ADRM1 segment is repeit

<E1ADRM1 SEGMENT="">

<PARTNER_Q>WE<PARTNER_Q>

<ADDRESS_T/>

<PARTNER_ID>1001<PARTNER_ID>

</E1ADRM1>

<E1ADRM1 SEGMENT="">

<PARTNER_Q>AG<PARTNER_Q>

<ADDRESS_T/>

<PARTNER_ID>1002<PARTNER_ID>

</E1ADRM1>

i want to map these field to I1NPT00 (occurence 1..1)

in that there is two fields like

PHSHTO

PHSOTO

So if partner_q is equals WE pass partner_id

So if partner_q is equals AG pass partner_id

So i write function and write logic also but E1ADRM1 is diffrent node , that;'s why it i am confuge

I hope that i explain my question properly ,

and also waiting for all positive reply

former_member189558
Contributor
0 Kudos

Bhaumik,

It is difficult to tell the exact logic -- however:

1) You need to map PHSHTO PHSOTO separately...

2) Even if there are multiple segments E1ADRM1 you need only one pair of PHSHTO and PHSOTO in the target is that right... ? Then you pass only one output to the target....

There is an alternative of using the global container as well...

Cheers,

Himadri

Former Member
0 Kudos

Hi Himadri,

one source you understand perfectly, but on target side INPT00 ( node) and in that there is two node PHSHTO , PHSOTO and i have to map with

E1ADRM1 -> check partner_q if "WE" : send partner_id -> PHSHTO

E1ADRM1 -> check partner_q if "AG" : send partner_id -> PHSOTO

and B'se of E1ADRM1 segment is repeated partner_id value is different...

if you have any dought on my question , please let me know

waiting for your reply

Bhaumik

former_member189558
Contributor
0 Kudos

Bhaumik,

Here can you paste a source XML with multiple E1ADRM1 segments ( keep the message small though) .. and also an expected target message xml....( You can create a target XML manually) ... ..

This will help us understand better ...

Cheers,

Himadri

former_member189558
Contributor
0 Kudos

That case you have to go for que mapping...with inputs partner_id and partner_q..

and for the logic inside the code...

Cheers,

Himadri

Changed the input field names.. .. )

Message was edited by:

Himadri Chakraborty