2009 Sep 17 11:52 AM
Hi all!
I'm finding a problem while i try to send a document using the class CL_DOCUMENT_BCS.
I'm working in ECC 6.0.
The problem i got is the... space limit!
I can send an attachment (as .csv file) but i see i got 255 chars limit.
There is any way to send longer attachments (FM, class..)
PLEASE PAY ATTENTION
The FM SO_NEW_DOCUMENT_ATT_SEND_API1 is NOT a solution! I replaced it with class CL_DOCUMENT_BCS when upgraded from 4.7 to 6.0 for avoid some conversion issue.
Hi all!
I'm finding a problem while i try to send a document using the class CL_DOCUMENT_BCS.
I'm working in ECC 6.0.
The problem i got is the... space limit!
I can send an attachment (as .csv file) but i see i got 255 chars limit.
There is any way to send longer attachments (FM, class..)
PLEASE PAY ATTENTION
The FM SO_NEW_DOCUMENT_ATT_SEND_API1 is NOT a solution! I replaced it with class CL_DOCUMENT_BCS when upgraded from 4.7 to 6.0 for avoid some conversion issue.
2009 Sep 17 12:06 PM
Hi Simone,
Refer to the example program BCS_TEST05. Basically what you need to do is to convert the csv file to a hexadecimal table ( use this FM to do that SCMS_TEXT_TO_BINARY) and then use the method add_attachment of the class which accepts a binary table
Hope this helps.
There are many other example programs starting with BCS which you can have a look at.
BR,
Advait
2009 Sep 17 12:09 PM
Hi Simone,
You can refer the program BCS_EXAMPLE_7.
Regards,
Blessy
2009 Sep 17 12:17 PM
Hi Advait!
Ty for the reply!
At the moment i can create my attachment but when i try to open it in SOST transaction (development system DO NOT send mails here), i see only å©u0161å©u0161å©u0161å©u0161å©u0161å©u0161å©u0161å©u0161å©u0161å©u0161å©u0161.
I downloaded it as .csv file...
Here my code, if can be useful.
REPORT zitsimil.
PARAMETERS: indir LIKE zmail-e_mail.
DATA: contenuto LIKE soli OCCURS 0 WITH HEADER
LINE.
DATA: obj_hd_change LIKE sood1,
receivers_tab LIKE soos1 OCCURS 0 WITH HEADER LINE.
DATA: document_data LIKE sodocchgi1,
receivers_tab2 LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
contents_bin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: send_request TYPE REF TO cl_bcs.
DATA: att_text TYPE bcsy_text.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: bcs_exception TYPE REF TO cx_bcs.
DATA: sent_to_all TYPE os_boolean.
DATA: text TYPE bcsy_text.
DATA: val_ind LIKE adr6-smtp_addr.
DATA: BEGIN OF t_attach OCCURS 0,
wa(400).
datA: end of t_attach.
datA: binar LIKE solix OCCURS 100.
DATA va_line LIKE soli-line.
WRITE: 'Data:' TO va_line(5),
sy-datum TO va_line+6(10) DD/MM/YYYY,
'Ora:' TO va_line+18(4),
sy-uzeit TO va_line+23(8) USING EDIT MASK '__:__:__'.
send_request = cl_bcs=>create_persistent( ).
APPEND va_line TO text.
APPEND text-102 TO text.
APPEND text-103 TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '81'
i_subject = 'Deliveries' ).
REFRESH text.
* create a fake attachment long 400 chars
DO 400 TIMES.
CONCATENATE t_attach-wa 'Z' INTO t_attach-wa.
ENDDO.
t_attach-wa+395(5) = 'SSSSS'.
APPEND t_attach.
CALL FUNCTION 'SCMS_TEXT_TO_BINARY'
TABLES
text_tab = t_Attach
binary_tab = binar.
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'RAW'
i_attachment_subject = 'File attch'
i_attachment_size = '21'
I_ATT_CONTENT_HEX = binar.
* add document to send request
CALL METHOD send_request->set_document( document ).
MOVE indir TO val_ind.
recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = val_ind ).
* add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
.
*---------- send document---------------------------------------
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF sent_to_all = ' '.
MESSAGE i000(zf) WITH 'OK'.
ENDIF.
COMMIT WORK.
2009 Sep 17 12:17 PM
2009 Sep 17 12:24 PM
2009 Sep 17 12:26 PM
Hi,
Try 'CSV' as the document type
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'RAW' === > Change this to 'CSV'
i_attachment_subject = 'File attch'
i_attachment_size = '21'
I_ATT_CONTENT_HEX = binar.
BR,
Advait