on 07-28-2010 1:26 AM
Hi all,
I am aworking on a web dynpro application and the screen that Ihave created will have both header data and line item data, to let user enter multiple line items I have written the following logic in the method WDDOINIT of the main view:
DATA lo_nd_t_bseg TYPE REF TO if_wd_context_node.
DATA lo_el_t_bseg TYPE REF TO if_wd_context_element.
DATA ls_t_bseg TYPE wd_this->Element_t_bseg.
DATA ls_t_bseg2 TYPE wd_this->Elements_t_bseg.
* navigate from <CONTEXT> to <T_BSEG> via lead selection
lo_nd_t_bseg = wd_context->path_get_node( path = `PRELIMINARY_POSTING.CHANGING.T_BSEG` ).
DO 10 TIMES.
APPEND INITIAL LINE TO ls_t_bseg2.
ENDDO.
CALL METHOD lo_nd_t_bseg->bind_table
EXPORTING
new_items = ls_t_bseg2
but right now I have card coded the value upto only ten line items but I want it to be declare dynamacially, for example if user enters 2 line items then only two line items should be available and if he decides to enter more than 10 then that functionality sould also be there.
Can you please help me in this.
Thanks,
Rajat
Hello Rajat,
If you want to create line items based on user input, then create an input field and bind that to a context attribute of type I.
And create a button and an action for that button. In that action handler, read the input value entered by the user i.e. get the value of context attribute which is bound to the input field and based on that have a loop to create that many line items. Then bind the line items to the context attribute.
Hope this helps!
Let me know if you have any further doubts!
Regards,
Srilatha M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi rajat,
Then you can do that in the event handler of your SUBMIT button.
1. create an input field for number of items and bind that to a context attribute of type I.
2. in the event handler of SUBMIT button, read that context attribute.
3. Then create line items looping n(user input read in step 2) number of items and add them to an internal table.
4. Bind the internal table to the context node.
Hope this helps!
REgards,
Srilatha
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.