Application Development and Automation 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: 
Read only

Smartforms: Create sender object for another sap system

stephan_marx
Explorer
0 Likes
2,245

Hi there,

I have to send a smartform to a sapuser on another system, in my case to an user on another client of the same system.

Sending smartforms is not the problem, but creating the recipient with function "CREATE_RECIPIENT_OBJ_PPF" seems to be a little tricky.

I think I have to use IP_TYPE_ID "R" and the parameter IP_MAILADDR has to contain the object (e.g. mailaddress or sapuser), but how do this parameter looks like in this case?

Any ideas for IP_MAILADDR ?

Thanks a lot for helping,

Stephan

1 REPLY 1
Read only

Former Member
0 Likes
2,194

hi stephan,

look at this, i think its help full,

g_cont_par-device = 'MAIL'.

  • Get BOR-Objects for Recipient, Sender und Applikation

PERFORM mail_recipient_object CHANGING g_mail_rec_obj.

PERFORM mail_sender_object CHANGING g_mail_sen_obj.

PERFORM mail_appl_object CHANGING g_mail_app_obj.

  • Calling Smartform

CALL FUNCTION fm_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = g_cont_par

mail_appl_obj = g_mail_app_obj

mail_recipient = g_mail_rec_obj

mail_sender = g_mail_sen_obj

output_options = g_output

user_settings = ' '

IMPORTING

... rest of function ...

Here are the Forms:

&----


*& Form mail_recipient_object

&----


  • text

----


  • <--P_G_MAIL_REC_OBJ text

----


FORM mail_recipient_object CHANGING p_mail_rec_obj.

CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'

EXPORTING

  • IP_COUNTRY =

  • IP_FAXNO =

ip_mailaddr = g_mail "g_mail type

"SO_NAME.

ip_type_id = g_rectype " 'U'

IMPORTING

ep_recipient_id = p_mail_rec_obj

  • EP_ADDRESS =

  • ET_RECIPIENT =

EXCEPTIONS

invalid_recipient = 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.

ENDFORM. " mail_recipient_object

&----


*& Form mail_sender_object

&----


  • text

----


  • <--P_G_MAIL_SEN_OBJ text

----


FORM mail_sender_object CHANGING p_mail_sen_obj.

CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'

EXPORTING

ip_sender = sy-uname

IMPORTING

ep_sender_id = p_mail_sen_obj

EXCEPTIONS

invalid_sender = 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.

ENDFORM. " mail_sender_object

&----


*& Form mail_appl_object

&----


  • text

----


  • <--P_G_MAIL_APP_OBJ text

----


FORM mail_appl_object CHANGING p_mail_app_obj.

SELECT * FROM soud WHERE sapnam LIKE sy-uname AND deleted = ' '.

ENDSELECT.

IF sy-subrc NE 0.

CALL FUNCTION 'SO_USER_AUTOMATIC_INSERT'

EXPORTING

sapname = sy-uname

EXCEPTIONS

no_insert = 1

sap_name_exist = 2

x_error = 3

OTHERS = 4.

IF sy-subrc NE 0.

CLEAR soud.

ELSE.

SELECT * FROM soud WHERE sapnam LIKE sy-uname AND deleted = ' '.

ENDSELECT.

ENDIF.

ENDIF.

CLEAR sofmfol_key.

sofmfol_key-type = 'FOL'.

sofmfol_key-year = soud-inbyr.

sofmfol_key-number = soud-inbno.

bor_key = sofmfol_key.

IF NOT bor_key IS INITIAL.

swc_create_object folder 'SOFMFOL' bor_key.

IF sy-subrc = 0.

swc_object_to_persistent folder p_mail_app_obj.

IF sy-subrc NE 0.

CLEAR p_mail_app_obj.

ENDIF.

ENDIF.

ELSE.

CLEAR p_mail_app_obj.

ENDIF.

ENDFORM. " mail_appl_object