cancel
Showing results for 
Search instead for 
Did you mean: 

IDoc to File mapping

Former Member
0 Kudos

Hello Every one,

I am currently working on a INVOICE IDoc to File(XML) interface. I have got a requirement like map E1EDP26-BETRG when Qual ="003" i have done it but on the source side the feild is occuring more than one time i mean there is one more E1EDP26-BETRG when Qual ="003" value comming from source side and the requirement is it should appear on the source side. i want to know how i can achive this.

Accepted Solutions (0)

Answers (2)

Answers (2)

zameerf
Contributor
0 Kudos

Hello,

You can try this,

Map this to the target node (right click QUALF and change the context to E1EDP01).

Then 1 to 1 mapping for field BETRG.

Scenario 2:

If target node mapping is something like,

generate as many target nodes as no of items in source(E1EDP01),

then just do this below mapping to field BETRG at target.

iaki_vila
Active Contributor
0 Kudos

Hi Swetha,

Let me explain if i understand well your requeriments:

Your XML source  has a field E1EDP26-BETRG that can occurs 0..unbound times. When Qual ="003" (What is qual an attribute from BETRG or a field in a subtree?), i supposse that whe qual != '003' you don't need make the mapping.

If you show us your xml source structure could help us to find the best resolution way.

If i'm right, you could use at first the function exits (quals) in order to know if the node really exists and later if this is true, to compare with function equalsS with the constant '003' and you should care with the contexts.

May be the problem could be in the structure and the field qual could be in several contexts. In this case may be the best is to do an UDF.

Regards.

Former Member
0 Kudos

Hi Vila,

I think i confused you, sorry about that I will clearly explain. I am sending you my source xml, its actually a Invoice Idoc. The source file has E1EDP01 segment occuring twice. under the sam element we have  E1EDP26-BETRG occuring. My requirement is i have to map  E1EDP26-BETRG to target side filed named Value when Qual=003.

You can notice E1EDP01 filed occuring twice. i want to map it to Value filed in the target twice twice.

I have done it but only value from the first E1EDP26-BETRG is comming on target side in both cases. Hope i made it clear

                                                         

E

Former Member
0 Kudos

Hi Swetha,

If I understand well, at the moment you have 2 value on the source side but you have only get one in  the target side, I'm right?

If yes, verify the context of BETRG, I think you use IfWithoutElse so you must have the same context for the field on the condition and the result, after you can use SplitByValue(Each value).

Hope this could help you

Former Member
0 Kudos

Hello Jo,

You are rite, but i am bit confused where exactly i have to use SplitByValue. Can you please explain breifly

iaki_vila
Active Contributor
0 Kudos

Hi Swetha,

Thanks!, i think that i know now your requeriments, you have several E1EDP26 belong to E1EDP01 and you want to map if E1EDP26 occur with QUALF = '003'. For example:

<E1EDP01 SEGMENT="1">

            <POSEX>000020</POSEX>

            <MENGE>1.000</MENGE>

            <MENEE>EA</MENEE>

...

            <E1EDP26 SEGMENT="1">

                <QUALF>011</QUALF>

                <BETRG>4.25</BETRG>

            </E1EDP26>

            <E1EDP26 SEGMENT="1">

                <QUALF>003</QUALF>

                <BETRG>0.22</BETRG>

            </E1EDP26>

            <E1EDP26 SEGMENT="1">

                <QUALF>001</QUALF>

                <BETRG>425</BETRG>

            </E1EDP26>

            <E1EDP26 SEGMENT="1">

                <QUALF>003</QUALF>

                <BETRG>425</BETRG>

            </E1EDP26>

Target:

<E1EDP01_TARGET SEGMENT="1">

            <POSEX>000020</POSEX>

            <MENGE>1.000</MENGE>

            <MENEE>EA</MENEE>

...

            <E1EDP26_TARGET SEGMENT="1">

                <QUALF>003</QUALF>

                <BETRG>0.22</BETRG>

            </E1EDP26_TARGET>

            <E1EDP26_TARGET SEGMENT="1">

                <QUALF>003</QUALF>

                <BETRG>425</BETRG>

           </E1EDP26_TARGET>

You could follow the Jo solution or to make an UDF. The UDF should take "All values from context" you provide like context EDP01 context. You take as parameters QUALF and  BETRG. Inside the function you make a "for" statement to take every value of QUALF and BETRG, if QUALF = '003' you make an ResultAddValue(BETRG[countfor]) in order to have the value in the queue output.

Regards.

Former Member
0 Kudos

Hello Vila,

You are absolutly rite, but i have now idea about Java, can you please tell me the alternative split by value method. i mean can you breifly explain or show where i have to use that splitbyvalue function.

Regards

Swetha

Former Member
0 Kudos

Swetha,

I think something like this , you can ignore SplitByValue 

former_member184681
Active Contributor
0 Kudos

Hi,

You can use the following mapping to stick to PI standard, no need for UDFs:

E1EDP26 (source node) -> equalsS( constant(003) ) -> createif -> E1EDP26 (target node)

QUALF -> QUALF

BETRG -> BETRG

The first mapping will control the creation of the whole E1EDP26 node. Then you create mappings for the sub-fields of E1EDP26 as straight 1:1 mappings.

Hope this helps,

Greg