cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a file in append mode

Former Member
0 Kudos

Hi All,

I have a requirement where in i need to create a flat file in append mode . The requirement is as follows :

- In a week , SAP sends certain number of IDOCs to XI . For the first IDOC that comes in ,XI has create a file and later for the rest of the IDOCs ,XI just has to append the file contents .

- During the End of the week , the target system picks this file for processing.

My file structure is as follows:

Header

seg1

seg2

seg2

seg3

seg3

seg1

seg2

seg2

seg3

seg3

Trailer.

So ,while creating a file in append mode , is there any way apart from creating one more interface to pick the finally created file , i can make sure that the file gets written in the above format without header and trailer getting repeated.

Regards

Vinay P.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi All,

One more requirement regarding this interface is once all the idocs are sent to XI , at the end of the week SAP will send an outbound proxy message to XI . XI has to just create a control file from this message .

So,is there anyway where in i can use this proxy message as indicator to add Header and Tralier to the main file which will be containing only detail segments.

stefan_grube
Active Contributor
0 Kudos

You can do this easily with an OS script.

stefan_grube
Active Contributor
0 Kudos

> i can make sure that the file gets written in the above format without header and trailer getting repeated.

No, this is not possible. How should PI know, that it is the last idoc?

The header could be set by system command, but the trailer, I do not see a possible way.

Way you need header and trailer? Discuss this with your team, they could think about not using header and trailer at all.

Former Member
0 Kudos

Hi vinay,

During the End of the week , the target system picks this file for processing.

As the file is getting picked by target systems, why u need another interface.

if possible try getting a file at the end of day from ECC and avoid append at PI side

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/30ea2fdf-f047-2a10-d3a2-955a634bd...

Regards,

srinivas

Former Member
0 Kudos

Hi, Vinay

If you don't want to use a new interface, you can use a operating system command in your target communication channel..

The OS script must:

  • pick up only one header line and move it to a temporal file. For example, with UNIX command you can do that with

grep "criteria" file | head -1 > temporal_file

  • pick up each detail line and move it to the temporal file.

  • pick up only the last trailer line and move it to the temporal file

  • Rename temporal file to final flat file.

Regards,

Carme.