cancel
Showing results for 
Search instead for 
Did you mean: 

Command Line Modifying File

Former Member
0 Kudos

Hello -

I have done an IDOC->XI-File scenario, everything looks good except for one line that needs to be added.

Without using XSLT/JAVA mapping (not that complex scenario), is it possible to modify the file that has been received to add an extra line.

For e.g after i have received the file, looks like this:

<xml>

<a>

<b>test</b>

</a>

Can i write a command line program for the file receiver adapter in the communication channel to modify the receiver file to add an extra line.

For e.g.

<xml>

This is a test

<a>

<b>test</b>

</b>

This is an example but in the real case its a huge file and believe me its a straight mapping from IDOC to the file but only thing needed is an extra line of text that needs to be added for which i do not want to use the XSLT or JAVA mapping programs.

Is it possible through the command line to read the Received file and modify the file by writing that extra line.

Any clues would really help.

Thanks,

Tirumal

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi,

You have option of "Run Operating System Command After Message Processing" in adapter. You can call this code of modifying the file and this will be called after the message is processed.

Thanks,

Prateek

Former Member
0 Kudos

I guess if you are not using the FCC, the best thing to do and the easiest is to just another segment and Field to your receiver message type and add the data you want to insert in this field

Regards

Vijaya

Former Member
0 Kudos

Vijaya -

I tried by following your method. Added another data type and assigned the line that i wanted as constant.

But it keeps adding the message type.

Can you give me an example on how to do this?

Thanks,

Tirumal

Former Member
0 Kudos

Hi,

I dont know much unix but you can refer to this blog.

/people/sameer.shadab/blog/2005/09/21/executing-unix-shell-script-using-operating-system-command-in-xi

Thanks,

Prateek

Former Member
0 Kudos

Prateek -

I will check how we can do it in UNIX.

But if am i am using FTP how can i do it?

Thanks,

Tirumal

Former Member
0 Kudos

Hi Tirumal,

Are you trying to create some kind of header in your file.

You cand ot he samein the File content conversion prameter: NameA.addHeaderLine

Or you can actally do this in your message mapping.

Regards

Vijaya

Former Member
0 Kudos

Vijaya -

Sort of.

1. If i use the NameA.addHeaderLine will it add the line after my <xml> line and keep the contents after the inserted line intact?

2. How can i do this in message mapping? Do you have a specific example?

Thanks,

Tirumal

Former Member
0 Kudos

Yes, if you are using file content conversion all you need to do is add this parameters.

The URL tells yuo how u should use it.

http://help.sap.com/saphelp_nw04/helpdata/en/d2/bab440c97f3716e10000000a155106/content.htm

Regards

Vijaya

Message was edited by: vijaya kumari

Former Member
0 Kudos

Vijaya -

I am using File but not File content conversion.

In this case how can i use it?

Thanks,

Tirumal

Former Member
0 Kudos

Hi Tirumal,

You can write the script unix which will open the file and modify it(Assuming operating system of the server is unix).

Thanks,

Prateek

Former Member
0 Kudos

Hello Prateek -

Yes the operating system is UNIX.

Can you give an example of the script on how to change it according to the example i have provided?

Thanks,

Tirumal