Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

to send payslip to mail id of emp.

Former Member
0 Kudos

hai everybody

can u plz send me information to send payslip to mail id.

how can i do this in reports...can u say any fuction module or sample code for this.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Chinny,

First conform whether your Basis consultants have configured SMTP and then use this below code you can reach your requirement.

DATA: http_client TYPE REF TO if_http_client .

DATA: wf_string TYPE string ,

result TYPE string ,

r_str TYPE string .

DATA: result_tab TYPE TABLE OF string.

SELECTION-SCREEN: BEGIN OF BLOCK a WITH FRAME.

PARAMETERS: mail(100) LOWER CASE,

m_no(20) LOWER CASE ,

m_mss(120) LOWER CASE.

SELECTION-SCREEN: END OF BLOCK a .

START-OF-SELECTION .

CLEAR wf_string .

CONCATENATE

'http://www.webservicex.net/SendSMS.asmx/SendSMSToIndia?MobileNumber='

m_no

'&FromEmailAddress='

mail

'&Message='

m_mss

INTO

wf_string .

CALL METHOD cl_http_client=>create_by_url

EXPORTING url = wf_string

IMPORTING client = http_client

EXCEPTIONS argument_not_found = 1

plugin_not_active = 2

internal_error = 3

OTHERS = 4.

CALL METHOD http_client->send

EXCEPTIONS

http_communication_failure = 1

http_invalid_state = 2.

CALL METHOD http_client->receive

EXCEPTIONS

http_communication_failure = 1

http_invalid_state = 2

http_processing_failed = 3.

CLEAR result .

result = http_client->response->get_cdata( ).

REFRESH result_tab .

SPLIT result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .

LOOP AT result_tab INTO r_str.

WRITE:/ r_str .

ENDLOOP .

Hope my answer helps you.

Cheers!!

5 REPLIES 5

Former Member
0 Kudos

Hi chinny ,

Function module :

SO_DOCUMENT_SEND_API1

Regards,

Sravanthi

0 Kudos

i think it is use ful for converting to pdf rt. how can i send payslip to mail

0 Kudos

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = doc_chng

document_type = 'RAW'

put_in_outbox = ' '

commit_work = 'X'

IMPORTING

sent_to_all = sent

new_object_id = email_id

TABLES

object_header = objhead

object_content = objtxt

receivers = reclist

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.

CASE sy-subrc.

WHEN 0.

WRITE 'The document sucessfully sent'.

WHEN 1.

WRITE: / 'No authorization for sending to the specified number',

'of recipients'.

WHEN 2.

WRITE: / 'Document could not be sent to any recipient'.

WHEN 4.

WRITE: / 'No send authorization'.

WHEN OTHERS.

WRITE: / 'Error occurred while sending'.

endcase.

Former Member
0 Kudos

Hi Chinny,

First conform whether your Basis consultants have configured SMTP and then use this below code you can reach your requirement.

DATA: http_client TYPE REF TO if_http_client .

DATA: wf_string TYPE string ,

result TYPE string ,

r_str TYPE string .

DATA: result_tab TYPE TABLE OF string.

SELECTION-SCREEN: BEGIN OF BLOCK a WITH FRAME.

PARAMETERS: mail(100) LOWER CASE,

m_no(20) LOWER CASE ,

m_mss(120) LOWER CASE.

SELECTION-SCREEN: END OF BLOCK a .

START-OF-SELECTION .

CLEAR wf_string .

CONCATENATE

'http://www.webservicex.net/SendSMS.asmx/SendSMSToIndia?MobileNumber='

m_no

'&FromEmailAddress='

mail

'&Message='

m_mss

INTO

wf_string .

CALL METHOD cl_http_client=>create_by_url

EXPORTING url = wf_string

IMPORTING client = http_client

EXCEPTIONS argument_not_found = 1

plugin_not_active = 2

internal_error = 3

OTHERS = 4.

CALL METHOD http_client->send

EXCEPTIONS

http_communication_failure = 1

http_invalid_state = 2.

CALL METHOD http_client->receive

EXCEPTIONS

http_communication_failure = 1

http_invalid_state = 2

http_processing_failed = 3.

CLEAR result .

result = http_client->response->get_cdata( ).

REFRESH result_tab .

SPLIT result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .

LOOP AT result_tab INTO r_str.

WRITE:/ r_str .

ENDLOOP .

Hope my answer helps you.

Cheers!!

Former Member
0 Kudos

hi,

heck this link

http://www.sap-img.com/fu016.htm

Check this for configuration help..

http://www.sapgenie.com/interfaces/sapconnect.htm

Regards,

Shiva Kumar