cancel
Showing results for 
Search instead for 
Did you mean: 

How to add header to a file in mapping

Former Member
0 Kudos

Hi,

I need to add header to a file , the header information i am getting is dynamic , it is an IP address of the m/c from where i received the file and keeps on changing.

Can we add this information in the header in mapping or there is any other way to acheive this.This IP is used to make a lookup at a latter stage for verification purpose.

Regards,

SRi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sri,

Write Java class or an ABAP class

in Java class or ABAP class write logic to find the first word or line

once you find that word in your incoming file, you need to replace with a string which has the static header+firstword what you have searched

for exmple

Incoming file

abcd

<abc>123</abc>

<def>321</def>

Your logic should find "abcd"

String Header = "http://www.sap.sdn.com"

String A = "abcd" (bcoz u kow u r searching for this word)

now concat A+Header and return the string

IF you are writing an ABAP or Java class include this in Interface Mapping

Hope this helps.

Answers (4)

Answers (4)

Former Member
0 Kudos

Opening the file and reading the first line and then concatenating with the header taken in a string.

Former Member
0 Kudos

I tried

Former Member
0 Kudos

Hi all ,

I am not able to understand , how to identify the IP address of sourse system once a XI receives the file. From where i can see and fetch the IP?

Former Member
0 Kudos

Hi, Sri:

Solution 1, if the sender if file adapter, maybe you can fetch from adapter parameter list.

Solution 2: write a Java module deployed in sender adapter, the module is used to get IP address from sender system, send it along with message to XI.

Solution 3: Write a OS level scripts, in file adapter, configure the script to be executed before message processing. The script will get IP address from sender system, you will find a way pass it to your lookup program.

Regards !

Liang

former_member192295
Active Contributor
0 Kudos

Hi,

We can add, take header filed in source structure and assign to target header structure. In mapping develop simple UDF, if value found pass value else pass space.

In FCC receiver channel add rec.addHeaderLine = 0 statement. It will appear header value in receiver file.