cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in creating save/hold button in header level on lead buyer view in Edit mode for SC in SRM7

Former Member
0 Kudos

Dear Experts,

We have a requirement to add a new button("SAVE") in header level on lead buyer screen while view is in edit mode.

We need to use standard functionality of save/hold button i.s. saving the changed data in edit mode.

The Action for standrad button SAVE is defined in SPRO "Meta data configuration for header Actions" as below :

PDO Action :SAVE

Process : EDIT

Object Type : BUS2121

Active : yes

I have created SAVE button in two ways :

i) In first way,created a new button called SAVE in toolbar using below configuration using Other_functions:

WDC - FPM_OIF_COMPONENT

Configuration name - /SAPSRM/WDCC_FPM_OIF_SC_PROFNL

The new button is having EventID as "SAVE" and ElementID as "SAVE" and it is same as used for Hold button.

Initially This save button is invisible mode.

I need to set visible this save button in Edit mode. So how we will achieve this in configuration or in programming?

If it will be done in programming, then without changing in FPM_OIF_COMPONENT(used for toolbar header). can visibility of button be changed in main view using method define_button of if_oif interface.



ii) In the second approach, using define_button of if_oif interface in WDDOMODIFYVIEW of child view(not in CNR_VIEW of FPM_OIF_COMPONENT), i 'm able to create a new button which has element_id and Action as "SAVE".

This button is visible with EDIT button, how this dynamically created button should only be visible after we click EDIT button .

My third question is can we have the reference of toolbar button in child view to control visibility of toolbar button ? then how?

Regards,

Partha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Changing property of a button (enabled <-> disabled) is done at runtime. You can do it by getting the CNR object from the FPM instance. Then, calling the define_button method passing the button key and the enabled/disabled parameter. If your UIBB is a freestyle UIBB, you should do it in the PROCESS_BEFORE_OUTPUT method. If your UIBB is a GUIBB, you should do it in the GET_DATA method. Alternatively, you can do it in the AFTER_PROCESS_BEFORE_OUTPUT of the application controller/application configuration controller component.

Answers (1)

Answers (1)

julia_bender
Active Participant
0 Kudos

Hello Partha,

as Abdullah has already written your defined button is a button within the OIF floorplan. In your first case you have configured it and you can change it afterwards using method DEFINE_BUTTON and passing ELEMENT_ID + the value of visibility.

In your second case you just call method DEFINE_BUTTON with passing also an ELEMENT_ID + relevant attributes. With the defined ELEMENT_ID you are able to again change the button state sometime afterwards.

Please also have a look into the following tutorials where exactly this scenario is described:

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

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

You would call this method e.g. within method PROCESS_EVENT of one of your UIBBs or AppCC, ...

Best regards,

Julia

Former Member
0 Kudos

Hi Julia & Abdullah,

Thanks for the information.

My requirement is to populate “SAVE” button in toolbar header if Lead buyer screen is in edit mode.So i tried to controll the toolbar button from method WDMODIFYVIEW of below child view :

WDC - /SAPSRM/WDC_UI_SC_DOTC_BD

View - V_SC_DOTC_BASIC

First tried to create a “SAVE” button in component configuration with visibility none.

Then another button “New SAVE2” in WDMODIFYVIEW of child view V_SC_DOTC_BASIC depending on condition.

Again  tried to set visibility to TRUE for “SAVE” button created in component configuration while screen is in editmode in WDMODIFYVIEW , but only “NEW SAVE2” button is visible.

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

lo_cnr_oif->define_button(

            EXPORTING

                iv_variant_id = 'VARIANT_SC_PROF'

                iv_function = if_fpm_constants=>gc_button-other_function

                iv_element_id = 'SAVE1'

                iv_explanation = 'Save1'

                iv_on_action =  'SAVE1' "cl_fpm_event=>gc_event_save

                iv_text = 'NEW SAVE2'

                iv_tooltip = 'Save Tool1'

                IV_VISIBILITY = '02'

                IV_ENABLED    = 'X'

                ).

lo_cnr_oif->define_button(

            EXPORTING

                iv_variant_id = 'VARIANT_SC_PROF'

                iv_function = 'OTHER_FUNCTIONS' "if_fpm_constants=>gc_button-other_function

                iv_element_id = 'SAVE'

                IV_VISIBILITY = '02'

                ).

I could not fiure out why component configured “SAVE” is not visible ? when i press EDIT button before properly displaying it shows “SAVE” buton but in actual view it is not visible .

.

If i change the visibility to true "SAVE" in component configuration then  it is visible before pressing EDIT button and also after pressing edit button.This "SAVE" button has element id as "SAVE" and action as "SAVE" but level as "NEW SAVE1".

One strange thing, when i press edit button, it is showing 3 button("NEW SAVE2","NEW SAVE1" -in config controller ,"save" -in define_button) in middle way, but actually it is showing 2 button(""NEW SAVE2","NEW SAVE1"), hiding "save" which has overwritten by 2nd define_button.

If it is overwritten by some standard method? then what is the standard class and method which is hiding the "SAVE" method?

I can not write  in CNR view as from there i can not figureout if this screen is for lead buyer or not? and another point is it will be applicable to many other view.

Can we get reference to child view elements & properties form CNR view if i have to modify in FPM_OIF_COMPONENT?

So Every thing i have written in WDDOMODIFY of view V_SC_DOTC_BASIC .


Fig-2-After pressing EDIT button : check “Save” button is shown in red rectangle ( but Save" should be "NEW SAVE1" defined in component config,Fig-4)

Fig-3 - But after pressing OK button in above , “Save” button is not displayed

Fig-4-component configuration for “SAVE” buton

Thanks & Regards,

Partha