cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to execute sap transaction code....

Former Member
0 Kudos

hellow experts,

I have small request, is it possible to execute sap transaction code using web dynpro...

if yes pls tell me...

with regards

babu

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Create this Program in SE38. - Change the 3 rd line to your application name

REPORT /DMPUI/WEBDYNPRO_TRANSACTION.

CONSTANTS: k_browser TYPE string VALUE 'IEXPLORE.EXE',

k_mandt_prefix TYPE string VALUE '?sap-client=',

k_wdappl_name TYPE string VALUE '/dmpui/EP_0016'. "change the k_wdappl_name constant value to your application name

DATA: g_mandt_param TYPE string,

g_url TYPE string.

START-OF-SELECTION.

CONCATENATE

k_mandt_prefix

sy-mandt

INTO g_mandt_param.

CALL METHOD cl_wd_utilities=>construct_wd_url

EXPORTING

application_name = k_wdappl_name

IMPORTING

out_absolute_url = g_url.

CONCATENATE

g_url

g_mandt_param

INTO g_url.

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

application = k_browser

parameter = g_url

maximized = 'X'

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

bad_parameter = 3

file_not_found = 4

path_not_found = 5

file_extension_unknown = 6

error_execute_failed = 7

synchronous_failed = 8

not_supported_by_gui = 9

OTHERS = 10.

IF sy-subrc NE 0.

WRITE:/,'Error al ejecutar Browser (',k_browser,')'.

ENDIF.

Thanks,

Anitha

Former Member
0 Kudos

you can create function .. and inside the function ... write call transaction code.

It works when you call the function in the webdynpro abap.

former_member515618
Active Participant
0 Kudos

Hi,

Calling a transaction inside webdynpro is not supported as the transaction launches a SAP Screen which cannot be handled by the frame work. Instead embed the transaction call in a seperate iView and launch the same upon any event.

Regards,

Sravan Varagani

Former Member
0 Kudos

Hi Sravan,

As you said, can you plz let me know how to embed the transaction call in separate view? Thanks in advance.

Ravin

former_member515618
Active Participant
0 Kudos

If you are using portal as a triggerring point of your web dynpro applications, then the below requirement is achieved by doing the following.

1. Create a BDC report program to call transaction CAT2 skipping the first screen.

2. The report has the same input parameters as that of the transaction CAT2.

3. Associate a transaction to the report program sat 'ZCAT2'.

In the event handler of the button in your web dynpro do that following

Data declarations

-


Local Internal tables(lt_)

-


lt_bus_parameter_list TYPE wdy_key_value_table,

lt_launcher_parameter_list TYPE wdy_key_value_table,

-


Local Work area's(ls_)

-


ls_keyvalue_pair TYPE wdy_key_value,

-


Local Variables(l_)

-


l_pcdpageurl TYPE string,

l_componentcontroller TYPE REF TO if_wd_component,

l_port_manager TYPE REF TO if_wd_portal_integration.

-


Constants(c_)

-


CONSTANTS:

c_transaction_code TYPE string VALUE 'ZCAT2',

c_okcode TYPE string VALUE 'F8',

c_param1 TYPE string VALUE 'P_Data_Entry_Profile',

c_param2 TYPE string VALUE 'P_person_number'.

l_componentcontroller = wd_this->wd_get_api( ).

l_port_manager = l_componentcontroller->get_portal_manager( ).

Fill all the business parameters

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = c_param1.

ls_keyvalue_pair-value = 'Data Entry Profile'.

APPEND ls_keyvalue_pair TO lt_bus_parameter_list .

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = c_param2.

ls_keyvalue_pair-value = 'Person Number'.

APPEND ls_keyvalue_pair TO lt_bus_parameter_list .

Fill the launcher parameters for the transaction

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = 'AutoStart'.

ls_keyvalue_pair-value = 'Yes'.

APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = 'GuiType'.

ls_keyvalue_pair-value = 'WinGui'.

APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = 'OkCode'.

ls_keyvalue_pair-value = c_okcode.

APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = 'System'.

ls_keyvalue_pair-value = 'SAP_R3_HumanResources'.

APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = 'TCode'.

ls_keyvalue_pair-value = c_transaction_code.

APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = 'Technique'.

ls_keyvalue_pair-value = 'SSF'.

APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.

CLEAR ls_keyvalue_pair.

ls_keyvalue_pair-key = 'WinGui_Type'.

ls_keyvalue_pair-value = 'Shortcut'.

APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.

SAP has provided us with customizing table to maintain the path for the iView.Here Resource_key is the key field to get the path.

We create a new entry in this table using which we uniquely identify the path of the iVew that needs to be launched.

get the url of the pcd page for the common transaction iView

SELECT SINGLE b~text

INTO l_pcdpageurl

FROM t7xssserstring AS b

INNER JOIN t7xssserres AS a

ON arespcdpage = bguid

WHERE a~ressource = /rio/zcl_hse_constants=>c_common_resource.

Navigate to the Injury Illness details

CALL METHOD l_port_manager->navigate_absolute

EXPORTING

navigation_target = l_pcdpageurl

navigation_mode = l_port_manager->co_show_external

use_sap_launcher = abap_true

business_parameters = lt_bus_parameter_list

launcher_parameters = lt_launcher_parameter_list.

The folowing is the flow of the program:

When user clicks a button to launch transaction CAT2, the event handler associated to it called.

Here we populate an internal table with the parameters to call transaction ZCAT2 and the iView is launched by calling navigate_absolute method with the right path.

I am not very much sure as to how the iViews are set up but there is a provision to read the key valure pair there. The values are read and the tranzation ZCAT2 is called which will inturn launch CAT2 transaction.

By adding Skip First screen statement we can get in the details directly.

Hope this helps.

Regards,

Sravan Varagani

Former Member
0 Kudos

Hi Babu,

Sorry its not possible to call the Tansaction with in the WebDynpro Application.

You need to re create the particulsr screen depending on your requirement.

Thanks.

Former Member
0 Kudos

Hellow Viji,

Than q for ur information.

Is there any other method to do this.Pls tell me..

with regards

babu

Former Member
0 Kudos

Hi Babu,

Check this link. It may help you.

https://forums.sdn.sap.com/click.jspa?searchID=9622796&messageID=4964825

Thanks.