• No se han encontrado resultados

Aspectos Particulares

In the last section we added an action to the main tool bar of an FPM application. In the following example, a parameter action is added that invokes a popup to enter the parameters of an action before executing the action. Moreover the example indicates how a Confirmation Popup for actions can be realized by configuring an OK and a Cancel button.

Execute the following steps to create this example:

1) Start the BOBF Enhancement Workbench (transaction /BOBF/CUST_UI) and create the following enhancement action on the Root node of the Freight Order Business Object (technical name TOR. See also section 3.3.6 for creating actions.

Attribute Value

Action Name ZENH_POPUP_PARAM_ACT

Description Enh. Parameter Action for UI Popup Demo Implementing Class ZCL_ENH_A_POPUP_PARAM_ACT Parameter Structure ZENH_S_A_POPUP_PARAM_ACT Action Cardinality Multiple Node Instances

Extensible Yes

The example action parameter structure ZENH_S_A_POPUP_PARAM_ACT shall look as follows:

Append Structure

Name ZENH_S_A_POPUP_PARAM_ACT Description Enhancement Action Parameters

Component Typing Method Component Type

ZENH_COMMENT Types /SCMTMS/DESCRIPTION

ZENH_WORKS_IND Types Boolean

Make sure that you have defined an enhancement category for the new structure. Then save and activate the action parameter structure.

The attributes of this structure will later be available to be placed on the popup. When executing the action via the UI, the popup will be displayed where you can enter corresponding values. In the example, we will configure an OK and a Cancel button that lets you execute or abort the execution of the action.

Use transaction SE91 to create message class ZENH_MESS with the following messages:

Message Message Short Text

001 Yes, it works! &1

002 No, it doesn’t work! &1

The coding for the action implementation shall look as follows (example code to be for method EXECUTE of implementing class ZCL_ENH_A_POPUP_PARAM_ACT):

METHOD /bobf/if_frw_action~execute.

FIELD-SYMBOLS: <fs_parameters> TYPE zenh_s_a_popup_param_act.

DATA: ls_msg TYPE symsg,

lr_act_param TYPE REF TO /scmtms/s_tor_a_conf,

lv_temp TYPE c. * take over action parameters

* prepare message text parameter

CLEAR ls_msg.

ls_msg-msgv1 = <fs_parameters>-zenh_comment. * use parameter ZENH_WORKS_IND

IF <fs_parameters>-zenh_works_ind = abap_true.

MESSAGE s001(zenh_mess) WITH ls_msg-msgv1 INTO lv_temp.

ELSE.

MESSAGE e002(zenh_mess) WITH ls_msg-msgv1 INTO lv_temp.

ENDIF.

CALL METHOD /scmtms/cl_common_helper=>msg_helper_add_symsg(

EXPORTING

iv_key = /scmtms/if_tor_c=>sc_bo_key iv_node_key = /scmtms/if_tor_c=>sc_node-root CHANGING

co_message = eo_message ). ENDMETHOD.

2) Start the Web Dynpro ABAP Component Configuration Editor to create a new Component Configuration. As mentioned already in section 5.3, the editor can be started via the following general link which has to be enhanced with information on server and port, depending on where you want to start the tool.

https://[server]:[port]/sap/bc/webdynpro/sap/configure_component

Example:

https://uscia9x.wdf.sap.corp:44352/sap/bc/webdynpro/sap/configure_component

Picture: Creating a new Component Configuration.

Enter a Component Name and a new Configuration ID. This new Component Configuration will define a From UIBB that will contain the action parameters as available input fields.

Field Value Comment

Component Name FPM_FORM_UIBB The new configuration shall

represent a form which will contain data of the action parameter structure. Configuration ID ZENH_WDCC_POPUP_ACTION This will be the new

configuration to be integrated in the Freight Order UI. Click on button New to create the new Component Configuration.

3) On the following popup provide a description and click on button OK to continue. On the next popup specify the package where you want to store the new Component Configuration and click on button OK again.

Field Value

Description Enhancement Action with Popup Demo

Package $TMP (or your own customer/partner specific package)

