on 03-01-2011 1:50 PM
Hi,
I want to define a customer button (with action) within PO on header level.
Web Dynpro FPM_OIF_COMPONENT
Configuration /SAPSRM/WDCC_FPM_OIF_PO_PURCH
Task:
Add a customer button besides standard Export button.
I assume-afterwards I have to enhance the method onactionbutton_pressed to create my event when customer button is pressed, right?
Could anyone please guide me how to solve this issue?
Thanks and best reagrds
Andreas
Hi,
Here are the steps to add the button, I wrote it in other thread. In my case for PO is not displayed, try to follow the steps and if you are able to show the button tell me how please.
And yes ,you need to create an enhancement point in the view CNR_VIEW of the component FPM_OIF_COMPONENT, you need to create a post-exit in the method BUTTON_PRESSED, here you have a sample code:
DATA: lv_id TYPE string,
lv_event_id TYPE fpm_event_id.
DATA: lo_nd_oif_application TYPE REF TO if_wd_context_node,
lo_nd_variant TYPE REF TO if_wd_context_node,
lo_nd_toolbar TYPE REF TO if_wd_context_node,
lo_nd_button TYPE REF TO if_wd_context_node,
lo_el_button TYPE REF TO if_wd_context_element,
lo_nd_other_functions TYPE REF TO if_wd_context_node.
DATA: lv_substring TYPE string,
lv_substring_i TYPE i,
lv_node_name TYPE string,
lv_position TYPE string,
lv_length TYPE i,
lv_seq TYPE i.
DATA:lt_keys TYPE STANDARD TABLE OF string,
lv_key LIKE LINE OF lt_keys.
TYPES:BEGIN OF y_parameters,
name TYPE string,
value TYPE string,
END OF y_parameters.
DATA: lt_parameters TYPE STANDARD TABLE OF y_parameters,
ls_parameter LIKE LINE OF lt_parameters.
DATA: lv_boid TYPE bbp_guid,
lv_botype TYPE string,
lv_objkey TYPE swo_typeid,
lv_objtype TYPE swo_objtyp,
lv_object_id TYPE crmt_object_id_db,
lv_process_type TYPE crmt_process_type_db,
lv_object_type TYPE crmt_subobject_category_db,
lv_rfc TYPE zgrs_co_logsys-rfc,
DATA: lo_fpm TYPE REF TO if_fpm.
lo_fpm = cl_fpm_factory=>get_instance( ).
lo_fpm->raise_event_by_id( lv_event_id ).
lt_keys = lo_fpm->mo_app_parameter->get_keys( ).
LOOP AT lt_keys INTO lv_key.
ls_parameter-name = lv_key.
lo_fpm->mo_app_parameter->get_value(
EXPORTING iv_key = lv_key
IMPORTING ev_value = ls_parameter-value ).
INSERT ls_parameter INTO TABLE lt_parameters.
ENDLOOP.
lv_id = wdevent->get_string( 'ID' ).
lo_nd_oif_application = wd_context->get_child_node( name = wd_this->wdctx_oif_application ).
lo_nd_variant = lo_nd_oif_application->get_child_node( name = wd_this->wdctx_variant ).
lo_nd_toolbar = lo_nd_variant->get_child_node( name = wd_this->wdctx_toolbar ).
lo_nd_other_functions = lo_nd_toolbar->get_child_node( name = wd_this->wdctx_other_functions ).
lv_substring = lv_id.
lv_length = STRLEN( lv_id ).
lv_seq = lv_length - 3.
IF lv_id+lv_seq = '_CP'.
lv_substring = lv_substring(lv_seq).
lv_id = lv_substring.
ENDIF.
WHILE lv_substring CS '_'.
lv_position = sy-fdpos + 1.
lv_substring = lv_substring+lv_position.
ENDWHILE.
IF lv_substring CO '1234567890'.
lv_substring_i = lv_substring.
ENDIF.
* Item level action;
IF lv_id CS '_item'.
* Or header level action;
ELSE.
IF lv_id CA '0123456789'.
lv_position = sy-fdpos - 1.
lv_node_name = lv_id(lv_position).
IF lv_id CS 'OTHER_FUNCTIONS'.
lo_nd_button = lo_nd_other_functions->get_child_node( name = wd_this->wdctx_button ).
lo_nd_button->set_lead_selection_index( index = lv_substring_i ).
lo_el_button = lo_nd_button->get_element( ).
TRY.
lo_el_button->get_attribute(
EXPORTING
name = `EVENT_ID`
IMPORTING
value = lv_event_id ).
CATCH cx_wd_context.
ENDTRY.
READ TABLE lt_parameters INTO ls_parameter WITH KEY name = 'SAPSRM_BOTYPE'.
lv_botype = ls_parameter-value.
READ TABLE lt_parameters INTO ls_parameter WITH KEY name = 'SAPSRM_BOID'.
lv_boid = ls_parameter-value.
* Obtain the object_id;
SELECT SINGLE object_id INTO lv_object_id
FROM crmd_orderadm_h
WHERE guid EQ lv_boid.
* If not Z button, exits;
IF lv_event_id(1) NE 'Z'. EXIT. ENDIF.
* Actions;
CASE lv_event_id.
WHEN 'ZBUTTON'.
WHEN 'ZBUTTON2'.
ENDCASE.
ENDIF.
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.