Skip to Content
0
Mar 08, 2009 at 12:58 AM

How to count detail line in a flat file.

71 Views

I have a flat file which has multiple header and detail lines. This flat file will later mapped to ACC_DOCUMENT03 IDOC and post it to SAP.

-doc1

-


header

-


cocode

-


docdate

-


postingdate

-


currencycode

-


detail

-


glaccount

-


itemno

-


costcenter

-


detail

-


glaccount

-


itemno

-


costcenter

I need to have a counter to track the number of detail lines in ACC_DOCUMENT03 IDOC target field in ITEM_TEXT.

for example this is the flat file

HDR,US00,20080102,20080102,USD

DTL,32456,1,CC0001

DTL,32456,2,CC0001

HDR,US00,20080102,20080102,USD

DTL,32458,1,CC0002

DTL,32458,2,CC0002

HDR,US00,20080102,20080102,USD

DTL,32459,1,CC0001

DTL,32459,2,CC0001

So every detail line in ITEM_TEXT, I need to put 1,2,3,4,5,6 and so on.

I tried to use global container to keep track the line counter but it doesn't work. Can anyone please help?

Edited by: Kam Weng Leong on Mar 8, 2009 1:58 AM

Edited by: Kam Weng Leong on Mar 8, 2009 2:00 AM