cancel
Showing results for 
Search instead for 
Did you mean: 

UDF reqd for generating target Segment additional times based on src field

Former Member
0 Kudos

Hi,

I have a flat file to Idoc Scenario,

record type B is the Header which follows Component Rows (record type C) both constitute an IDoc strucutre formation

Before : I used to generate the target CHA segment based on record type C present for a particular record type B

record type C = CHA segment (1- 1 Mapping)

For example if number of C records for a B record is 10, then 10 CHA segments will be created

Now : record type C, has a field Roc, which will have value either "Yes" or "No"

This CHA segment will be created as per the following rules

a) record type C present for a particular record type B

b) Number of times fields Roc in C records are 'Yes'

For example if number of C records for a B record is 10 and out of these 10 C records, 4 have field RoC = Yes, then a total of 14 CHA segment will be created and where last 4 records would have differerent mapping rules for the fields in the CHA Segment .

Thanks,

Varun

Edited by: Varun Reddy on Jan 24, 2011 4:29 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

pass the values of Rec as input and then use the below..

for(int i=0;i<Rec.Length;i++)

{

if(Rec<i>.equals('Yes') )

{

result.addValue(Rec<i>);

result.addValue(ResultList.CC);

}

}

Check the above..(not sure may be need some corrections..) but basic idea is same as above..

HTH

Rajesh

Answers (1)

Answers (1)

RKothari
Contributor
0 Kudos

Hello,

Please check the below mentioned code.

Keep the context of C to segment B and field Roc to C.

Input C and Roc queues.

int i,j;

for(i=0;i<C.length;i++)
{
	result.addValue();
}
for(j=0;j<Roc.length;j++)
{
	if(Roc<i>.equals("Yes")){
	result.addValue();
		}
}

-Rahul