Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CSV file not appear as a CSV file in attach

marisa_quaresma
Explorer
0 Kudos
522

Hi.

I am sending an CSV file as an attach in an email. But the problem is that it appears as a PDF file, even though in SOST it appears as a CVS file. Does anyone faced this problem?

Thanks.

6 REPLIES 6

Former Member
0 Kudos
295

How are you doing the attach and send? Are you naming it with a .csv (not CVS) suffix? For me, these have always shown up with an Excel icon when I send via email.

marisa_quaresma
Explorer
0 Kudos
295

Hi.

I am sending like this:

call method l_document->add_attachment

exporting

i_attachment_type = 'csv'

i_attachment_size = lv_size

i_attachment_subject = 'Result File'

i_att_content_hex = it_binary.

0 Kudos
295

Well, I when I look at this method, I see Attachment_type is of type SOODK-OBJTP. When I forward navigate into that, I see structure SOODK, with field name OBJTP, type SO_OBJ_TP. Forward navigating again, I see that that field has domain SO_OBJ_TP. When I look at the value range for the domain, I find table TSOTD. Inside that table, I don't find 'csv' as a type. This leads me to believe that SAP doesn't know what type of attachment it has. Since your code implies a hex/binary file, perhaps BIN is the replacement for CSV, and the file name should probably contain '.csv'. Sorry, it's been a while since I wrote a email with attachment; I don't remember what I used in prior programs, I believe is used BIN or RAW.

The choices are listed below:

ALI X X ABAP list document

ARC X Archive object (image)

BCS X External Document Storage

BIN X Binary document

DLI X Distribution list

EXT X X PC document

FOL X Folder

GRA X X SAP Business Graphics

OBJ X Business object

OFO X Object folder

OTF X OTF document

R3I X IDoc

RAW X X SAP editor document

SCR X SAPscript document

URL Link to Internet/Intranet

WIM X Work item

XXL X X Document for list viewer

0 Kudos
295

That's a good point but 'CSV' is actually valid - I've been using that and 'XLS' in custom email class methods with CL_BCS without any issues for years. The fact that the CSV file shows the correct format in the SAPConnect queue is strange. Format conversions are completed prior to rendering the document in the queue (as specifiied in the SMTP node configuration or in the language dependent device type conversion settings). If it's a SAPConnect problem, you should see the PDF format in the queue as well.

Have you tried using a different email client as the receiver? Is yur email dispatch based on the old RFC method or an SMTP-based connection to a mail host? With the old, RFC method, you could have a connection to external software package which could be the issue (if I remember correctly).

marisa_quaresma
Explorer
0 Kudos
295

I solved the problem.

0 Kudos
295

Hi Marisa,

Please let me know the document type you used for CSV format.

Thank you.