cancel
Showing results for 
Search instead for 
Did you mean: 

IDOC Mapping.

Former Member
0 Kudos

Hi All,

I have a scenario like this

Source:

Organisation(0...Unbound)

->TAG019(0...Unbound)

-> Custno(1..1)

-> System ID(1..1)

Now in the target I have a field called SORTL which needs to be filled with Custno, when SystemID is "2".

and one more thing is I am creating IDOC's only when SystemID is "1"

Example:

Organisation(0...Unbound) value

->TAG019(0...Unbound)

-> Custno(1..1) XYZ

-> System ID(1..1) 1

->TAG019(0...Unbound)

-> Custno(1..1) Test

-> System ID(1..1) 2

Then I need to create IDOC for systemID "1" which is working

and I need to pass the Value "Test" of Custno, when SystemID is "2" to SORTL(which is my target)....which is mot happening.

I have written an UDF for this which is working fine when the scenario is like above.

public void createSortL(String[] a,String[] b,ResultList result,Container container){

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

if(a<i>.equals("2")){

result.addValue(b<i>);

}

}

return;

But it fails when the scenario is other way.like this when 2 comes first, where i need to pass XYZ.

Organisation(0...Unbound) value

->TAG019(0...Unbound)

-> Custno(1..1) XYZ

-> System ID(1..1) 2

->TAG019(0...Unbound)

-> Custno(1..1) Test

-> System ID(1..1) 1

can u please let me know wht is wrong?

Regards,

Chaitanya.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kumar,

I'm not sure what you'd like to do. Can you please provide a sample source XML message and the expected target XML message? Maybe it'll become more clear.

BR

Holger

Former Member
0 Kudos

Hi Holger,

Here is the source xml

<?xml version="1.0" encoding="UTF-8"?>

<Root>

<MessageHeader>

<MessageID>

<MessageIDSystem>SCV</MessageIDSystem>

<MessageIDType>FE</MessageIDType>

<MessageIDIdentifier>CUSTOMER_MASTER</MessageIDIdentifier>

</MessageID>

<MessageReleaseNo>0004</MessageReleaseNo>

<MessageVersionNo>00</MessageVersionNo>

<MessageOrigApplID>SCV</MessageOrigApplID>

<MessageDestApplID>BROKER</MessageDestApplID>

<MessageInterfaceID>IDD088</MessageInterfaceID>

</MessageHeader>

<MessageBody>

<SCVData>

<SCVHeader>

<SCVMessageId>SCVFE004</SCVMessageId>

<SCVMessageVersion>000004</SCVMessageVersion>

<MessageSendTime>2007-10-17 01:08:42</MessageSendTime>

<MessageSequenceNumber>13220833</MessageSequenceNumber>

<NumberOfRecords>9</NumberOfRecords>

<ErrorCode>0</ErrorCode>

<ErrorDescription/>

</SCVHeader>

<ORGANISATION>

<TAG001>

<SCVEntity>ORGANISATION</SCVEntity>

<SCVAction>UPDATE</SCVAction>

<ChangeTime>2007-10-17 01:08:42</ChangeTime>

</TAG001>

<TAG019>

<LegacyCustNoID>1</LegacyCustNoID>

<custNo>5049001112</custNo>

<legacyCustNo>NZ9001112</legacyCustNo>

<previousLegacyCustNo/>

<legacySystemId>1</legacySystemId>

</TAG019>

<TAG019>

<LegacyCustNoID>1</LegacyCustNoID>

<custNo>5049001112</custNo>

<b> <legacyCustNo>NZ;OCEANBID;HQ</legacyCustNo></b>

<previousLegacyCustNo/>

<b><legacySystemId>2</legacySystemId></b>

</TAG019>

</ORGANISATION>

</SCVData>

</MessageBody>

</Root>

Now if u see the bold section, when LegacysystemID is 2 then I need to pass legacyCustNo to target field SORTL.. With my code it is working fine in this case, but when the TAG019 with LegacySystemID "2" occurs first then I am not getting the required Value.

Regards,

CK

Former Member
0 Kudos

HI,

You need to take the value in array.

