cancel
Showing results for 
Search instead for 
Did you mean: 

FM navigate to SC, PO, etc

RicardoRomero_1
Active Contributor
0 Kudos

Hi all,

I'm creating a custom webdynpro in wich I have a table with some documents. I need to navigate to these documents when the user click on them.

I don't know if exits any standard FM for that, I couldn't find any.

So, I'm trying to create a custom FM for that based in the login I've seen in the WD component /SAPSRM/WDC_UI_DO_HISTORY, View V_DODC_HISTORY, Method ONACTIONSHOW_DOCUMENT.

But, by the moment doesn't work. This is my code:

DATA: lo_componentcontroller     TYPE REF TO ig_componentcontroller,
        lo_api_componentcontroller TYPE REF TO if_wd_component,
        lo_navigation_service      TYPE REF TO /sapsrm/cl_ch_wd_navi_serv,
        lo_navigation              TYPE REF TO /sapsrm/if_ch_wd_navi_serv,
        ls_obn_components          TYPE /sapsrm/s_wd_ui_obn,
        bus_parameter_table        TYPE wdy_key_value_table,
        bus_parameter_struc        TYPE wdy_key_value,
        lx_pdo_error_gen           TYPE REF TO /sapsrm/cx_pdo_error_gen.

  lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
  lo_api_componentcontroller = lo_componentcontroller->wd_get_api( ).
  CREATE OBJECT lo_navigation_service
    EXPORTING
      io_api_componentcontroller = lo_api_componentcontroller.
  lo_navigation = lo_navigation_service.

  IF lv_object_type EQ 'BUS2121'.
    bus_parameter_struc-value     = /sapsrm/if_pdo_obj_types_c=>gc_pdo_shop.
    ls_obn_components-object_type = /sapsrm/if_feeder_constants=>c_obn_sc.
    ls_obn_components-operation   = /sapsrm/if_feeder_constants=>c_obn_op_detailprof.

    bus_parameter_struc-key = 'sap-client'.
    bus_parameter_struc-value = sy-mandt.
    INSERT bus_parameter_struc INTO TABLE bus_parameter_table.

    bus_parameter_struc-key = 'sap-language'.
    bus_parameter_struc-value = sy-langu.
    INSERT bus_parameter_struc INTO TABLE bus_parameter_table.

    bus_parameter_struc-key = 'sapsrm_botype'.
    bus_parameter_struc-value = /sapsrm/if_pdo_obj_types_c=>gc_pdo_shop.
    INSERT bus_parameter_struc INTO TABLE bus_parameter_table.

    bus_parameter_struc-key = 'sapsrm_mode'.
    bus_parameter_struc-value = 'DISPLAY'.
    INSERT bus_parameter_struc INTO TABLE bus_parameter_table.

    bus_parameter_struc-key = 'sapsrm_boid'.
    bus_parameter_struc-value = lv_guid.
    INSERT bus_parameter_struc INTO TABLE bus_parameter_table.

    ls_obn_components-business_parameters = bus_parameter_table.

    TRY.
        CALL METHOD lo_navigation->launch_target
          EXPORTING
            iv_target_type    = /sapsrm/if_ch_wd_navi_serv_c=>gc_target_type-obn
            is_obn_components = ls_obn_components.
      CATCH /sapsrm/cx_pdo_error_gen INTO lx_pdo_error_gen.

    ENDTRY.

  ENDIF.

Do you know if exits some function module for this?

Or if I have something wrong in my code ?

Thanks in advance.

Regards,

Ricardo.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Try below code and check.

DATA: lrif_context_element TYPE REF TO if_wd_context_element,

lt_bus_parameter_table TYPE wdy_key_value_table,

ls_bus_parameter_struc TYPE wdy_key_value,

ls_obn_components TYPE /sapsrm/s_wd_ui_obn,

lrif_navigation_service TYPE REF TO /sapsrm/if_ch_wd_navi_serv,

lrif_task_factory TYPE REF TO /sapsrm/if_cll_taskcon_factory,

lrif_task_container TYPE REF TO /sapsrm/if_cll_task_container,

lrcl_pdo_error_gen TYPE REF TO /sapsrm/cx_pdo_error_gen,

lt_messages TYPE TABLE OF bbp_pds_messages,

