Skip to Content
avatar image
Former Member

How can I use a internal table, defined in component controller method, in action/method of view

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Sep 26, 2014 at 06:56 AM

    hi kiran/Rama,

    I hv tried all the options mentioned by you. but unable to resolve the issue.

    could you pl help me?

    Add comment
    10|10000 characters needed characters exceeded

    • 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

      context_node.PNG (26.5 kB)
      att.PNG (13.7 kB)
  • Sep 25, 2014 at 11:29 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Sep 26, 2014 at 07:19 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 26, 2014 at 09:28 AM

    Thanks all...

    some how it is working.

    better I concentrate on the basics.. thanks

    Add comment
    10|10000 characters needed characters exceeded