if(a<i>.equals("2")

{

result.addValue(b<i>)

}

This will work.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

I think there is somthing missing in UDF.

wtire a(i) and b(i)

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi Chirag,

I have used this code, and Iam getting this error..

if(a.equals("2"));

{

result.addValue(b);

}

Source code has syntax error:

/usr/sap/XD1/DVEBMGS81/j2ee/cluster/server0/./temp/classpath_resolver/Map4741f7208dfd11dc90620018714e8238/source/com/sap/xi/tf/_IDD088_SCV_to_SAP_LOC_ORG_MM_.java:1478: addValue(java.lang.String) in com.sap.aii.mappingtool.tf3.rt.ResultList cannot be applied to (java.lang.String[])

result.addValue(b);

^

1 error

Please let me know what is wrong.

Rgds,

Kumar

Former Member
0 Kudos

Hi,

If you are using for loop and you are incrementing the value of i then u have to use the array as I said use a(i) and b(i).

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi

I changed the code to

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

if(a(i).equals("2")){

result.addValue(b(i));

}

}

this is working fine when the LegSystemID is 2 and when it occurs in the 2nd TAG019

But when I have TAG019 with LegSystemID -"2" first then it doesnot work..

any idea on this.

Rgds,

Kumar

Message was edited by:

Kumar

Former Member
0 Kudos

Hi,

This code will works only for when it is 2.

Can you please once again give me the requirement as it is not clear to me.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi I will get the source as

Orgnaisation

-> TAG019 Values

-> Legcustno Customer1

-> LegSysID 1

-> TAG019

-> Legcustno Customer2

-> LegSysID 2

I am creating idoc for each TAG019 where LegSysId is 1 and populating the LegCustno of TAG019 where LegSysId is 2. to my target.

The above scenario is working fine with the UDF.

But if the scenario is vice versa like

Orgnaisation

-> TAG019 Values

-> Legcustno Customer1

<b> -> LegSysID 2</b>

-> TAG019

-> Legcustno Customer2

<b> -> LegSysID 1</b>

Then my target field is not populated.

Rgds,

Kumar

Former Member
0 Kudos

HI,

Still there is some problem in transformation rule which you had mentioned.

What if LegSysID 2 then r u generating the IDOC that is not clear to me becus very time this value will change.

Thanks and Regards,

Chirag Gohil.

Former Member
0 Kudos

Hi

we are not generating any IDOC's when the legacy system id is "2".

if I have a TAG019 with LegSysId "1"

and another TAG019 with LegSysID "2"

then I am creating an idoc only for TAG019 with LegSysID "1" and populating the value of LegCustno from TAG019 of LegSysID "2" in target(SORTL)

and when I donot have a TAG019 with LegSysId "2" then I am not populating any value in the Target.

Rgds,

Kumar

Former Member
0 Kudos

HI What I understood is:

First you are checking the LegSysID "1" if it is one then you are populating an IDOC and you are mapping the value of LegSysID "2 to target ifeld.

Is this what are you looking for.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Yes you are partly correct.

we are generating an IDOC when LegSysID is "1" and if it also contains another TAG019 with LegSysID 2 then we are populating the value of LegCustno from this tag to the target.

if another TAG019 with LegSysId "2" doesnot exists then we simply leave the field blank.

Rgds,

Kumar

Former Member
0 Kudos

Please gimme ur no...I will call u and explain the scenario. if you have no problems with this.

Former Member
0 Kudos

Hi,

I assume that LEgacy ID 1 and Legacy ID 2 are coming in seperate field.

Legacy id 1=a

Legacy id 2=b

Customer =c

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

if(a(i).equals("1"))

{

if(b(i).equals("2")){

result.addValue(c(i));

}

else

{

result.addValue("");

}

}

result.addValue(SUPPRESS);

}

Thanks and Regards,

Chirag Gohil.

Former Member
0 Kudos

Hi,

My ID is chirag.gohil@gmail.com

I will give u my no.

Answers (1)

Answers (1)

Former Member
0 Kudos

With your sample file: you have two nodes <TAG019>, one of it has SystemId 1 and one of it has SystemId 2.

Your target file: you'd like to combine these two TAG019 nodes to just one IDoc structure, correct?