A third popup will come up requesting you to provide a transport request. Choose a valid existing transport request or create a new one (can be done on the same popup) and click on button OK.

4) Specify the FBI Feeder Class that shall be used for providing the data to the Form UIBB displayed on the new intended popup.

Picture: Entering the Feeder Class.

Choose Feeder Class /BOFU/CL_FBI_GUIBB_ACTPRM_FDR which represents a generic Action Parameter Feeder Class provided by the FBI framework. It makes use of the parameters defined for the action that will be assigned to trigger the new popup. The assignment of the action created in step 1 to the new Component Configuration is described in one of the next steps. Click on button Edit Parameters to get to the next step.

5) Now specify the parameters that the Feeder Class shall take into consideration at runtime. Enter the following values in the mentioned fields and then click on button OK.

Picture: Specifying the Feeder Class Parameters.

Field Value Comment

Business Object /SCMTMS/TOR The Business Object that the

action is assigned to.

Node ROOT The node of the Business

Object that the action is assigned to.

Action ZENH_POPUP_PARAM_ACT The name of the action that

will be executed and delivers the fields to be provided on the popup based on its action parameter structure.

Action Parameter UI Structure

ZENH_S_A_POPUP_PARAM_ACT The structure that serves as the UI structure for the action parameters (in this example it corresponds 1:1 to the Action Parameter Structure). 6) In the Component Configuration Editor navigate to the Form UIBB Schema, click on

button Element and choose option Add Group to add a new field group.

Picture: Adding a new Group in the Form UIBB Schema.

This group will contain the fields to be entered on the popup. In the attributes of the group enter the following value in field Group Title:

Field Value

Group Title Enhancement Parameter Action

Moreover you can specify further attributes for this group. You can give it a Group Title (e.g. Enhancement Parameter Action) and you can specify the Group Type which influences the layout of the two fields added to the group. In this example the option Half Width, 1 Column has been chosen which will arrange the two fields in a single column. Other options e.g. allow arranging the fields in two columns and in one row.

Picture: Specifying Attributes of the Group.

7) Select the new group and click on button Child Element in the Form UIBB Schema and add the available fields to the group. As we specified the Action Parameter UI Structure to be identical with the Action Parameter Structure, the available fields for the UI correspond exactly to the Action Parameters (if that was not the case you would have to specify an Action Parameter UI Mapper Class in the Feeder Class Parameters).

Picture: Adding fields to the group.

Configure the following Attributes for the two added fields (this is the minimum set of attributes to be specified for this example but of course you can also specify further attributes like a Tooltip or specify a Search-Help for the corresponding field, etc.):

Field Label Display Type

ZENH_COMMENT Comment Input Field

ZENH_WORKS_IND Flag whether it works or not Check Box

8) Save the configuration for the new Form UIBB. With this step the definition of the popup to be displayed when executing the intended Action is finished. In the next steps, the popup as well as the Action are integrated into the Freight Order UI.

9) Start the editor for the Web Dynpro ABAP Component Configuration to add a new page to the Freight Order UI configuration /SCMTMS/WDCC_FRE_ORDER. As mentioned already in section 5.3, the editor can be started via the following general link which has to be enhanced with information on server and port, depending on where you want to start the tool. In this case we customize an already existing standard Component Configuration, i.e. to start the component customizing use the following kind of link (this time it’s “customize_component”):

https://[server]:[port]/sap/bc/webdynpro/sap/customize_component

Example:

https://uscia9x.wdf.sap.corp:44352/sap/bc/webdynpro/sap/customize_component

Here you can enter the Component Name and the Configuration ID of the Component Configuration to be customized. This new configuration will define a From UIBB that will contain the action parameters as available input fields.

Field Value Comment

Component Name FPM_OVP_COMPONENT

Configuration ID /SCMTMS/WDCC_FRE_ORDER The standard Web Dynpro Component Configuration of the Freight Order UI.

Click on button New in case you have not yet created a corresponding component customizing for the given Component Configuration. If this already exists you can continue by clicking on button Continue in Change Mode.

10) On the following screen go to section Navigation on the left side of the screen, click on button New and chose option Dialog Box to add a new Dialog Box to the Freight Order UI.

