Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Jigang_Zhang张吉刚
Active Contributor

Please don't use this as it's not supported by SAP.


 

Users need to take action to approve one process with comments at one complex customized program with several inputs parameters. It'll be convenient to send the approval email along with the SAP shortcut as an attachment, the user can open directly from the shortcut, and 1st selection screen has already been skipped with pre-inputted parameters by the program.

Take FBL5N as an example, when the user double click the shortcut attachment, it should go to the result list of FBL5N with specific customer/company code/Open at key date.

 
Types: begin of t_para,
FIELDNAME(60),
FIELDVALUE(255),
end of t_para.
DATA: lt_shortcut TYPE soli_tab,
lv_parameter TYPE text255,
lv_tcode TYPE TCODE,
SHORTCUT_TABLE TYPE SOLI_TAB,
lt_shortcut_param type table of t_para,
ls_shortcut_param type t_para.

"1) collect inputs parameters for FBL5N
ls_shortcut_param-fieldname = 'KUN'. "customer no.
ls_shortcut_param-fieldvalue = '123456'.
APPEND ls_shortcut_param to lt_shortcut_param.
CLEAR ls_shortcut_param.

ls_shortcut_param-fieldname = 'BUK'. "company code
ls_shortcut_param-fieldvalue = 'COM1'.
APPEND ls_shortcut_param to lt_shortcut_param.
CLEAR ls_shortcut_param.

it_shortcut_param-fieldname = 'PA_STIDA'. "Open at key date
it_shortcut_param-fieldvalue = '06.06.2021'.
APPEND ls_shortcut_param to lt_shortcut_param.
CLEAR ls_shortcut_param.

CLEAR lv_parameter.
LOOP AT lt_shortcut_param into ls_shortcut_param.
CONCATENATE lv_parameter ls_shortcut_param-fieldname '='
ls_shortcut_param-fieldvalue ';'
INTO lv_parameter.
ENDLOOP.

"2) generate shortcut
CONCATENATE '*' 'FBL5N' INTO lv_tcode.
CALL FUNCTION 'SWN_CREATE_SHORTCUT'
EXPORTING
i_transaction = lv_tcode
i_parameter = lv_parameter
i_sysid = sy-sysid
i_client = sy-mandt
i_user = sy-uname
i_language = sy-langu
i_windowsize = 'Normal window'
IMPORTING
shortcut_string = content
shortcut_table = shortcut_table "here is shortcut
EXCEPTIONS
inconsistent_parameters = 1
OTHERS = 2.

"3) using BCS send email using shortcut as attachment
...normal BCS email generation
*Add Shorcut Attachment
document->add_attachment(
EXPORTING
i_attachment_type = 'SAP' "extension for shortcut
i_attachment_subject = 'FBL5N.SAP'
i_attachment_size = lp_shortcut_size
i_att_content_text = lt_shortcut ).
...

Then will find the email at SOSG:


Double click the attachment will go to FBL5N directly with the result screen. Of course, will popup the login window if no SAP GUI logon yet.

Please don't use this as it's not supported by SAP.


 
3 Comments