Created
May 26, 2014 04:28
-
-
Save js1972/a1de70bce6a34e7f51ef to your computer and use it in GitHub Desktop.
How to launch and external SAPGUI transaction from an FPM application. Note that the SAPGUI launches within a browser, but it is the *real* sapgui rendering within it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data lo_fpm_navigate_to type ref to if_fpm_navigate_to. | |
data ls_txn_fields type fpm_s_launch_transaction. | |
data lt_parameters type apb_lpd_t_params. | |
data ls_param like line of lt_parameters. | |
data ls_additional_parameter type apb_lpd_s_add_trans_parameters. | |
"because the enjoy transaction such as me53n cannot be passed parameters | |
"via the webgui (as they have no explicit selection-screen) we are using | |
"a proxy transaction which sets the document number as a parameter id | |
"and then calls the enjoy transaction. | |
ls_txn_fields-tcode = 'ZCCA_ENJOY_TXN'. | |
ls_txn_fields-gui_type = 'WIN_GUI'. "'WEB_GUI'. | |
if mv_running_in_portal = abap_true. | |
ls_txn_fields-system_alias = 'SAP_ECC_Workflow'. | |
else. | |
ls_txn_fields-system_alias = 'SAP_LOCALSYSTEM'. | |
endif. | |
"add in txn parameters | |
clear lt_parameters. | |
ls_param-key = 'BSART'. | |
ls_param-value = 'PO'. | |
append ls_param to lt_parameters. | |
ls_param-key = 'EBELN'. | |
ls_param-value = mo_wf_purchaseorder->m_ebeln. | |
append ls_param to lt_parameters. | |
ls_txn_fields-parameter = lt_parameters. | |
ls_additional_parameter-skip_init_screen_if_possible = abap_true. | |
lo_fpm_navigate_to = mo_fpm->get_navigate_to( ). | |
lo_fpm_navigate_to->launch_transaction( is_transaction_fields = ls_txn_fields is_additional_parameters = ls_additional_parameter ). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*&---------------------------------------------------------------------* | |
*& Report ZCCA_ENJOY_TXN_LAUNCHER | |
*& | |
*&---------------------------------------------------------------------* | |
*& This program is used to launch the sap enjoy transactions from FPM | |
*& apps. The enjoy transactions such as ME53N (pur. req. display) do | |
*& not allow proper passing of paramters within the webgui. However the | |
*& old sap transaction such as ME53 do (it requires a selection screen). | |
*& This program presents a simple selection screen which can be | |
*& populate with a document type and document number. | |
*& Depending on the document type, the number is passed through to the | |
*& relevant enjoy transaction. | |
*&---------------------------------------------------------------------* | |
report zcca_enjoy_txn_launcher. | |
parameter p_docnr type ebeln. | |
parameter p_docty type bsart. | |
parameter p_lblni type lblni. "only used for display service entry sheets with ml81n | |
start-of-selection. | |
case p_docty. | |
when 'PR'. | |
set parameter id 'BAN' field p_docnr. | |
call transaction 'ME53N'. | |
when 'PO'. | |
set parameter id 'BES' field p_docnr. | |
call transaction 'ME23N'. | |
when 'OA'. | |
set parameter id 'CTR' field p_docnr. | |
call transaction 'ME33K' and skip first screen. | |
when 'SE'. | |
* set parameter id 'CTR' field p_docnr. | |
* call transaction 'ML81N' and skip first screen. | |
data: l_s_bdcdata type bdcdata, | |
l_t_bdcdata type table of bdcdata. | |
l_s_bdcdata-program = 'SAPLMLSR'. | |
l_s_bdcdata-dynpro = '0400'. | |
l_s_bdcdata-dynbegin = 'X'. | |
append l_s_bdcdata to l_t_bdcdata. | |
clear l_s_bdcdata. | |
l_s_bdcdata-fnam = 'BDC_OKCODE'. | |
l_s_bdcdata-fval = '=SELP'. | |
append l_s_bdcdata to l_t_bdcdata. | |
clear l_s_bdcdata. | |
l_s_bdcdata-program = 'SAPLMLSR'. | |
l_s_bdcdata-dynpro = '0340'. | |
l_s_bdcdata-dynbegin = 'X'. | |
append l_s_bdcdata to l_t_bdcdata. | |
clear l_s_bdcdata. | |
l_s_bdcdata-fnam = 'RM11R-EBELN'. | |
l_s_bdcdata-fval = p_docnr. | |
append l_s_bdcdata to l_t_bdcdata. | |
clear l_s_bdcdata. | |
* l_s_bdcdata-fnam = 'RM11R-EBELP'. | |
* l_s_bdcdata-fval = ebelp. | |
* append l_s_bdcdata to l_t_bdcdata. | |
* clear l_s_bdcdata. | |
l_s_bdcdata-fnam = 'RM11R-LBLNI'. | |
l_s_bdcdata-fval = p_lblni. | |
append l_s_bdcdata to l_t_bdcdata. | |
clear l_s_bdcdata. | |
l_s_bdcdata-fnam = 'BDC_OKCODE'. | |
l_s_bdcdata-fval = '=ENTE'. | |
append l_s_bdcdata to l_t_bdcdata. | |
clear l_s_bdcdata. | |
l_s_bdcdata-program = 'SAPLMLSR'. | |
l_s_bdcdata-dynpro = '0400'. | |
l_s_bdcdata-dynbegin = 'X'. | |
append l_s_bdcdata to l_t_bdcdata. | |
clear l_s_bdcdata. | |
call transaction 'ML81N' using l_t_bdcdata mode 'E'. | |
endcase. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment