Hi All,
I have done my research in SDN and have not received a satisfactory answer hence posting in this forum.
Scenario below:
Tcode ML81N Service Entry sheet.
In this there is a workflow which performs Service Entry sheet approval process, as a part of approval process the approver would receive an email and once it is donethe user receives an email with the link to SWPR tcode to restart the workflow.
Here in this the mail reaches approver and he can approve, but the issue is the mail which the user receives with the link is not opening the SWPR tcode
instead it throws error page not found.
Could you please me in framing an link where I would be able to access SWPR tcode.
Sample Link: CONCATENATE 'http://Server.Company.com:8006/sap/bc/gui/sap/its/webgui?~TRANSACTION=VL81N?'"sysid='sy-sysid'&logonid=&client='sy-mandt'&uname='sy-uname'&langu='sy-langu'&transaction=*SWPR¶m= 'parameter'DYNP_OKCODE=ONLI' INTO lv_string.
I would appreciate if you could help me with the below code with you expertise.
Complete Code which Generates the email link below:
FORM lt_count USING pv_sesid TYPE lblni.
TYPES:BEGIN OF ty_swwwihead,
wi_id TYPE sww_wiid,
wi_text TYPE sww_witext,
wi_rh_task TYPE sww_task,
wi_stat TYPE sww_wistat,
parent_wi TYPE swfrparwi,
END OF ty_swwwihead.
DATA :
BEGIN OF zst_shortcut_par,
fieldname TYPE c LENGTH 60,
fieldvalue TYPE c LENGTH 255,
END OF zst_shortcut_par.
*
DATA: lt_swwwihead TYPE STANDARD TABLE OF ty_swwwihead,
ls_swwwihead TYPE ty_swwwihead,
lv_parent TYPE sww_wiid,
lv_child TYPE sww_wiid.
DATA: doc_chng LIKE sodocchgi1,
lv_string TYPE string,
lv_string1 TYPE string,
lv_text TYPE string.
DATA: tab_lines LIKE sy-tabix, body_start LIKE sy-tabix.
DATA: it_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: it_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: it_objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: it_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: it_shortcut_param LIKE zst_shortcut_par OCCURS 0 WITH HEADER LINE.
DATA: content TYPE string,
parameter TYPE text255.
DATA: lt_objtxt TYPE STANDARD TABLE OF solisti1,
ls_objtxt TYPE solisti1,
lt_objpack TYPE STANDARD TABLE OF sopcklsti1,
ls_objpack TYPE sopcklsti1,
lt_reclist TYPE STANDARD TABLE OF somlreci1,
ls_reclist TYPE somlreci1.
DATA:lv_255 TYPE char3,
lv_lines TYPE i.
**********
DATA : wda_name TYPE string,
in_protocol TYPE string,
out_host TYPE string,
out_port TYPE string,
out_protocol TYPE string,
val TYPE string,
g_url TYPE string.
* Data Declaration related to Mail
***********************************
DATA : send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
send TYPE REF TO if_sender_bcs,
i_text TYPE soli_tab,
wa_text TYPE soli,
receiver TYPE REF TO if_recipient_bcs,
sent_to_all TYPE os_boolean,
sender TYPE adr6-smtp_addr,
recipient TYPE adr6-smtp_addr,
subject TYPE so_obj_des.
DATA:v_host TYPE string,
v_port TYPE string,
v_out_protocol TYPE string,
v_tcode TYPE tcode,
v_url(500).
DATA : temp_addr TYPE adr6-smtp_addr.
SELECT wi_id
wi_text
wi_rh_task
wi_stat
parent_wi
INTO TABLE lt_swwwihead
FROM swwwihead
WHERE wi_rh_task IN ('TS92000421','WS91000005').
IF sy-subrc = 0.
LOOP AT lt_swwwihead INTO ls_swwwihead
WHERE wi_rh_task = 'WS91000005'
AND wi_stat = 'ERROR'.
IF sy-subrc = 0.
IF ls_swwwihead-wi_text+39(10) = pv_sesid.
lv_parent = ls_swwwihead-wi_id.
READ TABLE lt_swwwihead INTO ls_swwwihead
WITH KEY wi_rh_task = 'TS92000421'
wi_stat = 'ERROR'
parent_wi = lv_parent.
IF sy-subrc = 0.
lv_child = ls_swwwihead-wi_id.
ENDIF.
ELSE.
CONTINUE.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
cl_http_server=>if_http_server~get_location(
IMPORTING
host = v_host
port = v_port
out_protocol = v_out_protocol
).
CONCATENATE v_out_protocol '://' v_host ':' v_port
'/sap/public/bc/workflow/shortcut?sysid=' INTO v_url.
**********************************************NEW Code ENDS*************************************************************************************
*** Pass the required parameters and create the shortcut
CLEAR it_shortcut_param.
REFRESH it_shortcut_param.
* it_shortcut_param-fieldname = 'P_ACTION'.
* it_shortcut_param-fieldvalue = 'DISPLAY'.
* APPEND it_shortcut_param.
it_shortcut_param-fieldname = 'IT_WI_ID-LOW'.
it_shortcut_param-fieldvalue = lv_parent.
APPEND it_shortcut_param.
it_shortcut_param-fieldname = 'IT_WI_ID-SIGN'.
it_shortcut_param-fieldvalue = 'I'.
APPEND it_shortcut_param.
it_shortcut_param-fieldname = 'IT_WI_ID-OPTION'.
it_shortcut_param-fieldvalue = 'EQ'.
APPEND it_shortcut_param.
* it_shortcut_param-fieldname = 'P_APPL'.
* it_shortcut_param-fieldvalue = 'NOTIF'.
* APPEND it_shortcut_param.
IF NOT it_shortcut_param[] IS INITIAL.
CLEAR parameter.
LOOP AT it_shortcut_param.
CONCATENATE parameter it_shortcut_param-fieldname '=' it_shortcut_param-fieldvalue '; '
INTO parameter.
ENDLOOP.
ENDIF.
CONCATENATE v_url sy-sysid'&logonid=&client='sy-mandt'&uname='sy-uname'&langu='sy-langu'&transaction=*SWPR¶m= 'parameter'DYNP_OKCODE=ONLI' INTO lv_string.
CONCATENATE '<a href="'lv_string'">' text-w09 '</a>' INTO ls_objtxt-line.
APPEND ls_objtxt TO lt_objtxt.
ls_objtxt-line = '</HTML>'.
APPEND ls_objtxt TO lt_objtxt.
* Document data
CLEAR lv_255.
lv_255 = '255'.
DESCRIBE TABLE lt_objtxt LINES lv_lines.
READ TABLE lt_objtxt INTO ls_objtxt INDEX lv_lines.
* Packing data
CLEAR ls_objpack-transf_bin.
ls_objpack-head_start = 1.
ls_objpack-head_num = 0.
ls_objpack-body_start = 1.
ls_objpack-body_num = lv_lines.
* we will pass the HTML, since we have created the message body in the HTML
ls_objpack-doc_type = 'HTML'.
APPEND ls_objpack TO lt_objpack.
DATA: lc_rectype TYPE char1 VALUE 'U',
lc_com TYPE so_snd_art VALUE 'INT'.
CLEAR ls_reclist.
ls_reclist-receiver = VVijayakrishnanNair@xyz.com'.
ls_reclist-rec_type = lc_rectype.
ls_reclist-com_type = lc_com.
* ls_reclist-notif_del = .
* ls_reclist-notif_ndel = abap_true.
APPEND ls_reclist TO lt_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = lt_objpack
contents_bin = it_objbin
contents_txt = lt_objtxt
receivers = lt_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
ENDFORM. " LT_COUNT
Thank you for all your help.
Would reward points for appropriate solution.
Regards,
Vivek