cancel
Showing results for 
Search instead for 
Did you mean: 

Content conversion - variable length of last field/column

JaySchwendemann
Active Contributor
0 Kudos

Dear all,

i have a flat input like this

AAAABB111222333

where the "digit" part of the input (111222333) would be a substructure of 3 characters length but with a variable total lenght.

So above example we would have a total of 5 fields:

AAA

BB

111

222

333

But the input could easily also look like this

AAAABB111 (3 Fields AAAA BB 111)

or like this

AAAABB111222333444 (6 Fields AAAA BB 111 222 333 444)

-----

Having said so I would like to know if I can handle such an input with content conversion?

In a deluxe version I would like to have content conversion recognize all fields.

In a minimum solution I would like to have at least recognized 3 fields where the last field is of variable length

As we are designing the interface on the other side anew, I'm quite free on the record structure that content conversion would be filling: Could be something like this, but would not be limited to this:

<Recordset>

          <Field_A>AAA</Field_A>

          <Field_B>BB</Field_B>

          <Field_Sub>111</Field_Sub>

          <Field_Sub>222</Field_Sub>

          <Field_Sub>333</Field_Sub>

</Recordset>

Did anybody stumble upon such a problem? Any inputs would be really great.

<edit>

Almost forgot: I have read about file adapter content conversion parameters http://help.sap.com/saphelp_nw70/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/frameset.htm and also looked at this (very good) blog http://wiki.sdn.sap.com/wiki/display/XI/How+To...Content+conversion+module+with+J2EE+JMS+adapter So I'm aware of content conversion basics but haven't found a solution to above problem within those resources.

</edit>

Have a nice one.

Cheers

Jens

Message was edited by: Jens Schwendemann (added info on what resources I already have read)

Accepted Solutions (1)

Accepted Solutions (1)

Muniyappan
Active Contributor
0 Kudos

Hi jens,

AAAABB111    -  3 fields

AAAABB111222333444   - 6 fields

you can read AAA in Field_A and BBB Field_B.

and the rest read it in one field say Field_Sub = 111222333444.

try to populate number of occurrence in mapping.

correct me if i did not get you.

Regards,

Muniyappan.

JaySchwendemann
Active Contributor
0 Kudos

Hi Muniyappan,

thanks for the input. I could probably do that but I would need to specify a fixed length for the last field "Field_SUB" like so:

Plain2XML | xml.fieldFixedLengths | 4,2,9999

Where "9999" would be some arbitrary high value that might not suffice depending on input lenght.

Please correct me if there is an option to specify variable length for last field. Please note that I need to use fix length because I don't have separators in input.

Thanks and kind regards

Jens

Answers (5)

Answers (5)

JaySchwendemann
Active Contributor
0 Kudos

Thanks all,

as it turned out the receiver system does only support fixed field length of 512 CHARs for the last field anyways (in spite of the possibility of variable field lenght as it was written in the mapping specification document).

So in real world, the sending system is by convention never sending data that exceeds 512 characters for the last field, though it might be shorter than 512.

--> I will then set the length of the last field to 512 in my FCC as Ambrish and others suggested. So for me, this issue is resolved.

I will, however do not mark this question as answered, because mayber there is a way to do this in FCC that we haven't been told yet (though I think that reading the whole line and then doing splitting within Java mapping or UDF would probably the way one would need to go if the last field was truely of variable length)

Thanks so far for all the help provided. Keep the suggestions flowing for the original problem 🙂

Cheers

Jens

ambrish_mishra
Active Contributor
0 Kudos

Hi Jens,

As already posted, I recommend you go with the solution of having 4 fields for FCC because I have achieved a similar requirement in a BPM scenario taking hypothetical length for the last field since it was unknown. In your case it is 512 so you have clear direction.

cheers

Ambrish

Muniyappan
Active Contributor
0 Kudos

Hi,

this might sound stupid but: How do I read in the entire line? Do I need content conversion then? What if there may be multiple lines in one input (separated by new line 'nl')? Would this matter?

check  Grzegorz Glowacki 's reply in the below thread.

http://scn.sap.com/thread/3183128

--> I will definitely give this option (read whole line, do splitting in mapping) a try. But being a curious person: If anybody has information on whether this problem may be solvable using content conversion I would be happy to know.

not sure you can handle this.

lets us wait for better suggestions.

Regards,

Muniyappan.

JaySchwendemann
Active Contributor
0 Kudos

Thanks Amit and Muniyappan,

this might sound stupid but: How do I read in the entire line? Do I need content conversion then? What if there may be multiple lines in one input (separated by new line 'nl')? Would this matter?

--> I will definitely give this option (read whole line, do splitting in mapping) a try. But being a curious person: If anybody has information on whether this problem may be solvable using content conversion I would be happy to know.

Thanks all

Cheers

Jens

Former Member
0 Kudos

Hello,

If you want to achieve this scenario using FCC then u have to define some random field length for the last field, apart from that i don't think there is any other option and if u can't do that then u have to look for alternatives...

Perhaps, i would have opted for java mapping or message mapping splitting solution to crack this specific requirement.

Thanks

Amit Srivastava

Muniyappan
Active Contributor
0 Kudos

Hi,

you can follow amit's idea if you don't know the length.

as your first 5 letters are going to be AAA BB.

getting the count(like 0004) will make your mapping logic easy also.

Regards,

Muniyappan.

JaySchwendemann
Active Contributor
0 Kudos

I was just recognizing that by simplifying my input for the sake of clarity, I left out a field (Field_SubCount) that might be useful for a solution.

The actual input is like so:

AAAABB0004cccdddeeefff


where the field "0004" is the number of sub-fields that follow (cccdddeeefff in above input). Those sub-fields have, as mentioned in the initial post, a fixed lenght of 3 characters but can occur multiple (1...unbounded) times. Hence the total length of the input is variable

So these are also valid inputs:

AAAABB0001ccc (4 Fields AAAA BB 0001 ccc)

AAAABB0005cccdddeeefffggg (8 Fields AAAA BB 0005 ccc ddd eee fff ggg)

The recordset XML could be something like this (based upon first input)

<Recordset>

          <Field_A>AAA</Field_A>

          <Field_B>BB</Field_B>

          <Field_SubCount>4</Field_SubCount>

          <Field_Sub>ccc</Field_Sub>

          <Field_Sub>ddd</Field_Sub>

          <Field_Sub>fff</Field_Sub>

</Recordset>

Cheers

Jens

Former Member
0 Kudos

Hello,

Why don't u read entire line in a single field and then split the same in mapping?

Thanks

Amit Srivastava

ambrish_mishra
Active Contributor
0 Kudos

Hi Jens,

Read it as record with 4 fields and a fixed length file.

Put the last field length as 100 (arbitrary).

In the mapping, check the value of field 3 and based on that split up the 4th field based on length.

I worked on a similar requirement 5 years back and achieved it like this. it was a response error file.

cheers,

Ambrish