on 04-09-2012 6:19 AM
Hi All,
Greetings.
I am developing an application in web dynpro abap.The application has structure like this
(Lable) (Toggle link) (Input-Field1)
when user presses "enter" in the input field another input field should appear and the structure should be like this
(Lable) (Toggle Link) (Input Field1)
(Input Field2)
ANd so on i mean, when user presses enter on input field 2 , third input field should appear. I was able to achieve this as whichever input field i created dynamically had an action written for it.
Now the problem is that user wants the structure like this
(Lable1) (Toggle Link1) (Input field 1) " This area is binded to node1 and then attributes are binded in it
(Input field 2)
(Lable2) (Toggle Link2) (Input Field 3) " This area is binded to node 2 and then attributes are binded in it
(Input Field 4)
" NOte that in this case the number of nodes and attributes are also dynamic i.e there can be 1 node or many nodes based on scenario.
To achieve this i have created two nodes and two attributes in the modify view. i successfully got the following on screen
(lable1) (toggle link1) (input field1)
(lable1) (toggle link2) (input field 3)
all the input fields are dynamically created and hence i have only one action for them where i can code to add one more input field on screen.but that input field should be added in that particular node wherein the user presses enter. for eg.. user presses enter in "input field1" "input field 2" should be created as shown above and if user presses enter "input field3" "input field 4" should be created. how to acheiev this is a problem for me because i need to know exactly which input field user has selected and to which node is that input field binded to.
I hope i am clear in communicating my problem.
Any help will be appreciated.
Thanks and regards,
Sahai.S
Hello Sahai,
You must perform parameter mapping to your dynamic actions creatred using your code. BY mapping parameters value to the action, when the action is called, you will retrieve the mapped value to determine where the action was performed.
Refer to following SAP doc to map the params:
http://help.sap.com/saphelp_nw70/helpdata/en/f9/64c0410c2dcc17e10000000a155106/content.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/33/b11042705a5533e10000000a155106/content.htm
Regards,
Sharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try the below piece of code. (You may need to compile the change some aspects)
lt_parameters LIKE if_wd_event=>parameters,
parameter LIKE LINE OF lt_parameters,
lr_button TYPE REF TO cl_wd_button,
in wdModifyView
CHECK first_time = abap_true.
*new button is created dynamically and point it to the reference variable
* then assign a unique parameter for that button
lr_button ?= view->get_element( 'button1' ).
parameter-name = 'MYID'.
parameter-value = 1.
parameter-type = 'g'.
INSERT parameter INTO TABLE lt_parameters.
lr_button->map_on_action( lt_parameters ).
* in the action mapped to the button, create the parameter with name "MYID" of type string of importing type.
in this method, the importing parameter MYID will hold the value ot the parameter. set 1 for button1 and 2 for button2 and so on. So, if the value is 2, you know that the action is performed on button2.
The same operation can be performed for any other UI element, too.
Hope it is useful.
Regards,
Sharath
HI ,
in my case it is input field..i am sharing my piece of code here
data:lr_inputfield type ref to cl_wd_input_field.
lr_inputfield = view->get_element( 'INP1' ).
parameter-name = 'MYID'.
parameter-value = 1.
parameter-type = 'g'.
INSERT parameter INTO TABLE lt_parameters.
lr_inputfield->MAP_ON_ENTER( lt_parameters ).
..
the row which i wrote in bold has some problem coz lr_inputfield does not gets and value and it gives error of type mismatch.can you tell me is there any other method to get input field?
Regards,
sahai.s
Hi,
i figured it out the code will be ... as below
data lr_inputfield_ve type ref to if_wd_view_element.
lr_inputfield = view->get_element( 'INP1' ).
parameter-name = 'MYID'.
parameter-value = 1.
parameter-type = 'g'.
INSERT parameter INTO TABLE lt_parameters.
lr_inputfield->MAP_ON_ENTER( lt_parameters ).
...
sharath,
could you please guide me how will get to know the input field is binded to which node and attribute....
HI,
i succesfully got the path as you suggested.
data:lr_inputfield type ref to cl_wd_input_field,
lr_inputfield_view type ref to if_wd_view_element
lr_inputfield_view = lv_view->get_element( 'ID' ).
lr_inputfield ?= lr_inputfield_view.
path = lr_inputfield->bound_value( ).
Now,
the problem is i have to pass ID of the input field to get the path. rite?
and now i do not have the ID of the input field with me. can anyone suggest me how to proceed further.
all i have is input field dynamically generated on the screen so all have same action.. now i have toknow that on which input field user has performed the "enter" action and also i need to know later the path of the input field so that i can figure out the context node and attribute.
Regards,
Sahai.S
Hi,
I hope you create an input field using the following method,
CALL METHOD cl_wd_input_field=>new_input_field
EXPORTING
bind_value = 'SFLIGHT.CARRID'
id = 'INPUT1'
RECEIVING
control = lr_input.
So while creating each input field, call the map_on_enter along with the parameters. Pass MYID as parameter and value as same as the id. In this case INPUT1. Then when the action is called the corresponding parameters will be passed to the action using wdevent. So now you can get the ID of the element from the wdevent. Now you can get the element and then the node from the element.
Hope this will work.
Regards,
Fareez
Hi,
I am adding only 1 input field in the modify view. Now, i have to add input fields on "enter" action of the input fields.
why i need to now the path is because in my code the nodes and attributes both are radomly decided. so are the transparent containers now suppose for ex. i have two transparenmt containers, they will have one input field created in them in modify view. rite? now on action of enter another attribute is to be created and then the input field is created. now suppose user presses "enter" on the input field belonging to second node attribute should be created in node 2 and also the input field is to be cretaed in transparent container 2.
now to get the path i will have to pass the ID how to do this is my question..
hope m clear in my requirement
Regards,
Sahai.S
Hi,
You can define ID as parameter in your InputField onEnter action. by comparing ID value, you can differ the activity.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.