cancel
Showing results for 
Search instead for 
Did you mean: 

Creating the IDOC element

Former Member
0 Kudos

Hi,

I am getting an SAP-XML file where in I have the source structure as

ORGANISATION (0 to unbounded)

-> TAG001(1-1)

-> TAG002 (1-1)

-> TAG019(0 to unbounded)

under TAG019 I have a filed called legacy system ID and under TAG002 I have a field called Customer Name.

Now I am creating IDOC's only when my Legacy system ID under TAG019 is "1" for every occurance of ORGANISATION.

and then populating the Customer name to Name1 segment of Debmas06 Idoc.

This is working fine.

But when I have multiple Organisations and multiple TAG019's and in which if I have legacy system Id as 2 once and 1 in the second occurance of the TAG019 in orgnaisation then this customer number is not being poplutated.

Do I need to write any UDF for this?

Please suggest.

Rgds,

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

yes u need to write an udf ...

Former Member
0 Kudos

Hi,

Write a UDF.

Pass the two values TAG019 and TAG002 to UDF.

Now what you do is repeate the for loop as many times as the TAG019 is occurring and under the for loop write the result as TAG002.

So what is does is,suppose TAG019 is repeating 4 times then it will give you the TAG002 out put 4 times.

Thanks and Regards,

Chirag Gohil.

Former Member
0 Kudos

Hi Chirag,

can u help me out the UDF for this....

I have no clue of java.

Thanks & Regards,

Kumar

Former Member
0 Kudos

Hi,

This is what you are looking for.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi chirag...

If creating an UDF is the only soultion then yes....

can you help me out with the UDF.

Rgds,

Kumar

Former Member
0 Kudos

Pass the two values TAG019 and TAG002 to UDF.

Take the TAG019 in one context.

For(i=0;i< TAG019.length;i++)

{

Result.addValue(TAG002);

}

Other method is useofMany UDf which SAP XI has provided you can use that also.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi Chirag,

I have changed a bit in the code (I have added int )

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

{

result.addValue(TAG002);

}

But when executed Iam getting an error as

Source code has syntax error: /usr/sap/XD1/DVEBMGS81/j2ee/cluster/server0/./temp/classpath_resolver/Mapcfad03f08d1e11dc84bc0018714e8238/source/com/sap/xi/tf/_IDD088_SCV_to_SAP_LOC_ORG_MM_.java:1399: addValue(java.lang.String) in com.sap.aii.mappingtool.tf3.rt.ResultList cannot be applied to (java.lang.String[]) result.addValue(TAG002); ^ 1 error

can you please let me know what could be the reason for this..

Rgds,

Kumar

Former Member
0 Kudos

Hi Kumar,

This Link will help you

**Reward if helpfulll**:)

Former Member
0 Kudos

Hi,

Can you please send me ur code which u have written.

Thanks and Regards,

Chirag Gohil

Former Member
0 Kudos

Hi Chirag

This worked..

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

{

result.addValue(b[0]);

}

Thanks for the help...will award points.'

Former Member
0 Kudos

will award points once Reward points pops up...i could see that currently it is not working....

Former Member
0 Kudos

Hi,

You can try the same with useofmany std SAP Xi function.

Thanks and Regards,

Chirag Gohil

Answers (0)