cancel
Showing results for 
Search instead for 
Did you mean: 

Receiver mail with text file attached without line feeds

Former Member
0 Kudos

Hi, friends

I have a text file to mail scenario, where file must be attached to receiver mail.

Receiver CC mail is protocol XIPAYLOAD and use mail package and keep attachment.

In tab module, i have:

Module name --> SAP XI Sample/ConvertCRLFfromToLF

Module configuration --> mode LFtoCRLF

The plain text file is attached to mail but there are no line feeds after the plain text lines.

Thanks, in advance

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

fieldSeparator='0x0D''0x0A' solved this problem.

stefan_grube
Active Contributor
0 Kudos

If you work with attachments, you first have to use PayloadSwapBean to switch attachment and main payload, then use the ConvertCRLFfromToLF module and then PayloadSwapBean again.

Regards

Stefan

Former Member
0 Kudos

Thanks, Stefan.

I've tryed to apply your suggestion but i don't succeed.

I don't know how to do it if:

  • Attachment is created in CC via mail attributes

  • xml message is like:

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

- <ns0:Mail xmlns:ns0="http://sap.com/xi/XI/Mail/30">

<Subject>Envio fichero </Subject>

<From>xxxxxxxs</From>

<To>xxxxxxxs</To>

<Content_Type>text/plain;charset=utf-8;name="envprvped_006058_080808_110104_388_N"</Content_Type>

<Content>LIN|0087505|CANELONES GRATINADOS RACION 300 G|10|20.000|0|0.89| LIN|0088131|CARACOLES CABRILLA 2'5 KG EU/KG|10|6.000|0|4.5| LIN|0088183|PULPO COCIDO BOLSA 2 KG EU/KG|3|4.000|0|16.75| LIN|0088203|MAIZ DULCE 2'5 K EU/KG|2|2.000|0|1.34| LIN|0088215|CALAMAR COMPASS ROMANA 3KG EU/KG|3|3.000|0|5.85|| LIN|0088339|NUGGETS POLLO 1 KG|6|30.000|0|4.07| LIN|0088346|PATATAS DOLARS 2'5KG EU/KG|10|8.000|0|0.88| LIN|0088398|MEJILLON GALLEGO MEDIA CONCHA 1 KG|9|9.000|0|4.45| LIN|0088404|GAMBA LANGOSTINERA N2 RETRAC.EU/KG|12|18.000|0|13.36| LIN|0088405|GAMBA LANGOSTINERA N4 RETRAC.EU/KG|6|18.000|0|8.75| LIN|0088434|BROCOLI 2'5 KG EU/KG|5|4.000|0|1.1|</Content>

</ns0:Mail>

Can you help me?

Thanks,

Carme

prateek
Active Contributor
0 Kudos

It seems that u have ur data in xml format and not exactly in the text format. U may use java mapping to edit this data as per ur requirement. Using DOM parsing u may traverse till the nodeValue of tag Content and then perform required actions.

Regards,

Prateek

stefan_grube
Active Contributor
0 Kudos

I see. You do not have an XI message with an attachment, just the main payload.

In that case the module won't help you in any way.

You have to add the CRLF in mapping. You can do that with a Java mapping which is added as additional step to your existing mapping. In this Java mapping you replace all LF with CRLF.

The Java mapping could be similar to that one:

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

Just replace the ampersand with the characters of LF and CRLF

Regards

Stefan

Former Member
0 Kudos

Stefan,

This is not a Java mapping, it's an ABAP mapping.

I've tryed also to insert this characters, but without success.

In my abap class i have:

-


data: l_newline type c value cl_abap_char_utilities=>newline.

data: l_linefeed type c value cl_abap_char_utilities=>CR_LF.

clear wa_string.

incode = idocument->get_elements_by_tag_name( 'linea' ).

length = incode->GET_LENGTH( ).

do length times.

outcode = incode->get_item( index = d_lines ).

wa_linea = outcode->get_value( ).

if wa_string is initial.

wa_string = wa_linea.

else.

concatenate wa_string l_newline l_linefeed crlf wa_linea into wa_string.

endif.

add 1 to d_lines.

enddo.

l_element_dummy = l_document->create_simple_element(

name = 'Content'

VALUE = wa_string

parent = l_element_root ).

-


so...it's similar to your suggestion..

Any other input, please?

Regards,

Carme.

stefan_grube
Active Contributor
0 Kudos

It seems that cl_abap_char_utilities=>newline is 0A00 and cl_abap_char_utilities=>CR_LF is 0D00, the unicode values.

But this should be UTF-8 values, 0A and 0D.

Try using the hex values directly.

Regards

Stefan

Former Member
0 Kudos

Hi, Stefan,

You are right: I have change my ABAP code, and now when I download payload from Message Monitorin (TEchnical Routing) i can see one line for every record LIN:

<?xml version="1.0" encoding="utf-8"?><ns0:Mail xmlns:ns0="http://sap.com/xi/XI/Mail/30"><Subject>Envio fichero MAGSA</Subject><From>xxxxx</From><To>xxxx</To><Content_Type>text/plain;charset=utf-8;name=&quot;envprvped_sdicmp_006058_080808_110104_388_N&quot;</Content_Type><Content>LIN|0087500|CROQUETAS POLLO ARTESANAS 35 G 1K|4|20.000|0|2.58|

LIN|0087503|CROQUETAS SABOR POLLO 20 G 1K|4|20.000|0|1.12|

LIN|0087505|CANELONES GRATINADOS RACION 300 G|10|20.000|0|0.89|

LIN|0088131|CARACOLES CABRILLA 2&apos;5 KG EU/KG|10|6.000|0|4.5|

CHK|84|</Content></ns0:Mail>

However, when I open file received via mail, this character has disappeared and i can see only a line with all content:

LIN|0087500|CROQUETAS POLLO ARTESANAS 35 G 1K|4|20.000|0|2.58|LIN|0087503|CROQUETAS SABOR POLLO 20 G 1K|4|20.000|0|1.12|LIN|0087505|CANELONES GRATINADOS RACION 300 G|10|20.000|0|0.89|

LIN|0088131|CARACOLES CABRILLA 2&apos;5 KG EU/KG|10|6.000|0|4.5|CHK|84|

Kind regards,

Carme.

stefan_grube
Active Contributor
0 Kudos

It seems that you still have not correct CRLF characters. Check with a hex editor.

Regards

Stefan

prateek
Active Contributor
0 Kudos

Why r u using this module? Is there a conversion from Windows line feed to Unix line feed or vice-versa.

Regards,

Prateek

Former Member
0 Kudos

My problem is that i have a sender file in unix system that contains line feed.

Sender unix file is like:

LIN|0089541|150/200 3K EU/K|1|6.000|0|6.1|

LIN|0089579|5|10.000|0|4.7|

LIN|0089594|6|30.000|0|2.85|

LIN|0089599|3|15.000|0|4.55|

But received filed attached to mail is like:

LIN|0089541|150/200 3K EU/K|1|6.000|0|6.1|LIN|0089579|5|10.000|0|4.7|LIN|0089594|6|30.000|0|2.85| LIN|0089599|3|15.000|0|4.55|

And size is also different.

Thanks,