cancel
Showing results for 
Search instead for 
Did you mean: 

File handling without detail identifier

Former Member
0 Kudos

Hi Frndz,

i have a file structure below.

Header ( have identifier) --Ex:Record starts with AA we consider as Header

Detail (( without  identifier)

Footer( have identifier)  --Ex: Record starts with BB we consider as Footer

But in detail we dont have an identifier to read the record.

But my requirement is i wanna read the file and delete the header and footer and process in sap xi.how we can achieve this?

Regards,

Narendra

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Narendra

Create a generic data type like below for you sender structure

MT_xxxxxxxxxxxx

      row---0 to unbound

          Data....0 to 1

Use file content conversion to generate this structure.

Then in the mapping check the content of field 'Data' . if it starts with AA or AB then ignore it.

Else process the Data and generate your target structure based on data. You need to write an UDF

and split the whole line into target fields.

Let me know if you have any doubt.

Former Member
0 Kudos

Hi Indra and Prathibha,

Thanks for ur quick response.

i dont want to totally ignore header ...But from header i want read time stamp and record count value.

So kindly let me know if we can do this?

Regards,

Narendra

Former Member
0 Kudos

Hi

The header data will be in the first line of the xml message. So you can easily read it in message mapping.

If you have any doubt then please attach a sample file and the expected output structure so that we

can help you better.

former_member202642
Participant
0 Kudos

Hi Narendra,

You can use two UDFs in that case.

First one to read Header and other one to read Detail records.

You can get time stamp and record count from the first UDF.

Former Member
0 Kudos

Hi ,

With out Detail identifier how our file adapter reads the detail record.

Once we read we can do all the steps in graphical mapping....

Kindly help us

Regards,

Narendra

Former Member
0 Kudos

Hi

I have already mentioned in my first reply how you can read details information without identifier.

You have to create a generic structure like below

MT_xxxxxxxxxxxx

      row---0 to unbound

          Data....0 to 1

So if you input file is like below

AA123bcdf5345 (header )

354556565656 (detail)

56546757676576 (detail )

BB465465464       (footer )

after content conversion the xml message will be like below in PI

MT_XXXXXXXXXXXXXX

    <row >

          <data>AA123bcdf5345</data>

          <data>354556565656</data>

          <data>56546757676576</data>

          <data>BB465465464</data>

     </row>

Then in the graphical mapping you need to write an UDF to read the whole line for exmaple

'35455abc65656'  and split it into multiple values based on your target structure.

Former Member
0 Kudos

Hi Narendra,

You can filter in your mapping  to not map rows with the idetifier to your target.

As in,

1. Read the file

2. In mapping have an UDF which reads only the rows which do not start with Header & Footer Identifier (like AA & BB, as you mentioned)

3. So now, your target will have only the records which do not have identifier i.e. Details record.

You can also have two mappings, one to filter header & footer records & another mappnig to map fields as per your functional requirement.

Thanks,

Vani Prathibha MNS