Picture: Adding a new Dialog Box.

Then double click on the new entry for the Dialog Box in the Navigation List and specify the required attributes directly in the related list entry. Note that the system will default a Page ID and a Title. For this example overwrite it with the following values:

Attribute Value

Page ID ENH_PARAM_ACTION

Title Demo Enhancement Parameter Action

Picture: Specifying Dialog Box attributes in the Navigation List.

11) Now specify further required attributes for the Dialog Box on the right side of the Component Configuration Editor (if you do not directly see the Attributes Screen on the left side of the Editor double click again on the entry for the new Dialog Box in the Navigation List). This step is especially interesting as here the set of buttons to be available on the dialog popup for the Parameter Action is defined.

Attribute Value

Dialog Name Enhancement Parameter Action Button Sets OK and Cancel (OK is default button)

Tooltip for OK Execute the BOPF Action assigned to this popup Tooltip for Cancel Cancel the Action and close the popup

Action Type Close Validation-Independent

With the attribute Button Sets we have now specified what kind of buttons shall be available on the popup to trigger or cancel the related Action after having entered values in the input fields of the popup. In this example an OK and a Cancel button will be used where the OK button is the default button (i.e. it will have the focus when the popup is displayed).

12) Navigate to the Preview of the newly added Dialog Box on the right side of the Component Configuration Editor. Here you should see that the system has added a section for the Dialog Box with the content below this section still empty. Double click on the section content under the section. In the lower right part of the Editor you can now specify required attributes that specify the content to be displayed on the Dialog Box, i.e. the Form UIBB with the two input fields created in the previous steps will now be assigned to the Dialog Box.

Attribute Value

Component FPM_FORM_UIBB

Window Name FORM_WINDOW

Configuration ID ZENH_WDCC_POPUP_ACTION Rendering Type Without Panel

Title Enhancement Parameter Action

Picture: Specifying the attributes for assigning the Form UIBB to the Dialog Box. 13) Save the Component Customizing. With this step the popup for the Action is assigned to

the Freight Order UI. Before it can actually be used, a few more things need to be configured as shown in the next steps.

14) For the next step start the Component Configuration Editor to customize (remember “customize_component” in the URL for starting the editor) the Application Controller Configuration /SCMTMS/WDCC_APPCC. Here the BOPF Action implemented in the first steps is finally assigned to the popup that was configured in the previous steps.

Picture: Creating a new Component Customizing for the Application Controller.

Field Value Comment

Component Name /BOFU/WDC_FBI_CONTROLLER

Configuration ID /SCMTMS/WDCC_FRE_ORDER The standard SAP TM Application Controller Configuration.

Click on button New to create a new Component Customizing for the Application Controller or continue with clicking on button Continue in Change Mode in case a corresponding Component Customizing already exists.

15) Open section Component-Defined. In its subsection Configuration Context mark the Tree List entry context and click the right mouse button to open the context menu for this entry. Choose Add  actParamConfig to add a new Action Parameter Configuration in the Application Controller.

Picture: Adding a new Action Parameter Configuration in the Application Controller. Specify the following attributes:

Attribute Value

cfgIndex A valid number representing the latest entry in the list (Final flag is set automatically by the system).

Business Object /SCMTMS/TOR (Final flag not set) Node ROOT (Final flag not set)

Action ZENH_POPUP_PARAM_ACT (Final flag not set) Dialog Box ID ENH_PARAM_ACTION (Final flag not set)

16) Click on button Save in the Component Customizing Tool bar to save the Application Controller customizing.

17) In the final step add a button to the main toolbar of the Freight Order UI as shown in the previous section 5.4.4. Assign the parameter action ZENH_POPUP_PARAM_ACT to it that we created in the section.

The resulting popup that comes up when executing the new action can be seen on the following picture. The popup comes up after clicking on the button added with step 17. You can then enter values in the input fields and click on button OK to start the execution of the action with the entered values or click on button Cancel to abort the execution.

Picture: The final Parameter Action Popup in an example Freight Order.

With the input in the example shown in the picture above, the message that is issued looks as follows:

Documento similar