cancel
Showing results for 
Search instead for 
Did you mean: 

Hide Button in Applications WD ABAP Standard

former_member215786
Participant
0 Kudos

Dear Experts.

Please can someone help me with suggestions for the following issue that I have in this moment:

I need hide the button "Entrada Nueva" for the component fitv_vc_advances

[fitv_vc_advances|http://img842.imageshack.us/img842/2719/fitvvcadvances.png]

I checked the following link.

Illegal External link removed by moderator

Thanks in advance,

Regards

Carmen G

Edited by: Thomas Jung on Dec 14, 2010 9:39 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Carmen,

i would advise to use the PERSONALIZATION feature. Thats a development free way of hiding the button. when application up and running , make a right mouse click over the button you wish to hide on USER SETTING select hide 'btn name'.

Since you want to hide this button for all users , Launch the WebDynpro Application in config mode. This is done simply by appending

&sap-config-mode=X

to URL

example: http://XYZ:8020/sap/bc/webdynpro/sap/zdemo_main?sap-language=EN

http://XYZ:8020/sap/bc/webdynpro/sap/zdemo_main?sap-language=EN&sap-config-mode=X

-Prashant

former_member215786
Participant
0 Kudos

With the version that we are working the personalization feature not allow the transport between client of portal.

This is the reason, beacuse I want use codeABAP for solve my issue.

Thanks

Regards

Former Member
0 Kudos

Hi Carmen,

Personalization wouldnt even help in your requirement. You want to disable the button based on the application, i think many people already suggested to do a enhancement and i am wondering about your results.

former_member215786
Participant
0 Kudos

Hellow.

Thanks. I could hide the button.

How can get the name of the component and the name of the application for hide this button.

Thanks a lot in advances.

Regards,

Carmen G.

Former Member
0 Kudos

Hallo Carmen,

You can get the component name and application name by this way.Geting application name is already mentioned in this forum.

data:
lv_appli_name type string,
lv_component_name type string,

l_api type ref to if_wd_component,
l_component_info type ref to IF_WD_RR_COMPONENT,
l_application_api type ref to if_wd_application,
l_application_info type ref to if_wd_rr_application.

l_api = wd_this->wd_get_api( ).
l_component_info = l_api->get_component_info( ).
"Component name
lv_component_name = l_component_info->get_name( ).

l_application_api = l_api->get_application( ).
l_application_info = l_application_api->get_application_info( ).
"application name
lv_ api-application_name = l_application_info->get_name( ).

Former Member
0 Kudos

Hi Carmen,

I hope your problem is resolved.

Please revert back in case any issues/doubts.

Regards,

Sumit

Former Member
0 Kudos

Dear expert.

former_member215786
Participant
0 Kudos

The system display the following when I tried of active th code,

Web Dynpro Comp. / Intf. FITV_VC_ADVANCES,Web Dynpro View ADVANCESVIEW

Post-Exit PST4K69EOHXQ1QO5S8RT7WMB1X6C for WDDOMODIFYVIEW

The result type of the function method cannot be converted into the type of L_API. .

Web Dynpro Comp. / Intf. FITV_VC_ADVANCES,Web Dynpro View ADVANCESVIEW

Property "text" of element "CUSTOMIZING_TEXT" does not contain a value

Thanks

Regards

Former Member
0 Kudos

>

> The system display the following when I tried of active th code,

>

>

> Web Dynpro Comp. / Intf. FITV_VC_ADVANCES,Web Dynpro View ADVANCESVIEW

>

> Post-Exit PST4K69EOHXQ1QO5S8RT7WMB1X6C for WDDOMODIFYVIEW

> The result type of the function method cannot be converted into the type of L_API. .

>

> Web Dynpro Comp. / Intf. FITV_VC_ADVANCES,Web Dynpro View ADVANCESVIEW

> Property "text" of element "CUSTOMIZING_TEXT" does not contain a value

>

> Thanks

>

> Regards

CHange this line to solve the first problem.

l_api = wd_this->wd_get_api( ).

to

l_api = wd_comp_controller->wd_get_api( ).

Second problem, seems to me that you have a CUSTOMIZING_TEXT UI element without the text property binded. Either bind this to a context attribute or supply a string in design time.

Former Member
0 Kudos

Hi Carmen,

Is the second message coming asa warning or error?

For me it is coming as a warning.

Regards,

Sumit

former_member215786
Participant
0 Kudos

Hello.

The second message is warning, but the issue was solved.

Regards

Carmen G

Answers (3)

Answers (3)

nagendran_r2
Explorer
0 Kudos

To get application name, use this code

data:

lv_appli_name type string.

l_api type ref to if_wd_component,

l_application_api type ref to if_wd_application,

l_application_info type ref to if_wd_rr_application.

l_api = wd_this->wd_get_api( ).

l_application_api = l_api->get_application( ).

l_application_info = l_application_api->get_application_info( ).

lv_ api-application_name = l_application_info->get_name( ).

Thanks.

nagendran_r2
Explorer
0 Kudos

Hi,

All you need is to hide a standard WD button ?

If so, its simple..

Go to your view, click on the spiral (Enhancement) button, create a enhancement with enhancement name and description.

Now, the WD component will be in change mode. Do everything u need as your customized object.

Thanks.

Former Member
0 Kudos

Hi Carmen,

I assume your requirement is to hide the button on some condition.

Please check whether there is any attribute in the component which is boud to the visiblity of this button.

If yes you can hide the button setting the value of that attribute to None ( WDUI_VISIBILITY = 01 ).

If there is no such attribute then i can suggest below option:

Create a context node and attribute ATTR of type WDUI_VISIBILITY and bind the visible property of this button to this attribute.

Create a post-exit method for the WDDOINIT ( or any method suitable to the flow of this component) and set the value of ATTR to 01 on whichever condition you want.

If you can not get the access key to do above change the second option is to create a Z of above component and replace the standard but I do not support this option as it can impact at many places.

Please revert in case of issues.

Regards,

Sumit

former_member215786
Participant
0 Kudos

Hello.

I sent you a doubt with screenshots to your MAI*L.

Thanks in advance

Carmen G.

Former Member
0 Kudos

Hi Carmen,

I have a doubt that you can bind a standard UI Element to an Attribute. Properties of standard UI element can not be changed by enhancements. Otherwise, for this situation we can find many solutions to Hide some UI Elements by enhancement

here is a link about how to create it [->Create Enhancements<-|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/700317da-bd79-2c10-368e-8f18bf5d8b81?QuickLink=index&overridelayout=true]

Now enter with enhancement mode and try to DELETE this UI Element (it will not be totally deleted ) you can get it back if you want, by Click right in the Button and -> UNDODELETE.

Hope this Help

Best regards

former_member215786
Participant
0 Kudos

Hello.

I made this but the problem is that this view is used in several component.

The reason of use this using code ABAP is check the name of the application and hide this button standard.

Thanks in advance

Regards

Carmen

Former Member
0 Kudos

Hi Carmen,

As earlier stated the best way forward is to

1) enhance the view,replace the button and create the button with same id and bind the visibility property to a context attribute of type wdui_visibility.

