cancel
Showing results for 
Search instead for 
Did you mean: 

Java mapping help please

former_member190543
Participant
0 Kudos

Hi all,

I need help with java code please.

My source is a csv file and target is multiple idocs.

Source file structure is as follows:

Header (field 1, field 2, ........ field 10)

Item 1a (field 1, field 2, field 3, .........    field 180)

Item 1b (field 1, field 2, field 3, .........    field 180)

Item 2a (field 1, field 2, field 3, .........    field 180)

Item 2b (field 1, field 2, field 3, .........    field 180)

.

.

.

Item na (field 1, field 2, field 3, .........    field 180)

Item nb (field 1, field 2, field 3, .........    field 180)

First line is header. Second is VAT line. Third is Price line for that VAT. Now VAT and Price lines repeat. There need not be VAT line for non-European countries. So a VAT line may or may not preceed a Price line.

For example: the lines can be like:

Header

VAT1

Price1

VAT2

Price2

Price3

1) Now, it should produce 3 idocs like:

Header, VAT1, Price1

Header, VAT2, Price2

Header, Price3

2) One idoc should be created per a pair of VAT and Price lines and they will be identified by a co-relation of a particular field. So first I have to sort all the lines based on this field value. Then I have to read the lines in pairs. If no Vat line, I should just read the Price item and produce an idoc.

Can you please help me with the java code for this?

Many thanks in advance.

Ramesh.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Try to see if you get any clue on field value for priceline, VAT line, like say the text "FF" will always be there in VAT line, or price line.

Based on this you can segregate these lines and use XSLT, Java code to create the structure you want.

--Divyesh

Former Member
0 Kudos

Hi Ramesh,

You can go with normal message mapping for this requirement. Any reason for opting Java mapping in this scenario.

Read the VAT and Price line as Recordset (Use Variable in Recordset sequence in FCC)

Create IDoc for every record set. Map Price record fields and VAT record fields accordingly.

Regards,

Pranav

former_member190543
Participant
0 Kudos

Many thanks Ram.

The reason for thinking to go for java mapping is that there is no keyfield for price line. The source file is a pipe delimited csv file. There is a keyfield for VAT line. The same field will be empty for the Price line. I am trying to ask them to at least provide a space for that field between the pipes for price line so that I can use in FCC. It looks like they can't modify the source file.

Any inputs please?

Regards.

Ramesh.

Former Member
0 Kudos

did u try using recordset structure in the sender file adapter

http://help.sap.com/saphelp_nw04/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm