on 09-09-2011 3:15 PM
I have created a button using OIF FPM, but now depending on a condition would like to hide the button. At the click of the 'Start' button on the 'Initial Screen' I need to check one of the input values and depending on the value either hide or display my button that I added to the toolbar. Anyone know how to do that? I tried looking at the 'Start' button of the Component configuration, but there is no element event id or element id. I also tried debugging through the 'WDDOMODIFYVIEW' of the CRN view of the FPM_OIF_COMPONENT, but could not find anything helpful.
Never mind I figured it out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I found the answer in NET 313 Floorplan Manager for Web Dynpro ABAP, page 109. It gives an example how to access a toolbar programmatically (OIF). Here is the code in the example and that I used.
DATA lo_fpm TYPE REF TO if_fpm.
DATA lo_oif TYPE REF TO if_fpm_cnr_oif.
* get reference to FPM service object
lo_fpm = cl_fpm_factory=>get_instance( ).
* get reference to toolbar service object
lo_oif ?= lo_fpm->get_service( cl_fpm_service_manager=>gc_key_cnr_oif ).
* create button (notall parameters used)
CALL METHOD lo_oif->define_button
EXPORTING
* iv_variant_id = 'VARIANT_1'
iv_function = if_fpm_constants=>gc_button-other_function
iv_element_id = 'FPM_TENDER'
* iv_sequence_id =
* iv_design =
* iv_enabled =
* iv_explanation =
* iv_on_action =
* iv_text =
* iv_tooltip =
iv_visibility = cl_wd_button=>e_visible-none "possible attributes: blank, none, visible
* iv_default_button =
.
Quick understanding of the parameters. iv_function, I believe, is the section your button falls under in the component configuration. In my configuration along the left side there is a section labeled 'Hierarchy' and under the 'Toolbar' node There is a 'Print Preview' node and 'Other Functions' node. I believe this is determined when you create the button on the toolbar. The iv_element_id is the found in the configuration as well. Click on your button and if there is no element id give it one.
For those who don't know much about FPM, like myself. Here is step by step how I did it. Remember I am using FPM OIF, I'm not sure if this is the same in GAF.
1. Use transaction SE80 and change the drop down to Web Dynpro Comp. / Intf.
2. Enter 'FPM_OIF_COMPONENT' into box under the drop down and press enter.
3. Expand the 'Views' node and double click on the 'CNR_VIEW'
4. Go to the Methods tab and click the Enhance button along the main tool bar (Kind of looks like a cinamon bun) or Control + F4
5. Create or choose a pre-existing enhancement name.
6. Find the 'WDDOMODIFYVIEW' method.
7. slide the scroll bar over so you can see the Pre-Exit, Post-Exit and Overwrite fields.
8. Click the Post-Exit of the WDDOMODIFYVIEW.
9. Insert the code.
Hope this helps anyone.
Hi Champion,
I don't think you figured it out ;-(
Using method define_button is absolutely right.
But the coding has to be placed into the componentcontroller of your own component (Method process_before_output)
If you enhance the component FPM_OIF_COMPONENT, this affects all FPM-OIF-Applications!!!
Please adjust your thread, so no other sdn-users will follow your way.
Best regards,
Franz
Helpful Links to FPM-Tutorials:
[Toolbar - Simple Configuration of Toolbar Elements |http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/506e02ff-b7a4-2e10-28b7-833cb03e46ec]
[Toolbar - Dynamically Create Toolbar Elements |http://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/b02092c0-b8a4-2e10-2fa1-fd06feb5158d]
Franz,
Thank you very much for that catch. I took the code I had in the FPM_OIF_COMPONENT and pasted it into the component controller of my Web Dynpro Component that had IF_FPM_UI_BUILDING_BLOCK implemented. If anyone knows how I can edit or delete my previous post please let me know. Thanks again Franz. Points awarded
Hi Champion,
Thanks for the reply.In which method did you put the code in component controller.
It must be init method if i am correct.
Here i have more than one component configurations.So i have to select component configuration based on the roles and other parameters.
Where to implement this.I am working on standard SRM webdynpro component.It can be enhanced but we cannot edit all methods.
Any idea how to do this,Thx in advance
ch_ravi_sap,
I put the code in the BEFORE_PROCESS_BEFORE_OUTPUT method of the component controller. This way you have access to your component controller context. The button that I was defining was based on what kind of order type and whether the user was in Display, Change or create mode. Hope this helps.
Champion
User | Count |
---|---|
72 | |
26 | |
10 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.