cancel
Showing results for 
Search instead for 
Did you mean: 

Suppress field in target xml

Former Member
0 Kudos

Hi everybody,

I have a problem with IDOC-XML mapping. In the target message type I don't want to create every field, I don't want them to display at all in the target xml. With complete tags it would be easy with createIf, but with a single field I don't find the solution. So an example:

Source (IDOC):

Z_SOMETHING 0..1

TECH (field)

Z_X (segment)

X1 (field)

X2 (field)

If the field tech = '1' then all the fields necessary so it is OK, but if tech = '2' then I need just the field X1, but the field X2 is unnecessary. Because the empty field is also an information for us, leave the field empty is not the solution.

I hope I described the problem properly.

Maybe there is a solution already in the forums, but this problem came sudenly and I have very short deadline to solve it, so I hope you can help me faster then if I would read all the topics.

Thanks in advance,

Csaba FERENCZ

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

I guess there are two solutions ...

one is to have two mappings and in the interface determination using the condition editor check whether TECH field is 1 or 2 and execute your mapping accordingly.

For ref : /people/suraj.sr/blog/2006/01/05/multiple-inbound-interfaces-within-a-service

Else use only one mapping itself and in it check for the value of TECH and map acordingly to other fields (but if your IDOC contains large heirarchy or lot of fields prefer the earlier method )

Answers (1)

Answers (1)

Former Member
0 Kudos

Is target structure also same ? Only the fields needs to be suppressed as the case may be ? and the TECH field are possible options only 1 & 2...?

If yes, pls try the following mapping(with the assumptions above)...

Source Target

Z_SOMETHING -- Z_SOMETHING

  TECH  -- TECH

  Z_X -- Z_X

    X1 -- X1

   TECH ---
            
   Z_X --    useOneAsMAny -- 
            /                
   X1 ----                    equalsS --   if(then) -- X2
                             /            /
                constant(1)            X2

Former Member
0 Kudos

Hi Renjith,

your help was very-very useful. With a little modification it was good.

I am going through the rest of the mapping and hopefully everything will work. I am gonna close this topic just if my whole mapping will work (maybe I need additional help)

So thanks again.

Csaba.

Former Member
0 Kudos

Thanks Csaba...Good to hear that....

Regards,

Renjith.

Former Member
0 Kudos

Hi Renjith,

the life not that simple as I thought.

If in test mode I duplicate the Z_X tree (because it can occurs in the real life) than I get the following error:

"Too many values in first queue in function useOneAsMany. It must have the same number of contexts as second queue."

What could be the problem with this?

Thanks,

Csaba.

Former Member
0 Kudos

Hi CSaba,

Are there more than one value for TECH field?

For every context change in the second queue for useOneasMany, there should be a value in the first queue...

Conversly for every value in the first queue there should be a context change in the second queue....

Could you write the values in the 3 input queues to the useOneAsmany function...

Thanks,

Renjith

Former Member
0 Kudos

Hi Renjith,

yes the tech field could have 2 values, 1 or 2.

The Z_X (real name: <Bank_Account>) tag always has 2 instances at runtime. The first with the tech = 1, and the second tech = 2.

The main requirement was that I need in the target xml two tags with different structure, but with the same name.

The first tag in the target message type:

<Bank_Account>

<Bank_Account_Type>DR</Bank_Account_Type>

<Bank>

<Bank_Route_Code>

<Code_Type>S</Code_Type>

</Bank_Route_Code>

</Bank>

<Account>

<Account_ID>CITHU</Account_ID>

</Account>

</Bank_Account>

************************************

second tag:

<Bank_Account>

<Bank_Account_Type>C</Bank_Account_Type>

(TECH1)-additional tech field

<Bank>

<Bank_Route_Code>

(TECH2)-additional tech field

<Code_Type>S</Code_Type>

<Code/>

</Bank_Route_Code>

<Bank_Address_Info>

<Name/>

<Street1/>

<Street2/>

<City/>

<Country>GBR</Country>

</Bank_Address_Info>

</Bank>

<Account>

<Account_Number/>

<Account_Address_Info>

<Name>KING LTD</Name>

<Street1>LINCOLN ROAD</Street1>

<Street2/>

<City>ENFIELD</City>

<Postal>EN1 1SB</Postal>

<Country>GB</Country>

</Account_Address_Info>

</Account>

</Bank_Account>

so the 2 structures has common parts, but there are differences as well.

Thats why I use a technical field. I fill the technical field at runtime, and I planned that during the mapping I build the different structures.

The source IDOC part is the union of the 2 structures, with the additional tech fields.

Maybe not my idea is the optimal solution, but I don't have that big experience.

Thanks,

Csaba.