on 05-23-2012 3:42 PM
Hi guys,
Is there any way to load a UI element based on a condition.
i.e., if the condition is true then that particular UI element is loaded, else nothing.
Pls don't tell me to make it invisible, even if invisible that particular UI element is loaded but not displayed.
I don't want to load that UI element.
actually my scenario is....
my web dynpro app will have only one view.
It consists of a button and an interactive form.
On clicking the button the interactive form should be loaded.
But since both botton and IF( interactive form container) are in same view, both will be loaded at same time.
the xstring attribute needed for IF will be populated only after clicking the button.
but before clicking the button IF is loading, since xstring is initial it will throw an error.
even if I kept it as invisible, still getting the same error, means it was still loading.
Is there any way to load an UI element based up on a condition in abap web dynpro ....????
Vishnu,
you must create an InteractiveForm UI element dynamically. check the below thread, you may get some idea.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Guys,
I know we can create UI elements dynamicaly,
But my question is whether we can disable and enable that UI element dynamically ..??
It is possible in JAVA web Dynpro...
Is that possible in ABAP Web dynpro ...??
I just want to enable or disable that UI element, not visible or invisible..
I hope there will be some way to do it.
pls correct me if I am wrong..
Hi Vishnu,
Try this alternate way rather than creating UI element dynamically , we can display view dynamically.
Here what is your scenario is to display only button first time view is loaded. For that u can take view container UI element and button in a main view.
create two view first should have no design at all. and another should contain your IF container.
So embed these two views in the view continer ui element. And make the First blank view as default view.
Create Inbound and outbound plugs for main view to Second view containing FI element.
And in the action method of button write the code to fire the outbound plug.
Hope U will get ur requirements.
Thanks
Santosh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vishnu,
I think , Phani is right.
You can dynamically create UI elements based on the condition. But code to create UI element dymanically should be written in wddomodifyview method because it should be executed after button press. And here you can put condition If condition is true then only it will be executed otherwise not(put all code in IF...ENDIF statement).
Check the link below.
In that How to create table dynamically is explained. You can use this code as a guide for creating IF Container dynamically. Use CREATE_FORM_FROM_NODE method of class
CL_WD_DYNAMIC_TOOL in place of CREATE_TABLE_FROM_NODE method.
Please let me know if it works.
Thanks
santosh
Hi Vishnu,
As Phani suggested, you can dynamically create UI elements on button click.
Declare an attribute say GV_VIEW TYPE REF TO IF_WD_VIEW in the view in which you need both the button and interractive form container.
Go to method WDDOMODIFYVIEW and add the following code:
IF FIRST_TIME = ABAP_TRUE.
WD_THIS->GV_VIEW = VIEW.
ENDIF.
Go to the Event Handler method for the button and add the code to dynamically add the container. Here is a small example to add another button on the button click:
DATA: lv_button TYPE REF TO cl_wd_button,
l_root TYPE REF TO cl_wd_uielement_container.
DATA lv_button_flow TYPE REF TO cl_wd_flow_data.
l_root ?= wd_this->gv_view->get_root_element( ).
CALL METHOD cl_wd_button=>new_button
EXPORTING
id = 'BUTTON'
on_action = 'GET_DATA'
text = 'Dependent'
RECEIVING
control = lv_button.
CALL METHOD cl_wd_flow_data=>new_flow_data
EXPORTING
element = lv_button
RECEIVING
control = lv_button_flow.
l_root->add_child( the_child = lv_button ).
Note: Use flags so that once the UI element is created, this code is not triggered.
Hope the above analysis helps. Please let me know if you need any further inputs.
Regards,
Sayan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can dynamically create UI elements based on the condition.
Thanks
Phani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.