(SAP-BC4.0)Regarding the ffTemplate for reading a flatfile with haphazard records

Hi all,

I have a problem Scenario here. Anybody of you folks, kindly help me in this regard…

  Currently we have a Template that we have created to read the Data in specific order.Now we have a different scenario where the Data is not in the Specific order.

Details:

To read the Data like H- header record
D- Detail record(s)
recordWithNoID- some other record(s)
T- Trailer
Old Sample Data:

H fruit vegetables
D apples10 bittergourds1/2kg
D apples20 bittergourds2kg
12 oranges11 potatoes3kg
14 mangoes11 fig 1kg
T TOTAL WEIGHTS
where H-header,D-detail,12,14 are the RecordIdentifiers.

Now, to read this the template that we use is as follows.
<?xml version="1.0"?>


10













etc.,…




etc.,…




etc.,…




etc.,…




etc.,…


D


12


14

Latest Sample Data:

H fruit vegetables
D apples10 bittergourds1/2kg
D apples20 bittergourds2kg
12 oranges11 potatoes3kg
12 oranges11 potatoes3kg
14 mangoes11 fig 1kg
14 mangoes12 fig 1kg
D apples10 bittergourds1/2kg
D apples20 bittergourds2kg
12 oranges12 potatoes3kg
14 mangoes12 fig 1kg
14 mangoes12 fig 1kg
T TOTAL WEIGHTS

For reading the above data, I am not able to write the Template with the no limit and no order for number of data records in the input file.

If i am using the above template, i am seeing the records where the list of records is haphazard as the data. the output recordlist has the records.
H—
D
[0] 1st record
[1] 2nd record
12
[0] 1st record
[1] 2nd record
14
[0] 1st record
[0] 2nd record
D
[0] 1st record
[1] 2nd record
12
record
14
[0] 1st record
[1] 2nd record
T
record

But the list should be like all the D-records should be in one list and all the 12 records should be in one list etc.,

I am not very sure that this scenario can be possible or not…

Anybody,kindly advice

kindly help me if anybody has worked on the SAP-BC. I am not able to modify so as to read the above file.

Environment:SAP-BC 4.0 on windowsXP.

Immediate help is appreciated…!!!

Thanks in Advance,
Regards,
Teja.
:confused:

The template definition is not ok in the loop part. You need to define the root loop , then sub record has to appear in the main loop. Please go through the documentation for loop part and that should fetch the data as per your desire.

You need to understand the structure of the file and based on this the loop definition can be done

HTH
Bhavani Shankar