cancel
Showing results for 
Search instead for 
Did you mean: 

Send File Adapter - keyFieldValue like 'not(H,B)'

0 Kudos

Hi,

I've a problem in a sender file adapter.

The file has one header line, multiple body lines and one trailer line. The structure of the flat file is like:

H; 0815; text;

0235;my text; 745;7...

6341;your text; 464;4 ...

2342;another text; 726;2

T; 3; OK

For header and trailer line there is a key field but for body lines there isn't.

My idea:

I take the first field of body lines as key field and define keyFieldValue like 'not(H,T)'.

Is there a way to define keyFieldValues with expressions with 'not' and 'or' ?

Or have anyone a different idea to solve the problem ?

Regards

Christoph

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Read your file in Record by creating following structure

MT_target

-


File 0 to unbounded

-


Record...1

Do not Specify key field.

content conversion will include Record as fieldNames and newline as endSeparator

in mapping put a logic to compare 1st character of Record if H, T then map it to Header trailer in target

else it is a data

0 Kudos

Hi Mugdha,

I think this will be working, but this don't solve the problem but it bypass it.

I want to convert the message by the file adapter in a structure like

Header

- Bodyline

- Bodyline

- ..

Trailer

Regards

Christoph

Former Member
0 Kudos

Hi,

There is no keyfield for the multiple body lines in your data..The fcc parameters should be sufficient.Use the endSeparator parameter to distinguish between the header ,body and trailer lines..

regards,

Ramya Shenoy

Edited by: Ramya Shenoy on Aug 27, 2009 12:52 PM

0 Kudos

Hi Ramya Shenoy,

I think you want to expand each line by an endSeparator charakter, but I can't modify the given file. It's given from external provider.

Regards

Christoph

Former Member
0 Kudos

Hi Chris,

Did you got any solution to the problem. I have a similar issue with one of my scenario.

Can you please help me with your findings/results?

Thankyou,

Shanthi

Former Member
0 Kudos

Hi,

Create a common structure for header,detail,trailer.You should use AF_Modules/MessageTransformBean instead of FCC.

create a xslt mapping and use the mapping in adapter level.

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3823 [original link is broken] [original link is broken] [original link is broken]

Modules look like,

AF_Modules/MessageTransformBean For FCC

AF_Modules/MessageTransformBean for XSLT

Default module.

Regards,

Prakasu.M

Former Member
0 Kudos

Make the Source str as


MT_Source
  Records      ------------1 to unbounded
    Data         ------------1

In the sender File comm channel select Message protocol FCC and specify the parameters as given below


Document Name:MT_Source
Document namespace:(Specify the namespace)
Recordset structure:Records,*,Data,1
Add  more parameters choose +

Name                           Value
Records.fieldNames      Data
Records.fieldSeparator  'nl'
Records.endSeparator      'nl'

Follow this blog and modify java code according to ur requirement

nisarkhan_n
Active Contributor
0 Kudos

the simplest would be to handle this in java map, Just pick the records and till you encounter the record with T & put into one segment, if you want i will send the code, without keyfiled you cannot read that using file adapter, else you have to read each line by line from file adapter into one field in MM, then write the logic, again there will be lot of code sitting in UDFs.

if thinking about java map then let me know i can send you details.

0 Kudos

Hi,

I don't understand, where java map should be used ?

- before file adapter

- in file adapte

- during operation mapping

Regards

Christoph

Former Member
0 Kudos

Hi!

Any kind of mapping will not help you here, because Mapping takes place later in the PI, when XML document is created by File Adapter.. But maybe this documentation will help you:

http://help.sap.com/saphelp_nwpi71/helpdata/en/44/6713ec3f914ddee10000000a1553f7/content.htm

Especially this statement: "If you have entered a variable number of substructures under Recordset Structure, that is, you have entered the value * for at least one structure, specify a Key Field Name."

Did you do that?

Regards,

Volker

0 Kudos

Hi Volker,

closely this is my problem.

I difined the Recordset-Structure as follows:

Header,1,Body,*,Trailer,1

But my problem is, that only header and trailer have usable key fields (see my example above).

For body there is no constant value to take as key field.

Regards

Christoph

Former Member
0 Kudos

Hi!

Now I've understood your challenge. Sorry. Hm. I see two options.

1. Try to discuss with the guys creating the flat file if they can insert e.g. a 'B' at the beginning of every body record

2. Try to follow the hints mentioned above ...

Regards,

Volker