Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problem with CSV attachment using function 'SO_NEW_DOCUMENT_ATT_SEND_API1'


I am having a problem with a CSV file that I want to attach to an email sending it with function 'SO_NEW_DOCUMENT_ATT_SEND_API1'.

The function needs Contents_bin to be "solisti1" type, which has a line of 255 characters. Here is my code previous to the function:

"Main Text: Properties

CLEAR lw_objpack-transf_bin.

lw_objpack-head_start = 1.

lw_objpack-head_num = 0.

lw_objpack-body_start = 1.

lw_objpack-body_num = lv_lines_txt.

lw_objpack-doc_type = 'RAW'.

APPEND lw_objpack TO lt_objpack.

*  "Main Attachment (Properties)

lw_objpack-transf_bin = 'X'.

lw_objpack-head_start = 1.

lw_objpack-head_num = 0.

lw_objpack-body_start = 1.

DESCRIBE TABLE lt_objbin LINES lv_lines_bin.

lw_objpack-doc_size lv_lines_bin * 255.

lw_objpack-body_num = lv_lines_bin.

lw_objpack-doc_type = 'CSV'.

lw_objpack-obj_name = 'smart'.

"Get Attachment Name

CLEAR lv_text.

lv_text = 'FILE_NAME'.

lw_objpack-obj_descr = lv_text.      "Attachment Name

APPEND lw_objpack TO lt_objpack.

The the execution goes OK, but the CSV file attached is wrong: each line (no matter how much columns) has 255 characters, and if for example only 15 are completed, the other 240 char appear as blank spaces instead of not showing.

I mean, the width of the last column is not defined by the lenght of the last text, it just expands until it gets 255 characters.

Can somebody help me to avoid this? Thanks.

capture2.PNG (9624 B)

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question