cancel
Showing results for 
Search instead for 
Did you mean: 

Call a transaction from WebDynpro ABAP

former_member450029
Participant
0 Kudos

Hi Experts,

How can I call an ABAP transaction from WebDynpro Application.

I am trying call from an ALV column which is defined as LinkToAction.

BR,

Eshwar

Accepted Solutions (0)

Answers (2)

Answers (2)

ramakrishnappa
Active Contributor
0 Kudos

Hi Eshwar,

On click action, write the below code , modify as per your requirement.

Sample code:


METHOD on_click .

  DATA lo_nd_search_result TYPE REF TO if_wd_context_node.

  DATA lo_el_search_result TYPE REF TO if_wd_context_element.

  DATA ls_search_result TYPE wd_this->element_search_result.

  DATA lv_host TYPE string.

  DATA lv_port TYPE string.

  DATA lv_protocol TYPE string.

  DATA lv_url TYPE string.

  DATA lv_value TYPE string.

  FIELD-SYMBOLS <lv_value> TYPE any.

  DATA lo_window_manager TYPE REF TO if_wd_window_manager.

  DATA lo_api_component  TYPE REF TO if_wd_component.

  DATA lo_window         TYPE REF TO if_wd_window.

  lo_api_component           = wd_comp_controller->wd_get_api( ).

  lo_window_manager          = lo_api_component->get_window_manager( ).

  CLEAR lv_url.

    CALL METHOD cl_http_server=>if_http_server~get_location

*    EXPORTING

*      protocol            =

*      application         =

*      for_domain          =

*      server              =

*      use_ticket_protocol = ABAP_false

      IMPORTING

        host                = lv_host

        port                = lv_port

        out_protocol        = lv_protocol

        .

    CONCATENATE lv_protocol '://' lv_host ':' lv_port

'/SAP/BC/GUI/SAP/ITS/WEBGUI?~TRANSACTION=' INTO lv_url.

    ASSIGN r_param->value->* TO <lv_value>.

    IF <lv_value> IS ASSIGNED.

      WRITE <lv_value> TO <lv_value> NO-ZERO.

      lv_value = <lv_value>.

    ENDIF.

*     navigate from <CONTEXT> to <SEARCH_RESULT> via lead selection

  lo_nd_search_result = wd_context->get_child_node( name =

wd_this->wdctx_search_result ).

*     alternative access  via index

  lo_el_search_result = lo_nd_search_result->get_element( index =

r_param->index ).

*     get all declared attributes

  lo_el_search_result->get_static_attributes(

    IMPORTING

      static_attributes = ls_search_result ).

  CASE r_param->attribute.

  

    WHEN 'CEDENT_N' OR 'BROKER_N' OR 'INSURED_N'.

      CONCATENATE lv_url 'BP &BUS_JOEL_MAIN-CHANGE_NUMBER=' lv_value

      '&~OKCODE=BUS_MAIN_ENTER&SAP-CLIENT=' sy-mandt '&SAP-LANGUAGE='

sy-langu INTO lv_url.

  ENDCASE.

  IF lv_url IS NOT INITIAL.

    CALL METHOD lo_window_manager->create_external_window

      EXPORTING

        url            = lv_url

*       title          =

*       modal          = ABAP_FALSE

*       has_menubar    = ABAP_TRUE

*       is_resizable   = ABAP_TRUE

*       has_scrollbars = ABAP_TRUE

*       has_statusbar  = ABAP_TRUE

*       has_toolbar    = ABAP_TRUE

*       has_location   = ABAP_TRUE

        use_post       = abap_true

      RECEIVING

        window         = lo_window.

    lo_window->open( ).

  ENDIF.

*  ENDIF.

ENDMETHOD.

Hope this helps you.

Regards,

Rama

former_member184578
Active Contributor
0 Kudos

Hi,

Using ITS you can call the GUI Transactions. in onAction of LinkToAction cell editor, call an external window and pass the ITS url


" http://<host>:portno/sap/bc/gui/sap/its/webgui?~TRANSACTION=<Tcode>"


You can check this blog for reference:



Regards,

Kiran