2017 Mar 06 2:11 PM
Hi experts,
I have a report that was going well until some weeks ago, I don't know if it's due to migration to hana or to unicode.
We we're using fm SO_DOCUMENT_SEND_API1 to send a mail with an attachment .TXT. We used
CONSTANTS: crlf TYPE c VALUE cl_abap_char_utilities=>cr_lf.
to separate lines and it was working fine but now it doesn't work anymore. When I debug the code I see in each line '#' indicating the new line. When I open the file attached to the mail there is no format as you can see in my attach.
That's how I call the fm
call function 'SO_DOCUMENT_SEND_API1'
exporting
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
importing
SENT_TO_ALL = W_SENT_ALL
tables
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
exceptions
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
others = 8.
T_ATTACHMENT contains the text attached, should I convert this internal table to binary mode ? At this moment it looks like:
Thanks in advance !!
María
2017 Mar 06 8:24 PM
Why are you passing a "text" via the "binary" parameter (reserved for images, PDFs, ZIPs, etc., but NOT text), why don't you use the "text" parameter? It used to work because in the past, before Unicode, a character was a byte and vice versa. If you pass your text as a text, make sure to pass packing_list-transf_bin = abap_false. Moreover, why not using CL_BCS? See the many sample programs BCS_EXAMPLE_*.
Hi experts,
I have a report that was going well until some weeks ago, I don't know if it's due to migration to hana or to unicode.
We we're using fm SO_DOCUMENT_SEND_API1 to send a mail with an attachment .TXT. We used
CONSTANTS: crlf TYPE c VALUE cl_abap_char_utilities=>cr_lf.
to separate lines and it was working fine but now it doesn't work anymore. When I debug the code I see in each line '#' indicating the new line. When I open the file attached to the mail there is no format as you can see in my attach.
That's how I call the fm
call function 'SO_DOCUMENT_SEND_API1'
exporting
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
importing
SENT_TO_ALL = W_SENT_ALL
tables
PACKING_LIST = T_PACKING_LIST
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
exceptions
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
others = 8.
T_ATTACHMENT contains the text attached, should I convert this internal table to binary mode ? At this moment it looks like:
Thanks in advance !!
María
2017 Mar 06 2:17 PM
2017 Mar 06 2:36 PM
Thanks for the answer Pablo, but I don't find any solution for my problem in this link.
María
2017 Mar 06 3:56 PM
I'd imagine Pablo is referring to the following passage from the blog:
First, where to use it not. You cannot use a line feed character or any other control character in classical list programming. The following line
WRITE |aaaa\nbbbbb|.
produces an output like aaaa#bbbbb. The classical list processor does not recognize the control character and it does not treat it as a whitespace. It is an unknown character that is displayed as #. In classical list programming you have to use two (chained) WRITE-Statements:
WRITE: |aaaa|, / |bbbbb|.
2017 Mar 06 8:24 PM
Why are you passing a "text" via the "binary" parameter (reserved for images, PDFs, ZIPs, etc., but NOT text), why don't you use the "text" parameter? It used to work because in the past, before Unicode, a character was a byte and vice versa. If you pass your text as a text, make sure to pass packing_list-transf_bin = abap_false. Moreover, why not using CL_BCS? See the many sample programs BCS_EXAMPLE_*.
2017 Mar 07 7:20 AM
Absolutely. SO_DOCUMENT_SEND_API1 is not only obsolete but was always problematical. The OP should take the time to redevelop the program using CL_BCS classes.
2017 Mar 07 9:26 AM
This report has been working for years, it's not me who developped it, but it's me who has to solve the problem. I've been thinking on using CL_BCS but before doing that I want to understand the problem.
Sandra, I'll change the parameter and tell you if it works. Thanks !
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |