on 09-25-2014 12:18 PM
Hi experts..
I am beginner to Web dyn pro..
My problem is:
I have created a internal table in one of method of component controller and keeping some records there.
I want to use the records of the internal table in the methods or actions of the views embedded in the controller.
I also tried to define as global attribute but no solution.
the lines of the code is as:
method disp
DATA lo_nd_ztab TYPE REF TO if_wd_context_node.
DATA LT_ZTAB TYPE STANDARD TABLE OF WD_THIS->ELEMENT_ZTAB.
DATA lo_el_ztab TYPE REF TO if_wd_context_element.
DATA ls_ztab like LINE OF lt_ztab."wd_this->element_ztab.
* navigate from <CONTEXT> to <ZTAB> via lead selection
lo_nd_ztab = wd_context->get_child_node( name = wd_this->wdctx_ztab ).
lo_el_ztab = lo_nd_ztab->get_element( ).
IF lo_el_ztab IS INITIAL.
exit.
ENDIF.
DATA: ld_index type i,
it_rows type WDR_CONTEXT_ELEMENT_SET,
wa_ztab LIKE LINE OF lt_ztab,
ls_selrow like line of it_rows,
ls_ztab1 like LINE OF it_rows.
lo_el_ztab = lo_nd_ztab->get_lead_selection( ).
CALL METHOD lo_nd_ztab->GET_SELECTED_ELEMENTS
RECEIVING
set = it_rows..
LOOP AT it_rows INTO ls_selrow.
CALL METHOD ls_selrow->get_static_attributes
IMPORTING
static_attributes = wa_ztab.
APPEND wa_ztab to lt_ztab.
CLEAR wa_ztab.
ld_index = sy-tabix. "index of selected row
lo_nd_ztab->set_selected(
flag = abap_true
index = ld_index ).
ENDLOOP.
endmethod.
" I want to use the internal table LT_ZTAB.
pl help.
Thanks all...
some how it is working.
better I concentrate on the basics.. thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
you just need to create a global table.
put all your values in that table.
then you can access this table from the component controller.
Regards,
Zunaid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi kiran/Rama,
I hv tried all the options mentioned by you. but unable to resolve the issue.
could you pl help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
DATA lo_nd_ztab TYPE REF TO if_wd_context_node.
DATA LT_ZTAB TYPE STANDARD TABLE OF WD_THIS->ELEMENT_ZTAB.
DATA lo_el_ztab TYPE REF TO if_wd_context_element.
DATA ls_ztab like LINE OF lt_ztab."wd_this->element_ztab.
* navigate from <CONTEXT> to <ZTAB> via lead selection
lo_nd_ztab = wd_context->get_child_node( name = wd_this->wdctx_ztab ).
* @TODO handle non existant child
* IF lo_nd_ztab IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_ztab = lo_nd_ztab->get_element( ).
* @TODO handle not set lead selection
IF lo_el_ztab IS INITIAL.
exit.
ENDIF.
* get all declared attributes
**********************************************************************
* FOR MULTIPLE SAVE
DATA: ld_index type i,
it_rows type WDR_CONTEXT_ELEMENT_SET,
wa_ztab LIKE LINE OF lt_ztab,
*it_selrows like line of it_rows,
ls_selrow like line of it_rows,
ls_ztab1 like LINE OF it_rows.
lo_el_ztab = lo_nd_ztab->get_lead_selection( ).
* it_rows = lo_nd_ztab->GET_SELECTED_ELEMENTS( ).
CALL METHOD lo_nd_ztab->GET_SELECTED_ELEMENTS
RECEIVING
set = it_rows..
LOOP AT it_rows INTO ls_selrow.
CALL METHOD ls_selrow->get_static_attributes
IMPORTING
static_attributes = wa_ztab.
APPEND wa_ztab to lt_ztab.
CLEAR wa_ztab.
ld_index = sy-tabix. "index of selected row
** You can now do what you want with this, store in in a global variable so that you
** can build up a list of rows selected by user allowing them to select multiple rows.
** If you do this you simply need to use context_node->set_selected to select all the
** rows you have captured each time, remember to deselect any rows clicked on twice
*
** SELECT a row
lo_nd_ztab->set_selected(
flag = abap_true
index = ld_index ).
* DE-SELECT a row
* context_node->set_selected(
* flag = abap_false
* index = ld_index ).
ENDLOOP.
this is my code...
here i am keeping the records for the slected lines in the program.
after putting in the table, i m looping the int tab to perform the operation like save/delete etc, for the no of rows selected.
the code is working perfectly in the individual action button,
but I want to make it global and to access in the action button.
I tried to give various suggested attribute decl, but the system is saying not exists.
pl help. since I am new it is frusrated to find the exact solution/types.
Thanks,
Lalit
Hi,
How you created the node ZTAB in the context? Have you added the attributes individullay( by right click on Context node and create attribute) or by using DDIC reference?
If you have added the attributes individually(local), you need to create a DDIC structure with those attributes as fields in SE11 (say ZTAB_STRU) and then create a table type with the ZTAB_STRU as line (say ZTAB_TT) .
Then in the Attributes tab of your component controller, create an attribute with the created table type
gt_tab type ZTAB_TT.
hope its clear now!!
PS: please be little patient and don't be frustrated, which helps you in finding/resolving the issue.
I suggest you to go through the basics and then search the forums for more details.
Best Regards,
Kiran
Hi Lalit,
You need to find out the type used for context node.
go to your context node and check for the DDIC type used to create context node
Please refer the below snap shot for reference.
Now, use this structure/table and create a table type in SE11 eg. ZTT_RM_CLAUSES
Finally use ztt_RM_CLAUSES table type
Hope this helps you.
Regards,
Rama
Hi,
In your component controller, create an attribute( in Attributes tab) say gt_ztab of type (your internal tabel type). Then
After getting the data to lt_ztab set it to the global attribute
using wd_this->gt_ztab = lt_ztab.
Then in your view(s), you can access the internal table data using
wd_comp_controller->gt_ztab.
hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You have to declare the associated type of lt_ztab not lt_ztab.
For ex: if you have internal table,
lt_flight type standard table of sflight.
Now you have to use the type as table type of sflight. not the lt_flight.
so, create a table type for the structure associated to the lt_ztab and then use that type.
hope it clears!
Regards,
Kiran
Hi Lalit,
As suggested by Kiran, you need to use the type name used to create the local internal table lt_ztab.
In your case, you have defined the internal table lt_ztab by using context node reference.
Now, find out the DDIC name used to create your context node ZTAB and you need to get the table type for the same and use it to create global internal table at component controller.
Hope this helps you.
Regards,
Rama
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.