2) Based on your application name set the visibility of the context attribute.

Former Member
0 Kudos

Hi Carmen,

You can do the same dynamically.

Use the CL_WD_BUTTON runtime class.

For example in the WDmodifyView method you can use following pseduo code

lo_button = view->get_element( 'BUTTON' ).

If application_name is equal to 'App_1'

lo_button->SET_ENABLED with parameter true

else

lo_button->SET_ENABLED with parameter false

Thaks,

Prashant

Former Member
0 Kudos

Hallo carmen,

I think Prashant is right. You can do a enhancement ( post exit ) for wdDoModifyView and set the visibility according to the application name.

Former Member
0 Kudos

Hi Carmen,

I tried binding the New Entry buttons visiblity with the newly created attribute and it works for me.

You can use the below code in the post exit of WDDOINIT ( or any method as per your flow) to handle button's visibility.



DATA lo_nd_zzbutton2 TYPE REF TO if_wd_context_node.

    DATA lo_el_zzbutton2 TYPE REF TO if_wd_context_element.
    DATA ls_zzbutton2 TYPE wd_this->Element_zzbutton2.
    DATA lv_zzbuttonattrib TYPE wd_this->Element_zzbutton2-zzbuttonattrib.

*   navigate from <CONTEXT> to <ZZBUTTON2> via lead selection
    lo_nd_zzbutton2 = wd_context->get_child_node( name = wd_this->wdctx_zzbutton2 ).

*   @TODO handle non existant child
*   IF lo_nd_zzbutton2 IS INITIAL.
*   ENDIF.

*   get element via lead selection
    lo_el_zzbutton2 = lo_nd_zzbutton2->get_element( ).

*   @TODO handle not set lead selection
    IF lo_el_zzbutton2 IS INITIAL.
    ENDIF.

*   @TODO fill attribute
   IF sy-uname eq 'OBEROIS'.
   lv_zzbuttonattrib = 02.
   ELSE.
     lv_zzbuttonattrib = 01.
   ENDIF.

*   set single attribute
    lo_el_zzbutton2->set_attribute(
      name =  `ZZBUTTONATTRIB`
      value = lv_zzbuttonattrib ).

.

Please revert back in case of issues.

Regards,

Sumit

Former Member
0 Kudos

Hi Carmen,

>

> I assume your requirement is to hide the button on some condition.

>

> Please check whether there is any attribute in the component which is boud to the visiblity of this button.

>

> If yes you can hide the button setting the value of that attribute to None ( WDUI_VISIBILITY = 01 ).

>

> If there is no such attribute then i can suggest below option:

>

> Create a context node and attribute ATTR of type WDUI_VISIBILITY and bind the visible property of this button to this attribute.

> Create a post-exit method for the WDDOINIT ( or any method suitable to the flow of this component) and set the value of ATTR to 01 on whichever condition you want.

>

>

> If you can not get the access key to do above change the second option is to create a Z of above component and replace the standard but I do not support this option as it can impact at many places.

>

> Please revert in case of issues.

>

> Regards,

> Sumit

Hi Sumit,

I dont think property of button in standard component can bind, even in enhancement mode, as its greyed out. I have tried without success. If you have done it with standard button, pls put out the steps. Also, deleting and creating the button with same ID does not work as it says the ID already exists.