cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP UI element

Former Member
0 Kudos

Hi,

I need to know if there is a user element called menu so that i can get the various links based on the role of the user. If no such element is there, can any one give me an idea on how to get that functionality working.

Regards

Tenzin Wangmo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi tenzin,

Refer to this standard webdynopro component for the UI element MENU bar DEMO_UIEL_MENU.

Regards,

Sravanthi

Former Member
0 Kudos

Hi Sravanthi,

I tried the demo.. but that object is not available.. I am currently using gmt. The demo program is in which server?

Regards

Tenzin

Former Member
0 Kudos

Hi Tenzin,

Server : ECC6

Tcode : SE80

Package : SWDP_DEMO

Webdynpro comp : DEMO_UIEL_MENU

Regards,

Sravanthi

Former Member
0 Kudos

Hi,

I just saw the demo program but I need the links in line how we get in sap portal.. like here in this sdn only.. based on my rules only few links will be shown.. so, I will be really grateful if you give me some idea on how to do it.

Thanks and Regards

Tenzin

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

I am pasting the code for the menu_action item.

I have a menu called India, under it two menu action items, city1 with ltext 'Guwahati' and city2 with text 'Leh'. In the onaction of city1 I have a method clickonghy and for onaction of city2 I have a method clickohleh.

These methods set a textview text to the following:

I also use a textview to display the texts 'Clicked on Guwahati' and 'Clicked on Leh' once you click on 'Guwahati' or 'Leh'.

The codes are:

method ONACTIONCLICKGHY .

DATA lo_nd_node TYPE REF TO if_wd_context_node.

DATA lo_el_node TYPE REF TO if_wd_context_element.

DATA ls_node TYPE wd_this->element_node.

DATA lv_text LIKE ls_node-text.

  • navigate from <CONTEXT> to <NODE> via lead selection

lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).

  • get element via lead selection

lo_el_node = lo_nd_node->get_element( ).

lv_text = 'You Clicked on Guwahati'.

  • get single attribute

CALL METHOD lo_el_node->set_attribute

EXPORTING

  • index = USE_LEAD_SELECTION

value = lv_text

name = 'TEXT'

.

endmethod.

and....

METHOD onactionclickleh .

DATA lo_nd_node TYPE REF TO if_wd_context_node.

DATA lo_el_node TYPE REF TO if_wd_context_element.

DATA ls_node TYPE wd_this->element_node.

DATA lv_text LIKE ls_node-text.

  • navigate from <CONTEXT> to <NODE> via lead selection

lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).

  • get element via lead selection

lo_el_node = lo_nd_node->get_element( ).

lv_text = 'You Clicked on Leh'.

CALL METHOD lo_el_node->set_attribute

EXPORTING

  • index = USE_LEAD_SELECTION

value = lv_text

name = 'TEXT'

.

ENDMETHOD.

Regards,

Prosenjit.

Former Member
0 Kudos

Hi,

I tried with the code which you gave but its telling element_node is unknow... and one more doubt is that the menu is coming down.. I need it like how it comes in the sap portal top.. straight.. links....not down...

I will very grateful if you can give some more tips.

Thanks and Regards

Tenzin

Former Member
0 Kudos

Hi Tenzin,

[Menu Bar|http://help.sap.com/saphelp_nw70/helpdata/EN/45/41735a0d221191e10000000a1553f7/frameset.htm]

Regards,

Sravanthi

Former Member
0 Kudos

Hi,

Do you have any test program using menus... Cause I really don't know how to code for the menuactions.

Thanks and Regards

Tenzin

Former Member
0 Kudos

Hello,

Yes, there is a [menu UI element|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=%2fhelp%2fsdn_help_nw04s%2fsaphelp_nw04s%2fhelpdata%2fen%2f37%2f978b411fb4b05fe10000000a1550b0%2fcontent.htm] One way to do this is using authorization objects.

You can verify if the user has permission to the desired authorization object and if positive you can show the option. Another way is show all menu options and if the user doesn't have permission to the option you can show an error message.

Regards.

Former Member
0 Kudos

Hi,

Please use the class CL_WD_MENU and CL_WD_MENU_ITEM for achieving your functionality.

By using graphical layout choose, UI element MENU_BAR, you can do this by right clicking the ROOTUIELEMENTCONTAINER.

First you right click and enter the MENU_BAR.

Then you right click on the MENU_BAR Ui element and insert Menu Einfugen(Menu).

Third you right click on the Menu and insert the menu option, which can be for example a menu action item.

In the onAction event of the menu action item, give your code for the desired functionality.

regards,

Prosenjit.

Edited by: prosenjit chaudhuri on Feb 2, 2009 12:49 PM

Edited by: prosenjit chaudhuri on Feb 2, 2009 12:52 PM

Former Member
0 Kudos

Hi,

After right clicking and selecting insert element, I don't find menu_bar option but i can insert menu from the linktoaction ui element.. is that how it is supposed to be done?

Regards

Tenzin

Former Member
0 Kudos

Hi,

When you right click on the ROOTUIELEMENTCONTAINER, you will get the MENU_BAR UI Element right below the LINK_TO_URL UI element. Please proceed like that. Post your further queries in the process here.

Regards,

Prosenjit.

Former Member
0 Kudos

Hi Prosenjit,

I got how to get the menu_bar element but now how do I add the links in it... I am very new to this ABAP web dynpro, so could you kindly guide me how do it.

Regards

Tenzin

Former Member
0 Kudos

hi,

you have to right click on menu_bar ui element to add the menu.

then right click on the menu to add the menu action item.

then you have to write the code for that action item.

its like you add menu countries(menu bar), then a host of countries( each menu), and then the cities in individual countries(menu_action_item).

please leave your email id in case i am missing out your question.

regards,

Prosenjit.

Former Member
0 Kudos

Hi,

Thanks for the sincere support but since I am just an amatuer, its quite difficult to know just through mail but I will try and post again when there are more issues regarding this.

Thanks and Regards

Tenzin

Former Member
0 Kudos

Hi,

Menubar is the UI element.

You can aslo use the LINK related UI elements.

Please check the standard ones-

WDR_TEST_EVENTS and WDR_TEST_UI_ELEMENTS.

Regards,

Lekha.