2009 Aug 19 6:48 PM
<head>
Hi,
</head>
<body>
<br> I would like to know if anyone can help me sending an email that is giving me problems. The problem is that when I try to send it, this parts are Ok: body, header, attachment "file with one line", but when I open the file u201C.txtu201D the items appear separated by space and this happens when I send file with a line, if I do it with several lines everything works ok.
<br><br><br>Example:
<br>With one line:
<br>V - H 2 8 6 - 0 4 5 7 , 2 0 0 7 0 3 2 8 , C A R
<br>with many lines.
<br>V-H286-0457, 20070328, CAR
<br>V-H286-0457, 20070328, CAR
<br>V-H286-0457, 20070328, CAR
<br>
<br>the parameters that I'm sending.
<br>
<br> LOOP AT it_tab.
<br> DO.
<br> ASSIGN COMPONENT sy-index OF STRUCTURE it_tab TO <field>.
<br> IF sy-subrc <> 0.
<br> EXIT.
<br> ENDIF.
<br>* Look for Commas in the field value. If it exists, put quotes around
<br>* value so that the file opens correctly with all the columns aligned
<br>* in Excel.
<br> SEARCH <field> FOR ',' IN CHARACTER MODE.
<br>* If search for commas are successful.
<br> IF sy-subrc = 0.
<br> CONCATENATE '"' <field> '"' INTO <field> IN CHARACTER MODE.
<br> ENDIF.
<br> IF sy-index = 1.
<br> i_dload-dload = <field>.
<br> SHIFT: i_dload-dload LEFT DELETING LEADING space.
<br> ELSE.
<br>* Put Comma as a separator for values in IT_DLOAD internal table
<br> SHIFT: i_dload-dload LEFT DELETING LEADING space.
<br> CONCATENATE i_dload-dload <field> INTO i_dload-dload
<br> SEPARATED BY ',' IN CHARACTER MODE.
<br> ENDIF.
<br> ENDDO.
<br> it_objbin = i_dload-dload.
<br> APPEND it_objbin . CLEAR it_objbin.
<br> ENDLOOP.
<br>
<br>
<br>
<br> DESCRIBE TABLE it_objtxt LINES tab_lines.
<br> CLEAR it_objpack-transf_bin.
<br> it_objpack-head_start = 1.
<br> it_objpack-head_num = 0.
<br> it_objpack-body_start = 1.
<br> it_objpack-body_num = tab_lines.
<br> it_objpack-doc_type = 'RAW'.
<br> APPEND it_objpack.
<br>
<br> it_objpack-head_start = 1.
<br> it_objpack-head_num = 0.
<br> it_objpack-body_start = 1.
<br> it_objpack-body_num = 1.
<br> it_objpack-transf_bin = 'X'.
<br> it_objpack-doc_type = 'TXT'.
<br> it_objpack-obj_descr = w_filename.
<br> it_objpack-obj_name = 'BILLING'.
<br> it_objpack-doc_size = tab_lines * 255.
<br> APPEND it_objpack.
<br>
<br>
<br> CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
<br> EXPORTING
<br> document_data = doc_chng
<br> commit_work = 'X'
<br> TABLES
<br> packing_list = it_objpack
<br>* object_header = it_objhead
<br> contents_bin = it_objbin
<br> contents_txt = it_objtxt
<br> receivers = it_reclist
<br> EXCEPTIONS
<br> too_many_receivers = 1
<br> document_not_sent = 2
<br> operation_no_authorization = 4
<br> OTHERS = 99.
<br>
<br>Rgds
<br>
<br> Richard
</body>
Edited by: Richard Carrasco on Aug 19, 2009 7:50 PM
<head>
Hi,
</head>
<body>
<br> I would like to know if anyone can help me sending an email that is giving me problems. The problem is that when I try to send it, this parts are Ok: body, header, attachment "file with one line", but when I open the file u201C.txtu201D the items appear separated by space and this happens when I send file with a line, if I do it with several lines everything works ok.
<br><br><br>Example:
<br>With one line:
<br>V - H 2 8 6 - 0 4 5 7 , 2 0 0 7 0 3 2 8 , C A R
<br>with many lines.
<br>V-H286-0457, 20070328, CAR
<br>V-H286-0457, 20070328, CAR
<br>V-H286-0457, 20070328, CAR
<br>
<br>the parameters that I'm sending.
<br>
<br> LOOP AT it_tab.
<br> DO.
<br> ASSIGN COMPONENT sy-index OF STRUCTURE it_tab TO <field>.
<br> IF sy-subrc <> 0.
<br> EXIT.
<br> ENDIF.
<br>* Look for Commas in the field value. If it exists, put quotes around
<br>* value so that the file opens correctly with all the columns aligned
<br>* in Excel.
<br> SEARCH <field> FOR ',' IN CHARACTER MODE.
<br>* If search for commas are successful.
<br> IF sy-subrc = 0.
<br> CONCATENATE '"' <field> '"' INTO <field> IN CHARACTER MODE.
<br> ENDIF.
<br> IF sy-index = 1.
<br> i_dload-dload = <field>.
<br> SHIFT: i_dload-dload LEFT DELETING LEADING space.
<br> ELSE.
<br>* Put Comma as a separator for values in IT_DLOAD internal table
<br> SHIFT: i_dload-dload LEFT DELETING LEADING space.
<br> CONCATENATE i_dload-dload <field> INTO i_dload-dload
<br> SEPARATED BY ',' IN CHARACTER MODE.
<br> ENDIF.
<br> ENDDO.
<br> it_objbin = i_dload-dload.
<br> APPEND it_objbin . CLEAR it_objbin.
<br> ENDLOOP.
<br>
<br>
<br>
<br> DESCRIBE TABLE it_objtxt LINES tab_lines.
<br> CLEAR it_objpack-transf_bin.
<br> it_objpack-head_start = 1.
<br> it_objpack-head_num = 0.
<br> it_objpack-body_start = 1.
<br> it_objpack-body_num = tab_lines.
<br> it_objpack-doc_type = 'RAW'.
<br> APPEND it_objpack.
<br>
<br> it_objpack-head_start = 1.
<br> it_objpack-head_num = 0.
<br> it_objpack-body_start = 1.
<br> it_objpack-body_num = 1.
<br> it_objpack-transf_bin = 'X'.
<br> it_objpack-doc_type = 'TXT'.
<br> it_objpack-obj_descr = w_filename.
<br> it_objpack-obj_name = 'BILLING'.
<br> it_objpack-doc_size = tab_lines * 255.
<br> APPEND it_objpack.
<br>
<br>
<br> CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
<br> EXPORTING
<br> document_data = doc_chng
<br> commit_work = 'X'
<br> TABLES
<br> packing_list = it_objpack
<br>* object_header = it_objhead
<br> contents_bin = it_objbin
<br> contents_txt = it_objtxt
<br> receivers = it_reclist
<br> EXCEPTIONS
<br> too_many_receivers = 1
<br> document_not_sent = 2
<br> operation_no_authorization = 4
<br> OTHERS = 99.
<br>
<br>Rgds
<br>
<br> Richard
</body>
Edited by: Richard Carrasco on Aug 19, 2009 7:50 PM
2009 Aug 19 7:16 PM
Try this way
IF sy-index = 1.
i_dload-dload = .
*SHIFT: i_dload-dload LEFT DELETING LEADING space.
condense i_dload-dload.
ELSE.
*SHIFT: i_dload-dload LEFT DELETING LEADING space.
*CONCATENATE i_dload-dload INTO i_dload-dload
*SEPARATED BY ',' IN CHARACTER MODE.
concatenate i_dload-dload ';' into i_dload-dload.
condense i_dload-dload.
ENDIF.
PS I am not 100% sure about this
a®
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |