cancel
Showing results for 
Search instead for 
Did you mean: 

FPM: control (show/hide/enable/disable) button control?

ChrisSolomon
Active Contributor
0 Kudos

Folks,

  Got one that I just keep running into a wall on. I have several "form" fields and I can control them (show/hide and enable/disable) using the structure FPMGB_S_LISTFIELD_DESCR and assigning a related "technical" field for my form field.....I can then set/flag the "technical field" which will then affect the corresponding form field as I like (basically like binding the "visible" property of my form field to the dynamic value of another field).

  My problem is that for buttons....I cannot find any kind of similar "hook". Within my own class (not feeder), I can define a handler for "FPM events" and can capture that (so I do know what/when a button is pressed/clicked)....but even then, it is just a listener and cannot control the button(s) itself. However, because I set up "technical" fields related to my "form" fields, I can  set/unset those technical fields as I like (dynamic) and it will immediately control the related fields. Works great!....even down to the cell level on tables!!!

  A good example is on a pay related form we use. We have form field that shows to help calculate a salary on either % change or amount they would like to get too. There is a button they press to then make the calculations and distribute it over wage types correctly to come up with that salary. Now, for countries that do not use "annual salary", we simply hide the "calculation" form input box....works great....but the button is still there. For now, if the user just presses the button, we do at least give them a message that annual salary does not apply to their country and to disregard...but that is a "kludgy" way to handle it. Would be nice to hide the button too (like the form field).

  Is there anyways to get a "hook"/handle to a button within my FPM configuration at runtime and control it as I like? I cannot modify the "feeder" as it is used among several apps/configurations, so I am hoping there is some way I can get a handle on the FPM instance inside my own class and control the button(s) from there.

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

KK07
Contributor
0 Kudos

Hi Chris,

I am not sure if the FPM you are using is GAF or OIF.. but for OIF we can make something like below

*----Get a handle to the CNR. 

DATA LO_CNR_OIF     TYPE REF TO IF_FPM_CNR_OIF.    

lo_cnr_oif ?= cl_fpm_service_manager=>get_service( cl_fpm_service_manager=>gc_key_cnr_oif ). 

*---Hide FPM close-button 

  DATA lt_buttons TYPE if_fpm_cnr_oif=>t_button. 

lo_cnr_oif->get_buttons( 

    EXPORTING 

      iv_variant_id = 'v1' "Variant is generally available at Comp Configuration Level 

    IMPORTING 

      et_buttons = lt_buttons ).  

"Hiding Close Button, Same in above internal table lt_buttons you will get your Submit Button FUNCTION & ELEMENT_ID so as to  

"control visibility. 

lo_cnr_oif->define_button( 

    EXPORTING 

      iv_function   = if_fpm_constants=>gc_button-close 

      iv_visibility = cl_wd_uielement=>e_visible-none ).

The below links are useful(if you are not already gone through)..

http://scn.sap.com/docs/DOC-2310

http://scn.sap.com/docs/DOC-2311

ChrisSolomon
Active Contributor
0 Kudos

Ah yes....sorry about that...it is GAF.

I had gone through the links you shared too, but hit walls. Uggg.

Answers (2)

Answers (2)

simon_hoeg
Advisor
Advisor
0 Kudos

Hi Chris,

sounds that you work on GUIBB level, if you implement the Feeder Class method GET_DEFINITION of e.g. interface IF_FPM_GUIBB_LIST, IF_FPM_GUIBB_FORM, IF_FPM_GUIBB_CHART etc., then you may start with

     DATA ls_action_def TYPE fpmgb_s_actiondef.

     ls_action_def-id = 'ACTION1'.

     APPEND ls_action_def TO et_action_definition.

Now you continue with the Configuration Editor (FLUID), i.e. you create a component configuration for WD component FPM_LIST_UIBB_ATS, FPM_FORM_UIBB_GL2 or FPM_CHART_UIBB etc.

Here you provide the above implemented Feeder Class. Then on the left hand side there is a Button Repository where you can drag and drop the action ACTION1 into the Toolbar Schema.

In the Attributes Panel you define the Display Type (Button, Toggle Button, DDLB etc.) and provide some further attributes, e.g. texts.

Then save the configuration.

Now if you start the FPM application and press the configured button, then a corresponding FPM event with ID "ACTION1" will be raised.

In the Feeder Class methods PROCESS_EVENT and GET_DATA you may then programmatically react on this FPM event, i.e. here is your "binding" ....

Regards,

Simon

ChrisSolomon
Active Contributor
0 Kudos

Yes...I can "catch"/listen to the FPM events not problem. But how can I get a "handle" on the button control itself and then either hide or disable it programmatically? THAT is the issue.

simon_hoeg
Advisor
Advisor
0 Kudos

Hi Chris,

ok, in feeder method GET_DATA (-> PBO) you will find the changing parameter CT_ACTION_USAGE. Fill this table with the corresponding info regarding action visibility, text, read-only etc. In addition please set the exporting parameter EV_ACTION_USAGE_CHANGED to abap_true.

Regards,

Simon

ChrisSolomon
Active Contributor
0 Kudos

Thanks...but again...cannot change the feeder as it is used "generically" among many applications. I have made a slight modification to it in that I do assign "technical" fields to "form" fields based on some information that is available. I can "catch"/"listen" in my own "outside"/external class for the FPM instance and respond to events there (which is how I can manipulate the "technical" field values which then trigger the right behavior in the form fields). However, I can't find a "handle" to the button(s) themselves in a similar way. I have an idea of something else to try and will report back if it is successful.

former_member469314
Participant
0 Kudos

Hi,

just wondering: How do you set the technical fields for the form fields in your class?

I guess you have to modify your data table?! Because if you can modify the data within your own class, you should be able to modify the action usage table for the button as well....


ChrisSolomon
Active Contributor
0 Kudos

Not sure I follow exactly but I will try to explain...

Design Time....in my feeder class, I assign my "technical" field to my "form" field....ie. bind them. in the example of displaying a list/table, I have columns for the "form" field and next to it, I will have a column for it's corresponding "technical" field but hidden from display (this keeps the corresponding indexes in-sync so it know when I set which technical field value, which corresponding form field it should modify (ie. cell level).

Run Time.....in my own custom class, I can set the "technical" fields as I like (on whatever rules or conditions), and that setting/value will immediately reflect in the form field I have bound it too.

For buttons though, I can't seem to find the same kind of "hook" into them.

former_member469314
Participant
0 Kudos

Yes, I think I know what you mean.

I just don't really understand how your own class communicates with the feeder class. Somehow you have to pass the value of the technical fields to the feeder class, don't you? I mean, for example you have a table or a structure with the fields MATNR and the corresponding technical field MATNR_VIS for the visibility of the field MATNR. You set the technical field to visible or hidden. But how does the feeder class know that the values have changed? Do you call your own class in the feeder class?

ChrisSolomon
Active Contributor
0 Kudos

My class does not communicate with the feeder class. The feeder class sets up the "binding"...with that set, I am just setting/changing values in my own class on the "technical" fields and because of the binding, the "attached" form fields behave as I want "auto-magic-ly". haha Here is an older blog I did about how I did this...

.....and still, the buttons elude me. haha