ls_sc_history TYPE wd_this->element_sc_history,

lv_sc_object_id TYPE crmt_object_id_db,

lv_sc_guid TYPE bbp_guid.

**********************************************************************

  • get relevants objects

**********************************************************************

  • get task context

lrif_task_factory = /sapsrm/cl_ch_wd_taskcont_fact=>get_instance( ).

IF lrif_task_factory IS INITIAL.

EXIT.

ENDIF.

lrif_task_container = lrif_task_factory->get_task_container( ).

IF lrif_task_container IS INITIAL.

EXIT.

ENDIF.

  • get sc guid

CALL FUNCTION 'BBP_PD_SC_GUID_GET'

EXPORTING

iv_object_id = sc number

IMPORTING

ev_guid = lv_sc_guid

TABLES

et_messages = lt_messages.

IF sy-subrc NE 0.

EXIT.

ENDIF.

**********************************************************************

  • set navigation

**********************************************************************

  • OBN Action

ls_obn_components-object_type = /sapsrm/if_feeder_constants=>c_obn_sc.

ls_obn_components-operation = /sapsrm/if_feeder_constants=>c_obn_op_detailprof.

  • OBN Parameter

ls_bus_parameter_struc-key = 'sapsrm_botype'.

ls_bus_parameter_struc-value = /sapsrm/if_pdo_obj_types_c=>gc_pdo_shop.

INSERT ls_bus_parameter_struc INTO TABLE lt_bus_parameter_table.

ls_bus_parameter_struc-key = 'sap-client'.

ls_bus_parameter_struc-value = sy-mandt.

INSERT ls_bus_parameter_struc INTO TABLE lt_bus_parameter_table.

ls_bus_parameter_struc-key = 'sap-language'.

ls_bus_parameter_struc-value = sy-langu.

INSERT ls_bus_parameter_struc INTO TABLE lt_bus_parameter_table.

ls_bus_parameter_struc-key = 'sapsrm_mode'.

ls_bus_parameter_struc-value = 'DISPLAY'.

INSERT ls_bus_parameter_struc INTO TABLE lt_bus_parameter_table.

ls_bus_parameter_struc-key = 'sapsrm_boid'.

ls_bus_parameter_struc-value = lv_sc_guid.

INSERT ls_bus_parameter_struc INTO TABLE lt_bus_parameter_table.

ls_obn_components-business_parameters = lt_bus_parameter_table.

lrif_navigation_service = lrif_task_container->get_navigation_service( ).

TRY.

  • set navigation in next html roundtrip

CALL METHOD lrif_navigation_service->launch_target

EXPORTING

iv_target_type = /sapsrm/if_ch_wd_navi_serv_c=>gc_target_type-obn

is_obn_components = ls_obn_components.

CATCH /sapsrm/cx_pdo_error_gen INTO lrcl_pdo_error_gen.

EXIT.

ENDTRY.

Regards,

Neelima

RicardoRomero_1
Active Contributor
0 Kudos

Hi,

Thanks for your answer, but doesn't work.

I'm getting a short dump: Access via 'NULL' object reference not possible.

The following line returns an empty object:

lrif_navigation_service = lrif_task_container->get_navigation_service( ).

So, in the call method.... i have the short dump...

CALL METHOD lrif_navigation_service->launch_target

I think the problem is in this line:

lrif_task_container = lrif_task_factory->get_task_container( ).

Returns an object but the instance is not good, all the attributes are empty...

Former Member
0 Kudos

Hello,

I have tired now in custom webdynpro it is not working

Please use below logic but we need call new window

  • get single attribute

lo_el_context->get_attribute(

EXPORTING

name = `GUID`

IMPORTING

value = lv_guid ).

lv_bo_guid = lv_guid.

CALL FUNCTION 'BBP_OUTPUT_GET_SERVICE_URL'

EXPORTING

iv_guid = lv_bo_guid

iv_partner_id = lv_pt_no

iv_langu = 'E'

ic_bus = 'BUS2201'

IMPORTING

ev_url_long = lv_url.

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( ).

CALL METHOD lo_window_manager->create_external_window

EXPORTING

url = lv_url

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

RECEIVING

window = lo_window.

lo_window->open( ).

RicardoRomero_1
Active Contributor
0 Kudos

Thanks !

This solved the issue...

Answers (0)