Problem in sending Nota Fiscal XML as Email
Hi
We have activated B2B for our brazilianl client to send Nota fiscal xml as an email to the customer. This is triggered based upon the CNPJ code in table /xnfe/tb2b .This works fine.
Now, we have an additional requirement to send the XML to a general email address in the client company even for customers for whom B2B has not been activated in table /xnfe/tb2b.
For this wechanged the form check_b2b_sendin in program /XNFE/LAPPL_PROCESSESF02, to poulate the cnpj value even if it is not found in table /xnfe/tb2b.. however still the email is not triggered for such customers.
Thanks In advance!
I believe, you need to have partner profile(KU) created for your desired customer by using TCode WE20.
Then in customer master, your customer's contact email need to be maintain.
Regards
JP
Similar Messages
-
Problem in sending the smartform as an email in a country specific language
Hi,
I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
the program is working fine for english.
Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
Please help.
Arun.
Determine smartform function module for purchase document
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
error handling
ent_retco = sy-subrc.
IF sy-subrc = 1.
MESSAGE e001(/smb40/ssfcomposer).
ENDIF.
IF sy-subrc = 2.
MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
ENDIF.
PERFORM protocol_update_i.
ENDIF.
*Start of changes <Arun K Singarapu> C082493 <04/28/2008>
*for print preview
IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
EXIT.
ELSE.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_compop-tdnoprev = 'X'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Convert the data from OTF to PDF format
it_otf[] = wa_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = l_len_in
bin_file = lp_xcontent
TABLES
otf = it_otf
lines = it_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
TRY.
---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
len = XSTRLEN( lp_xcontent ).
transform to solix tab
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = lp_xcontent ).
Create Body to the E-mail.
APPEND Text-005 TO l_text.
Attachment Name
l_ponumber = text-004.
CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
Subject for the E-Mail.
l_subject = text-001.
CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
*create document E-Mail.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject
i_length = '13'
i_text = l_text
RECEIVING
result = l_email_object.
*Create PDF Document
bcs_doc = cl_document_bcs=>create_document(
i_type = 'PDF'
i_subject = l_ponumber
i_length = len
i_language = nast-spras
i_hex = lt_solix
*Type casting
obj_pdf_file ?= bcs_doc.
Add PDF document as an attachment
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_pdf_file.
get the attachments of the PO for each line item
SELECT ebeln
ebelp
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln = l_doc-xekko-ebeln.
concatenate PO and the Line Item Numebr to get the Object key
LOOP AT it_ekpo INTO wa_ekpo.
CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
APPEND wa_temp TO it_temp.
CLEAR: wa_temp,wa_ekpo.
ENDLOOP.
*Get data from table DRAD
IF it_temp[] IS NOT INITIAL.
SELECT dokar
doknr
dokvr
doktl
objky
FROM drad
client specified
INTO TABLE it_drad
FOR ALL ENTRIES IN it_temp
WHERE mandt = sy-mandt
AND objky = it_temp-objky.
ENDIF.
IF NOT it_drad IS INITIAL.
SELECT * FROM dms_doc2loio
INTO TABLE it_dms_doc2loio
FOR ALL ENTRIES IN it_drad
WHERE dokar = 'SRM'
AND doknr = it_drad-doknr
AND dokvr = it_drad-dokvr
AND doktl = it_drad-doktl.
ENDIF.
Get the Physical object class and Object ID of the attachment
IF NOT it_dms_doc2loio IS INITIAL.
SELECT * FROM dms_ph_cd1
INTO TABLE it_dms_ph_cd1
FOR ALL ENTRIES IN it_dms_doc2loio
WHERE loio_id = it_dms_doc2loio-lo_objid.
ENDIF.
Get the file from the DMS server using the below function module.
LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
wa_object_id-class = wa_dms_ph_cd1-ph_class.
wa_object_id-objid = wa_dms_ph_cd1-phio_id.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
EXPORTING
object_id = wa_object_id
client = sy-mandt
TABLES
file_access_info = it_file_access_info
file_content_binary = it_sdokcntbin
EXCEPTIONS
not_existing = 1
not_authorized = 2
no_content = 3
bad_storage_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
IF wa_file_access_info-mimetype = 'application/msword'.
l_doc_type = 'DOC'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for PDF document
ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
l_doc_type = 'PDF'.
file_size = wa_file_access_info-file_size.
Convert the 1022 binary data to xstring
CLEAR a_xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = file_size
IMPORTING
buffer = a_xstring
TABLES
binary_tab = it_sdokcntbin
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: w_output_length TYPE i.
Convert Xstring to 255 RAW
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = a_xstring
IMPORTING
output_length = w_output_length
TABLES
binary_tab = lt_content_bin.
len = w_output_length.
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_content_bin
type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for Excel Document
ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
l_doc_type = 'XLS'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for text doxument
ELSEIF wa_file_access_info-mimetype = 'plain/text'.
l_doc_type = 'TXT'.
file_size = wa_file_access_info-file_size.
Get the file name
l_filename = wa_file_access_info-file_name.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
input_length = file_size
TABLES
binary_tab = it_sdokcntbin
text_tab = file_data
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = l_doc_type
i_subject = l_filename
i_text = file_data
RECEIVING
result = bcs_doc1.
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
ENDIF.
CLEAR:it_file_access_info,it_sdokcntbin.
CLEAR:wa_object_id,wa_file_access_info,file_size.
ENDLOOP.
CALL METHOD send_request->set_document( l_email_object ).
*Get the address number for the vendor
SELECT SINGLE adrnr
FROM lfa1
INTO l_adrnr
WHERE lifnr = l_doc-xekko-lifnr.
MOVE l_adrnr TO l_addrno.
Get the Email Address for the vendor using address number
CALL FUNCTION 'ADDR_GET_REMOTE'
EXPORTING
addrnumber = l_addrno
TABLES
adsmtp = it_adsmtp
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
IF sy-subrc = 0.
LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
ELSE.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
IF sy-subrc = 0.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDIF.
ENDIF.
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_sent_to_all ).
CATCH cx_bcs INTO bcs_exception.
WRITE: 'Fehler aufgetreten.'(001).
WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
EXIT.
ENDTRY.
ENDIF.Hi,
I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
the program is working fine for english.
Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
Please help.
Arun.
Determine smartform function module for purchase document
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
error handling
ent_retco = sy-subrc.
IF sy-subrc = 1.
MESSAGE e001(/smb40/ssfcomposer).
ENDIF.
IF sy-subrc = 2.
MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
ENDIF.
PERFORM protocol_update_i.
ENDIF.
*Start of changes <Arun K Singarapu> C082493 <04/28/2008>
*for print preview
IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
EXIT.
ELSE.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_compop-tdnoprev = 'X'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*Convert the data from OTF to PDF format
it_otf[] = wa_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = l_len_in
bin_file = lp_xcontent
TABLES
otf = it_otf
lines = it_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
TRY.
---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
len = XSTRLEN( lp_xcontent ).
transform to solix tab
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = lp_xcontent ).
Create Body to the E-mail.
APPEND Text-005 TO l_text.
Attachment Name
l_ponumber = text-004.
CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
Subject for the E-Mail.
l_subject = text-001.
CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
*create document E-Mail.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject
i_length = '13'
i_text = l_text
RECEIVING
result = l_email_object.
*Create PDF Document
bcs_doc = cl_document_bcs=>create_document(
i_type = 'PDF'
i_subject = l_ponumber
i_length = len
i_language = nast-spras
i_hex = lt_solix
*Type casting
obj_pdf_file ?= bcs_doc.
Add PDF document as an attachment
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_pdf_file.
get the attachments of the PO for each line item
SELECT ebeln
ebelp
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln = l_doc-xekko-ebeln.
concatenate PO and the Line Item Numebr to get the Object key
LOOP AT it_ekpo INTO wa_ekpo.
CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
APPEND wa_temp TO it_temp.
CLEAR: wa_temp,wa_ekpo.
ENDLOOP.
*Get data from table DRAD
IF it_temp[] IS NOT INITIAL.
SELECT dokar
doknr
dokvr
doktl
objky
FROM drad
client specified
INTO TABLE it_drad
FOR ALL ENTRIES IN it_temp
WHERE mandt = sy-mandt
AND objky = it_temp-objky.
ENDIF.
IF NOT it_drad IS INITIAL.
SELECT * FROM dms_doc2loio
INTO TABLE it_dms_doc2loio
FOR ALL ENTRIES IN it_drad
WHERE dokar = 'SRM'
AND doknr = it_drad-doknr
AND dokvr = it_drad-dokvr
AND doktl = it_drad-doktl.
ENDIF.
Get the Physical object class and Object ID of the attachment
IF NOT it_dms_doc2loio IS INITIAL.
SELECT * FROM dms_ph_cd1
INTO TABLE it_dms_ph_cd1
FOR ALL ENTRIES IN it_dms_doc2loio
WHERE loio_id = it_dms_doc2loio-lo_objid.
ENDIF.
Get the file from the DMS server using the below function module.
LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
wa_object_id-class = wa_dms_ph_cd1-ph_class.
wa_object_id-objid = wa_dms_ph_cd1-phio_id.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
EXPORTING
object_id = wa_object_id
client = sy-mandt
TABLES
file_access_info = it_file_access_info
file_content_binary = it_sdokcntbin
EXCEPTIONS
not_existing = 1
not_authorized = 2
no_content = 3
bad_storage_type = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
IF wa_file_access_info-mimetype = 'application/msword'.
l_doc_type = 'DOC'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for PDF document
ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
l_doc_type = 'PDF'.
file_size = wa_file_access_info-file_size.
Convert the 1022 binary data to xstring
CLEAR a_xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = file_size
IMPORTING
buffer = a_xstring
TABLES
binary_tab = it_sdokcntbin
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: w_output_length TYPE i.
Convert Xstring to 255 RAW
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = a_xstring
IMPORTING
output_length = w_output_length
TABLES
binary_tab = lt_content_bin.
len = w_output_length.
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_content_bin
type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for Excel Document
ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
l_doc_type = 'XLS'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for text doxument
ELSEIF wa_file_access_info-mimetype = 'plain/text'.
l_doc_type = 'TXT'.
file_size = wa_file_access_info-file_size.
Get the file name
l_filename = wa_file_access_info-file_name.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
input_length = file_size
TABLES
binary_tab = it_sdokcntbin
text_tab = file_data
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = l_doc_type
i_subject = l_filename
i_text = file_data
RECEIVING
result = bcs_doc1.
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
ENDIF.
CLEAR:it_file_access_info,it_sdokcntbin.
CLEAR:wa_object_id,wa_file_access_info,file_size.
ENDLOOP.
CALL METHOD send_request->set_document( l_email_object ).
*Get the address number for the vendor
SELECT SINGLE adrnr
FROM lfa1
INTO l_adrnr
WHERE lifnr = l_doc-xekko-lifnr.
MOVE l_adrnr TO l_addrno.
Get the Email Address for the vendor using address number
CALL FUNCTION 'ADDR_GET_REMOTE'
EXPORTING
addrnumber = l_addrno
TABLES
adsmtp = it_adsmtp
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
IF sy-subrc = 0.
LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
ELSE.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
IF sy-subrc = 0.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDIF.
ENDIF.
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_sent_to_all ).
CATCH cx_bcs INTO bcs_exception.
WRITE: 'Fehler aufgetreten.'(001).
WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
EXIT.
ENDTRY.
ENDIF. -
Problem to send a report to an Email address
Hi All,
I am using 10g forms and reports.I want to send a report to an email address using web.show_document();
code is:WEB.SHOW_DOCUMENT('http://localhost:post/reports/rwservlet?userid=ur/ps@db&report='report_name&destype=mail&desformat=RTF&from=[email protected]&desname=[email protected]¶mform=no&_blank') ;
this code generates an error message:
REP-50159: Executed successfully but there were some errors when distribute the output
I already configure my rwbuilder.conf and report_server.conf file.
Although I am able to send this mail from report builder from FILE->mail menu.
plz help me ASAP.
thanks in advance.
SanjitOk, did you add your smtp server to your <reports>.conf file is located at the end of the file.
Because if it has been working for other destype it's probably security smtp related.
so check if the correct smtp server is written there and that you can access it too because otherwise it would be impossible to send e-mail, if you're not the e-mail admin contact him and ask hin if he sees an attempt to send on the smtp engine log for your from user
Erwin -
Problem in sending CSV as attachment in email
Hi All,
I'm working on ECC 5.0. I have an internal table with the data. I have to send this data as an attachment in an email. I sending a sample code which i used. When i try to open the attachment it is giving as warning popup 'File type is not recognized' and also the entire record in coming in the first column only.
*& Report ZTEST_EMAIL_SEND_ATTACH_PDF
REPORT ZTEST_EMAIL_SEND_ATTACH_PDF.
class CL_ABAP_CHAR_UTILITIES definition load.
constants:v_nl type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>newline,
v_ht type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>horizontal_TAB,
v_bs type ABAP_CHAR1 value CL_ABAP_CHAR_UTILITIES=>CR_LF.
data: begin of i_records occurs 0,
data(30) type c,
reason(225) type c,
end of i_records.
DATA: v_dest LIKE tsp01-rqdest,
v_handle LIKE sy-tabix,
v_spool_id LIKE tsp01-rqident,
v_rc TYPE c,
v_errmessage(100) TYPE c,
v_text(200) TYPE c,
i_pdf type standard table of tline.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
START-OF-SELECTION.
i_records-data = '1002'.
i_records-reason = 'date is empty'.
append i_records.
clear i_records.
i_records-data = '1005'.
i_records-reason = 'time is empty'.
append i_records.
clear i_records.
loop at i_records.
concatenate i_records-data i_records-reason into objbin-line separated by ','.
concatenate v_nl objbin-line into objbin-line.
append objbin.
clear: i_records, objbin.
endloop.
perform f_mail_send.
*& Form f_mail_send
text
--> p1 text
<-- p2 text
form f_mail_send .
DATA: i_email TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_mess TYPE TABLE OF solisti1 WITH HEADER LINE,
w_subject TYPE so_obj_des,
w_name TYPE so_obj_nam.
w_name TYPE char30.
i_email-receiver = '[email protected]'.
APPEND i_email.
i_mess-line = 'This is a test message. Customer Statements'.
APPEND i_mess.
w_name = 'Statements_345594_344455_conv'.
w_subject = 'Your Customer Statement for'.
PERFORM send_mail_out_raw TABLES i_email
i_mess
USING w_subject
w_name.
endform. " f_mail_send
*& Form send_mail_out_raw
text
-->PI_EMAIL text
-->PI_MESS text
-->PI_PDF text
-->PV_SUBJECT text
-->PV_NAME text
FORM send_mail_out_raw TABLES pi_email STRUCTURE somlreci1
pi_mess STRUCTURE solisti1 "Message
USING pv_subject TYPE so_obj_des
pv_name TYPE char30.
DATA :
li_receivers TYPE STANDARD TABLE OF somlreci1,
li_head TYPE STANDARD TABLE OF solisti1,
li_packing_list TYPE STANDARD TABLE OF sopcklsti1,
li_pdf TYPE STANDARD TABLE OF solisti1.
DATA : lst_doc_data TYPE sodocchgi1,
lw_lines TYPE i,
lw_name(34) TYPE c,
lw_subject TYPE sodocchgi1-obj_descr.
DATA : lst_pemail TYPE somlreci1,
lst_pmess TYPE solisti1,
lst_receivers TYPE somlreci1,
lst_head TYPE solisti1,
lst_packing_list TYPE sopcklsti1,
lst_mess TYPE solisti1.
lw_subject = pv_subject.
lw_name = pv_name.
CONCATENATE lw_name '.csv' INTO lw_name.
CONDENSE lw_name NO-GAPS.
Fill the email content
DESCRIBE TABLE pi_mess LINES lw_lines.
Populate the subject/generic message attributes
lst_doc_data-obj_langu = sy-langu.
lst_doc_data-obj_name = lw_name.
lst_doc_data-obj_descr = lw_subject.
READ TABLE pi_mess INTO lst_mess INDEX lw_lines.
lst_doc_data-doc_size = ( lw_lines - 1 ) * 255 +
STRLEN( lst_mess ).
Describe the body of the message
REFRESH li_packing_list.
lst_packing_list-transf_bin = space.
lst_packing_list-head_start = 1.
lst_packing_list-head_num = 0.
lst_packing_list-body_start = 1.
lst_packing_list-body_num = lw_lines.
lst_packing_list-doc_type = 'RAW'.
lst_packing_list-doc_size = ( lw_lines - 1 ) * 255 +
STRLEN( lst_mess ).
APPEND lst_packing_list TO li_packing_list.
CLEAR lst_packing_list.
Create attachment
CLEAR lw_lines.
DESCRIBE TABLE objbin LINES lw_lines.
lst_packing_list-transf_bin = 'X'.
lst_packing_list-head_start = 1.
lst_packing_list-head_num = 1.
lst_packing_list-body_start = 1.
lst_packing_list-body_num = lw_lines.
lst_packing_list-doc_type = 'CSV'.
lst_packing_list-obj_descr = lw_subject.
lst_packing_list-obj_name = lw_name.
lst_packing_list-doc_size = ( lw_lines ) * 255.
APPEND lst_packing_list TO li_packing_list.
Header
REFRESH li_head.
CLEAR lst_head. REFRESH li_head.
lst_head-line = lw_name. APPEND lst_head TO li_head.
Add the recipients email address
REFRESH li_receivers.
LOOP AT pi_email INTO lst_pemail.
lst_receivers-receiver = lst_pemail-receiver.
lst_receivers-rec_type = 'U'.
lst_receivers-com_type = 'INT'.
APPEND lst_receivers TO li_receivers.
CLEAR lst_receivers.
ENDLOOP.
*Send mail to external address
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = lst_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = li_packing_list
object_header = li_head
contents_bin = objbin
contents_txt = pi_mess
receivers = li_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.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lst_doc_data
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
tables
packing_list = li_packing_list
OBJECT_HEADER = li_head
CONTENTS_BIN = objbin
CONTENTS_TXT = pi_mess
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = li_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 .
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "Send_mail
SaiHi sai,
1. I just tried it now.
2. And it works ok now.
3. Just make 2 corrections.
a) replace your definition of new_line with.
<b>constants:v_nl(2) type c value CL_ABAP_CHAR_UTILITIES=>CR_LF,</b>
b) Instead of using concatenate v_nl objbin-line into objbin-line.
use
<b> concatenate objbin-line v_nl into objbin-line.</b>
regards,
amit m. -
Problem while sending idoc over xml http
Hello all,
We have developed a scenario to send the idocs from SAP to Java(Tomcat) web server. Its was working fine. But SOMETIMES the idoc status will be set to 03(Data passede to port OK) on the SAP side, but no data(no xml string) received in the web server. is this depends on the size of the idoc? or due to some JVM settings of webserver??Could someone suggest us a way to identify the problem.
Thanks in advance
Regards,
Vishu.Asit Purbey,
i have send 2 idocs with different number of segments. idoc with 2 segments is successfully received in the webserver, but the idoc with 100 segments didnt received in the webserver. Then i processed RBDMOIND but both the idocs remain in status 03.. Please help me to figure out the problem......
Regards,
Vishu. -
Problems with sending the Job_ID with activity EMAIL from a processflow
Hello everybody,
i have a problem with a simple process flow.
I want to send an EMail that contains in the MESSAGE_BODY the Job_ID from the started workflow. For that reason i wrote a function with a select statement that gives back the number.
Code:
l_owb_id VARCHAR2(20);
BEGIN
select to_char(top_level_execution_audit_id)
into l_owb_id
from ALL_RT_AUDIT_EXECUTIONS
where task_name = 'XYZ'
and created_on like sysdate;
return (l_owb_id);
END;
The function works fine. So i placed it into my workflow. Now i wanted to bind the MESSAGE_BODY from the activity EMAIL with the parameter of the function. But when i click validate it shows following error:
VLD-10042: Parameter MESSAGE_BODY of EMAIL is incorrectly bound. Output of cannot be converted into a constant value.
VLD-10042: Activity MESSAGE_BODY of EMAIL is currently bound to parameter GET_OWB_ID of .Activities must be bound through an intermediate variable
Can anyone help me how to fix that proplem. How can i send the Process ID per activity EMAIL in a Workflow. On the internet i didn't found anything helpful, so any help would be appreiciated.
Kind regards,
DanielYou need to create Variable and then bind the value from your function to that variable and than use that variable as parameter for email MESSAGE_BODY.
So you will have:
Variable: p_id
Return parameter of your function will be bind to p_id and message_body of your email will be bind to p_id. -
Problem in sending a JSP Page as email !!
Hi,
I have a web based tool which sends a jsp page as the body of the email. The jsp page contains a table with data. When i forward that email the table in the email is coming up. Kindly suggest something which will prevent me fom this.Hi,
There is an article regarding this at
http://www.stardeveloper.com/articles/display.html?article=2001101101&page=1
Best Regards -
Problem in sending online interactive form in email as PDF attachment
Hi,
I am trying to send online intercative forms as PDF attachment once user fills it and click on send button. But this mail i am trying to send from SAP workflow. For this am using one function module which is accepting the pdfsource context attribute of binary type as Xstring. Once i run the webdynpro application i am getting mail in out look but when i open the attachment i am getting error file is damaged.
Can you pls help me in solving this, Or any other way for doing the same.
Here is the code i am using for triggering the RFC from WD
Zsend_Mail_Attachment_Sev_Input mail = new Zsend_Mail_Attachment_Sev_Input();
//to capture the outplacement level entered in the form
mail.setI_Out_Place_Level(wdContext.currentVn_severancedetailsElement().getVa_outplacement_level().getBytes());
mail.setI_Bin_Data(wdContext.currentContextElement().getPdfSource());
wdContext.nodeZsend_Mail_Attachment_Sev_Input().bind(mail);
try
wdContext.currentZsend_Mail_Attachment_Sev_InputElement().modelObject().execute();
wdComponentAPI.getMessageManager().reportSuccess("Notification Sent Successfully.");
catch (WDDynamicRFCExecuteException e)
// TODO Auto-generated catch block
wdComponentAPI.getMessageManager().reportSuccess(" This is inside the mail exception!!"+e);
e.printStackTrace();
Here is the function module code
FUNCTION ZSEND_MAIL_ATTACHMENT_SEV.
""Local Interface:
*" IMPORTING
*" VALUE(I_OUT_PLACE_LEVEL) TYPE XSTRING OPTIONAL
*" VALUE(I_BIN_DATA) TYPE XSTRING OPTIONAL
*" TABLES
*" T_V_BIN_DATA STRUCTURE SOLISTI1
*" IT_MESSAGE STRUCTURE SOLISTI1
Data Declaration
DATA: gd_cnt TYPE i,
gd_sent_all(1) TYPE c,
gd_error TYPE sy-subrc,
tab_lines LIKE sy-tabix,
v_subject(255) VALUE 'HI'.
Structure Declaration
DATA : BEGIN OF it_file OCCURS 0,
row(255),
END OF it_file.
DATA : BEGIN OF i_split OCCURS 0,
row(50),
END OF i_split.
DESCRIBE TABLE it_message LINES tab_lines.
READ TABLE it_message INDEX tab_lines.
Internal Table Declaration
data : it_receivers like table of SOMLRECI1 with header line."occurs 0.
DATA : objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE.
DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
data : wa_receiver like table of SOMLRECI1 with header line.
data : it_receiver like table of SOMLRECI1 with header line.
DATA : gd_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
REFRESH : objbin, it_packing_list, it_receivers, wa_receiver.
CLEAR : objbin, it_packing_list, wa_receiver, it_receivers.
gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SENDFILE'.
gd_doc_data-obj_descr = v_subject.
gd_doc_data-sensitivty = 'O'.
APPEND GD_DOC_DATA.
Appending The Internal Table it_packing_list
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
it_packing_list-doc_type = 'RAW'.
it_packing_list-body_num = tab_lines.
APPEND it_packing_list.
move i_bin_data to t_v_bin_data.
********Add By Anuj
APPEND t_v_bin_data.
********End Add By Anuj
LOOP AT t_v_bin_data.
MOVE t_v_bin_data TO objbin-line.
APPEND objbin.
ENDLOOP.
CLEAR it_packing_list.
DESCRIBE TABLE objbin LINES tab_lines.
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
it_packing_list-doc_type = 'PDF'.
it_packing_list-body_num = tab_lines.
it_packing_list-doc_size = tab_lines * 255.
APPEND it_packing_list.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
*Appending The Internal Table it_receivers
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver to it_receiver.
append it_receiver.
Move wa_receiver[] to it_receivers[].
Clear it_receivers.
if i_OUT_PLACE_LEVEL NE 0.
loop at it_receivers into wa_receiver.
loop at it_receivers into wa_receiver.
*Function Module To Post The Message To Externa Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_hex = objbin
receivers = it_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.
clear wa_receiver.
endloop.
elseif i_OUT_PLACE_LEVEL eq 0.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_hex = objbin
receivers = it_receiver
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.
clear wa_receiver.
endif.
ENDFUNCTION.
Regards
RavindraHi,
I am trying to send online intercative forms as PDF attachment once user fills it and click on send button. But this mail i am trying to send from SAP workflow. For this am using one function module which is accepting the pdfsource context attribute of binary type as Xstring. Once i run the webdynpro application i am getting mail in out look but when i open the attachment i am getting error file is damaged.
Can you pls help me in solving this, Or any other way for doing the same.
Here is the code i am using for triggering the RFC from WD
Zsend_Mail_Attachment_Sev_Input mail = new Zsend_Mail_Attachment_Sev_Input();
//to capture the outplacement level entered in the form
mail.setI_Out_Place_Level(wdContext.currentVn_severancedetailsElement().getVa_outplacement_level().getBytes());
mail.setI_Bin_Data(wdContext.currentContextElement().getPdfSource());
wdContext.nodeZsend_Mail_Attachment_Sev_Input().bind(mail);
try
wdContext.currentZsend_Mail_Attachment_Sev_InputElement().modelObject().execute();
wdComponentAPI.getMessageManager().reportSuccess("Notification Sent Successfully.");
catch (WDDynamicRFCExecuteException e)
// TODO Auto-generated catch block
wdComponentAPI.getMessageManager().reportSuccess(" This is inside the mail exception!!"+e);
e.printStackTrace();
Here is the function module code
FUNCTION ZSEND_MAIL_ATTACHMENT_SEV.
""Local Interface:
*" IMPORTING
*" VALUE(I_OUT_PLACE_LEVEL) TYPE XSTRING OPTIONAL
*" VALUE(I_BIN_DATA) TYPE XSTRING OPTIONAL
*" TABLES
*" T_V_BIN_DATA STRUCTURE SOLISTI1
*" IT_MESSAGE STRUCTURE SOLISTI1
Data Declaration
DATA: gd_cnt TYPE i,
gd_sent_all(1) TYPE c,
gd_error TYPE sy-subrc,
tab_lines LIKE sy-tabix,
v_subject(255) VALUE 'HI'.
Structure Declaration
DATA : BEGIN OF it_file OCCURS 0,
row(255),
END OF it_file.
DATA : BEGIN OF i_split OCCURS 0,
row(50),
END OF i_split.
DESCRIBE TABLE it_message LINES tab_lines.
READ TABLE it_message INDEX tab_lines.
Internal Table Declaration
data : it_receivers like table of SOMLRECI1 with header line."occurs 0.
DATA : objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE.
DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
data : wa_receiver like table of SOMLRECI1 with header line.
data : it_receiver like table of SOMLRECI1 with header line.
DATA : gd_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
REFRESH : objbin, it_packing_list, it_receivers, wa_receiver.
CLEAR : objbin, it_packing_list, wa_receiver, it_receivers.
gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SENDFILE'.
gd_doc_data-obj_descr = v_subject.
gd_doc_data-sensitivty = 'O'.
APPEND GD_DOC_DATA.
Appending The Internal Table it_packing_list
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
it_packing_list-doc_type = 'RAW'.
it_packing_list-body_num = tab_lines.
APPEND it_packing_list.
move i_bin_data to t_v_bin_data.
********Add By Anuj
APPEND t_v_bin_data.
********End Add By Anuj
LOOP AT t_v_bin_data.
MOVE t_v_bin_data TO objbin-line.
APPEND objbin.
ENDLOOP.
CLEAR it_packing_list.
DESCRIBE TABLE objbin LINES tab_lines.
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
it_packing_list-doc_type = 'PDF'.
it_packing_list-body_num = tab_lines.
it_packing_list-doc_size = tab_lines * 255.
APPEND it_packing_list.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
*Appending The Internal Table it_receivers
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver to it_receiver.
append it_receiver.
Move wa_receiver[] to it_receivers[].
Clear it_receivers.
if i_OUT_PLACE_LEVEL NE 0.
loop at it_receivers into wa_receiver.
loop at it_receivers into wa_receiver.
*Function Module To Post The Message To Externa Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_hex = objbin
receivers = it_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.
clear wa_receiver.
endloop.
elseif i_OUT_PLACE_LEVEL eq 0.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_hex = objbin
receivers = it_receiver
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.
clear wa_receiver.
endif.
ENDFUNCTION.
Regards
Ravindra -
Problema ao enviar e-mail Nota fiscal
oi
Ativamos o B2B para o nosso cliente brazilianl para enviar Nota fiscal xml como um e-mail para o cliente. Esta é acionado com base no código de CNPJ na tabela / xnfe/tb2b. Isso funciona bem.
Agora, temos um requisito adicional para enviar o XML para um endereço de e-mail geral da empresa cliente, mesmo para clientes B2B para quem não foi ativado na tabela / xnfe/tb2b.
Para este wechanged o check_b2b_sendin forma no programa / XNFE/LAPPL_PROCESSESF02, para poulate o valor cnpj mesmo se ela não for encontrada na tabela / xnfe/tb2b .. no entanto, ainda o e-mail não é acionado para esses clientes.
obrigadoEnviando e-mail para parceiro de negócios está a trabalhar se o número de CNPJ está na mesa / XNFE/TB2B. Mas também queremos que, mesmo quando CNPJ número do parceiro de negócios não é mantido na tabela, ainda o e-mail deve ser enviado para um endereço de e-mail genérico dentro de nossa empresa e não ao parceiro de negócios.
Sending email to business partner is working if CNPJ number is maintained in table /XNFE/TB2B. But we also want that even when CNPJ number of the business partner is not maintained in the table, still the mail should be sent to a generic email address within our company and not to the business partner. -
Problem while sending unicode (utf-8) xml to IE.
Hi,
I have encoding problem while sending utf-8 xml from servlet to IE (Client), where i am parsing the xml using Ajax.
In the log I can see proper special characters that are being sent from the servlet. but when same is seen in the client end,, it is showing ? symbols instead of special charcters.
This is the code that sends the xml from servlet.
ByteArrayOutputStream stream = new ByteArrayOutputStream(2000);
transformer.transform(new DOMSource(document), new StreamResult(new OutputStreamWriter(stream, "iso-8859-1")));
_response.setContentType("text/xml; charset=UTF-8");
_response.setHeader("Cache-Control", "no-cache");
_response.getWriter().println(new String(stream.toByteArray(), "UTF-8"));
In the log i can see :
<response status="success" value="1154081722531" hasNextPage="false" hasPreviousPage="false" ><row row_id="PARTY_test_asdasd" column_0="PARTY_test_asdasd" column_1="asdasd �" mode="edit" column_en_US="asdasd �" column_de_DE="? xyz" column_fr_FR="" ></row></response>
But in the Client side I am able to see
<?xml version = '1.0' encoding = 'UTF-8'?>
<response status="success" value="1154082795061" hasNextPage="false" hasPreviousPage="false"><row row_id="PARTY_test_asdasd" column_0="PARTY_test_asdasd" column_1="asdasd ?" mode="edit" column_en_US="asdasd ?" column_de_DE="? xyz" column_fr_FR=""/></response>
I am getting ? instead of �.
It will be greatful if somebody tell how to send utf xml from servlet, for ajax purpose.
Thanks,
Siva1This is the code that sends the xml from servlet.
ByteArrayOutputStream stream = new
ByteArrayOutputStream(2000);
transformer.transform(new DOMSource(document), new
StreamResult(new OutputStreamWriter(stream,
"iso-8859-1")));Here you produce XML that's encoded in ISO-8859-1. (!!!)
_response.setContentType("text/xml; charset=UTF-8");Here you tell the browser that it's encoded in UTF-8.
_response.getWriter().println(new String(stream.toByteArray(), "UTF-8"));Here you convert the XML to a String, assuming that it was encoded in UTF-8, which it wasn't.
Besides shooting yourself in the foot by choosing ISO-8859-1 for no good reason, you're also doing a lot of translating from bytes to chars and back again. Not only is that a waste of time, it introduces errors if you don't do it right. Try this instead:_response.setContentType("text/xml; charset=UTF-8");
_response.setHeader("Cache-Control", "no-cache");
_transformer.transform(new DOMSource(document_),
new StreamResult(_response.getOutputStream())); -
How to send multiple attachemnt with a Email
Hello experts,
I have problem with sending multiple attachement with a Email .
I have used program BCS_EXAMPLE_5. it is not for multiple attachment.
Please help me.
Thank you.Hello,
u can make use of these Function Modules.
SO_DOCUMENT_SEND_API1
SO_NEW_DOCUMENT_SEND_API1
'CONVERT_OTFSPOOLJOB_2_PDF'
the program which u gave using the method classes
Thank u,
santhosh
Edited by: santhosh kumar on Dec 2, 2008 2:15 PM -
Use sender from payload: Sender not in payload
Hi,
I am currently facing problems with a IDoc -> XI -> Proxy(XI) sceanrio.
The Idoc is received by XI without any problems. No message mapping is required for this scenario. However, the message keeps getting stuck in the Inbound queue (SMQ2). The status text says "Use sender from payload: Sender not in payload".
Can anyone help me out on this?
Thanks,
KrishneelCheck this related problem:
ATTRIBUTE_IDOC_METADATA : Sender not in payload
Regards,
Abhishek. -
Why are my exported files not going to me email? I have used 3 different ones.
Why are my exported files not going to my email (receipts & business card)? I have used 3 different ones...2 yahoo and 1 hotmail. I have checked spam box also.
For the Receipts app I chose to export the info as a PDF file..an email was requested..I entered info and clicked send. For the Business Card app I chose Send, not Print..an email was requested..I entered info and clicked send. I haven't received anything, not even in my spam folder.
-
Can't send Notes through email and it used to work. The same problem of sending picture from iPhone message. Did the reset twice but still not working
Try a reset:
Hold the Sleep and Home button down for about 10 second until you see the Apple logo. -
HAVE A PROBLEM WHEN SENDING AN EMAIL IT STATES IT DOES NOT ALLOW RELAYING
HAVE A PROBLEM WHEN SENDING AN EMAIL IT STATES IT DOES NOT ALLOW RELAYING
You have either entered the wrong SMTP server info or they have blocked the sending of e-mails from outside their network. That message indicates that you are not permitted to send through that server from the network you are using to connect.
Contact them again. There is no magic that will allow you to bypass this.
Maybe you are looking for
-
Hi all, i'm using ADF Faces EA19. On the JSP page i have a panelForm with child elements of panelLabelAndMessages with inputTexts and selectInputDates. At the first time i call the page, the order of the element is correct. If i reload the page (or l
-
Manipulating an XML document!
Hi every1, I am working on my dissertation which is based on XML. I need 2 b able 2 change the text of a node in an XML document. E.g., <price> </price>. I need 2 insert a value betweem these tags. I have downloaded JAXP, but it seems 2 b mising a pa
-
InterMedia in Jdeveloper?
How can i use interMedia possibilities in Jdeveloper. I want to get an image, audio, video from a oracle8i database. null
-
Hi I have got the requirement to add a new screen in which user can enter service provider and then this records should be created in the ESERVICE table by calling Function module ISU_S_NBSERVICE_CREATE. This is enhancement : step 1. Run the tcode EG
-
Linux SCCM 2012R2 Client - inventorydataitem.xml file growth
I'm running the 5.00.7958.1024 Linux SCCM 2012 R2 client on a RHEL 6.5 x86_64 system. It appears that the file: /opt/microsoft/configmgr/root/ccm/policy/inventorydataitem.xml grows without being truncated over time. I attempted to search for info