cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with file content conversion

Former Member
0 Kudos

Hi,

in my scenario (Z-IDOC - XI - File) I send 2 segments to the XI.

L061 18000 DE 0101 23236318 050605 EUR

L061 87000 DE 0101 050605 EUR

In the second segment there is no XBLNR !!

IDOC: ZFIBUCH

Segment: L061

Fields:

IDENTIF

KZ

LAND

BUKRS

XBLNR

BLDAT

WAERS

Data typ: L061

Message type: MT_ZFIBUCH_FILE

My XML-message looks like this:

<?xml version="1.0" encoding="UTF-8" ?>

<ns1:MT_ZFIBUCH_FILE xmlns:ns1="http://xxx">

<L061>

<IDENTIF>L061</IDENTIF>

<KZ>18000</KZ>

<LAND>DE</LAND>

<BUKRS>0101</BUKRS>

<XBLNR>AG1236318</XBLNR>

<BLDAT>050605</BLDAT>

<WAERS>EUR</WAERS>

</L061>

<L061>

<IDENTIF>L061</IDENTIF>

<KZ>87000</KZ>

<LAND>DE</LAND>

<BUKRS>0101</BUKRS>

<BLDAT>050605</BLDAT>

<WAERS>EUR</WAERS>

</L061>

</ns1:MT_ZFIBUCH_FILE>

I use content conversion in the receiver-file-adapter

RECORDSET: L061

L061.fieldFixedLengths 4,6,3,4,10,3

L061.headerLine 0

L061.fixedLengthTooShortHandling Ignore

L061.endSeparator 'nl'

The result is:

L06118000 DE 0101AG1236318 050605EUR

L06187000 DE 0101050605EUR

But I will use fixed lengths for getting this:

L06118000 DE 0101AG1236318 050605EUR

L06187000 DE 0101 __________050605EUR

(instead of the underline there should be blanks)

Did I something wrong?

Christoph

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

Even if the field XBLNR is empty, you have to provide the element in the structure, otherwise the content conversions gets out of order.

Correct would be:

<ns1:MT_ZFIBUCH_FILE xmlns:ns1="http://xxx">

<L061>

<IDENTIF>L061</IDENTIF>

<KZ>18000</KZ>

<LAND>DE</LAND>

<BUKRS>0101</BUKRS>

<XBLNR>AG1236318</XBLNR>

<BLDAT>050605</BLDAT>

<WAERS>EUR</WAERS>

</L061>

<L061>

<IDENTIF>L061</IDENTIF>

<KZ>87000</KZ>

<LAND>DE</LAND>

<BUKRS>0101</BUKRS>

<XBLNR />

<BLDAT>050605</BLDAT>

<WAERS>EUR</WAERS>

</L061>

</ns1:MT_ZFIBUCH_FILE>

Regards

Stefan

Former Member
0 Kudos

Hello Stefan,

but the SAP system didn't fill this Idoc-Segment full.

What should I do?

Regards

Christoph

Former Member
0 Kudos

Hello Stefan,

but the SAP system didn't fill this Idoc-Segment full.

What should I do?

Regards

Christoph

stefan_grube
Active Contributor
0 Kudos

In SP13 you can use the new node function mapWithDefault, which is just made for this purpose.

In lower SP, create an advanced user defined function with one inbound parameter and apply following code:

if (a.length == 0)
  result.addValue(""); 
else for (int j=0;j<a.length;j++)
  result.addValue(a[j]);

This should prevent you from difficult exists - if constructions

Regards

Stefan

Former Member
0 Kudos

Hi Stefan,

im not so familiar with advanced functions.

is it possible to explain this more detailed?

In my mapping i have the problem with XBLNR.

Should I map the XBLNR_I -> advanced function -> XBLNR_O?

Where can I edit the code later on?

Regards

Christoph

stefan_grube
Active Contributor
0 Kudos

Hi Christoph,

that is correct.

After creating an user-defined function, there will be a new entry in the function list, User-Defined. Here your function will appear.

To edit the function, try to hit the small triangle right at the function name. If you are successfull, you get a menu. Choose <i>edit</i>.

Hope that helps,

Stefan

Former Member
0 Kudos

Thanks all,

I tried the user-defined function and this works fine.

Thanks

Christoph

Answers (2)

Answers (2)

STALANKI
Active Contributor
0 Kudos

You can use the simple node function <b>exists</b>.

1.XBLNR(source) exists and pass this to boolean function if then else.If XBLNR exists then pass the source XBLNR else pass the space.

If you want me to give the snap shot of the mapping.Mail me at sravya.talanki@wipro.com.After this you have to allot points..:)

stefan_grube
Active Contributor
0 Kudos

The exists function is fine, when you just want to map a element of source to target, but you could have a more complex case, where several elements are combined and checked. In this case it would very inconvenient to use the exists - if - combination:

............expression
......................
expression - exists - if - target_element 
....................../
..............constant

STALANKI
Active Contributor
0 Kudos

Hi cristpoph..

Create the tag in your message mapping explicitly by using the node function "exists" and if then else boolean function.Check wether the tag exists otherwise create it explictily by passing a blank constant space.Please revert if any further input is required.